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        'u:dev:UnsafeScripts/personal.js' // http://dev.wikia.com/wiki/UnsafeScripts - the good version    ] });

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, finally got tired of not having this $(function {   $('#AccountNavigation .subnav li:first').after( 'My contributions' ); });

//Highlight whitespace characters in diffs when they're the only thing in the change //Winner of most conspicuous missing feature for five 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 $(function {   if (mw.util.getParamValue('action') === 'delete') {        document.getElementById('wpReason').focus;        $('#wpDeleteReasonList option').click(function{ document.getElementById('wpReason').focus; });

if (mw.config.get('wgNamespaceNumber') === 6) { $('#wpDeleteReasonList').parent.append(             'unused file'            ); $('a#mySelect').click(function {               $('#wpDeleteReasonList option[value="Unused file"]').attr('selected', 'selected').click; // click triggers first part of this block           }); }   } });

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

// On code pages, mark in the editing toolbar the approximate width //  of the box containing the code on the resulting page, //  to aid in ensuring readability. // (It comes out to about 82 columns in the editor.) // Requires use of UnsafeScripts. //For Fluid layout, add 30px (another 3 columns or so.) $(function {   if (mw.config.get('wgAction') === 'edit') {        var page = mw.config.get('wgPageName');        if (['.css', '.js'].indexOf(page.substring(page.indexOf('.'))) !== -1) {            $('#EditPageToolbar').css('background', '-moz-linear-gradient(left, #FCB8D9 0%, #FCB8D9 665px,' +              '#FCF4A4 665px, transparent 100%)');        }    } });