User:Bobogoobo/global.js

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

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

// 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 86 columns.) //This isn't working in some cases, not sure why. $(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%)');        }    } });

// Convenience for deleting pages $(document).ready(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;        summary += $info.substring(1, $info.indexOf(' by ')) + ' by ' + revuser + '';        $('#ca-edit').attr('href', $('#ca-edit').attr('href') + summary);    } });