Code that you insert on this page could contain malicious content capable of compromising your account. If you import a script from another page with "importScript", "mw.loader.load", "iusc", or "lusc", take note that this causes you to dynamically load a remote script, which could be changed by others. Editors are responsible for all edits and actions they perform, including by scripts. User scripts are not centrally supported and may malfunction or become inoperable due to software changes. A guide to help you find broken scripts is available. If you are unsure whether code you are adding to this page is safe, you can ask at the appropriate village pump. This code will be executed when previewing this page.
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.
// The original value of the edit summary field is stored herevareditsummOriginalSummary=newString();// A global ref to the dropdown with canned edit summariesvareditsummDropdown=null;functioneditsummInitialize(){// Save the original value of the edit summary fieldeditsummOriginalSummary=document.getElementById("wpSummary");if(editsummOriginalSummary==null){return;}varinsertBeforeThis=document.getElementById("wpSummary").nextSibling;if(insertBeforeThis.className!="editCheckboxes"){return;}editsummOriginalSummary=editsummOriginalSummary.value// For convenience, add a dropdown box with some canned edit// summaries to the form.vardropdown=document.createElement("select");dropdown.style.width="50%";dropdown.onchange=newFunction("editsummOnCannedSummarySelected()");varminorDropdown=document.createElement("select");minorDropdown.style.width="50%";minorDropdown.onchange=newFunction("editsummOnCannedSummarySelected()");editsummAddOptionToDropdown(minorDropdown,"Common minor edit summaries - click to use");editsummAddOptionToDropdown(dropdown,"Common edit summaries - click to use");if(mw.config.get('wgNamespaceNumber')==0){editsummAddCatToDropdown(dropdown,"Minor edits");editsummAddOptionToDropdown(dropdown,"Spelling/grammar correction");editsummAddOptionToDropdown(dropdown,"Fixing style/layout errors");editsummAddOptionToDropdown(dropdown,"[[Help:Reverting|Reverting]] [[Wikipedia:Vandalism|Vandalism]] or test edit");editsummAddOptionToDropdown(dropdown,"[[Help:Reverting|Reverting]] unexplained content removal");editsummAddOptionToDropdown(dropdown,"Copyedit (minor)");editsummAddCatToDropdown(dropdown,"Non-minor edits - add details if possible");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,"Clean up");editsummAddOptionToDropdown(dropdown,"Copyedit (major)");}else{editsummAddCatToDropdown(dropdown,"Talk Pages");editsummAddOptionToDropdown(dropdown,"Reply");editsummAddOptionToDropdown(dropdown,"Comment");editsummAddOptionToDropdown(dropdown,"[[Wikipedia:WikiProject|WikiProject]] tagging");editsummAddOptionToDropdown(dropdown,"[[Wikipedia:WikiProject|WikiProject]] assessment");}vartheParent=insertBeforeThis.parentNode;theParent.insertBefore(dropdown,insertBeforeThis);theParent.insertBefore(minorDropdown,insertBeforeThis);theParent.insertBefore(document.createElement("br"),dropdown);// Store a global ref to iteditsummDropdown=dropdown;}functioneditsummAddOptionToDropdown(dropdown,optionText){varoption=document.createElement("option");varoptionTextNode=document.createTextNode(optionText);option.appendChild(optionTextNode);dropdown.appendChild(option);}functioneditsummAddCatToDropdown(dropdown,catText){varoption=document.createElement("option");option.disabled="disabled"varoptionTextNode=document.createTextNode(catText);option.appendChild(optionTextNode);dropdown.appendChild(option);}// There's a cross-browser issue when accessing the selected text:// *In Firefox you can use: selectObj.value// *In IE, you have to use: selectObj.options[selectObj.selectedIndex].text// *The latter method also works in FirefoxfunctioneditsummOnCannedSummarySelected(){varidx=editsummDropdown.selectedIndex;varcanned=editsummDropdown.options[idx].text;varnewSummary=editsummOriginalSummary;if(newSummary.length!=0)newSummary+=" - ";newSummary+=canned;document.forms.editform.wpSummary.value=newSummary;}addOnloadHook(function(){editsummInitialize();});