Youtube Hide Paused Gradient by Sapioit

Removes the annoying gradients visible when pausing a video.

当前为 2022-07-19 提交的版本,查看 最新版本

  1. // ==UserScript==
  2. // @name Youtube Hide Paused Gradient by Sapioit
  3. // @namespace Sapioit
  4. // @copyright Sapioit, 2020 - Present
  5. // @author sapioitgmail.com
  6. // @license GPL-2.0-only; http://www.gnu.org/licenses/gpl-2.0.txt
  7. // @include https://www.youtube.com/*
  8. // @include https://youtu.be/*
  9. // @description Removes the annoying gradients visible when pausing a video.
  10. // @version 1.3.3.5
  11. // @grant GM_addStyle
  12. // @grant GM_registerMenuCommand
  13. // @grant GM_setValue
  14. // @grant GM_getValue
  15. // ==/UserScript==
  16.  
  17.  
  18. if (typeof document.getElementsByClassName("ytp-gradient-top")[0] != "undefined") {
  19. document.getElementsByClassName("ytp-gradient-top")[0].style.display = 'none';
  20. }
  21. if (typeof document.getElementsByClassName("ytp-gradient-top")[0] != "undefined") {
  22. document.getElementsByClassName("ytp-gradient-top")[0].style.opacity = '0';
  23. }
  24. if (typeof document.getElementsByClassName("ytp-gradient-bottom")[0] != "undefined") {
  25. document.getElementsByClassName("ytp-gradient-bottom")[0].style.display = 'none';
  26. }
  27. if (typeof document.getElementsByClassName("ytp-gradient-bottom")[0] != "undefined") {
  28. document.getElementsByClassName("ytp-gradient-bottom")[0].style.opacity = '0';
  29. }
  30.  
  31. /*
  32. document.getElementsByClassName("ytp-gradient-top")[0].style.display = 'none';
  33. document.getElementsByClassName("ytp-gradient-top")[0].style.opacity = '0';
  34. document.getElementsByClassName("ytp-gradient-bottom")[0].style.display = 'none';
  35. document.getElementsByClassName("ytp-gradient-bottom")[0].style.opacity = '0';
  36. */
  37.  
  38. GM_addStyle('.ytp-gradient-top { display: none !important; opacity: 0 !important; }');
  39. GM_addStyle('.ytp-gradient-top { width: none !important; opacity: 0 !important; }');
  40.  
  41. GM_addStyle('button div.ytp-autonav-toggle-button-container { display: none !important;}');
  42. GM_addStyle('[data-tooltip-target-id="ytp-autonav-toggle-button"] { display: none !important;}');
  43. //GM_addStyle('.ytp-button[data-tooltip-target-id="ytp-autonav-toggle-button"] { display: none !important;}');
  44. GM_addStyle('--ytd-engagement-panel-section-list-rendere { display: none !important;}');
  45. GM_addStyle('.ytp-time-display > span { padding: 3px; background: rgba(0, 0, 0, 0.5); }');
  46. //GM_addStyle('.ytd-thumbnail-overlay-time-status-renderen { transition-duration: 0s; }');
  47.  
  48.  
  49. window.onload = function(){setTimeout(function () {
  50. GM_addStyle('button div.ytp-autonav-toggle-button-container { display: none !important;}');
  51. GM_addStyle('[data-tooltip-target-id="ytp-autonav-toggle-button"] { display: none !important;}');
  52. GM_addStyle('--ytd-engagement-panel-section-list-rendere { display: none !important;}');
  53. GM_addStyle('#video-title.ytd-compact-video-renderer { overflow: none !important;}');
  54. //GM_addStyle('.ytd-thumbnail-overlay-time-status-renderen { transition-duration: 0s; }');
  55. }, 5*1000)}; //loads after 5 seconds
  56.  
  57. function yourFunction(){
  58. GM_addStyle('button div.ytp-autonav-toggle-button-container { display: none !important;}');
  59. GM_addStyle('[data-tooltip-target-id="ytp-autonav-toggle-button"] { display: none !important;}');
  60. GM_addStyle('--ytd-engagement-panel-section-list-rendere { display: none !important;}');
  61. setTimeout(yourFunction, 30*1000); //loads every 30 seconds
  62. }
  63. yourFunction();
  64.  
  65. function add_hover_tooltips() {
  66. /*var video_titles = document.getElementsByTagName("h3").getElementsByClassName("ytd-compact-video-renderer").getElementsByTagName("span");*/
  67. /*var video_titles = document.querySelector("span.ytd-compact-video-renderer");*/
  68. //var video_titles = document.getElementsByTagName("span").getElementsByClassName("ytd-compact-video-renderer");
  69.  
  70. /*var video_titles = document.querySelectorAll("span.ytd-compact-video-renderer");*/
  71. var video_titles = document.querySelectorAll("span.ytd-compact-video-renderer, #video-title");
  72. for(var i=0; i<video_titles.length; i++){
  73. console.log(video_titles[i]);
  74. var current_title = video_titles[i].getAttribute("title");
  75. video_titles[i].setAttribute("alt", current_title);
  76. video_titles[i].setAttribute("data-title", current_title);
  77. video_titles[i].setAttribute("data-tooltip", current_title);
  78. }
  79. /*
  80. video_titles = document.querySelectorAll("#video-title");
  81. for(i=0; i<video_titles.length; i++){
  82. console.log(video_titles[i]);
  83. current_title = video_titles[i].getAttribute("title");
  84. video_titles[i].setAttribute("alt", current_title);
  85. video_titles[i].setAttribute("data-title", current_title);
  86. video_titles[i].setAttribute("data-tooltip", current_title);
  87. }
  88. */
  89. }
  90.  
  91. window.onloadstart = function(){setTimeout(function () {
  92. add_hover_tooltips();
  93. }, 0.001*1000)}; //loads after 0.001 seconds
  94.  
  95. window.onload = function(){setTimeout(function () {
  96. add_hover_tooltips();
  97. }, 3*1000)}; //loads after 3 seconds
  98.  
  99. window.onload = function(){setTimeout(function () {
  100. add_hover_tooltips();
  101. }, 10*1000)}; //loads after 10 seconds
  102.  
  103.  
  104. GM_addStyle("span[data-tooltip]:before { z-index:301; content: attr(data-tooltip); position: absolute; opacity: 0; padding: 10px; background: black; color: white;} span[data-tooltip]:hover:before { opacity: 1;} ");
  105. GM_addStyle(".yt-simple-endpoint[title]:before { z-index:301; content: attr(title); position: absolute; opacity: 0; padding: 10px; background: black; color: white;} .yt-simple-endpoint[title]:hover:before { opacity: 1 !important;} ");
  106.  
  107.  
  108. // <ytd-engagement-panel-section-list-renderer class="style-scope ytd-watch-flexy" visibility="ENGAGEMENT_PANEL_VISIBILITY_EXPANDED">GM_addStyle(a);