Facebook Reel: Video Controls Fork

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

คุณจะต้องติดตั้งส่วนขยาย เช่น Tampermonkey, Greasemonkey หรือ Violentmonkey เพื่อติดตั้งสคริปต์นี้

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

คุณจะต้องติดตั้งส่วนขยาย เช่น Tampermonkey หรือ Violentmonkey เพื่อติดตั้งสคริปต์นี้

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

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

You will need to install a user script manager extension to install this script.

(I already have a user script manager, let me install it!)

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.

You will need to install a user style manager extension to install this style.

You will need to install a user style manager extension to install this style.

You will need to install a user style manager extension to install this style.

(I already have a user style manager, let me install it!)

// ==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);