Year of the Dragon: Through April 23rd, claim the adventure pack Slice of Life for free! Speak to Xatheral in the Hall of Heroes.

Game mechanicsNewbie guideIn developmentDDO StoreSocial Media


ChallengesClassesCollectablesCraftingEnhancementsEpic DestiniesFavorFeats

GlossaryItemsMapsMonstersPlacesQuestsRacesReincarnationSkillsSpells


Please create an account or log in to build a reputation and unlock more editing privileges, and then visit DDO wiki's IRC Chat/Discord if you need any help!

MediaWiki:Gadget-SpecialPages.js

From DDO wiki
Jump to navigation Jump to search

Note: After saving, you may have to bypass your browser's cache to see the changes, you can click here or try one of the methods below..

  • Firefox / Safari: Hold Shift while clicking Reload, or press either Ctrl+F5 or Ctrl+r ( Command+r on a Mac)
  • Google Chrome: Press Ctrl+ Shift+R ( Command+ Shift+R on a Mac)
  • Internet Explorer: Hold Ctrl while clicking Refresh, or press Ctrl+F5
  • Konqueror: Click Reload or press F5
  • Opera: Clear the cache in Tools ‣ Preferences
//<nowiki>
( function ( mw, $ ) {
  switch ( mw.config.get( 'wgCanonicalSpecialPageName' ) ) {
    case 'Specialpages':
      //INITIALIZE VARIABLES
      var pagesTooBig = {
        'UnwatchedPages': 5000,
        'UncategorizedFiles': 5000,
        'ShortPages': 5000,
        'ListRedirects': 5000,
        'WantedPages': 5000,
        'UnusedFiles': 1611,
        'UncategorizedTemplates': 711,
        'WantedCategories': 685,
        'UnusedCategories': 534
      };
      var pagesToCheck = {
/*        'UnwatchedPages': 'Unwatchedpages',/* Restricted to administrators only *//*
        'UncategorizedFiles': 'Uncategorizedimages',
        'ShortPages': 'Shortpages',
        'ListRedirects': 'Listredirects',
        'WantedPages': 'Wantedpages',
        'UnusedFiles': 'Unusedimages',
        'UncategorizedTemplates': 'Uncategorizedtemplates',
        'WantedCategories': 'Wantedcategories',
        'UnusedCategories': 'Unusedcategories',//*/
        'WantedFiles': 'Wantedfiles',
        'LonelyPages': 'Lonelypages',
        'UncategorizedPages': 'Uncategorizedpages',
        'UnusedTemplates': 'Unusedtemplates',
        'WantedTemplates': 'Wantedtemplates',
        'DeadendPages': 'Deadendpages',
        'UncategorizedCategories': 'Uncategorizedcategories',
        'DoubleRedirects': 'DoubleRedirects',
        'BrokenRedirects': 'BrokenRedirects'
      };

    $.each( pagesTooBig, function ( title, lastCount ) {
      $( 'a[title="Special:' + title + '"]' ).after( ' <span style="font-size: x-small; font-style: italic;">(' + lastCount.toLocaleString() + ( lastCount === 5000 ? '+' : '±' ) + ')</span>' );
    } );

    $.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' );// [[MW: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 );
//</nowiki>[[Category:Gadgets]]