Facebook Reel: Video Controls Fork

A fixed control bar fork of CY Fung's Facebook Reel: Video Controls.

Aby zainstalować ten skrypt, wymagana jest instalacje jednego z następujących rozszerzeń: Tampermonkey, Greasemonkey lub Violentmonkey.

You will need to install an extension such as Tampermonkey to install this script.

Aby zainstalować ten skrypt, wymagana jest instalacje jednego z następujących rozszerzeń: Tampermonkey, Violentmonkey.

Aby zainstalować ten skrypt, wymagana będzie instalacja rozszerzenia Tampermonkey lub Userscripts.

You will need to install an extension such as Tampermonkey to install this script.

Aby zainstalować ten skrypt, musisz zainstalować rozszerzenie menedżera skryptów użytkownika.

(Mam już menedżera skryptów użytkownika, pozwól mi to zainstalować!)

You will need to install an extension such as Stylus to install this style.

You will need to install an extension such as Stylus to install this style.

You will need to install an extension such as Stylus to install this style.

Będziesz musiał zainstalować rozszerzenie menedżera stylów użytkownika, aby zainstalować ten styl.

Będziesz musiał zainstalować rozszerzenie menedżera stylów użytkownika, aby zainstalować ten styl.

Musisz zainstalować rozszerzenie menedżera stylów użytkownika, aby zainstalować ten styl.

(Mam już menedżera stylów użytkownika, pozwól mi to zainstalować!)

// ==UserScript==
// @name        Facebook Reel: Video Controls Fork
// @namespace   UserScript
// @match       https://www.facebook.com/*
// @version     0.1.2
// @license     MIT
// @author      CY Fung | fork by ArminC
// @description A fixed control bar fork of CY Fung's Facebook Reel: Video Controls.
// @run-at      document-start
// @grant       none
// @unwrap
// ==/UserScript==

document.addEventListener('play', (evt) => {
  const target = (evt || 0).target;

  if (target instanceof HTMLVideoElement && !target.hasAttribute('controls') && location.href.includes('reel')) {
    let buttonLayer = target.closest('div[class][role="button"][tabindex]');

    if (buttonLayer) {
      target.setAttribute('controls', '');

      setTimeout(() => {
        Object.assign(target.style, {
          'position': 'relative',
          'zIndex': 999,
          'pointerEvents': 'all'
        });

        [...buttonLayer.querySelectorAll('.x10l6tqk.x13vifvy:not(.x1m3v4wt)')].forEach(s => {
          Object.assign(s.style, {
            'pointerEvents': 'none',
            'position': 'relative',
            'zIndex': 1000
          });
        });
      }, 1);
    }
  }
}, true);