Greasy Fork is available in English.
8/17/2023, 1:51:20 AM
当前为
// ==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);
})();