User:Bobogoobo/global.js

/* All code here written by Bobogoobo unless otherwise stated. */

window.NoImageLightbox = { novideo:true };

importArticles({   type: 'script',    articles: [        'u:dev:CacheCheck/code.js', // http://dev.wikia.com/wiki/CacheCheck        'u:dev:HeaderLinks/code.js', // http://dev.wikia.com/wiki/HeaderLinks        'u:dev:NoImageLightbox/code.js', // http://dev.wikia.com/wiki/NoImageLightbox        'u:dev:OldFilePages/code.js', // http://dev.wikia.com/wiki/OldFilePages        'u:dev:RevealAnonIP/usercode.js', // http://dev.wikia.com/wiki/RevealAnonIP    ] });

if (mw.config.get('wgPageName') === 'Special:Upload') { importArticle({type:'script', article:'u:dev:MiniComplete/code.js'}); // http://dev.wikia.com/wiki/MiniComplete }

// Add link to contribs to account dropdown, finally got tired of not having this $(function {   $('#AccountNavigation .subnav li:first').after( 'My contributions' ); });

// Add "infinite" value to expiry dropdowns (another thing that should be built-in) $('#mw-input-wpExpiry option:last').before(   $(' ', { 'value':'infinite', 'text':'infinite' }) );

//Highlight whitespace characters in diffs when they're the only thing in the change //Winner of most conspicuous missing feature for six consecutive years if (window.location.href.indexOf('diff=') !== -1) { $('.diffchange-inline').each(function {       if (!(new RegExp('\\S+').test($(this).text))) {            $(this).css('background-color', 'red');        }    }); }

// Convenience for deleting pages if (mw.util.getParamValue('action') === 'delete') { $('#wpReason').focus; $('#wpDeleteReasonList option').click(function {       $('#wpReason').focus;    }); } if ({'Unusedimages':1, 'UnusedVideos':1}[mw.config.get('wgCanonicalSpecialPageName')]) { $('li.gallerybox .gallerytext').each(function {       $(this).find('br:last').before($(' ', {            'style':'float:right',            'html':'(' + $('', {                'href':$(this).find('a').attr('href') +                   '?action=delete&wpReason=unused+file',                'text':'del'            })[0].outerHTML + ')'        }));    }); }

// Add automatic edit summary when editing old page version $(function {   if ( mw.util.getParamValue('diff') === null && mw.util.getParamValue('oldid') !== null ) {       var revuser = $('#mw-revision-info .mw-userlink').text,          summary = '&summary=Reverted to r',          $info = $('#mw-revision-info').text,          $editbutt = $('#ca-edit').length ? $('#ca-edit') : $('[data-id="editprofile"]');        summary += $info.substring(1, $info.indexOf(' by ')) + ' by ' + revuser + '';        $editbutt.attr('href', $editbutt.attr('href') + summary);    } });