MediaWiki:Gadget-SpecialPages.js

// ( function ( mw, $ ) { switch ( mw.config.get( 'wgCanonicalSpecialPageName' ) ) {    case 'Specialpages':      //INITIALIZE VARIABLES      var pagesToCheck = { //* 30,191 */        'UnwatchedPages': 'Unwatchedpages',/* Restricted to administrators only */ //* 16,137 */        'UncategorizedFiles': 'Uncategorizedimages', //*  9,833 */        'ShortPages': 'Shortpages', //*  8,404 */        'ListRedirects': 'Listredirects', //*  5,720 */        'WantedPages': 'Wantedpages', /*  1,306 */        'UnusedFiles': 'Unusedimages', /*    540 */        'UnusedCategories': 'Unusedcategories', /*    496 */        'UncategorizedTemplates': 'Uncategorizedtemplates', /*    353 */        'LonelyPages': 'Lonelypages', /*    196 */        'UnusedTemplates': 'Unusedtemplates', /*    199 */        'DeadendPages': 'Deadendpages', /*    165 */        'WantedFiles': 'Wantedfiles', /*     82 */        'WantedCategories': 'Wantedcategories', /*    77 */        'UncategorizedPages': 'Uncategorizedpages', /*    10 */        'UncategorizedCategories': 'Uncategorizedcategories', /*     0 */        'WantedTemplates': 'Wantedtemplates', /*     0 */        'DoubleRedirects': 'DoubleRedirects', /*     0 */        'BrokenRedirects': 'BrokenRedirects' };

$.each( pagesToCheck, function ( title, qppage ) {     var qpoffset = 0;      while ( qpoffset !== -1 ) {        $.ajax( { url: 'https://ddowiki.com/api.php?action=query&format=json&list=querypage&qplimit=max&qpoffset=' + qpoffset + '&qppage=' + encodeURIComponent( qppage ), dataType: 'json', async: false,//* REALLY DON'T LIKE THIS!!! IT WILL FAIL IN THE FUTURE!!! */         success: function ( successData ) { if ( successData[ 'query-continue' ] !== undefined ){ qpoffset = successData['query-continue'].querypage.qpoffset; } else { var membersInGroup = qpoffset + successData.query.querypage.results.length; qpoffset = -1; $( 'a[title="Special:' + title + '"]' ).after( ' (' + membersInGroup.toLocaleString + ')' ); }         },          fail: function ( failureData ) { alert( 'Sorry, failed to retrieve page counts for workable pages.\nPlease check the console for more details if available.' ); console.error( '%O', failureData ); }       } );      }    } );    mw.loader.load( '/index.php?title=MediaWiki:Gadget-SpecialPages.js/Autopromote.js&action=raw&ctype=text/javascript' );// Gadget-SpecialPages.js/Autopromote.js break; case 'Wantedfiles':// Special:Wantedfiles mw.loader.load( '/index.php?title=MediaWiki:Gadget-SpecialPages.js/WantedFiles.js&action=raw&ctype=text/javascript' );// MW:Gadget-SpecialPages.js/WantedFiles.js]   break;  case 'DoubleRedirects':// [[Special:DoubleRedirects    mw.loader.load( '/index.php?title=MediaWiki:Gadget-SpecialPages.js/DoubleRedirects.js&action=raw&ctype=text/javascript' );// MediaWiki:Gadget-SpecialPages.js/DoubleRedirects.js    break;  case 'Log':// Special:Log    switch ( mw.config.get( 'wgPageName' ) ) {      case 'Special:Log/newusers':// Special:Log/newusers        mw.loader.load( '/index.php?title=MediaWiki:Gadget-SpecialPages.js/UserCreation.js&action=raw&ctype=text/javascript' );// MediaWiki:Gadget-SpecialPages.js/UserCreation.js        break;      default:        /* Do nothing */    }    break;  default:    /* do nothing */  } } )( mediaWiki, jQuery ); //