_ _    _ _____  ___   __                       
 __      _(_) | _(_)___ / ( _ ) / /_   ___ ___  _ __ ___  
 \ \ /\ / / | |/ / | |_ \ / _ \| '_ \ / __/ _ \| '_ ` _ \ 
  \ V  V /| |   <| |___) | (_) | (_) | (_| (_) | | | | | |
   \_/\_/ |_|_|\_\_|____/ \___/ \___(_)___\___/|_| |_| |_|

User:ערן/defaultsummaries.js

In this article, we will explore the fascinating world of User:ערן/defaultsummaries.js and everything it has to offer. User:ערן/defaultsummaries.js has been the subject of interest and debate for centuries, and its impact has been felt in a variety of areas, from science to popular culture. Throughout these pages, we will examine the history of User:ערן/defaultsummaries.js, its importance in the modern world and the different perspectives that exist on this topic. Whether you are an expert on User:ערן/defaultsummaries.js or simply looking to learn more about it, this article will give you a comprehensive and insightful overview.
/*  _____________________________________________________________________________
 * |                                                                             |
 * |                    === WARNING: GLOBAL GADGET FILE ===                      |
 * |                  Changes to this page affect many users.                    |
 * | Please discuss changes on the talk page or on ] before editing. |
 * |_____________________________________________________________________________|
 *
 * Imported as of 09/06/2011 from ]
 * Edited version from ]
 * Implements default edit summary dropdown boxes
 */
 
(function ($) { // Wrap with anonymous function
    var $summaryBox  = $('#wpSummary');

    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);
    }
 
    function editsummOnCannedSummarySelected() {
        // Save the original value of the edit summary field
        var editsummOriginalSummary = $summaryBox.val();
 
        var idx = this.selectedIndex;
        var canned = this.options.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;
        $summaryBox.val( newSummary );
    }
 
    function insertSummaryOptions($insertBeforeThis, dropdownWidth) { 
        // For convenience, add a dropdown box with some canned edit
        // summaries to the form.
        var dropdown = document.createElement("select");
        dropdown.style.width = dropdownWidth;
        dropdown.style.margin = "0 4px 0 0";
        dropdown.onchange = editsummOnCannedSummarySelected;
 
        var minorDropdown = document.createElement("select");
        minorDropdown.style.width = dropdownWidth;
        minorDropdown.onchange = editsummOnCannedSummarySelected;
 
        editsummAddCatToDropdown(minorDropdown, "Common minor edit summaries – click to use");
        editsummAddCatToDropdown(dropdown, "Common edit summaries – click to use");
 
        editsummAddOptionToDropdown(minorDropdown, "Spelling/grammar correction");
        editsummAddOptionToDropdown(minorDropdown, "Fixing style/layout errors");
        editsummAddOptionToDropdown(minorDropdown, "] ] or test edit");
        editsummAddOptionToDropdown(minorDropdown, "] unexplained content removal");
        editsummAddOptionToDropdown(minorDropdown, "Copyedit (minor)");
 
        if (mw.config.get('wgNamespaceNumber') === 0) {
            editsummAddOptionToDropdown(dropdown, "Expanding article");
            editsummAddOptionToDropdown(dropdown, "Adding/improving reference(s)");
            editsummAddOptionToDropdown(dropdown, "Adding/removing category/ies");
            editsummAddOptionToDropdown(dropdown, "Adding/removing external link(s)");
            editsummAddOptionToDropdown(dropdown, "Adding/removing wikilink(s)");
            editsummAddOptionToDropdown(dropdown, "Removing unsourced content");
            editsummAddOptionToDropdown(dropdown, "Removing ] per ]");
            editsummAddOptionToDropdown(dropdown, "Clean up");
            editsummAddOptionToDropdown(dropdown, "Copyedit (major)");
        } else {
            editsummAddOptionToDropdown(dropdown, "Reply");
            editsummAddOptionToDropdown(dropdown, "Comment");
            editsummAddOptionToDropdown(dropdown, "Suggestion");
            if ((mw.config.get('wgNamespaceNumber') % 2 !== 0) & (mw.config.get('wgNamespaceNumber') !== 3)) {
                editsummAddOptionToDropdown(dropdown, "] tagging");
                editsummAddOptionToDropdown(dropdown, "] assessment");
            }
        }
 
	$insertBeforeThis.before(dropdown);
        $insertBeforeThis.before(minorDropdown);
    }
    mw.hook( 've.activationComplete' ).add(function(){
	//.ve-init-mw-viewPageTarget-saveDialog-checkboxes
        var $insertBeforeThis =  ve.init.mw.targets.saveDialog.$body.find('.ve-ui-mwSaveDialog-options');
	$summaryBox = ve.init.mw.targets.saveDialog.$body.find('.ve-ui-mwSaveDialog-summary textarea')
        if (!$insertBeforeThis.length) {
            return;
        }
        insertSummaryOptions($insertBeforeThis, "98%");
    });
    $(function() {
        var $insertBeforeThis = $('.editCheckboxes');
 
        // If we failed to find the editCheckboxes class
        if (!$insertBeforeThis.length) {
            return;
        }
        insertSummaryOptions($insertBeforeThis, "38%");
    });
}(jQuery)); // End wrap with anonymous function