Widget:Build Submissions Formatting Maintenance Script

 var heroes = [];

// jquery RLQ.push( function {   $.when( $(document).ready, mw.loader.using( ['mediawiki.util'] ) ).then( function { // Query for all the pages in Category:Heroes var heroPageQuery = $.getJSON( mw.config.get( 'wgServer' ) + mw.util.wikiScript( 'api' ) + '?action=query&list=categorymembers&cmtitle=Category:Heroes&cmlimit=500&cmtype=page&format=json', function {         heroes = heroPageQuery.responseJSON.query.categorymembers;

// Compare the heroes against all the following categories compareAgainstCategory("Pages_with_Build_Submission_Header", "buildSubmissionHeaderMissingPages"); compareAgainstCategory("Pages_with_Builds_in_Need_of_Improvement_Header", "buildsInNeedOfImprovementHeaderMissingPages"); compareAgainstCategory("Pages_with_Invalid_Builds_Header", "invalidBuildsHeaderMissingPages"); compareAgainstCategory("Pages_with_Other_Suggestions_and_Discussion_Header", "otherSuggestionsAndDiscussionHeaderMissingPages"); compareAgainstCategory("Pages_with_Submit_Build_Info", "submitBuildInfoMissingPages"); compareAgainstCategory("Heroes_with_Budget_Build(s)", "heroesMissingBudgetBuilds") });   }); });

// Function that compares the contents of Category: to the pages in Category:Heroes // Outputs any missing pages in the div with  function compareAgainstCategory(categoryName, divID) { // Query for all the pages in Category: var query = $.getJSON( mw.config.get( 'wgServer' ) + mw.util.wikiScript( 'api' ) +  '?action=query&list=categorymembers&cmtitle=Category:' + categoryName + '&cmlimit=500&cmtype=page&format=json', function {    var categoryPages = query.responseJSON.query.categorymembers;

// We only want to get the title of these pages var categoryPageNames = []; categoryPages.forEach(function(page) {     categoryPageNames.push(page.title);    });

var output = ""; heroes.forEach(function(hero) {     // The page names are in the format /Builds/Submissions, so we need to concatenate it as such for comparison.      var pageName = hero.title + "/Builds/Submissions";      if(categoryName == "Heroes_with_Budget_Build(s)") {        pageName = hero.title + "/Strategy";      }      // If this page name is NOT in the category, something's wrong so output it.      if(!categoryPageNames.includes(pageName)) {        output = output + "► " + pageName + " ";      }    }); if(output != "") { $("#" + divID).html(output); } }); }

Pages with Build Submission Header‎ Missing: All good!

Pages with Builds in Need of Improvement Header‎ Missing: All good!

Pages with Invalid Builds Header‎ Missing: All good!

Pages with Other Suggestions and Discussion Header‎ Missing: All good!

Pages with Submit Build Info‎ Missing: All good!

Heroes without Budget Builds: All good!