Youtube Adblock Chrome Extension Hide Share Button

Hides "Share" Button from Youtube Adblock Chrome Extension

目前为 2019-03-22 提交的版本。查看 最新版本

  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.6
  10. // ==/UserScript==
  11.  
  12. var share_button_id = "ab4yt-brand";
  13. var share_button_element = null;
  14. var share_button_obvserver = null;
  15. var observerConfig = {
  16. attributes: true,
  17. childList: true,
  18. characterData: true
  19. };
  20.  
  21. (function() {
  22. function loadObserver() {
  23. share_button_element.setAttribute( "style" , "visibility: hidden !important" );
  24. share_button_obvserver = new MutationObserver( function( mutations ) {
  25. mutations.forEach( function( mutation , index ) {
  26. if ( mutation.type === "childList" ) {
  27. var addedNode = mutation.addedNodes[ 0 ];
  28. if( addedNode ) {
  29. share_button_element.setAttribute( "style" , "visibility: hidden !important" );
  30. }
  31. }
  32. });
  33. });
  34. share_button_obvserver.observe( share_button_element , observerConfig );
  35. }
  36. var initial = setInterval ( function() {
  37. var x1 = document.getElementById( share_button_id );
  38. if ( x1 ) { x1.setAttribute( "style" , "visibility: hidden !important" ); }
  39. } , 200 );
  40. setTimeout( function() {
  41. clearInterval( initial );
  42. } , 10000 );
  43. var ready = setInterval( function() {
  44. var x1 = document.getElementById( share_button_id );
  45. if ( x1 ) { share_button_element = x1; clearInterval( ready ); loadObserver(); }
  46. } , 2 );
  47. setTimeout( function() {
  48. clearInterval( ready );
  49. } , 5000 );
  50. })();

QingJ © 2025

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