මාධ්යවිකි:Gadget-defaultsummaries.js
සටහන: සුරැකීමෙන් පසුව, වෙනස් කම් දැකගැනුමට ඔබගේ බ්රවුසරයෙහි කෑෂය මගහැරයෑමට ඔබට සිදුවිය හැක. ගූගල් ක්රෝම්, ෆයර්ෆොක්ස්, මයික්රොසොෆ්ට් එජ් සහ සෆාරි: Reload ඔබන අතරතුර ⇧ Shift ඔබන්න. සවිස්තරාත්ම උපදෙස් සහ වෙනත් බ්රව්සර වලට අදාළ තොරතුරු සඳහා, විකිපීඩියා:කෑෂය මගහැරයෑම වෙතට යොමු වන්න.
/* _____________________________________________________________________________
* | |
* | === WARNING: GLOBAL GADGET FILE === |
* | Changes to this page affect many users. |
* | Please discuss changes on the talk page or on [[WT:Gadget]] before editing. |
* |_____________________________________________________________________________|
*
* Imported as of 09/06/2011 from [[User:ErrantX/defaultsummaries.js]]
* Edited version from [[User:MC10/defaultsummaries.js]]
* Implements default edit summary dropdown boxes
*/
(function ($) { // Wrap with anonymous function
// The original value of the edit summary field is stored here
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);
}
function editsummOnCannedSummarySelected() {
// Save the original value of the edit summary field
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;
}
$(function () {
var insertBeforeThis = document.getElementById("wpSummary");
// Loop through siblings, looking for editCheckboxes class
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 = "38%";
dropdown.style.margin = "0 4px 0 0";
dropdown.onchange = editsummOnCannedSummarySelected;
var minorDropdown = document.createElement("select");
minorDropdown.style.width = "38%";
minorDropdown.onchange = editsummOnCannedSummarySelected;
editsummAddCatToDropdown(minorDropdown, "සුළු සංස්කරණය සාරාංශ – භාවිතයට ක්ලික් කරන්න");
editsummAddCatToDropdown(dropdown, "සාමාන්යය සංස්කරණය සාරාංශ – භාවිතයට ක්ලික් කරන්න");
editsummAddOptionToDropdown(minorDropdown, "අක්ෂර වින්යාසය නිවැරදි කිරීම");
editsummAddOptionToDropdown(minorDropdown, "ව්යාකරණ නිවැරදි කිරීම");
editsummAddOptionToDropdown(minorDropdown, "ශෛලිය වෙනස් කිරීම");
editsummAddOptionToDropdown(minorDropdown, "ටැග සැකසීම");
editsummAddOptionToDropdown(minorDropdown, "වෙනත් විකියකින් සැකිල්ලක් ආයාත කිරීම");
editsummAddOptionToDropdown(minorDropdown, "වෙනත් විකියකින් පිටුවක් ආයාත කිරීම");
if (mw.config.get('wgNamespaceNumber') === 0) {
editsummAddOptionToDropdown(dropdown, "අන්තර්ගතය වෙනස් කිරීම");
editsummAddOptionToDropdown(dropdown, "අන්තර් විකි සබැඳුම් සැකසීම");
editsummAddOptionToDropdown(dropdown, "ලිපියට කරුණු එක් කිරීම");
editsummAddOptionToDropdown(dropdown, "ලිපිය පිරිසිදු කිරීම");
editsummAddOptionToDropdown(dropdown, "පින්තූර එක් කිරීම");
editsummAddOptionToDropdown(dropdown, "නිර්දේශ/මූලාශ්ර එක් කිරීම");
editsummAddOptionToDropdown(dropdown, "ප්රවර්ගයන් සැකසීම");
editsummAddOptionToDropdown(dropdown, "බාහිර සබැඳුම් සැකසීම");
editsummAddOptionToDropdown(dropdown, "වෙනත් ලිපියකින් අන්තර්ගතය ගෙන ඒම");
editsummAddOptionToDropdown(dropdown, "ප්රකාශණ හිමිකම් ගැටලු සහිත කොටස් ඉවත් කිරීම");
editsummAddOptionToDropdown(dropdown, "නව ලිපියක් තැනීම");
} else {
editsummAddOptionToDropdown(dropdown, "නව මාතෘකාවක් පටන් ගැනීම");
editsummAddOptionToDropdown(dropdown, "පිළිතුර දීම");
editsummAddOptionToDropdown(dropdown, "අදහස් දැක්වීම");
editsummAddOptionToDropdown(dropdown, "නව යෝජනාවන් එක් කිරීම");
editsummAddOptionToDropdown(dropdown, "අන්තර්ගතය වෙනස් කිරීම");
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);
});
}(jQuery)); // End wrap with anonymous function