User:Sealbudsman/common.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; // unhide "empty" page headings $("h2").nextAll("h3").each(function {   		var headingContent = $(this).nextUntil("h3");            if (headingContent.length > 0 // if heading has content at all && headingContent.is(function { return $(this).is(".patrol-request-hide"); }) // and contains finished requests && !headingContent.is(function { return $(this).is(".patrol-request"); })) { // but no unfinished ones             $(this).show;            }    	}); });   // 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 {   		var headingContent = $(this).nextUntil("h3");            if (headingContent.length > 0 // if heading has content at all && headingContent.is(function { return $(this).is(".patrol-request-hide"); }) // and contains finished requests && !headingContent.is(function { return $(this).is(".patrol-request"); })) { // but no unfinished ones             $(this).hide;            }    	}); }); });