HWM_MapEnhancer

Улучшения функционала карты

Bu betiği kurabilmeniz için Tampermonkey, Greasemonkey ya da Violentmonkey gibi bir kullanıcı betiği eklentisini kurmanız gerekmektedir.

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

Bu betiği kurabilmeniz için Tampermonkey ya da Violentmonkey gibi bir kullanıcı betiği eklentisini kurmanız gerekmektedir.

Bu betiği kurabilmeniz için Tampermonkey ya da Userscripts gibi bir kullanıcı betiği eklentisini kurmanız gerekmektedir.

Bu betiği indirebilmeniz için ayrıca Tampermonkey gibi bir eklenti kurmanız gerekmektedir.

Bu komut dosyasını yüklemek için bir kullanıcı komut dosyası yöneticisi uzantısı yüklemeniz gerekecek.

(Zaten bir kullanıcı komut dosyası yöneticim var, kurmama izin verin!)

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.

(Zateb bir user-style yöneticim var, yükleyeyim!)

// ==UserScript==
// @name         HWM_MapEnhancer
// @namespace    Небылица
// @version      1.2
// @description  Улучшения функционала карты
// @author       Небылица
// @include      /^https{0,1}:\/\/((www|qrator)\.heroeswm\.ru|178\.248\.235\.15)\/map\.php/
// ==/UserScript==

(function() {
    "use strict";

    // Вспомогательные функции
    function loadingTimeoutWrapper(mode){ // Обёртка под ожидание прогрузки (mode – "map" для обычной страницы карты, "moving" – для страницы перехода)
        if (mode === undefined){
            if (document.documentElement.innerHTML.indexOf("Район:") !== -1){
                mode = "map";
            } else{
                mode = "moving";
            }
        }

        switch (mode){
                // страница карты
            case "map":
                var mapNotifs = document.querySelectorAll(".map_notif");

                if (mapNotifs.length !== 0){
                    // прячем восклицательные знаки на иконках ГС, ГЛ и ГИ
                    mapNotifs.forEach(function(element){element.style.display = "none";});

                    // добавляем отступ для блока со списком учреждений в районе
                    document.getElementById("text1").style.marginBottom = "5px";
                } else{
                    window.setTimeout(function(){loadingTimeoutWrapper("map");}, 250);
                }
                break;

                // страница перехода
            case "moving":
                var text3 = document.getElementById("text3");

                if (text3.innerText.length !== 0){
                    // добавляем время перехода в заголовок вкладки
                    addTimeToTitle(text3, document.title);
                } else{
                    window.setTimeout(function(){loadingTimeoutWrapper("moving");}, 250);
                }
                break;
        }
    }
    function addTimeToTitle(text3, commonPart){ // С периодичностью в 500 мс добавляем текущее время до конца перехода в начало заголовка вкладки
        var time = Number(text3.innerHTML.split(" ")[1]);
        if (time >= 0){
            document.title = time + " сек. " + commonPart;
            window.setTimeout(function(){addTimeToTitle(text3, commonPart)}, 500);
        }
    }


    // Обёртка под ожидание прогрузки
    loadingTimeoutWrapper();
})();