MediaWiki:Gadget-TimelessSidebarDropdowns.js

/** * 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)'), $('#site-navigation .sidebar-inner .mw-portlet:not(#p-navigation)').children('.mw-portlet-body')[0]).on("mouseleave", function {	timer = setTimeout(hide($(this)), 10); }).mouseenter(function {	clearTimeout(timer); });