User:Sideswipe9th/V22FloatingToolsMenu-debug-copy.js: Difference between revisions

Content deleted Content added
update last edit date
update last edit date
 
(4 intermediate revisions by the same user not shown)
Line 1:
//<nowiki>
// By Sideswipe9th
// Last edit date: 2712 NovemberDecember 2023
// Known bugs:
// - On pages with a ToC, scrolling the main content area will cause the stick panel to jump to whatever
Line 8:
// The parent containers exist when the menu is hidden, and if not create empty ones
// Change log:
// - 12 December 2023
// * Fix bug where the tools menu was no longer appearing on TOC-less pages, after another set of class and ID changes in the theme
// - 27 November 2023
// * Fix bug where the tools menu was no longer being added to TOC-less pages, after some class and id changes in the theme
Line 24 ⟶ 26:
// it does not, so we're on a ToCless page
// get the div with the class name mw-page-container-inner
var pageContainer = document.getElementsByClassName("mwvector-pagecolumn-container-innerstart");
if (pageContainer.length > 0)
{
Line 36 ⟶ 38:
// append this nav as a child to div with clas mw-page-container-inner
pageContainer[0].appendChild(nav);
// ok, now we have a nav element in the right place, time to move its content to the right place.
var newContainer = document.createElement("div"); // create a new div
newContainer.id = "vector-toc-pinned-container"; // give it the right id
newContainer.className = "vector-pinned-container"; // give it some class
nav.appendChild(newContainer); // and append it to the navbar
 
var toolsBar = document.getElementById("vector-page-tools"); // then grab the tools bar by ID
toolsBar.disabled = true; // because enabling the tools bar will break this, we want to force it to disabled
newContainernav.appendChild(toolsBar); // and finally append the tools bar to the floating ToC*/
}
}