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

Нет описания правки
Нет описания правки
Строка 1: Строка 1:
document.addEventListener("DOMContentLoaded", function() {
document.addEventListener("DOMContentLoaded", function() {
     const menu = document.querySelector("div.catlinks");
     const menu = document.querySelector("div.catlinks");
    if (!menu) return;


     function updateOpacity() {
     function updateOpacity() {
        if (!menu) return;
         const scrollTop = menu.scrollTop;
         const scrollTop = menu.scrollTop;
         const maxScroll = menu.scrollHeight - menu.clientHeight;
         const maxScroll = menu.scrollHeight - menu.clientHeight;
       
 
         document.documentElement.style.setProperty('--fade-top', scrollTop > 10 ? '1' : '0');
         document.documentElement.style.setProperty('--fade-top', scrollTop > 10 ? '1' : '0');
         document.documentElement.style.setProperty('--fade-bottom', scrollTop < maxScroll - 10 ? '1' : '0');
         document.documentElement.style.setProperty('--fade-bottom', scrollTop < maxScroll - 10 ? '1' : '0');