MediaWiki:Gadget-SpecialPages.js/ActiveUsers.js

// ( function ( $, mw ) { // Reload the page to get all users on one page  /* API query == http://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 ); //