YouTube: Force Single Column Mode

8/17/2023, 1:51:20 AM

目前为 2023-08-16 提交的版本。查看 最新版本

// ==UserScript==
// @name        YouTube: Force Single Column Mode
// @namespace   UserScripts
// @match       https://www.youtube.com/*
// @grant       none
// @unwrap
// @inject-into page
// @version     1.0.1
// @author      CY Fung
// @description 8/17/2023, 1:51:20 AM
// @license MIT
// ==/UserScript==

(() => {

  const Promise = (async () => { })().constructor;
  const { setInterval, clearInterval } = window;

  if (location.pathname.indexOf('live_chat') >= 0) return;

  let cid = setInterval.call(window, () => {
    let ywf = document.querySelector('ytd-watch-flexy[is-two-columns_]:not([hidden])');
    if (ywf) {
      ywf.removeAttribute('is-two-columns_');
      const ywb =  ywf.ytdWatchBehavior
      if (typeof ywf.updateIsTwoColumnsFromBinding === 'function' && ywb && ('isTwoColumns_' in ywb)) {
        ywf.updateIsTwoColumnsFromBinding = function () {

        };
      }
      Promise.resolve(ywf).then((ytdWatchFlexy) => {
        ytdWatchFlexy.ytdWatchBehavior.isTwoColumns_ = false;
      })
      clearInterval.call(window, cid);
    }

  }, 1);

})();

QingJ © 2025

镜像随时可能失效,请加Q群300939539或关注我们的公众号极客氢云获取最新地址