Hide Chess.com Opponent Ratings

Hide ratings in games, and on your homepage. For those who don't want a constant reminder that their opponent is better (or worse) than them.

Aby zainstalować ten skrypt, wymagana jest instalacje jednego z następujących rozszerzeń: Tampermonkey, Greasemonkey lub Violentmonkey.

Aby zainstalować ten skrypt, wymagana jest instalacje jednego z następujących rozszerzeń: Tampermonkey, Violentmonkey.

Aby zainstalować ten skrypt, wymagana jest instalacje jednego z następujących rozszerzeń: Tampermonkey, Violentmonkey.

Aby zainstalować ten skrypt, wymagana będzie instalacja rozszerzenia Tampermonkey lub Userscripts.

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

Aby zainstalować ten skrypt, musisz zainstalować rozszerzenie menedżera skryptów użytkownika.

(Mam już menedżera skryptów użytkownika, pozwól mi to zainstalować!)

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.

Będziesz musiał zainstalować rozszerzenie menedżera stylów użytkownika, aby zainstalować ten styl.

Będziesz musiał zainstalować rozszerzenie menedżera stylów użytkownika, aby zainstalować ten styl.

Musisz zainstalować rozszerzenie menedżera stylów użytkownika, aby zainstalować ten styl.

(Mam już menedżera stylów użytkownika, pozwól mi to zainstalować!)

// ==UserScript==
// @name        Hide Chess.com Opponent Ratings
// @description Hide ratings in games, and on your homepage.  For those who don't want a constant reminder that their opponent is better (or worse) than them.
// @namespace   http://xyxyx.org/
// @include     http://www.chess.com/*
// @version     0.1
// @grant       none
// ==/UserScript==

try {

	var elements = document.getElementsByClassName("playerrating");
	if (elements) {
		for (var i = 0; i < elements.length; i++) {
			elements.item(i).style.visibility = 'hidden';
		}
	}

	var getElementByXpath = function (path) {
		return document.evaluate(path, document, null, 9, null).singleNodeValue;
	};

	var linkPrefix    =  "http://www.chess.com/members/view/";
	var linkPrefixLen = linkPrefix.length;
	var ratingPattern = / \([0-9]+\)/;

	elements = document.getElementById("mv-table-c16").getElementsByTagName("a");
	// console.log("Found " + elements.length);
	if (elements) {
		for (var i = 0; i < elements.length; i++) {
			var link = elements.item(i);
			//console.log("link = " + link);
			if (link && link.href.substring(0, linkPrefixLen) === linkPrefix) {
				var next = link.nextSibling;
				if (next && next.data) {
					//console.log("sibling " + link.href + ": " + next.data);
					if (ratingPattern.test(next.data)) {
						next.data = next.data.replace(ratingPattern, "");
					}
				}
			}
		}

	}

} catch(e) {
   console.log("Hide chess.com opponent ratings failed: " + e);
}