Year of the Dragon: Through June 26th, claim free Ground Bound Green Dragon Mount! Speak to Xatheral in the Hall of Heroes. edit
Game mechanics • Newbie guide • In development • DDO Store • Social Media
Challenges • Classes • Collectables • Crafting • Enhancements • Epic Destinies • Favor • Feats
Glossary • Items • Maps • Monsters • Places • Quests • Races • Reincarnation • Skills • Spells
Please create an account or log in to remove ads, 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/UserRights.js
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, $ ) {
if( mw.config.get( 'wgCanonicalSpecialPageName' ) === 'Userrights' ) {
//INITIALIZE VARIABLES
// Define the api check variables
var apiAllusersDone = false;
var apiAllusersFailed = false;
var apiUsercontribsDone = false;
var apiUsercontribsFailed = false;
// Get the username from the page title from mw.config variables
var urUsername = $( '#username' ).val();
// Define edit count as -1 to start
var urEditCount = -1;
// Define registration time as empty to start, may modify this to epoch later and return a message warning about created before reg date existed
var urRegistration = "";
// Define user's age in months since Jan 2000 as -1 to start, may need to go back further at some point
var urAgeInMonths = -1;
// Check to see if the VIP checkbox is checked and if it is, they are a VIP already && set isVIP to false for viewing user
var urVIP = $( '#wpGroup-ddowikivip' ).is( ':checked' );
var isVIP = false;
// Check to see if the SU checkbox is checked and if it is, they are a SU already && set isSU to false for viewing user
var urSU = $( '#wpGroup-superuser' ).is( ':checked' );
var isfSU = false;
// Check to see if the admin checkbox is checked and if it is, they are an admin already && set isAdmin to false for viewing user
var urAdmin = $( '#wpGroup-sysop' ).is( ':checked' );
var isAdmin = false;
// Check to see if the crat checkbox is checked and if it is, they are a crat already && set isCrat to false for viewing user
var urCrat = $( '#wpGroup-bureaucrat' ).is( ':checked' );
var isCrat = false;
// Check to see if the steward checkbox is checked and if it is, they are a steward already && set isSteward to false for viewing user
var urSteward = $( '#wpGroup-steward' ).is( ':checked' );
var isSteward = false;
// Check to see if the bot checkbox is checked and if it is, they are a bot already && set isBot to false for viewing user
var urBot = $( '#wpGroup-bot' ).is( ':checked' );
var isBot = false;
// Get viewing user's groups
for ( var group in mw.config.get( 'wgUserGroups' ) ){
switch ( mw.config.get( 'wgUserGroups' )[ group ]){
case 'ddowikivip' : isVIP = true; break;
case 'superuser' : isSU = true; break;
case 'sysop' : isAdmin = true; break;
case 'bureaucrat' : isCrat = true; break;
case 'steward' : isSteward = true; break;
case 'bot' : isBot = true; break;
default: break;
}
}
// Define a new date constructor
var currDate = new Date();
// Calculate the current number of months since Jan 2000
var currDateInMonths = currDate.getFullYear() * 12 + currDate.getMonth();
// function to format numbers with commas
function numformat(nStr){
nStr += '';
x = nStr.split( '.' );
x1 = x[ 0 ];
x2 = x.length > 1 ? '.' + x[ 1 ] : '';
var rgx = /(\d+)(\d{3})/;
while ( rgx.test( x1 ) ) {
x1 = x1.replace( rgx, '$1' + ',' + '$2' );
}
return x1 + x2;
}
// Update the table
function updateInfo(){
/* Need to get edit history to look for gaps and last contribution (doesn't have to be an edit, a move, delete, protect etc counts)
if( urGapLong <= *//* 1 month /*) {*/
$( '.mo-gap' ).html( '<a href=\"https://ddowiki.com/index.php?title=Special:Contributions&limit=999&contribs=user&target=' + encodeURIComponent( urUsername ) + '" title="View contributions" style="font-size: 12pt; color: #AA0; font-weight: bold;">?</a>' );/*
$( '.mo-gap' ).css( { 'color': '#00FF00', 'font-size': '12pt' } ).html( '✔' );
}
if( urLongGaps <= 3 ) {*/
$( '.no-gaps' ).html( '<a href=\"https://ddowiki.com/index.php?title=Special:Contributions&limit=999&contribs=user&target=" + encodeURIComponent( urUsername ) + "\" title=\"View contributions\" style=\"font-size: 12pt; color: #AA0; font-weight: bold;\">?</a>' );/*
$( '.no-gaps' ).css( { 'color': '#00FF00', 'font-size': '12pt' } ).html( '✔' );
}
if(urActive === true){*/
$( '.active' ).html( '<a href=\"https://ddowiki.com/index.php?title=Special:Contributions&limit=999&contribs=user&target=' + encodeURIComponent( urUsername ) + '" title="View contributions" style="font-size: 12pt; color: #AA0; font-weight: bold;">?</a>' );/*
$( '.active' ).css( { 'color': '#00FF00', 'font-size': '12pt' } ).html( '✔' );
}
*/
if ( urAdmin === true ){
$( '.is-admin' ).css( 'color', '#00FF00' ).html( '✔' );
}
// If they are a VIP but not a crat or stewart, then show the message about what the * means
if ( isVIP === true && !( isCrat === true || isSteward === true ) ) {
$( '#groups-add-noremove' ).removeClass( 'hidden' );
}
// Change the exclaimation mark to a semicolon
$( '#groups-qualified-js' ).html( ':' );
// Unhide completed table
$( '#groups-add-table-js' ).removeClass( 'hidden' );
}
$.ajax( {
url: mw.config.get( 'wgScriptPath' ) + '/api.php?action=query&format=json&list=allusers&auprop=editcount|registration&aulimit=1&aufrom=' + encodeURIComponent( urUsername ),
dataType: 'json',
success: function( data ){
urEditCount = data.query.allusers[ 0 ].editcount;
urRegistration = data.query.allusers[ 0 ].registration;
if ( typeof( urRegistration ) !== 'undefined' ) {
urRegistration = new Date( urRegistration );
} else {
urRegistration = new Date( 1999, 11, 30 );
}
urAgeInMonths = ( ( urRegistration.getFullYear() * 12 ) + urRegistration.getMonth() );
urAgeInMonths = ( currDateInMonths - urAgeInMonths );
if ( urEditCount >= 0 ){
if ( urEditCount >= 100 ){
$( '.100' ).css( { 'color': '#00FF00', 'font-size': '12pt' } ).html( '✔' );
if ( urEditCount >= 250 ){
$( '.250' ).css( { 'color': '#00FF00', 'font-size': '12pt' } ).html( '✔' );
if ( urEditCount >= 1000 ) {
$( '.1k' ).css( { 'color': '#00FF00', 'font-size': '12pt' } ).html( '✔' );
}
}
}
} else {
$( '.100' ).html( '<a href="https://ddowiki.com/index.php?title=Special:Contributions&limit=99&contribs=user&target=' + encodeURIComponent( urUsername ) + '" title="View contributions" style="font-size: 12pt; color: #AA0; font-weight: bold;">?</a>' )
$( '.250' ).html( '<a href="https://ddowiki.com/index.php?title=Special:Contributions&limit=249&contribs=user&target=' + encodeURIComponent( urUsername ) + '" title="View contributions" style="font-size: 12pt; color: #AA0; font-weight: bold;">?</a>' )
$( '.1k' ).html( '<a href="https://ddowiki.com/index.php?title=Special:Contributions&limit=999&contribs=user&target=' + encodeURIComponent( urUsername ) + '" title="View contributions" style="font-size: 12pt; color: #AA0; font-weight: bold;">?</a>' )
}
// If account is 6+ months old, tick box in green. If account is between 3-6 months old, tick it in yellow
if ( urAgeInMonths >= 0 && urAgeInMonths < 3 ) {
/* Account isn't at least 3 months old - not eligible */
} else if ( urAgeInMonths >= 3 && urAgeInMonths < 6 ) {
/* Account is at least 3 months old, but is less than 6 months old - eligible for probational status */
$( '.age' ).css( { 'color': '#AAAA00', 'font-size': '12pt' } ).html( '✔' );
} else {
/* Account is at least 6 months old or there's no registration date - fully eligible */
$( '.age' ).css( { 'color': '#00FF00', 'font-size': '12pt' } ).html( '✔' );
}
// Add the registration date and edit count to the bottom left cell in the table
// Create text string
var textUserStats = "This ";
if ( urAgeInMonths < 0 || isNaN( urAgeInMonths ) ){
textUserStats += 'account is <a href="https://ddowiki.com/index.php?title=Special:Contributions&limit=1&dir=prev&target=' + encodeURIComponent( urUsername ) + '" title="View contributions" style="font-style: italic;">too old</a> ';
}
else if ( urAgeInMonths === 0 ) {
textUserStats += 'is a new account ';
}
else if ( urAgeInMonths === 1 ) {
textUserStats += 'account is a month old ';
} else {
textUserStats += 'account is ' + urAgeInMonths + ' months old ';
}
textUserStats += 'and has made ';
if ( urEditCount < 0 || isNaN( urEditCount ) ) {
textUserStats += 'an undefined number of edits.';
}
else if ( urEditCount === 0 ) {
textUserStats += 'no edits.';
}
else if ( urEditCount === 1 ) {
textUserStats += 'an edit.';
} else {
textUserStats += numformat( urEditCount ) + ' edits.';
}
$( '#groups-userstats-js' ).html( textUserStats );
apiAllusersDone = true;
updateInfo();
},
fail: function( reason ){
$( '.100' ).html( '<a href="https://ddowiki.com/index.php?title=Special:Contributions&limit=99&contribs=user&target=' + encodeURIComponent( urUsername ) + '" title="View contributions" style="font-size: 12pt; color: #AA0; font-weight: bold;">??</a>' )
$( '.250' ).html( '<a href="https://ddowiki.com/index.php?title=Special:Contributions&limit=249&contribs=user&target=' + encodeURIComponent( urUsername ) + '" title="View contributions" style="font-size: 12pt; color: #AA0; font-weight: bold;">???</a>' )
$( '.1k' ).html( '<a href="https://ddowiki.com/index.php?title=Special:Contributions&limit=999&contribs=user&target=' + encodeURIComponent( urUsername ) + '" title="View contributions" style="font-size: 12pt; color: #AA0; font-weight: bold;">???</a>' )
$( '.age' ).css({"color": "#AA0", "font-size": "12pt"}).html( '<a href="https://ddowiki.com/index.php?title=Special:Contributions&limit=1&dir=prev&target=' + encodeURIComponent( urUsername ) + '" title="View contributions" style="font-style: italic;">???</a>' );
console.error( 'apiAllusers failed: %o', reason );
apiAllusersFailed = true;
}
} );
}
} )( mediaWiki, jQuery );
//</nowiki>[[Category:Gadgets]]