User:Bfpage/common.js

Source: 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.
importScript("User:Writ Keeper/Scripts/teahouseUtility.js"); // Gives one-click option to add Teahouse invitation or talkback to a user

importScript("User:Writ Keeper/Scripts/teahouseTalkback.js"); // Adds Talkback reminder when you save an edit at the Teahouse

importScript("User:Writ Keeper/Scripts/teahouseTalkbackLink.js"); // Adds a talkback link to signatures on the Teahouse 

importScript("User:Ocaasi/WikiLoveinstallscript.js");// Adds Teahouse Badges to WikiLove

importScript('User:TheJosh/Scripts/NewPagePatrol.js');

importScript('User:Ucucha/duplinks.js'); // [[User:Ucucha/duplinks]]

importScript("User:Ocaasi/WikiLoveinstallscript.js");

importScript("User:PleaseStand/userinfo.js");

mw.loader.load( '//en.wikipedia.org/w/index.php?title=User:Kaldari/assessmentHelper.js&action=raw&ctype=text/javascript' );

importScript( "User:Fred Gandt/getUnpatrolledOfAlexNewArtBotResultsPages.js" );

// [[File:Krinkle_WhatLeavesHere.js]]
mw.loader.load('//meta.wikimedia.org/w/index.php?title=User:Krinkle/Tools/WhatLeavesHere.js&action=raw&ctype=text/javascript');

importScript('User:Cameltrader/Advisor.js');
importScript( 'User:Equazcion/ScriptInstaller.js' ); // Backlink: [[User:Equazcion/ScriptInstaller.js]]


/***********************************************************************************************/
/* This is a modified version of http://en.wikipedia.org/wiki/User:ErrantX/defaultsummaries.js
   and http://en.wikipedia.org/wiki/User:MC10/defaultsummaries.js.

   This version displays a single menu of custom edit summaries across all namespaces.
   See http://en.wikipedia.org/wiki/User:Equazcion/CustomSummaryPresets for full instructions.

   Place the following in your common.js page or whatever script page for your skin:

   if (mw.config.get( 'wgAction' ) === 'edit' || mw.config.get( 'wgAction' ) === 'submit') {
       var customSummaries = [
           'your first preset summary',
           'your second preset summary',
           'a third preset using [[a wiki hotlink' + ']]',
       ];
       mw.loader.load( 'User:Kanegasi/editsummarypresets.js' );
   }

   Do not forget that end bracket and semi-colon!

   The extra single quotes and plus sign on the link is to prevent the wiki software from
   creating a link as the variables are loaded. This normally happens with templates being
   transcluded or substituted in scripts, so the single quotes and plus may not be needed.

   The extra "if" line is to prevent the script from running on any page BUT edit/submit pages,
   since it is useless on other pages.

   Source: http://en.wikipedia.org/wiki/User:Equazcion/CustomSummaryPresets.js                 */
/***********************************************************************************************/

var editsummOriginalSummary = "";

function editsummAddOptionToDropdown(dropdown, optionText) {
    var option = document.createElement("option");
    var optionTextNode = document.createTextNode(optionText);
    option.appendChild(optionTextNode);
    dropdown.appendChild(option);
}

function editsummAddCatToDropdown(dropdown, catText) {
    var option = document.createElement("option");
    option.disabled = true;
    option.selected = true;
    var optionTextNode = document.createTextNode(catText);
    option.appendChild(optionTextNode);
    dropdown.appendChild(option);
}

// Save the original value of the edit summary field
function editsummOnCannedSummarySelected() {
    editsummOriginalSummary = document.getElementById("wpSummary");
    if (editsummOriginalSummary) {
        editsummOriginalSummary = editsummOriginalSummary.value;
    } else {
        editsummOriginalSummary = "";
    }
    var idx = this.selectedIndex;
    var canned = this.options[idx].text;
    var newSummary = editsummOriginalSummary;

// Append old edit summary with space, if exists,
// and last character != space
    if (newSummary.length !== 0 && newSummary.charAt(newSummary.length - 1) !== " ") {
        newSummary += " ";
    }
    newSummary += canned;
    document.getElementById("wpSummary").value = newSummary;
}

// Loop through siblings, looking for editCheckboxes class
$(function () {
    var insertBeforeThis = document.getElementById("wpSummary");
    while (insertBeforeThis) {
        if (insertBeforeThis.className === "editCheckboxes") {
            break;
        }
        insertBeforeThis = insertBeforeThis.nextSibling;
    }

// If we failed to find the editCheckboxes class, or insertBeforeThis is null
    if (!insertBeforeThis || insertBeforeThis.className !== "editCheckboxes") {
        return;
    }
    editsummOriginalSummary = editsummOriginalSummary.value;

// For convenience, add a dropdown box with some canned edit
// summaries to the form.
    var dropdown = document.createElement("select");
    dropdown.style.width = "50%";
    dropdown.style.margin = "0 4px 0 0";
    dropdown.onchange = editsummOnCannedSummarySelected;
    editsummAddCatToDropdown(dropdown, "Summary presets");

    for (var i=0; i<customSummaries.length; i++) {
        if (typeof customSummaries[i] !== 'undefined') {
             editsummAddOptionToDropdown(dropdown, customSummaries[i]);
        }
    }

    var theParent = insertBeforeThis.parentNode;
    theParent.insertBefore(dropdown, insertBeforeThis);
    theParent.insertBefore(document.createElement("br"), dropdown);
});
importScript('User:Dixtosa/userscriptInterwikiLink.js'); //Linkback: [[User:Dixtosa/userscriptInterwikiLink.js]] Added by Script installer
importScript('User:Bility/convert24hourtime.js'); //Linkback: [[User:Bility/convert24hourtime.js]] Added by Script installer
importScript('User:קיפודנחש/watchlistScout.js'); //Linkback: [[User:קיפודנחש/watchlistScout.js]] Added by Script installer
importScript('User:Ais523/catwatch.js'); //Linkback: [[User:Ais523/catwatch.js]] Added by Script installer
importScript('User:Cumbril/IPLabeller.js'); //Linkback: [[User:Cumbril/IPLabeller.js]] Added by Script installer

importScript( 'User:Equazcion/ScriptInstaller.js' ); // Backlink: [[User:Equazcion/ScriptInstaller.js]]