Jump to content

User:Zzuuzz/common.js

From Wikipedia, the free encyclopedia
Note: After saving, you have to bypass your browser's cache to see the changes. Google Chrome, Firefox, Microsoft Edge and Safari: Hold down the ⇧ Shift key and click the Reload toolbar button. For details and instructions about other browsers, see Wikipedia:Bypass your cache.
// [[MediaWiki:Gadget-popups.js]]
var popupHideDelay = 0.1;

// [[MediaWiki:Gadget-markblocked.js]]
var mbTempStyle = 'opacity: 0.9; text-decoration: wavy underline';
var mbIndefStyle = 'opacity: 0.9; font-style: italic; text-decoration: wavy underline';

function loadLocalJS(s) {
    mw.loader.load(mw.config.get('wgServer') + mw.config.get('wgScript')
        + '?action=raw&ctype=text/javascript&title=' + s);
}

$.when(mw.loader.using('mediawiki.util'), $.ready).then(function () {

    if (mw.config.get('wgUserGroups').indexOf('checkuser') !== -1) {
        $('.mw-contributions-link-check-user-initiator').parent().hide();
    }

    if (mw.config.get('wgUserGroups').indexOf('sysop') !== -1) {
        loadLocalJS("User:Zzuuzz/scripts/blockreasons.js"); // [[User:Zzuuzz/blockreasons.js]]
        loadLocalJS("User:Zzuuzz/scripts/deletionreasons.js"); // [[User:Zzuuzz/deletionreasons.js]]
        loadLocalJS("User:Zzuuzz/scripts/protectionreasons.js"); // [[User:Zzuuzz/protectionreasons.js]]
        loadLocalJS("User:Zzuuzz/scripts/spamblacklistblock.js"); // [[User:Zzuuzz/spamblacklistblock.js]]
        loadLocalJS("User:Writ Keeper/Scripts/massRevdel.js"); // [[User:Writ Keeper/Scripts/massRevdel.js]]
    }

    // loadLocalJS("User:Galobtter/scripts/adminhighlighter.js"); // [[User:Galobtter/scripts/adminhighlighter.js]]
    loadLocalJS("User:Zzuuzz/scripts/badimagelist.js"); // [[User:Zzuuzz/scripts/badimagelist.js]]
    loadLocalJS("User:Timotheus Canens/spihelper.js"); // [[User:Timotheus Canens/spihelper.js]]
    // loadLocalJS("User:Writ Keeper/Scripts/sectionLinkShortener.js"); // [[User:Writ Keeper/Scripts/sectionLinkShortener.js]]

    // navigation
    mw.util.addPortletLink('p-navigation', '/wiki/Wikipedia:Administrator intervention against vandalism#Reports', 'AIV', 'n-linkaiv', 'Administrator intervention against vandalism');
    mw.util.addPortletLink('p-navigation', '/wiki/Wikipedia:Requests for page protection#toc', 'RFPP', 'n-linkrfpp', 'Protection requests');
    mw.util.addPortletLink('p-navigation', '/wiki/Wikipedia:Usernames for administrator attention#Bot-reported', 'Usernames', 'n-linkuaa', 'Usernames for administrator attention');
    mw.util.addPortletLink('p-navigation', '/wiki/Category:Candidates for speedy deletion#Subcategories', 'Speedy', 'n-linkcsd', 'Candidates for speedy deletion');
    mw.util.addPortletLink('p-navigation', '/wiki/Category:SPI cases awaiting a CheckUser', 'CU SPI', 'n-linkcuspi', 'SPI cases awaiting a CheckUser');
    mw.util.addPortletLink('p-navigation', '/wiki/Category:Requests for checkuser', 'RFCU', 'n-linkrfcu', 'Requests for checkuser');
    mw.util.addPortletLink('p-navigation', '/wiki/Special:PendingChanges', 'Pending', 'n-linkpc', 'Pending changes');

    // special pages
    if (mw.config.get('wgNamespaceNumber') === -1) {

        // portals vary by skin
        var myTopTab = null;
        switch (mw.config.get('skin')) {
            case 'vector':
                myTopTab = 'p-namespaces';
                break;
            default:
                myTopTab = 'p-cactions';
        }

        // Special page talk pages
        // mw.util.addPortletLink( myTopTab, mw.config.get( 'wgScript' ) + '?title=Wikipedia talk:' + mw.config.get( 'wgPageName' ).split('/')[0], 'Special Talk', 'ca-specialtalk', 'Discussion about this special page (' + mw.config.get( 'wgPageName' ).split( '/' )[0] + ').' );
        // mw.util.addPortletLink( myTopTab, mw.config.get( 'wgScript' ) + '?title=Wikipedia talk:' + mw.config.get( 'wgPageName' ).split('/')[0] + '&action=edit&section=new', '+', 'ca-addsection', 'Start a new section on the discussion page for ' + mw.config.get( 'wgPageName' ).split( '/' )[0] + '.' );

        // watchlist items
        if ('Watchlist' === mw.config.get('wgCanonicalSpecialPageName')) {
            mw.util.addPortletLink(myTopTab, '/wiki/Special:Log/newusers', 'New users', 'ca-newusers', 'New user log');
            mw.util.addPortletLink(myTopTab, '/wiki/Special:AbuseFilter/history', 'Filter', 'ca-filterlog', 'Abuse filter');
            mw.util.addPortletLink(myTopTab, '/wiki/Special:Log/spamblacklist', 'SBL Log', 'ca-sbllog', 'Spam Blacklist log');
            if (mw.config.get('wgUserGroups').indexOf('checkuser') !== -1) {
                mw.util.addPortletLink(myTopTab, '/wiki/Special:CheckUserLog', 'CU Log', 'ca-culog', 'CheckUser log');
                mw.util.addPortletLink(myTopTab, 'https://checkuser.wikimedia.org/wiki/Special:RecentChanges', 'CUWiki', 'ca-cuwiki', 'Wikimedia Checkuser Wiki');
            }
            mw.util.addPortletLink(myTopTab, '/wiki/m:Special:Watchlist', 'Meta', 'ca-meta', 'Wikimedia Meta-Wiki');
            mw.util.addPortletLink(myTopTab, '/wiki/c:Special:Watchlist', 'Commons', 'ca-commons', 'Wikimedia Commons');
        }
    }

});