MediaWiki:Gadget-TimelessSidebarDropdowns.js
From Nookipedia, the Animal Crossing wiki
Revision as of 04:27, August 29, 2021 by SuperHamster (talk | contribs) (Remove extra selector for mw-portlet-body, not needed due to parent mw-portlet being selected)
Note: After saving, you may have to bypass your browser's cache to see the changes.
- Firefox / Safari: Hold Shift while clicking Reload, or press either Ctrl-F5 or Ctrl-R (⌘-R on a Mac)
- Google Chrome: Press Ctrl-Shift-R (⌘-Shift-R on a Mac)
- Internet Explorer / Edge: Hold Ctrl while clicking Refresh, or press Ctrl-F5
- Opera: Go to Menu → Settings (Opera → Preferences on a Mac) and then to Privacy & security → Clear browsing data → Cached images and files.
/**
* Turns each section in the Timeless sidebar into a dropdown menu.
* Created by SuperHamster on Nookipedia (https://nookipedia.com/wiki/User:SuperHamster)
* Licensed under CC BY-SA 3.0 (https://creativecommons.org/licenses/by-sa/3.0/)
* TODO:
* Make mobile-friendly (after opening a menu, clicking on header should close menu)
**/
var timer;
function hide(element) {
$(element).children('.mw-portlet-body')[0].style.display = "none"
}
$('#site-navigation .sidebar-inner .mw-portlet:not(#p-navigation)').on("mouseover", function () {
$(this).children('.mw-portlet-body')[0].style.display = 'block';
});
$('#site-navigation .sidebar-inner .mw-portlet:not(#p-navigation)').on("mouseleave", function () {
timer = setTimeout(hide($(this)), 10);
}).mouseenter(function() {
clearTimeout(timer);
});