User:OneTwoThreeFall/global.js

/*jslint browser */ /*global window, $, mw, importArticles, playerParams */

window.NoImageLightbox = { novideo: true };

window.pseudoVector = { addContributionsTab: true, blacklist: ['community.wikia.com'] };

importArticles({   type: 'script',    articles: [        'u:dev:CacheCheck/code.js',        'u:dev:NoImageLightbox/code.js',        'u:dev:CompareLink.js',        'u:dev:DisplayTimer/code.js',        'u:dev:QuickDiff/code.js',        'u:dev:MonobookHighlight.js',        'u:dev:Pseudo-Vector.js',        'u:c:User:OneTwoThreeFall/SwitchSkin-js.css',        'u:c:User:OneTwoThreeFall/MassNullEdit-js.css',        'u:c:User:OneTwoThreeFall/LastEdited-js.css'    ] });

// custom edit buttons if (mw.toolbar) { mw.toolbar.addButton(       '//images.wikia.nocookie.net/central/images/c/c8/Button_redirect.png',        'Redirect',        '#REDIRECT ',        '',        'Target'    ); mw.toolbar.addButton(       '//images.wikia.nocookie.net/central/images/2/23/Button_code.png',        'Code',        ' '    ); }

// disable redirect links mw.hook('wikipage.content').add(function ($content) {   $content.find('.mw-redirect, .allpagesredirect > a').each(function (ignore, element) { var link = new mw.Uri(element.href); link.extend({           redirect: 'no'        }); element.href = link.toString; }); });

// expand collapsed groups on recent changes/watchlist if ($.inArray(mw.config.get('wgCanonicalSpecialPageName'), ['Recentchanges', 'Watchlist']) !== -1) { $(window).load(function {        $('.mw-collapsible-toggle-collapsed').click;    }); }

// don't leave redirect when moving files if (   mw.config.get('wgCanonicalSpecialPageName') === 'Movepage' &&    mw.config.get('wgRelevantPageName').indexOf(mw.config.get('wgFormattedNamespaces')[6] + ':') === 0 ) { $('#wpLeaveRedirect').prop('checked', false); }

// don't save page when enter is pressed in summary box - credit to User:Ciencia Al Poder if ($.inArray(mw.config.get('wgAction'), ['edit', 'submit']) !== -1) { $('#wpSummary').keypress(function (event) {       if (event.which === 13) {            return false;        }    }); }

// add clear reason button on delete page if (mw.config.get('wgAction') === 'delete') { $('#wpReason').after(' \u232b '); $('#wpClearReason').click(function {        $('#wpReason').val('').focus;    }); }

// add edit links on Special:WhatLinksHere if (mw.config.get('wgCanonicalSpecialPageName') === 'Whatlinkshere') { $('#mw-whatlinkshere-list > li').each(function (ignore, element) {       var editLink = $(element).children('a').attr('href') + '?action=edit';        $(element).find('.mw-whatlinkshere-tools > a:last-child')            .after(' | ', $('edit').attr('href', editLink));    }); }

// add prefix search + page log links to tools menu if (mw.config.get('wgNamespaceNumber') !== -1) { var extraLinks = 'Prefix search' + 'Logs for this page'; if (mw.config.get('skin') === 'oasis') { $('#my-tools-menu').prepend(extraLinks); } else { $('#p-tb > .pBody > ul').append(extraLinks); } }

// add button to show hidden messages in threads if (mw.config.get('wgNamespaceNumber') === 1201) { $('.removed-info').append('Show '); $('.showremovedmessage').click(function (event) {       $(event.target).closest('.message-removed').removeClass('hide');    }); }

// add direct link on youtube video file pages if (window.playerParams && playerParams.provider === 'youtube') { var $ytLink = $('') .attr('href', 'https://www.youtube.com/watch?v=' + playerParams.jsParams.videoId) .text(mw.config.get('wgTitle')); $('.video-provider').prepend($ytLink, ' – '); $('[id^="youtubeVideoPlayer"]').removeAttr('style'); }

// add watchlist and contribs links to oasis user menu $('.user-menu > li:has(a[data-id="preferences"])').after(   'My watchlist' +    'My contributions</a>' );

// move edit + talk buttons into oasis page header $('#WikiaPageHeader > .header-container > .header-title > h1') .after($('#WikiaPageHeader > .comments').css('margin', '2px 10px 0')) .after($('#WikiaPageHeader > .wikia-button')) .after($('#WikiaPageHeader > .wikia-menu-button')) .after($('#WikiaPageHeader > .view-source'));

// add 'what links here' link to oasis toolbar on file pages if (mw.config.get('wgNamespaceNumber') === 6) { $('#WikiaBarWrapper .tools') .append('<li>What links here</a>'); }

// add 'used templates' button to oasis edit toolbar if (mw.config.get('wgIsEditPage')) { $(window).load(function {        $(' ').attr({ 'onclick': $('.tmpl_listused > a').attr('onclick'), 'src': '//images.wikia.nocookie.net/central/images/4/43/Button-template.png', 'title': $('.tmpl_listused > a').text }).appendTo('#cke_toolbar_source_1');   }); }