User:ErrantX/defaultsummaries.js
// The original value of the edit summary field is stored here
var editsummOriginalSummary = new String();
// A global ref to the dropdown with canned edit summaries
var editsummDropdown = null;
function editsummInitialize()
{
// Save the original value of the edit summary field
editsummOriginalSummary = document.getElementById("wpSummary");
if(editsummOriginalSummary == null)
{
return;
}
var insertBeforeThis = 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.
var dropdown = document.createElement("select");
dropdown.style.width = "38%";
dropdown.style.margin = "0px 4px 0px 0px";
dropdown.onchange = new Function("editsummOnCannedSummarySelected()");
var minorDropdown = document.createElement("select");
minorDropdown.style.width = "38%";
minorDropdown.onchange = new Function("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,"[[Help:Reverting|Reverting]] [[Wikipedia:Vandalism|Vandalism]] or test edit");
editsummAddOptionToDropdown(minorDropdown,"[[Help:Reverting|Reverting]] 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,"Clean up");
editsummAddOptionToDropdown(dropdown,"Copyedit (major)");
} else
{
editsummAddOptionToDropdown(dropdown,"Reply");
editsummAddOptionToDropdown(dropdown,"Comment");
if ((mw.config.get('wgNamespaceNumber') % 2 != 0) & (mw.config.get('wgNamespaceNumber') != 3))
{
editsummAddOptionToDropdown(dropdown,"[[Wikipedia:WikiProject|WikiProject]] tagging");
editsummAddOptionToDropdown(dropdown,"[[Wikipedia:WikiProject|WikiProject]] assessment");
}
}
var theParent = insertBeforeThis.parentNode;
theParent.insertBefore(dropdown,insertBeforeThis);
theParent.insertBefore(minorDropdown,insertBeforeThis);
theParent.insertBefore(document.createElement("br"),dropdown);
// Store a global ref to it
editsummDropdown = dropdown;
}
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 = "disabled"
var optionTextNode = 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 Firefox
function editsummOnCannedSummarySelected()
{
var idx = editsummDropdown.selectedIndex;
var canned = editsummDropdown.options[idx].text;
var newSummary = editsummOriginalSummary;
if (newSummary.length!=0) newSummary += " - ";
newSummary += canned;
document.forms.editform.wpSummary.value = newSummary;
}
$(function (){
editsummInitialize ();
});
Content Disclaimer
Informasi ini disarikan dari Wikipedia dan disajikan kembali untuk tujuan edukasi. Konten tersedia di bawah lisensi CC BY-SA 3.0. Kami tidak bertanggung jawab atas ketidakakuratan data yang bersumber dari kontribusi publik tersebut.
- The information displayed on this website is sourced in part or in whole from Wikipedia and has been adapted for the purpose of restating it. We strive to provide accurate and relevant information, however:
- There is no guarantee of absolute accuracy. Wikipedia is an open, collaborative project that can be edited by anyone, so information is subject to change.
- It is not intended to constitute professional advice. The content displayed is for informational and educational purposes only. For important decisions (e.g., medical, legal, or financial), please consult a professional.
- Content copyright. Wikipedia is licensed under the Creative Commons Attribution-ShareAlike License (CC BY-SA). This means that content may be reused with appropriate attribution and shared under a similar license.
- Responsible use. Any risk arising from the use of information from this website is entirely the responsibility of the user.