Youtube Adblock Chrome Extension Hide Share Button

Hides "Share" Button from Youtube Adblock Chrome Extension

  1. // ==UserScript==
  2. // @name Youtube Adblock Chrome Extension Hide Share Button
  3. // @namespace http://userstyles.org
  4. // @description Hides "Share" Button from Youtube Adblock Chrome Extension
  5. // @description https://chrome.google.com/webstore/detail/adblock-for-youtube/cmedhionkhpnakcndndgjdbohmhepckk
  6. // @author 636597
  7. // @include *://*youtube.com/*
  8. // @run-at document-start
  9. // @version 0.9
  10. // ==/UserScript==
  11.  
  12. var share_button_id = "ab4yt-brand";
  13. var doc_body = null;
  14. var share_button_element = null;
  15. var doc_body_obvserver = null;
  16. var observerConfig = {
  17. childList: true,
  18. attributes: true,
  19. characterData: true,
  20. subtree: true,
  21. attributeOldValue: true,
  22. characterDataOldValue: true
  23. };
  24.  
  25. (function() {
  26. function loadObserver() {
  27. doc_body = document.getElementsByTagName( "BODY" )[ 0 ];
  28. doc_body_obvserver = new MutationObserver( function( mutations ) {
  29. mutations.forEach( function( mutation , index ) {
  30. if ( mutation.type === "childList" ) {
  31. mutation.addedNodes.forEach( function( node , index ) {
  32. if ( node.id === share_button_id ) {
  33. console.log( mutation );
  34. node.setAttribute( "style" , "visibility: hidden !important" );
  35. }
  36. });
  37. }
  38. });
  39. });
  40. doc_body_obvserver.observe( doc_body , observerConfig );
  41. var x1 = document.getElementById( share_button_id );
  42. if ( x1 ) { x1.setAttribute( "style" , "visibility: hidden !important" ); }
  43. }
  44. window.addEventListener ( "load" , loadObserver );
  45. })();

QingJ © 2025

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