Jump to content

User:Pyrospirit/scripts.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.
// This JavaScript file is an extension of [[User:Pyrospirit/monobook.js]].

if ( typeof myLocalSettings === 'undefined' )
    myLocalSettings = {}; // prevent errors if settings file doesn't run

function boolFirstDefined () {
    var len = arguments.length;
    for (var i = 0; i < len; i++) {
        if ( arguments[i] !== undefined )
            return Boolean(arguments[i])
    }
    return null;
}

/* The values in myLocalSettings check a file on my computer to decide whether to run each script 
or not. This lets me turn scripts on and off without editing this page. */
if ( boolFirstDefined(myLocalSettings.all, true) )
{

// Adds extra edit/hist tabs for both discussion page and article page
if ( boolFirstDefined(myLocalSettings.sixtabs, true) ) {
    importScript('Wikipedia:WikiProject User scripts/Scripts/Six tabs');
}

// Edit top link by [[User:Alex Smotrov]]
if ( boolFirstDefined(myLocalSettings.edittop, true) ) {
    importScript('User:TheDJ/Gadget-edittop.js');
    if (wgAction == 'edit' && document.URL.indexOf('&section=0') != -1)
        addOnloadHook(function () {
            document.getElementById('wpSummary').value = '/* Intro */ ';
        })
}

// Logs link in toolbox
if ( boolFirstDefined(myLocalSettings.logs_link, true) 
        && wgCanonicalNamespace != 'User' && wgCanonicalNamespace != 'User talk' ) {
    importScript('Wikipedia:WikiProject User scripts/Scripts/Logs link');
}

// Modified version of [[User:Voyagerfan5761/changelinks.js]]
if ( boolFirstDefined(myLocalSettings.changelinks, true) ) {
    importScript('User:Pyrospirit/changelinks.js');
}

// Unwatch links next to page names in watchlist from [[User:Alex Smotrov/wlunwatch.js]]
if ( boolFirstDefined(myLocalSettings.unwatch, true) && wgCanonicalSpecialPageName == 'Watchlist' && wgAction == 'view' ) 
    addOnloadHook(function () {
        var frm = document.getElementsByTagName('form')[0];
        frm.parentNode.insertBefore(document.createTextNode(' | '), frm);
        var lnk = document.createElement('a');
        lnk.appendChild(document.createTextNode('Unwatch'));
        lnk.href = 'javascript:importScript("User:Alex_Smotrov/wlunwatch.js")';
        frm.parentNode.insertBefore(lnk, frm);
    })

importScript('Wikipedia:WikiProject User scripts/Scripts/Add LI menu');
importStylesheet('Wikipedia:WikiProject User scripts/Scripts/Add LI menu/css');

// [[User:Voice of All]]'s helper JavaScript
if ( boolFirstDefined(myLocalSettings.voa_helper, true) ) {
    importScript('User:Voice of All/Addtabs/monobook.js');
}

// UTC time clock with double-click purge function
if ( boolFirstDefined(myLocalSettings.utc_clock, true) ) {
    importScript('User:Voice of All/UTCclock.js');
}

// Rollback with summary
if ( boolFirstDefined(myLocalSettings.rollback, true) ) {
    importScript('User:Pyrospirit/rollbacksummary.js');
}

// my modified copy of [[User:Jsimlo/shortcuts.js]] - customized sidebar links
if ( boolFirstDefined(myLocalSettings.shortcuts, true) ) {
    importScript('User:Pyrospirit/shortcuts.js');
    
    function shortcutsInit () {
        shortcutsStartSection('more links');
        shortcutsAddLink('Monobook.js', 'Special:MyPage/monobook.js');
        shortcutsAddLink('Scripts.js', 'Special:MyPage/scripts.js');
        shortcutsAddLink('Monobook.css', 'Special:MyPage/monobook.css');
        shortcutsAddLink('Metadata', 'Special:MyPage/metadata');
        shortcutsAddLink('User scripts', 'Wikipedia:WikiProject User scripts');
        shortcutsAddLink('wikEd', 'User:Cacycle/wikEd');
        shortcutsAddLink('Twinkle', 'Wikipedia:Twinkle');
        shortcutsAddLink('Friendly', 'Wikipedia:WikiProject User scripts/Scripts/Friendly');
        shortcutsAddLink('New pages', 'Special:NewPages');
        shortcutsAddLink('AIV', 'Wikipedia:Administrator intervention against vandalism');
        shortcutsAddLink('Help desk', 'Wikipedia:Help desk');
        shortcutsAddLink('Most vandalized', 'Special:RecentChangesLinked/Wikipedia:Most vandalized pages');
        shortcutsAddLink('Noticeboards', 'Special:RecentChangesLinked/User:Pyrospirit/Noticeboards');
    }
}

// Reformats compare button in history as a link
if ( boolFirstDefined(myLocalSettings.compare_link, true) && wgAction == 'history' ) {
    importScript('MediaWiki:WikiProject User scripts/Scripts/Compare link.js');
}

// tagging script by [[User:S]]
if ( boolFirstDefined(myLocalSettings.s_tags, true) ) {
    importScript('User:S/tags.js');
    autosubmit = false;
    minoredit = true;
    show_cwli = true;
}

// User watchlist from [[User:Tra/userwatchlist.js]]
if ( boolFirstDefined(myLocalSettings.user_watchlist, true) ) {
    importScript('User:Tra/userwatchlist.js');
}

// Reformats [[Special:Newpages]] as table with extra features
if ( boolFirstDefined(myLocalSettings.patroller, true) ) {
    importScript('user:js/patroller.js'); //[[user:js/patroller.js]]
}

// Gives assessment data for articles in the page header
if ( boolFirstDefined(myLocalSettings.metadata, true) ) {
    importScript('User:Pyrospirit/metadata.js');
    importScript('User:Pyrospirit/metadata/projectbanners.js');
    importScript('User:Pyrospirit/metadata/assesslinks.js');
}

// Modified version of [[User:Proteins/showrandomlinksonpage.js]]
if ( boolFirstDefined(myLocalSettings.random_links, true) ) {
    importScript('User:Pyrospirit/showrandomlinksonpage.js');
}

// Performs basic formatting changes from a tab while editing
if ( boolFirstDefined(myLocalSettings.formatting, true) && ( wgAction == 'edit' || wgAction == 'submit' ) ) {
    importScript('Wikipedia:WikiProject User scripts/Scripts/Formatter');
}

// [[User:Lupin/recent2.js]] anti-vandalism script
if ( boolFirstDefined(myLocalSettings.lupin, true) ) {
    importScript('User:Lupin/recent2.js');
}

// Some history-related script from VoA
if ( boolFirstDefined(myLocalSettings.voa_history, true) ) {
    importScript('User:Voice of All/History/monobook.js');
}

// Improves formatting of history pages
if ( boolFirstDefined(myLocalSettings.history_format, true) && wgAction == 'history' ) {
    importScript('User:Alex_Smotrov/histcomb.js');
}

// [[User:Cacycle/wikEd]] in-browser text editor
var wikEdRegExTypoFix = true;
if ( boolFirstDefined(myLocalSettings.wiked, true) && ( wgAction == 'edit' || wgAction == 'submit' ) ) {
    importScript('User:Cacycle/wikEd.js');
}

// [[User:Lupin/popups.js]] - navigation popups
if ( boolFirstDefined(myLocalSettings.navpops, true) ) {
    importScript('User:Lupin/popups.js');
}

// Twinkle script (reverting, warning, reporting, csd, xfd, prod, rpp)
if ( boolFirstDefined(myLocalSettings.twinkle, true) ) {
    importScript('User:AzaToth/twinkle.js');
    TwinkleConfig = {
        revertMaxRevisions              :       50,
        userTalkPageMode                :       'tab',
        showSharedIPNotice              :       true,
        openTalkPage                    :       [ 'agf', 'norm', 'vand' ],
        openTalkPageOnAutoRevert        :       true,
        summaryAd                       :       " ([[WP:TW|TW]])",
        deletionSummaryAd               :       " ([[WP:TW|TW]])",
        protectionSummaryAd             :       " ([[WP:TW|TW]])",
        watchSpeedyPages                :       [ ],
        watchProdPages                  :       true,
        //openUserTalkPageOnSpeedyDelete  :       going with default here
        watchRevertedPages              :       [ ],
        markRevertedPagesAsMinor        :       [ 'agf', 'norm', 'vand', 'torev' ],
        deleteTalkPageOnDelete          :       false,
        watchWarnings                   :       false,
        markAIVReportAsMinor            :       false,
        markSpeedyPagesAsMinor          :       false,
        offerReasonOnNormalRevert       :       true,
        orphanBacklinksOnSpeedyDelete   :       {orphan:true, exclude:['g6']}
    };
}

// Rollback integration with Twinkle
if ( boolFirstDefined(myLocalSettings.tw_rollback, true) ) {
    importScript('User:Ioeth/twinklerollbackintegration.js');
    TwinkleRollbackIntegrationConfig = {
        rollbackStyle : 'MWonly', // replace, replaceall, move, TWonly, MWonly
        addVanarticle : true
    };
}

// [[WP:FRIENDLY]] script similar to Twinkle
if ( boolFirstDefined(myLocalSettings.friendly, true) ) {
    importScript('User:Ioeth/friendly.js');
    FriendlyConfig = {
        summaryAd               :  " ([[WP:FRIENDLY|Friendly]])",
        watchWelcomes           :  false,
        markWelcomesAsMinor     :  false,
        watchTaggedPages        :  false,
        markTaggedPagesAsMinor  :  true,
        insertHeadings          :  true,
        welcomeHeading          :  "== Welcome ==",
        insertUsername          :  true,
        insertSignature         :  true,
        enableClock             :  false
    };
}

// Makes minor editing suggestions
if ( boolFirstDefined(myLocalSettings.advisor, true) ) {
    importScript('User:Cameltrader/Advisor.js');
}

if ( boolFirstDefined(myLocalSettings.markblocked, true) ) {
    importScript('User:Kalan/markblocked.js');
}

if ( boolFirstDefined(myLocalSettings.longsummary, true) )
    importScript('User:Ilmari Karonen/longeditsummary.js');

// [[User:GeorgeMoney]] script improves search box functionality
if ( boolFirstDefined(myLocalSettings.searchbox, false) ) {
    addOnloadHook(function () {
        document.getElementById('searchform').action = 'http://wikipedia.georgemoney.com/search.php';
        document.getElementById('searchInput').name = 'title';
    });
}

// Box with newest pages in sidebar, disabled by default
if ( boolFirstDefined(myLocalSettings.newpagebox, false) ) {
    importScript('User:TheJosh/Scripts/NewPagePatrol.js');
    npp_enabled = false;
    npp_num_pages = 10;
    npp_refresh = 5;
}

// Box with recent changes in sidebar, disabled by default
if ( boolFirstDefined(myLocalSettings.recentbox, false) ) {
    importScript('User:TheJosh/Scripts/RecentChangesPatrol.js');
    rcp_enabled = false;
    rcp_num_pages = 10;
    rcp_refresh = 5;
}

// [[User:GeorgeMoney]]'s helper scripts (Cookies, AddLinks, and Include), copied to my userspace
if ( boolFirstDefined(myLocalSettings.georgemoney, false) ) {
    importScript('User:Pyrospirit/gmhelper.js');
}

// Patrol links for new pages
if ( boolFirstDefined(myLocalSettings.patrollinks, false) ) {
    importScript('User:Mr.Z-man/patrollinks.js');
    showbydefault = true;
}

// Page size data
if ( boolFirstDefined(myLocalSettings.pagesize, false) ) {
    importScript('User:Omegatron/monobook.js/addlink.js'); //[[User:Omegatron/monobook.js/addlink.js]]
    importScript('User:Dr_pda/prosesize.js'); //[[User:Dr_pda/prosesize.js]]
}

// Nice formatting for [[Special:Log]]
if ( boolFirstDefined(myLocalSettings.logtable, false) && wgCanonicalSpecialPageName == 'Log' ) {
    importScript('User:Alex_Smotrov/logpage.js')
}

// A local file for general testing
if ( boolFirstDefined(myLocalSettings.test, false) )
    document.write('<s' + 'cript type="text/javascript" src="'
    + 'http://localhost/test_scripts.js"></s' + 'cript>');

} // end scripts
// [[Category:Wikipedians who use RC script]]