مدیاویکی:Gadget-defaultsummaries.js: تفاوت میان نسخهها
ظاهر
imported>Taranet مثل ویکی انگلیسی. اجتمالا مترجم حواسش به حذف و اضافهٔ دانشگاه بوده! |
imported>Ladsgroup بروزرسانی از نسخه جدید |
||
| (۳ نسخهٔ میانی ویرایش شده توسط ۲ کاربر نشان داده نشد) | |||
| خط ۱: | خط ۱: | ||
/* | /* | ||
* Imported as of 2011/11/24 from [[en:MediaWiki:Gadget-defaultsummaries.js]] | * Imported as of 2011/11/24 from [[:en:MediaWiki:Gadget-defaultsummaries.js]] | ||
* http://en.wikipedia.org/w/index.php?title=MediaWiki:Gadget-defaultsummaries.js&oldid=454943034 | * http://en.wikipedia.org/w/index.php?title=MediaWiki:Gadget-defaultsummaries.js&oldid=454943034 | ||
* Implements default edit summary dropdown boxes | * Implements default edit summary dropdown boxes | ||
| خط ۶: | خط ۶: | ||
(function ($) { // Wrap with anonymous function | (function ($) { // Wrap with anonymous function | ||
var $summaryBox = $('input#wpSummary, #wpSummary > input'); | |||
var | |||
function editsummAddOptionToDropdown(dropdown, optionText) { | function editsummAddOptionToDropdown(dropdown, optionText) { | ||
var option = document.createElement("option"); | var option = document.createElement("option"); | ||
| خط ۲۷: | خط ۲۶: | ||
function editsummOnCannedSummarySelected() { | function editsummOnCannedSummarySelected() { | ||
// Save the original value of the edit summary field | // Save the original value of the edit summary field | ||
editsummOriginalSummary = | var editsummOriginalSummary = $summaryBox.val(); | ||
var idx = this.selectedIndex; | var idx = this.selectedIndex; | ||
| خط ۳۹: | خط ۳۳: | ||
var newSummary = editsummOriginalSummary; | var newSummary = editsummOriginalSummary; | ||
// Append old edit summary with space, if exists | // Append old edit summary with space, if exists, | ||
if (newSummary.length !== 0) { | // and last character != space | ||
if (newSummary.length !== 0 && newSummary.charAt(newSummary.length - 1) !== " ") { | |||
newSummary += " "; | newSummary += " "; | ||
} | } | ||
newSummary += canned; | newSummary += canned; | ||
$summaryBox.val( newSummary ).trigger( 'change' ); | |||
} | } | ||
function insertSummaryOptions($insertBeforeThis, dropdownWidth) { | |||
// For convenience, add a dropdown box with some canned edit | // For convenience, add a dropdown box with some canned edit | ||
// summaries to the form. | // summaries to the form. | ||
var dropdown = document.createElement("select"); | var dropdown = document.createElement("select"); | ||
dropdown.style.width = | dropdown.style.width = dropdownWidth; | ||
dropdown.style.margin = "0 4px 0 0"; | dropdown.style.margin = "0 4px 0 0"; | ||
dropdown.onchange = editsummOnCannedSummarySelected; | dropdown.onchange = editsummOnCannedSummarySelected; | ||
var minorDropdown = document.createElement("select"); | var minorDropdown = document.createElement("select"); | ||
minorDropdown.style.width = | minorDropdown.style.width = dropdownWidth; | ||
minorDropdown.onchange = editsummOnCannedSummarySelected; | minorDropdown.onchange = editsummOnCannedSummarySelected; | ||
| خط ۸۱: | خط ۵۹: | ||
editsummAddOptionToDropdown(minorDropdown, "اصلاح املایی/جملهبندی"); | editsummAddOptionToDropdown(minorDropdown, "اصلاح املایی/جملهبندی"); | ||
editsummAddOptionToDropdown(minorDropdown, "رفع خطاهای ظاهری"); | editsummAddOptionToDropdown(minorDropdown, "رفع خطاهای ظاهری"); | ||
editsummAddOptionToDropdown(minorDropdown, "[[ | editsummAddOptionToDropdown(minorDropdown, "[[راهنما:خنثیسازی|خنثیسازی]] [[وپ:خرابکاری|خرابکاری]] یا ویرایش آزمایشی"); | ||
editsummAddOptionToDropdown(minorDropdown, "[[راهنما: | editsummAddOptionToDropdown(minorDropdown, "[[راهنما:خنثیسازی|خنثیسازی]] حذف محتوای بدون توضیح"); | ||
editsummAddOptionToDropdown(minorDropdown, "ویرایش و تصحیح (جزئی)"); | editsummAddOptionToDropdown(minorDropdown, "ویرایش و تصحیح (جزئی)"); | ||
| خط ۱۰۷: | خط ۸۵: | ||
} | } | ||
var | $insertBeforeThis.before(dropdown); | ||
$insertBeforeThis.before(minorDropdown); | |||
} | |||
mw.hook( 've.saveDialog.stateChanged' ).add(function(){ | |||
//.ve-init-mw-viewPageTarget-saveDialog-checkboxes | |||
if ( $( 'body' ).data( 'wppresent' ) ) { return; } | |||
$( 'body' ).data( 'wppresent', 'true' ); | |||
var target = ve.init.target, | |||
$insertBeforeThis = target.saveDialog.$saveOptions; | |||
$summaryBox = target.saveDialog.editSummaryInput.$input; | |||
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)) | }(jQuery)); | ||
نسخهٔ کنونی تا ۱۳ مهٔ ۲۰۱۷، ساعت ۰۰:۰۰
/*
* Imported as of 2011/11/24 from [[:en:MediaWiki:Gadget-defaultsummaries.js]]
* http://en.wikipedia.org/w/index.php?title=MediaWiki:Gadget-defaultsummaries.js&oldid=454943034
* Implements default edit summary dropdown boxes
*/
(function ($) { // Wrap with anonymous function
var $summaryBox = $('input#wpSummary, #wpSummary > input');
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[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;
$summaryBox.val( newSummary ).trigger( 'change' );
}
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, "خلاصه ویرایشهای جزئی رایج - برای استفاده کلیک کنید");
editsummAddCatToDropdown(dropdown, "خلاصه ویرایشهای رایج - برای استفاده کلیک کنید");
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, "پیشنهاد");
if ((mw.config.get('wgNamespaceNumber') % 2 !== 0) & (mw.config.get('wgNamespaceNumber') !== 3)) {
editsummAddOptionToDropdown(dropdown, "برچسب [[وپ:ویکیپروژه]]");
editsummAddOptionToDropdown(dropdown, "تعیین برچسب [[وپ:ویکیپروژه]]");
}
}
$insertBeforeThis.before(dropdown);
$insertBeforeThis.before(minorDropdown);
}
mw.hook( 've.saveDialog.stateChanged' ).add(function(){
//.ve-init-mw-viewPageTarget-saveDialog-checkboxes
if ( $( 'body' ).data( 'wppresent' ) ) { return; }
$( 'body' ).data( 'wppresent', 'true' );
var target = ve.init.target,
$insertBeforeThis = target.saveDialog.$saveOptions;
$summaryBox = target.saveDialog.editSummaryInput.$input;
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));