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') { // http://dev.wikia.com/wiki/MiniComplete importArticle({type:'script', article:'u:dev:MiniComplete/code.js'}); }

// Add link to contribs to account dropdown, finally got tired of not having this $(function {   $('.wds-global-navigation__user-menu .wds-list li').eq(1).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' }) );

// 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);    } });