Content deleted Content added
Sideswipe9th (talk | contribs) No edit summary |
Sideswipe9th (talk | contribs) update last edit date |
||
(11 intermediate revisions by the same user not shown) | |||
Line 1:
//<nowiki>
// By Sideswipe9th
// Last edit date:
// 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
// - 6 April 2023
// * Fix bug where the className on the containers was not being set properly for newly created elements
// * Fix bug where the nav with id mw-panel-toc needs to have its margin-left set to 0px when it's added to ToCless pages.
// - 4 March 2023
// * Fix the tools menu not being appended on TOC-less pages after the previously always present nav I was relying on was removed
Line 13 ⟶ 20:
// * Initial release
$( function() {
// does the document contain
{
// it does not, so we're on a ToCless page
// get the
var
{
// so we now need to create a NAV with id mw-panel-toc
{▼
▲ if (nav == null)
▲ if (pageContainer.length > 0)
▲ nav = document.createElement("NAV");
▲ // assign it the right ID, classes, and arialabel
▲ nav.id = "mw-panel-toc";
▲ nav.className = "mw-table-of-contents-container vector-toc-landmark";
▲ nav.arialabel = "Contents";
▲ nav.style.margin-left = "0px";
▲ // append this nav as a child to the right page container
▲ pageContainer[0].appendChild(nav);
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
}
}
else
{
// it does
// to the end of vector-toc
var toolsBar = document.getElementById("vector-page-tools"); // first grab the tools bar by ID
var floatingToC = document.getElementById("vector-toc"); // then grab the floating TOC by ID
if (floatingToC != null && toolsBar != null)
{ floatingToC.appendChild(toolsBar); // and finally append the tools bar to the floating ToC }
|