Chess Com Hide Upgrade Stuff

Hides Upgrade Div Stuff

K instalaci tototo skriptu si budete muset nainstalovat rozšíření jako Tampermonkey, Greasemonkey nebo Violentmonkey.

You will need to install an extension such as Tampermonkey to install this script.

K instalaci tohoto skriptu si budete muset nainstalovat rozšíření jako Tampermonkey nebo Violentmonkey.

K instalaci tohoto skriptu si budete muset nainstalovat rozšíření jako Tampermonkey nebo Userscripts.

You will need to install an extension such as Tampermonkey to install this script.

K instalaci tohoto skriptu si budete muset nainstalovat manažer uživatelských skriptů.

(Už mám manažer uživatelských skriptů, nechte mě ho nainstalovat!)

You will need to install an extension such as Stylus to install this style.

You will need to install an extension such as Stylus to install this style.

You will need to install an extension such as Stylus to install this style.

You will need to install a user style manager extension to install this style.

You will need to install a user style manager extension to install this style.

You will need to install a user style manager extension to install this style.

(Už mám manažer uživatelských stylů, nechte mě ho nainstalovat!)

// ==UserScript==
// @name          Chess Com Hide Upgrade Stuff
// @namespace     http://userstyles.org
// @description   Hides Upgrade Div Stuff
// @author        636597
// @include       /chess\.com
// @run-at        document-start
// @version       0.2
// ==/UserScript==

var css_selectors_hide = [
	"a.diamond" ,
	"div.adblock-message" ,
    "div.upgrade-content" ,
    "div.short-sidebar-ad-top" ,
    "div.short-sidebar-ad-bottom" ,
];

function _hide_stuff() {
	try {

		var upgrade_text = document.querySelectorAll( "span.text" );
		for ( var j = 0; j < upgrade_text.length; ++j  ) {
			var x = upgrade_text[ j ].innerHTML;
			x = x.trim();
			x = x.toLowerCase();
			if ( x === "upgrade" ) {
				upgrade_text[ j ].style.visibility = "hidden";
			}
		}

		for ( var i = 0; i < css_selectors_hide.length; ++i ) {
			var elements = document.querySelectorAll( css_selectors_hide[ i ] );
			for ( var j = 0; j < elements.length; ++j  ) {
				elements[ j ].style.visibility = "hidden";
			}
		}

	}
	catch( error ) { console.log( error ); }
}

var hide_interval = null;
function hide_stuff() {
	hide_interval = setInterval( _hide_stuff , 50 );
	setTimeout( function() {
		clearInterval( hide_interval );
	}, 3000 );
}

hide_stuff();
window.addEventListener ( "load" , _hide_stuff );