Hides "Share" Button from Youtube Adblock Chrome Extension
当前为
// ==UserScript==
// @name Youtube Adblock Chrome Extension Hide Share Button
// @namespace http://userstyles.org
// @description Hides "Share" Button from Youtube Adblock Chrome Extension
// @description https://chrome.google.com/webstore/detail/adblock-for-youtube/cmedhionkhpnakcndndgjdbohmhepckk
// @author 636597
// @include *://*youtube.com/*
// @run-at document-start
// @version 0.6
// ==/UserScript==
var share_button_id = "ab4yt-brand";
var share_button_element = null;
var share_button_obvserver = null;
var observerConfig = {
attributes: true,
childList: true,
characterData: true
};
(function() {
function loadObserver() {
share_button_element.setAttribute( "style" , "visibility: hidden !important" );
share_button_obvserver = new MutationObserver( function( mutations ) {
mutations.forEach( function( mutation , index ) {
if ( mutation.type === "childList" ) {
var addedNode = mutation.addedNodes[ 0 ];
if( addedNode ) {
share_button_element.setAttribute( "style" , "visibility: hidden !important" );
}
}
});
});
share_button_obvserver.observe( share_button_element , observerConfig );
}
var initial = setInterval ( function() {
var x1 = document.getElementById( share_button_id );
if ( x1 ) { x1.setAttribute( "style" , "visibility: hidden !important" ); }
} , 200 );
setTimeout( function() {
clearInterval( initial );
} , 10000 );
var ready = setInterval( function() {
var x1 = document.getElementById( share_button_id );
if ( x1 ) { share_button_element = x1; clearInterval( ready ); loadObserver(); }
} , 2 );
setTimeout( function() {
clearInterval( ready );
} , 5000 );
})();