User:Technical 13/Scripts/ACCHelp/Creation log.js
Appearance
Code that you insert on this page could contain malicious content capable of compromising your account. If you import a script from another page with "importScript", "mw.loader.load", "iusc", or "lusc", take note that this causes you to dynamically load a remote script, which could be changed by others. Editors are responsible for all edits and actions they perform, including by scripts. User scripts are not centrally supported and may malfunction or become inoperable due to software changes. A guide to help you find broken scripts is available. If you are unsure whether code you are adding to this page is safe, you can ask at the appropriate village pump. This code will be executed when previewing this page. |
This user script seems to have a documentation page at User:Technical 13/Scripts/ACCHelp/Creation log. |
if ( mw.config.get( 'wgCanonicalSpecialPageName' ) === 'Log' && $( 'h1#firstHeading' ).text() === 'User creation log' ) {
var mwUser = mw.config.get( 'wgUserName' );
if ( $( 'p:contains( "No matching items in log." )' ).html() !== undefined ) {
$( 'p:contains( "No matching items in log." )' ).addClass( 'error' );
$( 'h1#firstHeading' ).html( tickGood + ' ' + $( 'h1#firstHeading' ).html() );
document.title = Ucheck + document.title;
} else {
var limit = 0;
if ( document.location.href.search( '&limit=' ) !== -1 ) {
limit = parseInt( document.location.href.substr( document.location.href.search( '&limit=' ) + 7 ), 10 );
}
if ( $( 'p:contains( "No matching items in log." )' ).html() === undefined && $( 'input#mw-log-page' ).val().substr( 5 ) !== '' && limit === 1 ) {
$( 'h1#firstHeading' ).html(tickBad + ' ' + $( 'h1#firstHeading' ).html() );
document.title = Ucheck + document.title;
alert( 'WARNING!\n\t\tThere is a local account for:\n\n\t\t' + $( 'input#mw-log-page' ).val().substr( 5 ).replace( '_', ' ' ));
}
else if ( $( 'input#mw-log-user' ).val().replace( '_', ' ' ) === mwUser && limit !== 1000 ) {
setTimeout(function() { location += '&limit=1000'; }, 1 );
}
else if ( $( 'input#mw-log-user' ).val().replace( '_', ' ' ) === mwUser ) {
$( 'li.mw-logline-newusers' ).closest( 'ul' ).replaceWith( '<ol reverse="reverse">\n' + $( 'li.mw-logline-newusers' ).closest( 'ul' ).html() + '\n</ol>' );
// $( 'li.mw-logline-newusers' ).css( 'list-style-image', '/* none */' );
// $( 'li.mw-logline-newusers' ).css( 'list-style-type', 'decimal' );
$( 'li.mw-logline-newusers' ).each( function() {
$( this ).html( $( this ).html().replace( ' by <a href="/wiki/User:' + mwUser.replace( ' ', '_' ) + '" title="User:' + mwUser + '" class="mw-userlink">' + mwUser + '</a> <span class="mw-usertoollinks">(<a href="/wiki/User_talk:' + mwUser.replace( ' ', '_' ) + '" title="User talk:' + mwUser + '">talk</a> | <a href="/wiki/Special:Contributions/' + mwUser.replace( ' ', '_' ) + '" title="Special:Contributions/' + mwUser + '">contribs</a>)</span>', '' ) );
} );
}
$( 'li.mw-logline-newusers' ).find( 'span.comment' ).each( function() {
if ( parseInt( $( this ).html().lastIndexOf( 'WP:ACC</a>' ), 10 ) !== -1 ) {
var ACC = $( this ).html().substr( ( parseInt( $( this ).html().lastIndexOf( '#' ), 10 ) + 1 ), ( parseInt( $( this ).html().match( /#[\d]*/ )[ 0 ].length, 10 ) - 1 ) );// ACC zoom number
$( this ).html( $( this ).html().replace( 'Requested account at <a href="/wiki/Wikipedia:ACC" class="mw-redirect" title="Wikipedia:ACC">WP:ACC</a>, request #' + ACC, '<a href="/wiki/Wikipedia:Request an account" class="mw-redirect" title="Wikipedia:Request an account">ACC</a> request <a href="//accounts.wmflabs.org/acc.php?action=zoom&id=' + ACC + '" title="Account Creation Interface\n\tRequest: #' + ACC + '">#' + ACC + '</a>' ) );
}
} );
$( 'span.mw-usertoollinks' ).each( function( i ) {
var thisUser = $( this ).prev( 'a' ).text();
var thisUserToolLinks = '';
var thisUserInfo = { groups: [ ], blocked: { isBlocked: false } };
new mw.Api().get( {
action: 'query',
list: 'users',
usprop: [ 'blockinfo', 'groups', 'editcount', 'emailable', 'gender' ],
ususers: encodeURIComponent( thisUser ),
continue: ''
} ).done( function( userInfoQuery ) {
/* Create an object with all the data for the current user */
thisUserInfo.editCount = userInfoQuery.query.users[ 0 ].editcount;
thisUserInfo.groups = userInfoQuery.query.users[ 0 ].groups;
if ( userInfoQuery.query.users[ 0 ].blockid ) {
thisUserInfo.blocked.isBlocked = true;
thisUserInfo.blocked.isBlockedBy = userInfoQuery.query.users[ 0 ].blockedby;
thisUserInfo.blocked.isBlockedTimestamp = userInfoQuery.query.users[ 0 ].blockedtimestamp;
thisUserInfo.blocked.isBlockedReason = userInfoQuery.query.users[ 0 ].blockreason;
thisUserInfo.blocked.isBlockedExpiry = userInfoQuery.query.users[ 0 ].blockexpiry;
}
thisUserInfo.gender = userInfoQuery.query.users[ 0 ].gender;
thisUserInfo.emailable = ( userInfoQuery.query.users[ 0 ].emailable === undefined ) ? false : true;
/* Create the replacement text */
var thisUserTalk = '<a href="//en.wikipedia.org/wiki/User_talk:' + encodeURIComponent( thisUser ) + '" title="leave a message on ' + thisUser + '\'s talk page"';
if( $( this ).find( 'span.mw-usertoollinks a.new:first' ) ) {
thisUserTalk += ' class"new"';
}
thisUserTalk += '>t</a>';
var thisUserEmail = '';
if ( thisUserInfo.emailable ) {
thisUserEmail = ' | <a href="//en.wikipedia.org/wiki/Special:EmailUser/' + encodeURIComponent( thisUser ) + '" title="send ' + thisUser + ' an email">e</a>';
}
var thisUserContribClass = '';
if ( thisUserInfo.editCount <= 0 ){
thisUserContribClass = 'class="new"';
} else if ( thisUserInfo.editCount === 'NaN' ) {
thisUserContribClass = 'class="new error"';
}
var thisUserContribs = ' | <a' + thisUserContribClass + ' href="//en.wikipedia.org/wiki/Special:Contributions/' + encodeURIComponent( thisUser ) + '" title="view all contributions for ' + thisUser + '">' + thisUserInfo.editCount + '</a>';
var thisUserLogs = ' | <a href="//en.wikipedia.org/wiki/Special:Logs/' + encodeURIComponent( thisUser ) + '" title="view all logs for ' + thisUser + '">l</a>';
var thisUserWel = ' | <a href="#" title="send ' + thisUser + ' a welcome to the English Wikipedia">wel</a>';
var thisUserTH = ' | <a href="#" title="send ' + thisUser + ' an invitation to the Teahouse">th</a>';
var thisUserBlocked = '';
if( thisUserInfo.blocked.isBlocked === false ){
var thisUserSPI = ' | <a href="#" title="report ' + thisUser + ' to SPI">SPI</a>';
var thisUserAIV = ' | <a href="#" title="report ' + thisUser + ' to AIV">AIV</a>';
var thisUserUAA = ' | <a href="#" title="report ' + thisUser + ' to UAA">UAA</a>';
thisUserBlocked = thisUserSPI + thisUserAIV + thisUserUAA;
} else {
thisUserBlocked = ' | <a href="" class="error" style="font-variant: small-caps;" title="' + thisUser + ' was bad. ' + thisUserInfo.gender.replace( 'male', 'He was' ).replace( 'female', 'She was' ).replace( 'unspecified', 'They were' ) + ' blocked for ' + thisUserInfo.blocked.isBlockedExpiry.replace( 'infinity', 'forever' ) + ' by ' + thisUserInfo.blocked.isBlockedBy + ' with a reason of:\n\t' + thisUserInfo.blocked.isBlockedReason + '">Blocked</a>';
}
thisUserToolLinks = '<span class="mw-usertoollinks" style="font-family: monospace;">( ' + thisUserTalk + thisUserEmail + thisUserContribs + thisUserLogs/* + thisUserWel + thisUserTH*/ + thisUserBlocked + ' )</span>';
/* Apply the replacement text */
$( 'span.mw-usertoollinks' ).eq( i ).replaceWith( thisUserToolLinks );
} );
} );
}
}