MediaWiki:Timeless.js: Difference between revisions
From Ephinea PSO Wiki
(Restore more-info) |
(Disable timeless more info js, if still doesnt work il debug it later) |
||
Line 53: | Line 53: | ||
} | } | ||
$(".more_info").click(function () { | /*$(".more_info").click(function () { | ||
var $title = $(this).find(".title"); | var $title = $(this).find(".title"); | ||
if (!$title.length) { | if (!$title.length) { | ||
Line 60: | Line 60: | ||
$title.remove(); | $title.remove(); | ||
} | } | ||
}); | });*/ |
Revision as of 07:19, 18 November 2021
/* Any JavaScript here will be loaded for all users on every page load. */ /* Sets the top property for stickyHeader tables */ function setStickyHeaderTop() { const stickyTables = document.getElementsByClassName('stickyHeader'); const headHeight = document.getElementById('mw-header-container').offsetHeight; for (var i = 0; i < stickyTables.length; i++) { const firstRow = stickyTables[i].getElementsByClassName('headerRow-0'); const secondRow = stickyTables[i].getElementsByClassName('headerRow-1'); var firstHeight = 0; if (firstRow.length > 0) { firstHeight = firstRow[0].offsetHeight; const firstHeaders = firstRow[0].getElementsByTagName('th'); for (var j = 0; j < firstHeaders.length; j++) { firstHeaders[j].style.top = headHeight + 'px'; } if (secondRow.length > 0) { const secondHeaders = secondRow[0].getElementsByTagName('th'); var secondHeight = headHeight + firstHeight; for (var j = 0; j < secondHeaders.length; j++) { secondHeaders[j].style.top = secondHeight + 'px'; } } } } } $(document).ready(function () { if (document.getElementsByClassName("stickyHeader").length > 0) { setStickyHeaderTop(); $(window).resize(setStickyHeaderTop); } const darkMode = localStorage.getItem("darkMode"); if (darkMode === "true") { document.body.classList.add("darkMode"); } else { document.body.classList.remove("darkMode"); } $("#personal-inner").append('<button onClick="toggleDarkMode();" style="margin:.5rem!important;">Toggle Dark Mode</button>'); }); function toggleDarkMode() { const darkMode = localStorage.getItem("darkMode"); if (darkMode !== "true") { localStorage.setItem("darkMode", true); document.body.classList.add("darkMode"); } else { localStorage.setItem("darkMode", false); document.body.classList.remove("darkMode"); } } /*$(".more_info").click(function () { var $title = $(this).find(".title"); if (!$title.length) { $(this).append('<span class="title">' + $(this).attr("title") + '</span>'); } else { $title.remove(); } });*/