User:Technical 13/Scripts/ACCHelp/Creation log.js

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( ' \n' + $( 'li.mw-logline-newusers' ).closest( 'ul' ).html + '\n' ); //           $( '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 ' + mwUser + ' (talk | contribs) ', '' ) );            } ); }       $( 'li.mw-logline-newusers' ).find( 'span.comment' ).each( function {            if ( parseInt( $( this ).html.lastIndexOf( 'WP:ACC' ), 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 WP:ACC, request #' + ACC, 'ACC request #' + ACC + '' ) );            }        } ); $( '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 = 't'; var thisUserEmail = ''; if ( thisUserInfo.emailable ) { thisUserEmail = '&thinsp;|&thinsp;<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 = '&thinsp;|&thinsp;<a' + thisUserContribClass + ' href="//en.wikipedia.org/wiki/Special:Contributions/' + encodeURIComponent( thisUser ) + '" title="view all contributions for ' + thisUser + '">' + thisUserInfo.editCount + '</a>'; var thisUserLogs = '&thinsp;|&thinsp;<a href="//en.wikipedia.org/wiki/Special:Logs/' + encodeURIComponent( thisUser ) + '" title="view all logs for ' + thisUser + '">l</a>'; var thisUserWel = '&thinsp;|&thinsp;<a href="#" title="send ' + thisUser + ' a welcome to the English Wikipedia">wel</a>'; var thisUserTH = '&thinsp;|&thinsp;<a href="#" title="send ' + thisUser + ' an invitation to the Teahouse">th</a>'; var thisUserBlocked = ''; if( thisUserInfo.blocked.isBlocked === false ){ var thisUserSPI = '&thinsp;|&thinsp;<a href="#" title="report ' + thisUser + ' to SPI">SPI</a>'; var thisUserAIV = '&thinsp;|&thinsp;<a href="#" title="report ' + thisUser + ' to AIV">AIV</a>'; var thisUserUAA = '&thinsp;|&thinsp;<a href="#" title="report ' + thisUser + ' to UAA">UAA</a>'; thisUserBlocked = thisUserSPI + thisUserAIV + thisUserUAA; } else { thisUserBlocked = '&thinsp;|&thinsp;<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 = ' (&thinsp;' + thisUserTalk + thisUserEmail + thisUserContribs + thisUserLogs/* +  thisUserWel + thisUserTH*/ + thisUserBlocked + '&thinsp;) '; /* Apply the replacement text */ $( 'span.mw-usertoollinks' ).eq( i ).replaceWith( thisUserToolLinks ); } );       } );    } }