Youtube Adblock Chrome Extension Hide Share Button

Hides "Share" Button from Youtube Adblock Chrome Extension

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

// ==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.7
// ==/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_obvserver = new MutationObserver( function( mutations ) {
			mutations.forEach( function( mutation , index ) {
                console.log( mutation.type );
                share_button_element.setAttribute( "style" , "visibility: hidden !important" );
			});
		});
        var initial = setInterval ( function() {
            var x1 = document.getElementById( share_button_id );
            console.log( x1 );
            if ( x1 !== null ) {
                share_button_element = x1;
                x1.setAttribute( "style" , "visibility: hidden !important" );
                share_button_obvserver.observe( share_button_element , observerConfig );
                clearInterval( initial );
            }
        } , 100 );
        setTimeout( function() {
            console.log( "clearing inital interval" );
            clearInterval( initial );
        } , 10000 );
	}
    window.addEventListener ( "load" , loadObserver );
})();

QingJ © 2025

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