youtube + bilibili rec blocker

youtube and bilibili recommendation blocker

  1. // ==UserScript==
  2. // @name youtube + bilibili rec blocker
  3. // @version 2024-04-9_3
  4. // @license GNU GPLv3
  5. // @description youtube and bilibili recommendation blocker
  6. // @author RayRay
  7. // @match https://www.youtube.com/
  8. // @match https://www.bilibili.com/?*
  9. // @match https://www.bilibili.com/
  10. // @run-at document-body
  11. // @grant GM_info
  12. // @grant GM_addStyle
  13. // @grant GM_setValue
  14. // @grant GM_getValue
  15. // @grant GM_xmlhttpRequest
  16. // @grant GM_registerMenuCommand
  17. // @namespace https://greatest.deepsurf.us/users/1285841
  18. // ==/UserScript==
  19.  
  20. (function() {
  21. 'use strict';
  22. console.log(location.href)
  23. if(location.href.includes('youtube.com')){
  24. console.log("YT")
  25.  
  26. document.addEventListener("DOMContentLoaded", function() {
  27. console.log("DOM fully loaded and parsed");
  28.  
  29.  
  30. document.getElementsByClassName("style-scope ytd-two-column-browse-results-renderer")[0].style.display='none'
  31. window.addEventListener("load", (event) => {
  32. console.log("page is fully loaded");
  33.  
  34.  
  35. document.getElementsByClassName("style-scope ytd-guide-entry-renderer")[10].style.display='none'
  36. document.getElementsByClassName("style-scope ytd-guide-entry-renderer")[20].style.display='none'
  37. document.getElementsByClassName("style-scope ytd-guide-renderer")[2].style.display='none'
  38. });
  39. });
  40.  
  41. }
  42. if(location.href.includes('bilibili.com')){
  43.  
  44. document.addEventListener("DOMContentLoaded", function() {
  45. console.log("DOM fully loaded and parsed");
  46. document.getElementsByClassName("bili-feed4-layout")[0].style.display='none'
  47. window.addEventListener("load", (event) => {
  48.  
  49. document.getElementsByClassName('header-channel-fixed')[0].style.display='none'
  50. document.getElementsByClassName('bili-header__channel')[0].style.display='none'
  51. document.getElementsByClassName("bili-header__bar")[0].getElementsByClassName('left-entry')[0].style.opacity='0'
  52. //document.getElementsByClassName('nav-search-input')[0].placeholder=""
  53. document.getElementsByClassName('palette-button-wrap')[0].style.opacity='0'
  54. document.getElementsByClassName('nav-search-input')[0].style.opacity='0'
  55.  
  56. setTimeout(() => {
  57. document.getElementsByClassName('nav-search-input')[0].placeholder=""
  58. document.getElementsByClassName('nav-search-input')[0].style.opacity='1'
  59.  
  60. }
  61. ,
  62. 800)
  63. })
  64.  
  65. })
  66.  
  67.  
  68.  
  69. //palette-button-wrap
  70. }
  71.  
  72.  
  73.  
  74.  
  75.  
  76.  
  77. })();