YouTube: Force Animated-Rolling-Number

To force YouTube use Animated-Rolling-Number for YouTube Live

  1. // ==UserScript==
  2. // @name YouTube: Force Animated-Rolling-Number
  3. // @namespace UserScripts
  4. // @match https://www.youtube.com/*
  5. // @grant none
  6. // @version 0.1.11
  7. // @author CY Fung
  8. // @license MIT
  9. // @description To force YouTube use Animated-Rolling-Number for YouTube Live
  10. // @run-at document-start
  11. // @inject-into page
  12. // @unwrap
  13. // @require https://update.gf.qytechs.cn/scripts/475632/1361351/ytConfigHacks.js
  14. // ==/UserScript==
  15.  
  16. (() => {
  17.  
  18. window._ytConfigHacks.add((config_) => {
  19.  
  20. const EXPERIMENT_FLAGS = config_.EXPERIMENT_FLAGS;
  21.  
  22. if (EXPERIMENT_FLAGS) {
  23.  
  24. EXPERIMENT_FLAGS.web_enable_dynamic_metadata = true;
  25. EXPERIMENT_FLAGS.dynamic_metadata_update_interaction_delay_period_sec = 8;
  26. EXPERIMENT_FLAGS.web_animated_like = true;
  27. EXPERIMENT_FLAGS.web_animated_like_lazy_load = true;
  28.  
  29. }
  30.  
  31. });
  32.  
  33. const insp = o => o ? (o.polymerController || o.inst || o || 0) : (o || 0);
  34.  
  35. setInterval(() => {
  36. // prevent animation number flicking due to change of video content (browse -> mini -> browse of another)
  37.  
  38. for (const an of document.querySelectorAll('[hidden] yt-animated-rolling-number:not([f9wm6="0"]), [hidden] yt-smartimation:not([f9wm6="0"])')) {
  39. an.setAttribute('f9wm6', '0');
  40. const cnt = insp(an);
  41. const pnt = typeof cnt.disconnectedCallback === 'function' ? cnt : an;
  42. if (typeof pnt.disconnectedCallback === 'function') pnt.disconnectedCallback();
  43. }
  44.  
  45. for (const an of document.querySelectorAll('yt-animated-rolling-number[f9wm6="0"], yt-smartimation[f9wm6="0"]')) {
  46. if (an.closest('[hidden]')) continue;
  47. an.setAttribute('f9wm6', '1');
  48. const cnt = insp(an);
  49. const pnt = typeof cnt.connectedCallback === 'function' ? cnt : an;
  50. if (typeof pnt.connectedCallback === 'function') pnt.connectedCallback();
  51. }
  52.  
  53. }, 100);
  54.  
  55.  
  56. })();

QingJ © 2025

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