emshaFocusMode

Hides every info about your opponent during a competitive duel.

이 스크립트를 설치하려면 Tampermonkey, Greasemonkey 또는 Violentmonkey와 같은 확장 프로그램이 필요합니다.

이 스크립트를 설치하려면 Tampermonkey와 같은 확장 프로그램을 설치해야 합니다.

이 스크립트를 설치하려면 Tampermonkey 또는 Violentmonkey와 같은 확장 프로그램이 필요합니다.

이 스크립트를 설치하려면 Tampermonkey 또는 Userscripts와 같은 확장 프로그램이 필요합니다.

이 스크립트를 설치하려면 Tampermonkey와 같은 확장 프로그램이 필요합니다.

이 스크립트를 설치하려면 유저 스크립트 관리자 확장 프로그램이 필요합니다.

(이미 유저 스크립트 관리자가 설치되어 있습니다. 설치를 진행합니다!)

이 스타일을 설치하려면 Stylus와 같은 확장 프로그램이 필요합니다.

이 스타일을 설치하려면 Stylus와 같은 확장 프로그램이 필요합니다.

이 스타일을 설치하려면 Stylus와 같은 확장 프로그램이 필요합니다.

이 스타일을 설치하려면 유저 스타일 관리자 확장 프로그램이 필요합니다.

이 스타일을 설치하려면 유저 스타일 관리자 확장 프로그램이 필요합니다.

이 스타일을 설치하려면 유저 스타일 관리자 확장 프로그램이 필요합니다.

(이미 유저 스타일 관리자가 설치되어 있습니다. 설치를 진행합니다!)

// ==UserScript==
// @name         emshaFocusMode
// @namespace    http://tampermonkey.net/
// @version      1.1
// @author       emshanoff
// @description  Hides every info about your opponent during a competitive duel.
// @match        https://www.geoguessr.com/*
// @grant        none
// ==/UserScript==

(function () {
    'use strict';

    const myAvatar = "ba136d13cf440d565839166164e8f6a6.png";
    const replacementImage = "https://i.imgur.com/qIgrwRi.png";


    const hideSecond = [
        '.health-bar_avatarContainer__sMgJM',
        '.health-bar_nickContainer__2ZdwR',
        '.ranked-matchmaking-layout_avatarContainer__POKsW',
        '.player-stats-card_cardInner__G8sHN'
    ];


    const hideSingle = [
        '.post-guess-player-spectator_avatarCam__MTwKL',
        '.post-guess-player-spectator_playerInfo__7FNe2',
        '.chat-message_nick__EyPYz',
        '.chat-message_avatarContainer__m4wTM',
        '.chat-message_fullBodyAvatar__uZ4QK',
        '.head-to-head_score__OahzQ'
    ];


    function hideSecondElements() {
        hideSecond.forEach(selector => {

            const elements = document.querySelectorAll(selector);

            if (elements.length > 1) {
                elements[1].style.display = "none";
            }

        });
    }


    function hideSingleElements() {
        hideSingle.forEach(selector => {

            const el = document.querySelector(selector);

            if (el) {
                el.style.display = "none";
            }

        });
    }


    function replaceOpponentPin() {

        document
        .querySelectorAll('.polite-pin_wrapper__uEwNd image')
        .forEach(el => {

            const href =
                el.getAttribute("href") ||
                el.getAttribute("xlink:href");

            if (href && !href.includes(myAvatar)) {

                el.setAttribute("href", replacementImage);
                el.setAttribute("xlink:href", replacementImage);

            }

        });

    }


    function applyFocusMode() {

        hideSecondElements();
        hideSingleElements();
        replaceOpponentPin();

    }


    applyFocusMode();


    const observer = new MutationObserver(applyFocusMode);

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

})();