Greasy Fork 还支持 简体中文。

ytConfigHacks

To provide a way to hack the yt.config_ such as EXPERIMENT_FLAGS

此腳本不應該直接安裝,它是一個供其他腳本使用的函式庫。欲使用本函式庫,請在腳本 metadata 寫上: // @require https://update.cn-greasyfork.org/scripts/475632/1361351/ytConfigHacks.js

您需要先安裝使用者腳本管理器擴展,如 TampermonkeyGreasemonkeyViolentmonkey 之後才能安裝該腳本。

您需要先安裝使用者腳本管理器擴充功能,如 TampermonkeyViolentmonkey 後才能安裝該腳本。

您需要先安裝使用者腳本管理器擴充功能,如 TampermonkeyViolentmonkey 後才能安裝該腳本。

您需要先安裝使用者腳本管理器擴充功能,如 TampermonkeyUserscripts 後才能安裝該腳本。

你需要先安裝一款使用者腳本管理器擴展,比如 Tampermonkey,才能安裝此腳本

您需要先安裝使用者腳本管理器擴充功能後才能安裝該腳本。

(我已經安裝了使用者腳本管理器,讓我安裝!)

你需要先安裝一款使用者樣式管理器擴展,比如 Stylus,才能安裝此樣式

你需要先安裝一款使用者樣式管理器擴展,比如 Stylus,才能安裝此樣式

你需要先安裝一款使用者樣式管理器擴展,比如 Stylus,才能安裝此樣式

你需要先安裝一款使用者樣式管理器擴展後才能安裝此樣式

你需要先安裝一款使用者樣式管理器擴展後才能安裝此樣式

你需要先安裝一款使用者樣式管理器擴展後才能安裝此樣式

(我已經安裝了使用者樣式管理器,讓我安裝!)

作者
𝖢𝖸 𝖥𝗎𝗇𝗀
版本
0.4.3
建立日期
2023-09-19
更新日期
2024-04-16
尺寸
5.5 KB
授權條款
MIT

The script must be included from a userscript with the following metablocks

  • // @match https://www.youtube.com/*
  • // @run-at document-start
  • // @inject-into page
  • // @grant none

Then an array window._ytConfigHacks will be provided and push your function into the array.

Testing

// ==UserScript==
// @name        New1235
// @namespace   Violentmonkey Scripts
// @match       https://greasyfork.org/*
// @grant       none
// @version     1.0
// @author      -
// @description 9/19/2023, 10:41:12 AM
// @require https://update.greasyfork.org/scripts/475632/1361351/ytConfigHacks.js
// ==/UserScript==


console.log(window._ytConfigHacks)

window._ytConfigHacks.add(function(){
  console.log('test OK')
});


window.ytcsi={
  tick:function(){}
}

window.yt={}
window.yt.config_={};

ytcsi.tick;

Real Example


// ==UserScript==
// @name        YouTube: Force Animated-Rolling-Number for Live
// @namespace   Violentmonkey Scripts
// @match       https://www.youtube.com/*
// @grant       none
// @version     1.0
// @author      -
// @description 9/19/2023, 9:32:49 AM
// @run-at      document-start
// @inject-into page
// @unwrap
// @require https://update.greasyfork.org/scripts/475632/1361351/ytConfigHacks.js
// ==/UserScript==

(() => {

  let mex = 0;

  window._ytConfigHacks.add((config_) => {


    let EXPERIMENT_FLAGS = null;
    EXPERIMENT_FLAGS = config_.EXPERIMENT_FLAGS || 0;

    if (EXPERIMENT_FLAGS) {

      if (!mex) {
        mex = 1;
        console.log('EXPERIMENT_FLAGS detected')
      }

      EXPERIMENT_FLAGS.web_enable_dynamic_metadata = true;
      EXPERIMENT_FLAGS.dynamic_metadata_update_interaction_delay_period_sec = 8;


    }

  });

})();

Scripts Using this Library