GMify

Pretend to be GM

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

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

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         GMify
// @version      20231020-3
// @description  Pretend to be GM
// @author       soup_steward
// @match        https://www.chess.com/*
// @match        https://chess.com/*
// @require http://code.jquery.com/jquery-latest.js
// @grant        none
// @license        MIT
// @inject-into content
// @namespace https://greasyfork.org/users/964951
// ==/UserScript==

function waitForElm(selector) {
    return new Promise(resolve => {
        if (document.querySelector(selector)) {
            return resolve(document.querySelector(selector));
        }

        const observer = new MutationObserver(mutations => {
            if (document.querySelector(selector)) {
                resolve(document.querySelector(selector));
                observer.disconnect();
            }
        });

        observer.observe(document.body, {
            childList: true,
            subtree: true
        });
    });
}

function setGmStatus(){



    $('#board-layout-player-bottom > div > div.player-tagline > div.player-game-over-component > div > span.rating-score-rating').html(
  parseInt($('#board-layout-player-bottom > div > div.player-tagline > div.player-game-over-component > div > span.rating-score-rating').html()) +2000
    );


    $('.user-tagline-rating').html(
  parseInt($('.user-tagline-rating').html().replace("(","").replace(")","")) +2000
    );

  $('#board-layout-player-bottom > div > div.player-tagline > div.user-tagline-component').prepend('<a href="/members/titled-players" target="_blank" class="user-chess-title-component" data-tooltip-target="10">GM</a>');



};

waitForElm('.rating-score-rating').then((elm) => {

setGmStatus();
  setElo();

});


waitForElm('#board-layout-player-bottom > div > div.player-tagline > div > span').then((elm) => {

setGmStatus();
  setElo();

});



$('#board-layout-player-bottom > div > div.player-tagline > div.player-game-over-component > div > span.rating-score-rating').bind('DOMSubtreeModified', function(e) {
  setGmStatus();
  //setElo();
});