Year of the Dragon: Through May 28th, claim free Expansion Pack (excluding Vecna Unleashed) or a Greater Elixir of Discovery! Speak to Xatheral in the Hall of Heroes.
(Please note: Due to bugs with the distribution system, this reward is temporarily unavailable.)edit

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/ActiveUsers.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 ) {
  // Reload the page to get all users on one page
   
  /* API query == https://ddowiki.com/api.php?action=query&format=jsonfm&aulimit=max&list=allusers&auprop=editcount|registration&auactiveusers=1 */
  var activeUsers = [];
  $( '#mw-content-text' ).find( 'ul li').each( function( i ) {
    activeUsers[ i ] = [];
    activeUsers[ i ][ 0 ] = $( this ).find( 'a:first' ).text();/* */console.info( activeUsers[ i ][ 0 ] );
    activeUsers[ i ][ 1 ] = $( this ).text().match( /([\d]*?) (action|edit)s? in the last / );/* */console.info( activeUsers[ i ][ 1 ] );
    activeUsers[ i ][ 1 ] = parseInt( activeUsers[ i ][ 1 ][ 1 ].toString(), 10 );/* */console.info( activeUsers[ i ][ 1 ] );
    activeUsers[ i ][ 2 ] = $( this ).html();/* */console.info( activeUsers[ i ][ 2 ] );
    // console.log( 'i: %d', i );
  } );
  activeUsers.sort( function( a, b ) {
      if ( a[ 1 ] == b[ 1 ]) { return 0; }
      if ( a[ 1 ] > b[ 1 ]) { return 1; }
      else { return -1; }
  } ).reverse();
  for ( i=0; i < activeUsers.length; i++ ) {
    console.info( 'User %d with %s edits: %s', i, activeUsers[ i ][ 1 ], activeUsers[ i ][ 0 ]/*, activeUsers[i][2]*/ );
  }
   
  // $( 'div#mw-content-text' ).html();
} )( mediaWiki, jQuery );
//</nowiki>[[Category:Gadgets]]