|
Tags: Replaced Manual revert |
| Line 1: |
Line 1: |
| /* All JavaScript here will be loaded for users of the Timeless skin */ | | /* All JavaScript here will be loaded for users of the Timeless skin */ |
|
| |
| /* Sticky wiki tools and sidebar */
| |
| var catSidebar = document.getElementById("catlinks-sidebar");
| |
| var pageTools = document.getElementById("page-tools");
| |
|
| |
| var catSidebarVisible = false;
| |
|
| |
| // Check if catlinks-sidebar exists
| |
| if (catSidebar) {
| |
| var visibleCats = catSidebar.querySelectorAll(".mw-normal-catlinks ul li");
| |
| var hiddenCats = catSidebar.querySelectorAll(".mw-hidden-catlinks ul li");
| |
|
| |
| // Hide if no visible categories and some hidden ones
| |
| if (visibleCats.length === 0 && hiddenCats.length > 0) {
| |
| catSidebar.style.display = "none";
| |
| }
| |
|
| |
| // Check if it's visible after all that
| |
| catSidebarVisible = catSidebar.style.display !== "none";
| |
| }
| |
|
| |
| // Apply sticky logic
| |
| if (catSidebarVisible) {
| |
| // Make catlinks-sidebar sticky
| |
| catSidebar.style.position = "sticky";
| |
| catSidebar.style.top = "70px";
| |
|
| |
| // Remove sticky from page-tools
| |
| if (pageTools) {
| |
| pageTools.style.position = "";
| |
| pageTools.style.top = "";
| |
| }
| |
| } else {
| |
| // Make page-tools sticky
| |
| if (pageTools) {
| |
| pageTools.style.position = "sticky";
| |
| pageTools.style.top = "70px";
| |
| }
| |
|
| |
| // Remove sticky from catlinks-sidebar (if it exists)
| |
| if (catSidebar) {
| |
| catSidebar.style.position = "";
| |
| catSidebar.style.top = "";
| |
| }
| |
| }
| |
/* All JavaScript here will be loaded for users of the Timeless skin */