gyaani / Hide rating opponent

// ==UserScript==
// @name        Hide rating opponent
// @version      0.2
// @copyright    2018, gyaani
// @description  Hide opponent ratings on lichess.org, so you can forget how good the opponent maybe.
// @author       gyaani
// @match        https://lichess.org/*
// @grant        none
// @license 	 MIT
// @run-at       document-body
// ==/UserScript==

(function() {
    'use strict';
    var globalVars = {
        countInterval : 0
    }
    var textEle = document.querySelectorAll('body div.player a.user_link');
    if (textEle && textEle[0] && textEle[1]){
        textEle[0].innerText = textEle[0].innerText.replace(/\(\d*\)/,"(----)");
        textEle[1].innerText = textEle[1].innerText.replace(/\(\d*\)/,"(----)");
    }
    var userName = document.body.dataset.user
    var interval = setInterval(function(){
        var users = document.querySelectorAll('div.table > div.username');
        if (users && users[0]){
            if ( users[0].querySelector('a').text != userName ){
                var rating = users[0].querySelector('rating');
                rating.style.display = 'none';
            }
            clearInterval(interval);
        }
        if (globalVars.countInterval > 2500/10){
            clearInterval(interval);
        }
        globalVars.countInterval++;
    },10);
})();