Hide Youtube video title and player control bar

Hide Youtube video title and player control bar when playing in full screen.

当前为 2023-02-23 提交的版本,查看 最新版本

  1. // ==UserScript==
  2. // @name Hide Youtube video title and player control bar
  3. // @description Hide Youtube video title and player control bar when playing in full screen.
  4. // @author Wanten
  5. // @copyright 2023 Wanten
  6. // @license MIT
  7. // @supportURL https://github.com/WantenMN/userscript-youtube/issues
  8. // @icon https://youtube.com/favicon.ico
  9. // @homepageURL https://github.com/WantenMN/userscript-youtube
  10. // @namespace https://greasyfork.org/en/
  11. // @version 0.0.0
  12. // @match http*://*.youtube.com/watch?*
  13. // @match http*://youtube.com/watch?*
  14. // @match http*://*.youtu.be/watch?*
  15. // @match http*://youtu.be/watch?*
  16. // @run-at document-end
  17. // @grant GM_addStyle
  18. // ==/UserScript==
  19.  
  20.  
  21. (function () {
  22. "use strict";
  23.  
  24. //settings
  25. const toggleKey = 'e';
  26. const hideProgressBar = false;//hide progress bar?
  27.  
  28. const enableStyle =`
  29. .ytp-chrome-top {
  30. display: none !important;
  31. }
  32. .ytp-gradient-top {
  33. display: none !important;
  34. }
  35. .ytp-chrome-controls {
  36. display: none !important;
  37. }
  38. .ytp-gradient-bottom {
  39. display: none !important;
  40. }
  41. .ytp-progress-bar-container {
  42. bottom: 10px !important;
  43. ${hideProgressBar ? 'display: none !important;' : ''}
  44. }
  45. .caption-window, .caption-window.ytp-caption-window-bottom, .caption-window ytp-caption-window-top {
  46. margin-bottom: 0px !important;
  47. margin-top: 0px !important;
  48. }
  49. .annotation {
  50. display: none !important;
  51. }
  52. `;
  53.  
  54. let enableFlag = false;
  55. let styleTag = null;
  56. window.addEventListener("keydown", (e) => {
  57. enableFlag = !enableFlag;
  58. if (e.key === toggleKey) {
  59. styleTag && document.head.removeChild(styleTag);
  60. styleTag = null;
  61. if (enableFlag)
  62. styleTag = GM_addStyle(enableStyle);
  63. }
  64. });
  65. })();