Board Thread:New Features/@comment-1526346-20160902104505/@comment-452-20160918005357

Since I've already written a script which retrieves various special pages and maintenance categories and displays them on a single page - long before insights - I've repurposed it to create a mix-and-match maintenance list.

I've been using it for several days, and I haven't come across any major issues.

I'm following this thread, so if you find any bugs, or have any suggestions, leave a comment below and I'll look into it.

There are 3 different ways to use it, and 2 options, as explained below.

You can edit the lists of special pages and categories so they are more relevant to you. /* There are two ways to view MaintenanceReport: a div or a modal.

*Special:MaintenanceReport to auto-start in a div *Add to any page to auto-start in a div *Or, add Maintenance Report to any page for a button which launches a modal popup. Unlike Wikia Staff, I believe in giving users a choice how to use features.

$(function {	if ( (!$('#MaintenanceReport').size && mw.config.get('wgCanonicalNamespace')+":"+mw.config.get('wgTitle') != "Special:MaintenanceReport") || typeof window.maintenanceReport != "undefined" ) return; //skip non-relevant pages and avoid duplicate instances.

window.maintenanceReport = { "options": { removeZero: false, //set to true to remove pages with zero results addButton: false   //set to true to add a button instead of autostarting. },		"specials": ["Unusedcategories", "BrokenRedirects", "DoubleRedirects", "Deadendpages", "Lonelypages", "Uncategorizedcategories", "Uncategorizedpages", "Uncategorizedtemplates", "Wantedcategories", "Wantedfiles", "Wantedpages", "Wantedtemplates", "Unusedtemplates"],

"categories": ["Lonelypages", "DPL queries with no results", "DPL queries with errors", "Deletion proposals", "Merge proposals", "Dialogue template with one line", "Broken references", "Broken file links", "Template errors", "ParserFunction errors", "Template has invalid parameters", "References needing descriptions", "References needing names", "Cleanup", "Content requests", "Image requests", "Infobox needs information", "Reference requests", "Rating requests", "Translation requests", "Unconfirmed information"],

"defaults": ["Unusedcategories", "BrokenRedirects", "DoubleRedirects", "Deadendpages", "Lonelypages", "Uncategorizedcategories", "Uncategorizedpages", "Uncategorizedtemplates", "Wantedcategories", "Wantedfiles", "Wantedpages", "Wantedtemplates", "Unusedtemplates", "DPL queries with no results", "DPL queries with errors", "Deletion proposals", "Merge proposals", "Dialogue template with one line", "Broken references", "Broken file links", "Template errors", "ParserFunction errors", "Template has invalid parameters", "References needing names"],

"results": {} };	if (mw.config.get('wgCanonicalNamespace')+":"+mw.config.get('wgTitle') == "Special:MaintenanceReport") { $("title").html("Maintenance Report"); $("#WikiaPageHeader h1").html("Maintenance Report"); $("h1#firstHeading").html("Maintenance Report"); $("#mw-content-text").html($(" ", {id:"MaintenanceReport" }) ); }	if (maintenanceReport.options.addButton) $('#MaintenanceReport').after($(" "), $(" ", { id:"MaintenanceReport", class:"button", html:"Start Maintenance Report" })).remove; if ($('#MaintenanceReport.button').size) $('#MaintenanceReport.button').click(function { MaintenanceReportInit(1) }); else MaintenanceReportInit;

function showResult(message, result) { if (typeof window.MaintenanceReportNotify != "undefined") window.MaintenanceReportNotify.hide; window.MaintenanceReportNotify = new BannerNotification(message, result).show; }

function MaintenanceReportDisplay(andor) { var output = new Array, firstloop = 1;

$("#MaintenanceReport input[type=checkbox]").each(function{		if($(this).attr("checked")) {			var temp = maintenanceReport.results[$(this).attr("id").substring(5)];			if (firstloop) {				firstloop = 0;				output = output.concat(temp);			} else if (andor == "or") {				output = output.filter(function(i) { return temp.indexOf(i) == -1; });				output = output.concat(temp);			} else if (andor == "and") {				output = output.filter(function(i) { return temp.indexOf(i) != -1; });			}		}	});	$("#resultsPane").html($("")); if (output.length == 0) $("#resultsPane ol").html("No results"); else $(output).each(function(index, value) {		$("#resultsPane ol").append(''+value+'');	}); }

function MaintenanceReportInit(modal) { var ajaxIndicator = window.ajaxIndicator || 'http://images.wikia.nocookie.net/common/skins/common/images/ajax.gif';

if(modal) { $("#MaintenanceReport").attr("id",""); $.showCustomModal('Maintenance Report', null, {			id: 'MaintenanceReportModal',			width: $(window).width - 254,		}); $(".modalContent").remove; $("#MaintenanceReportModal h1").css({"margin-bottom":0,"text-align":"left"}).append("  "); $("#MaintenanceReportModal").append($(" ", {id:"MaintenanceReport", class:"WikiaArticle"})); $("#MaintenanceReportModal").css({			"text-align":"center",			"overflow": "auto",                       "top":"100px",                        "min-height":"452px"		}); } else { $("#MaintenanceReport").empty; }	$("#MaintenanceReport").append(" "); $("#MaintenanceReport").append(" "); $("#listPane").append(		$(" ", { html:"Show Combined" }).click(function { MaintenanceReportDisplay("or") })	); $("#listPane").append(		$(" ", { html:"Show Intersection", style:"float:right;" }).click(function { MaintenanceReportDisplay("and") })	);

for(var i in maintenanceReport.specials) { $("#listPane").append(" "+maintenanceReport.specials[i]+" (Page) Loading ");

$.getJSON('/api.php?action=query&format=json&list=querypage&qplimit=5000&qppage='+maintenanceReport.specials[i], function(result) {		 var formattedresults = new Array,formatteddisplay = "";		  var querypage = result.query.querypage;		  $(querypage.results).each(function(index, value) { if (querypage.name == "Unusedcategories") if (maintenanceReport.categories.indexOf("value.title") == -1) return; formattedresults.push(value.title); if (maintenanceReport.defaults.indexOf(querypage.name) != -1) formatteddisplay += ''+value.title+''; });		if (formatteddisplay) $("#resultsPane").append(' '+querypage.name+' Cached: '+querypage.cachedtimestamp+'<ol>'+formatteddisplay+'</ol>');

$("#checkS"+querypage.name +" ~ span").html("("+formattedresults.length+")"); $("#checkS"+querypage.name +" ~ span").removeClass("loading"); if (!$("span.loading").size) $("#ajaxProgress").remove;

maintenanceReport.results["S"+querypage.name] = formattedresults;

if (!formattedresults.length) { $("#checkS"+querypage.name).prop("disabled",true); if (maintenanceReport.options.removeZero) $("#checkS"+querypage.name).parent.remove; }

if (querypage.cachedtimestamp) { diff = count=Math.floor((new Date(new Date(querypage.cachedtimestamp).getTime+(24*60*60000)).getTime-new Date.getTime)/1000); if ($("#updateCountdown").attr("left") < diff) { $("#updateCountdown").attr("left", diff); var left = (diff%60) + 's';					diff=Math.floor(diff/60); if(diff > 0) left = (diff%60) + 'm ' + left;	diff=Math.floor(diff/60); if(diff > 0) left = (diff%24) + 'h ' + left;	diff=Math.floor(diff/24); if(diff > 0) left = diff + ' days ' + left; $("#updateCountdown").html("Time left until cache update: "+left); }		 }		});	}

for(var i in maintenanceReport.categories) { $("#listPane").append(" <label for='checkC"+maintenanceReport.categories[i].replace(/ /g,"")+"' style='cursor: pointer;'><input type='checkbox' style='margin: 0 3px;' id='checkC"+maintenanceReport.categories[i].replace(/ /g,"")+"'>"+maintenanceReport.categories[i]+" (<a target='_blank' href='./Category:"+maintenanceReport.categories[i]+"'>Page</a>) Loading ");

$.getJSON('/api.php?action=query&format=json&list=categorymembers&cmlimit=5000&cmtitle=Category:'+maintenanceReport.categories[i]+'&requestid='+maintenanceReport.categories[i].replace(/ /g,""), function(results) {		 var formattedresults = new Array, formatteddisplay = "";		  $("#checkC"+results.requestid +" ~ span").html("("+Object.keys(results.query.categorymembers).length+")");		  $("#checkC"+results.requestid +" ~ span").removeClass("loading");		  if (!$("span.loading").size) $("#ajaxProgress").remove;

$(results.query.categorymembers).each(function(index, value) {			formattedresults.push(value.title);			if (maintenanceReport.defaults.indexOf(results.requestid) != -1) formatteddisplay += '<a href="./'+value.title+'">'+value.title+'</a></li>';		 }); if (formatteddisplay) $('#resultsPane').append(" <a href='./Category:"+results.requestid+"'>"+results.requestid+"</a> <ul>"+formatteddisplay+"</ul>");

maintenanceReport.results["C"+results.requestid] = formattedresults; if (!formattedresults.length) { $("#checkC"+results.requestid).prop("disabled",true); if (maintenanceReport.options.removeZero) $("#checkC"+results.requestid).parent.remove; }		});	}   } });