Greasy Fork is available in English.
This script is based on YouTube Web Tweaks (except with only minimal config flags, the removal of video paused continue watching popup and it keeps the shorts player)
当前为
// ==UserScript==
// @name YouTube Web Tweaks Lite
// @version 1.1.5
// @description This script is based on YouTube Web Tweaks (except with only minimal config flags, the removal of video paused continue watching popup and it keeps the shorts player)
// @author Magma_Craft
// @license MIT
// @match *://www.youtube.com/*
// @namespace http://greasyfork.icu/en/users/933798
// @icon https://www.youtube.com/favicon.ico
// @unwrap
// @run-at document-start
// @grant none
// @require https://cdnjs.cloudflare.com/ajax/libs/arrive/2.4.1/arrive.min.js
// ==/UserScript==
// Modifiying yt.config flags
(function() {
window['yt'] = window['yt'] || {};
yt['config_'] = yt.config_ || {};
yt.config_['EXPERIMENT_FLAGS'] = yt.config_.EXPERIMENT_FLAGS || {};
var iv = setInterval(function() {
yt.config_.EXPERIMENT_FLAGS.polymer_verifiy_app_state = false;
yt.config_.EXPERIMENT_FLAGS.desktop_delay_player_resizing = false;
yt.config_.EXPERIMENT_FLAGS.web_animated_like = false;
yt.config_.EXPERIMENT_FLAGS.web_animated_like_lazy_load = false;
yt.config_.EXPERIMENT_FLAGS.render_unicode_emojis_as_small_images = true;
yt.config_.EXPERIMENT_FLAGS.kevlar_refresh_on_theme_change = false; //disable reload when changing theme
yt.config_.EXPERIMENT_FLAGS.kevlar_watch_cinematics = false;
}, 1);
var to = setTimeout(function() {
clearInterval(iv);
}, 1000)
})();
// CSS adjustments and other tweaks to apply (including removal of "Video paused. Continue watching?" popup)
(function() {
ApplyCSS();
function ApplyCSS() {
var styles = document.createElement("style");
styles.innerHTML=`
/* Remove ambient light on watch page */
cinematics.ytd-watch-flexy {
display: none !important;
}`
document.head.appendChild(styles);
}
})();
(function () {
'use strict';
const wm = new WeakSet();
const removeAdsSlot = async (grid) => {
const td = grid.data;
if (td && !wm.has(td)) {
const md = Object.assign({}, td);
md.contents = md.contents.filter(content => {
let isadSlotRenderer = ((((content || 0).richItemRenderer || 0).content || 0).adSlotRenderer || null) !== null;
return isadSlotRenderer ? false : true;
});
wm.add(md);
grid.data = md;
}
}
customYtElements.whenRegistered('ytd-rich-grid-renderer', (proto) => {
proto.dataChanged = ((dataChanged) => {
return function () {
removeAdsSlot(this);
return dataChanged.apply(this, arguments);
}
})(proto.dataChanged)
});
})();
Object.defineProperties(document, { 'hidden': {value: false}, 'webkitHidden': {value: false}, 'visibilityState': {value: 'visible'}, 'webkitVisibilityState': {value: 'visible'} });
setInterval(function(){
document.dispatchEvent( new KeyboardEvent( 'keyup', { bubbles: true, cancelable: true, keyCode: 143, which: 143 } ) );
}, 60000);