MediaWiki:Common.js: различия между версиями

Материал из Revera Wiki
Нет описания правки
Метка: отменено
Нет описания правки
Метка: отменено
Строка 1: Строка 1:
mw.loader.load("https://revera.world/js/reverin-date.js");
#reverinDateWidget {
    font-size: 13px; /* Уменьшаем размер шрифта */
    font-weight: normal; /* Убираем жирный шрифт по умолчанию */
    color: #333; /* Делаем текст более нейтральным */
    background: #f8f9fa;
    padding: 5px 8px; /* Уменьшаем отступы */
    border-radius: 4px;
    border-top: 1px solid #ccc;
    text-align: center;
    line-height: 1.2; /* Уменьшаем высоту строк */
    white-space: nowrap; /* Запрещаем перенос строк */
}


document.addEventListener("DOMContentLoaded", function() {
#reverinDateWidget b {
     let sidebar = document.getElementById("p-navigation") || document.getElementById("p-tb");
     font-weight: bold; /* Оставляем жирный только для ключевых слов */
    font-size: 13px;
}


    function ensureReverinDateWidget() {
.year-link {
        if (sidebar && !document.getElementById("reverinDateWidget")) {
    font-weight: bold;
            let dateDiv = document.createElement("div");
    font-size: 13px;
            dateDiv.id = "reverinDateWidget";
    color: #0056b3;
            dateDiv.style.padding = "10px";
    text-decoration: none;
            dateDiv.style.borderTop = "1px solid #ccc";
}
            dateDiv.style.marginTop = "10px";
            dateDiv.style.fontWeight = "bold";
            dateDiv.style.whiteSpace = "pre-line";
            dateDiv.innerText = "Загрузка реверинской даты...";


            sidebar.appendChild(dateDiv);
.year-link:hover {
            console.log("`#reverinDateWidget` вставлен в сайтбар!");
    text-decoration: underline;
        }
}
    }
 
    function waitForReverinScript(callback) {
        let attempts = 0;
        let checkInterval = setInterval(function() {
            if (typeof window.loadReverinDate === "function") {
                clearInterval(checkInterval);
                console.log("Скрипт `reverin-date.js` загружен, запускаем!");
                window.loadReverinDate();
                callback();
            } else if (attempts >= 20) {
                clearInterval(checkInterval);
                console.error("Ошибка: `reverin-date.js` не загрузился!");
            }
            attempts++;
        }, 250);
    }
 
    function waitForTooltips() {
        let attempts = 0;
        let checkInterval = setInterval(function() {
            if (typeof window.addTooltipHandlers === "function") {
                clearInterval(checkInterval);
                console.log("Подсказки загружены, запускаем!");
                window.addTooltipHandlers();
            } else if (attempts >= 20) {
                clearInterval(checkInterval);
                console.error("Ошибка: `addTooltipHandlers` не загрузился!");
            }
            attempts++;
        }, 250);
    }
 
    ensureReverinDateWidget();
    waitForReverinScript(waitForTooltips);
});

Версия от 23:11, 25 февраля 2025

#reverinDateWidget {
    font-size: 13px; /* Уменьшаем размер шрифта */
    font-weight: normal; /* Убираем жирный шрифт по умолчанию */
    color: #333; /* Делаем текст более нейтральным */
    background: #f8f9fa;
    padding: 5px 8px; /* Уменьшаем отступы */
    border-radius: 4px;
    border-top: 1px solid #ccc;
    text-align: center;
    line-height: 1.2; /* Уменьшаем высоту строк */
    white-space: nowrap; /* Запрещаем перенос строк */
}

#reverinDateWidget b {
    font-weight: bold; /* Оставляем жирный только для ключевых слов */
    font-size: 13px;
}

.year-link {
    font-weight: bold;
    font-size: 13px;
    color: #0056b3;
    text-decoration: none;
}

.year-link:hover {
    text-decoration: underline;
}