Greasy Fork

Greasy Fork is available in English.

YouTube Web Tweaks Lite

This script is based on YouTube Web Tweaks (except it keeps the shorts player)

当前为 2023-10-18 提交的版本,查看 最新版本

// ==UserScript==
// @name         YouTube Web Tweaks Lite
// @version      1.4.5
// @description  This script is based on YouTube Web Tweaks (except 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
// @unwrap
// @grant        none
// ==/UserScript==
 
// Enable strict mode to catch common coding mistakes
"use strict";
 
// Define the flags to assign to the EXPERIMENT_FLAGS object
const flagsToAssign = {
  IS_TABLET: true,
  DISABLE_YT_IMG_DELAY_LOADING: true,
  polymer_verifiy_app_state: false,
  desktop_delay_player_resizing: false,
  web_animated_actions: false,
  web_animated_like: false,
  web_animated_like_lazy_load: false,
  render_unicode_emojis_as_small_images: true,
  kevlar_refresh_on_theme_change: false,
  kevlar_watch_cinematics: false
};
 
const updateFlags = () => {
  // Check if the EXPERIMENT_FLAGS object exists in the window.yt.config_ property chain
  const expFlags = window?.yt?.config_?.EXPERIMENT_FLAGS;
 
  // If EXPERIMENT_FLAGS is not found, exit the function
  if (!expFlags) return;
 
  // Assign the defined flags to the EXPERIMENT_FLAGS object
  Object.assign(expFlags, flagsToAssign);
};
 
// Create a MutationObserver that calls the updateFlags function when changes occur in the document's subtree
const mutationObserver = new MutationObserver(updateFlags);
mutationObserver.observe(document, { subtree: true, childList: true });