YouTube Always Hoverable ProgressBar

Makes progressbar hoverable from the very beginning (also works when paused).

目前为 2021-11-14 提交的版本,查看 最新版本

  1. // ==UserScript==
  2. // @name YouTube Always Hoverable ProgressBar
  3. // @namespace https://github.com/Amadeus-AI
  4. // @version 1.0.2
  5. // @description Makes progressbar hoverable from the very beginning (also works when paused).
  6. // @icon https://www.youtube.com/s/desktop/3748dff5/img/favicon_48.png
  7. // @author AmadeusAI
  8. // @match *://www.youtube.com/*
  9. // @license MIT
  10. // ==/UserScript==
  11. /*jshint esversion: 6 */
  12.  
  13. var InstantBar =
  14. {
  15. css :
  16. `
  17. .ytp-chrome-bottom { opacity: 0 }
  18. .ytp-gradient-bottom { opacity: 0 }
  19. .html5-video-player:not(.ytp-fullscreen):hover > .ytp-chrome-bottom { opacity: 1 }
  20. .html5-video-player:not(.ytp-fullscreen):hover > .ytp-gradient-bottom { opacity: 1 }
  21. .html5-video-player.ytp-fullscreen > .ytp-chrome-bottom:hover { opacity: 1 }
  22.  
  23. `,
  24.  
  25. apply : function()
  26. {
  27. if (typeof GM_addStyle !== "undefined")
  28. {
  29. GM_addStyle(InstantBar.css);
  30. }
  31. else
  32. {
  33. let styleNode = document.createElement("style");
  34. styleNode.appendChild(document.createTextNode(InstantBar.css));
  35. (document.querySelector("head") || document.documentElement).appendChild(styleNode);
  36. }
  37. },
  38.  
  39. start : function()
  40. {
  41. // To overwrite youtube's default behavior
  42. setTimeout(InstantBar.apply, 0);
  43. }
  44. };
  45.  
  46. InstantBar.start();