MediaWiki:Gadget-togglePatrollerRequests.js

// A toggle script for hiding "patrol-requests". // This is basically just a function for hiding a heading with underlying conversation. // // Created by User:Jack McKalling

// append script to document $(document).ready(function {	// create handler for displaying hideable patrol requests   $(".patrol-request-toggle-show").on("click", function { $(".patrol-request-hide").next("dl").show; $(".patrol-request-hide").show; $("h3").show; // just re-show all headings again });   // create handler for hiding hideable patrol requests    $(".patrol-request-toggle-hide").on("click", function { $(".patrol-request-hide").next("dl").hide; $(".patrol-request-hide").hide; // hide "empty" page headings $("h2").nextAll("h3").each(function {           if ($(this).nextUntil("h3").length > 0 // if heading has content at all && $(this).nextUntil("h3").is(function { return $(this).is(".patrol-request-hide"); }) // and contains finished requests && !$(this).nextUntil("h3").is(function { return $(this).is(".patrol-request"); })) { // but no unfinished ones             $(this).hide;            }    	}); }); });