مدیاویکی:Gadget-Extra-Editbuttons.js: تفاوت میان نسخهها
ظاهر
imported>Dalba برای «شد» هم خلاصهویرایش بنویسید |
imported>Ebrahim تمیزکاری محدود عمومی!/آزمایشی |
||
| خط ۱: | خط ۱: | ||
function | /*jslint indent: 2*/ | ||
(function () { | |||
'use strict'; | |||
/** | |||
* Make HTML of button from a common pattern | |||
/ | */ | ||
function buttonHTMLGenerator(javascriptCode, summaryText, replaceSummary, imageSuffix, title, alt) { | function buttonHTMLGenerator(javascriptCode, summaryText, replaceSummary, imageSuffix, title, alt) { | ||
var | var result = []; | ||
result.push("<a href=\"javascript:" + javascriptCode + ";"); | |||
if (summaryText) { | if (summaryText) { | ||
result.push("void(addEditSummary('" + summaryText + "',"); | |||
if (replaceSummary) { | |||
result.push("true"); | |||
} else { | |||
result.push("false"); | |||
} | |||
result("));"); | |||
} | } | ||
result.push("\"><img src=\"//upload.wikimedia.org/wikipedia/" + imageSuffix + "\""); | |||
result.push(" title=\"" + title + "\" alt=\"" + alt + " \"></a>"); | |||
return | return result.join(''); | ||
} | } | ||
function addEditSummary(summaryText, replaceSummary) { | function addEditSummary(summaryText, replaceSummary) { | ||
if (document.location.href.indexOf("§ion=new") > -1 || summaryText == "") return; | if (document.location.href.indexOf("§ion=new") > -1 || summaryText == "") return; | ||
if (!document.getElementById('wpSummary')) return; | if (!document.getElementById('wpSummary')) return; | ||
var summaryPrefix = ""; | var summaryPrefix = ""; | ||
if (document.getElementById('wpSummary').value.indexOf("*/ ") > -1) { | if (document.getElementById('wpSummary').value.indexOf("*/ ") > -1) { | ||
pos = document.getElementById('wpSummary').value.indexOf("*/ "); | |||
summaryPrefix = document.getElementById('wpSummary').value.substr(0, pos + 3); | |||
} | } | ||
if (replaceSummary) { | if (replaceSummary) { | ||
document.getElementById('wpSummary').value = summaryPrefix + summaryText; | |||
} else { | } else { | ||
if (document.getElementById('wpSummary').value == summaryPrefix) { | |||
document.getElementById('wpSummary').value += summaryText; | |||
} else { | |||
if (document.getElementById('wpSummary').value.search(summaryText) == -1) { // do not repeat in edit summary | |||
document.getElementById('wpSummary').value += "، " + summaryText; | |||
} | } | ||
} | |||
} | } | ||
} | } | ||
// Buttons that FIX wikitext | // Buttons that FIX wikitext | ||
/* ی ک */ | |||
/* ی ک */ | var EE_YKArabic = buttonHTMLGenerator( | ||
var EE_YKArabic = buttonHTMLGenerator( | |||
"applyOnSelection(YKarabic)", | "applyOnSelection(YKarabic)", | ||
"اصلاح نویسههای عربی", | "اصلاح نویسههای عربی", | ||
false, | false, | ||
"commons/8/88/Button_YehKeh.png", | "commons/8/88/Button_YehKeh.png", | ||
"اصلاح ی و ک", | "اصلاح ی و ک", | ||
"ی و ک"); | "ی و ک" | ||
); | |||
/* فاصلهٔ مجازی */ | /* فاصلهٔ مجازی */ | ||
var EE_zwnj = buttonHTMLGenerator( | var EE_zwnj = buttonHTMLGenerator( | ||
"applyOnSelection(FM)", | "applyOnSelection(FM)", | ||
"اصلاح فاصلهٔ مجازی", | "اصلاح فاصلهٔ مجازی", | ||
false, | false, | ||
"fa/d/d0/Button_ZWNJ.png", | "fa/d/d0/Button_ZWNJ.png", | ||
"فاصلهٔ مجازی", | "فاصلهٔ مجازی", | ||
"فاصلهٔ مجازی"); | "فاصلهٔ مجازی" | ||
); | |||
/* نویسهٔ غیراستاندارد */ | /* نویسهٔ غیراستاندارد */ | ||
var EE_nonS = buttonHTMLGenerator( | var EE_nonS = buttonHTMLGenerator( | ||
"applyOnSelection(NonStandard)", | "applyOnSelection(NonStandard)", | ||
"اصلاح نویسه", | "اصلاح نویسه", | ||
false, | false, | ||
"fa/9/94/Button_non_standard.png", | "fa/9/94/Button_non_standard.png", | ||
"نویسههای غیراستاندارد", | "نویسههای غیراستاندارد", | ||
"نویسههای غیراستاندارد"); | "نویسههای غیراستاندارد" | ||
); | |||
/* اصلاح ارقام */ | /* اصلاح ارقام */ | ||
var EE_Dig = buttonHTMLGenerator( | var EE_Dig = buttonHTMLGenerator( | ||
"applyOnSelection(digits)", | "applyOnSelection(digits)", | ||
"اصلاح ارقام", | "اصلاح ارقام", | ||
false, | false, | ||
"fa/4/4a/Button_numbers.png", | "fa/4/4a/Button_numbers.png", | ||
"اصلاح ارقام", | "اصلاح ارقام", | ||
"ارقام"); | "ارقام" | ||
); | |||
/* اصلاح ارقام مخصوص صفحه انتقال */ | |||
/* اصلاح ارقام مخصوص صفحه انتقال */ | var EE_Dig_move = buttonHTMLGenerator( | ||
var EE_Dig_move = buttonHTMLGenerator( | |||
"applyOnSelection(digits_move)", | "applyOnSelection(digits_move)", | ||
"اصلاح ارقام", | "اصلاح ارقام", | ||
false, | false, | ||
"fa/4/4a/Button_numbers.png", | "fa/4/4a/Button_numbers.png", | ||
"اصلاح ارقام", | "اصلاح ارقام", | ||
"ارقام"); | "ارقام"); | ||
/* یونیکدسازی نشانیهای وب */ | /* یونیکدسازی نشانیهای وب */ | ||
var EE_URLFIX = buttonHTMLGenerator( | var EE_URLFIX = buttonHTMLGenerator( | ||
"applyOnSelection(URLfix)", | "applyOnSelection(URLfix)", | ||
"اصلاح نشانی وب", | "اصلاح نشانی وب", | ||
false, | false, | ||
"fa/b/ba/Button_decode_URI.png", | "fa/b/ba/Button_decode_URI.png", | ||
"یونیکدسازی نشانیها", | "یونیکدسازی نشانیها", | ||
"یونیکدسازی"); | "یونیکدسازی"); | ||
/* اصلاح علامت @ */ | /* اصلاح علامت @ */ | ||
var EE_AtSignFix = buttonHTMLGenerator( | var EE_AtSignFix = buttonHTMLGenerator( | ||
"applyOnSelection(AtSignReplace)", | "applyOnSelection(AtSignReplace)", | ||
"اصلاح @", | "اصلاح @", | ||
false, | false, | ||
"fa/7/7f/Button_at_sign.png", | "fa/7/7f/Button_at_sign.png", | ||
"اصلاح علامت @", | "اصلاح علامت @", | ||
"@"); | "@"); | ||
/* ابرابزار */ | /* ابرابزار */ | ||
var EE_STool = buttonHTMLGenerator( | var EE_STool = buttonHTMLGenerator( | ||
"applyOnSelection(SuperTool)", | "applyOnSelection(SuperTool)", | ||
"ابرابزار", | "ابرابزار", | ||
false, | false, | ||
"fa/f/fc/Button_super_tool.png", | "fa/f/fc/Button_super_tool.png", | ||
"ابرابزار", | "ابرابزار", | ||
"ابرابزار"); | "ابرابزار"); | ||
/* ابرابزار مخصوص صفحه انتقال */ | /* ابرابزار مخصوص صفحه انتقال */ | ||
var EE_STool_move = buttonHTMLGenerator( | var EE_STool_move = buttonHTMLGenerator( | ||
"applyOnSelection(SuperTool_move)", | "applyOnSelection(SuperTool_move)", | ||
"ابرابزار", | "ابرابزار", | ||
false, | false, | ||
"fa/f/fc/Button_super_tool.png", | "fa/f/fc/Button_super_tool.png", | ||
"ابرابزار", | "ابرابزار", | ||
"ابرابزار"); | "ابرابزار"); | ||
/* ابزار املا */ | /* ابزار املا */ | ||
var EE_Dictation = buttonHTMLGenerator( | var EE_Dictation = buttonHTMLGenerator( | ||
"applyOnSelection(ZWNJ_Dictation)", | "applyOnSelection(ZWNJ_Dictation)", | ||
"اصلاح املا", | "اصلاح املا", | ||
false, | false, | ||
"commons/a/a3/Button_Dictation-fa.png", | "commons/a/a3/Button_Dictation-fa.png", | ||
"املا", | "املا", | ||
"املا"); | "املا"); | ||
/* اصلاحات نقطهگذاری */ | /* اصلاحات نقطهگذاری */ | ||
var EE_Punc = buttonHTMLGenerator( | var EE_Punc = buttonHTMLGenerator( | ||
"applyOnSelection(Punctuation)", | "applyOnSelection(Punctuation)", | ||
"اصلاح سجاوندی", | "اصلاح سجاوندی", | ||
false, | false, | ||
"fa/e/ed/Button_punctuation.png", | "fa/e/ed/Button_punctuation.png", | ||
"نقطهگذاری", | "نقطهگذاری", | ||
"نقطهگذاری"); | "نقطهگذاری"); | ||
// Buttons that add tags | // Buttons that add tags | ||
/* برچسب ویکیسازی */ | |||
/* برچسب ویکیسازی */ | var EE_Wikify = buttonHTMLGenerator( | ||
var EE_Wikify = buttonHTMLGenerator( | |||
"void(document.getElementById('wpTextbox1').value='{{ویکیسازی}}\\n'+document.getElementById('wpTextbox1').value)", | "void(document.getElementById('wpTextbox1').value='{{ویکیسازی}}\\n'+document.getElementById('wpTextbox1').value)", | ||
"برچسب ویکیسازی", | "برچسب ویکیسازی", | ||
false, | false, | ||
"fa/3/38/Button_wikify.png", | "fa/3/38/Button_wikify.png", | ||
"برچسب ویکیسازی", | "برچسب ویکیسازی", | ||
"ویکیسازی"); | "ویکیسازی"); | ||
/* بدون منبع */ | /* بدون منبع */ | ||
var EE_NoS = buttonHTMLGenerator( | var EE_NoS = buttonHTMLGenerator( | ||
"void(document.getElementById('wpTextbox1').value='{{بدون منبع}}\\n'+document.getElementById('wpTextbox1').value)", | "void(document.getElementById('wpTextbox1').value='{{بدون منبع}}\\n'+document.getElementById('wpTextbox1').value)", | ||
"برچسب منبع", | "برچسب منبع", | ||
false, | false, | ||
"fa/8/8a/Button_no_source_fa.png", | "fa/8/8a/Button_no_source_fa.png", | ||
"برچسب بدون منبع", | "برچسب بدون منبع", | ||
"بدون منبع"); | "بدون منبع"); | ||
/* حذف سریع */ | /* حذف سریع */ | ||
var EE_SpeedyDel = buttonHTMLGenerator( | var EE_SpeedyDel = buttonHTMLGenerator( | ||
"temp1=document.getElementById('wpTextbox1');temp2=temp1.value;temp1.value='';insertTags('{{" + "حذف سریع|','}}\\n'+temp2,'معیار');", | "temp1=document.getElementById('wpTextbox1');temp2=temp1.value;temp1.value='';insertTags('{{" + "حذف سریع|','}}\\n'+temp2,'معیار');", | ||
"حذف سریع", | "حذف سریع", | ||
true, | true, | ||
"fa/c/c1/Button_delete_vote.png", | "fa/c/c1/Button_delete_vote.png", | ||
"برچسب حذف سریع", | "برچسب حذف سریع", | ||
"حذف سریع"); | "حذف سریع"); | ||
/* حذف زماندار */ | /* حذف زماندار */ | ||
var EE_PROD = buttonHTMLGenerator( | var EE_PROD = buttonHTMLGenerator( | ||
"temp2=document.getElementById('wpTextbox1');temp3=temp2.value;temp2.value='';insertTags('{{جا" + ":حذف زماندار|','}}\\n'+temp3,'معیار')", | "temp2=document.getElementById('wpTextbox1');temp3=temp2.value;temp2.value='';insertTags('{{جا" + ":حذف زماندار|','}}\\n'+temp3,'معیار')", | ||
"حذف زماندار", | "حذف زماندار", | ||
true, | true, | ||
"commons/3/3f/Button_attendre.png", | "commons/3/3f/Button_attendre.png", | ||
"برچسب حذف زماندار", | "برچسب حذف زماندار", | ||
"حذف زماندار"); | "حذف زماندار"); | ||
/* منبع تصویر نامعلوم */ | /* منبع تصویر نامعلوم */ | ||
var EE_PicSource = buttonHTMLGenerator( | var EE_PicSource = buttonHTMLGenerator( | ||
"document.getElementById('wpTextbox1').value='{{منبع تصویر نامعلوم}}\\n'+document.getElementById('wpTextbox1').value", | "document.getElementById('wpTextbox1').value='{{منبع تصویر نامعلوم}}\\n'+document.getElementById('wpTextbox1').value", | ||
"برچسب منبع", | "برچسب منبع", | ||
false, | false, | ||
"fa/5/59/Button_image_source.png", | "fa/5/59/Button_image_source.png", | ||
"برچسب منبع تصویر نامعلوم", | "برچسب منبع تصویر نامعلوم", | ||
"منبع تصویر نامعلوم"); | "منبع تصویر نامعلوم"); | ||
/* حق تکثیر تصویر نامعلوم */ | /* حق تکثیر تصویر نامعلوم */ | ||
var EE_PicCopy = buttonHTMLGenerator( | var EE_PicCopy = buttonHTMLGenerator( | ||
"document.getElementById('wpTextbox1').value='{{جا" + ":حق تکثیر تصویر نامعلوم}}\\n'+ document.getElementById('wpTextbox1').value", | "document.getElementById('wpTextbox1').value='{{جا" + ":حق تکثیر تصویر نامعلوم}}\\n'+ document.getElementById('wpTextbox1').value", | ||
"برچسب حق تکثیر", | "برچسب حق تکثیر", | ||
false, | false, | ||
"fa/7/7e/Button_image_copyright.png", | "fa/7/7e/Button_image_copyright.png", | ||
"برچسب حق تکثیر تصویر نامعلوم", | "برچسب حق تکثیر تصویر نامعلوم", | ||
"حق تکثیر تصویر نامعلوم"); | "حق تکثیر تصویر نامعلوم"); | ||
/* تمیزکاری */ | /* تمیزکاری */ | ||
var EE_Cleanup = buttonHTMLGenerator( | var EE_Cleanup = buttonHTMLGenerator( | ||
"void(document.getElementById('wpTextbox1').value='{{تمیزکاری}}\\n'+document.getElementById('wpTextbox1').value);", | "void(document.getElementById('wpTextbox1').value='{{تمیزکاری}}\\n'+document.getElementById('wpTextbox1').value);", | ||
"برچسب تمیزکاری", | "برچسب تمیزکاری", | ||
false, | false, | ||
"commons/2/2e/Button_broom.png", | "commons/2/2e/Button_broom.png", | ||
"برچسب تمیزکاری", | "برچسب تمیزکاری", | ||
"تمیزکاری"); | "تمیزکاری"); | ||
/* اخطار نگاره */ | /* اخطار نگاره */ | ||
var EE_ImgWarn = buttonHTMLGenerator( | var EE_ImgWarn = buttonHTMLGenerator( | ||
"document.getElementById('wpTextbox1').value='';insertTags('{{جا" + ":اخطار نگاره|','}}','نگاره')", | "document.getElementById('wpTextbox1').value='';insertTags('{{جا" + ":اخطار نگاره|','}}','نگاره')", | ||
"برچسب نگاره", | "برچسب نگاره", | ||
false, | false, | ||
"commons/e/ec/Button_aviso.png", | "commons/e/ec/Button_aviso.png", | ||
"اخطار نگاره", | "اخطار نگاره", | ||
"اخطار نگاره"); | "اخطار نگاره"); | ||
/* حق تکثیر مشکوک */ | /* حق تکثیر مشکوک */ | ||
var EE_Sus = buttonHTMLGenerator( | var EE_Sus = buttonHTMLGenerator( | ||
"document.getElementById('wpTextbox1').value='{{حق تکثیر مشکوک}}\\n'+document.getElementById('wpTextbox1').value", | "document.getElementById('wpTextbox1').value='{{حق تکثیر مشکوک}}\\n'+document.getElementById('wpTextbox1').value", | ||
"برچسب حق تکثیر", | "برچسب حق تکثیر", | ||
false, | false, | ||
"fa/c/c7/Button_Sus.png", | "fa/c/c7/Button_Sus.png", | ||
"برچسب حق تکثیر مشکوک", | "برچسب حق تکثیر مشکوک", | ||
"حق تکثیر مشکوک"); | "حق تکثیر مشکوک"); | ||
/* نقض حق تکثیر */ | /* نقض حق تکثیر */ | ||
var EE_CopyR = buttonHTMLGenerator( | var EE_CopyR = buttonHTMLGenerator( | ||
"document.getElementById('wpTextbox1').value='';insertTags('{{جا" + ":نقض حق تکثیر|url=','}}','Address')", | "document.getElementById('wpTextbox1').value='';insertTags('{{جا" + ":نقض حق تکثیر|url=','}}','Address')", | ||
"برچسب حق تکثیر", | "برچسب حق تکثیر", | ||
false, | false, | ||
"fa/6/6f/Button_CopyR.png", | "fa/6/6f/Button_CopyR.png", | ||
"برچسب نقض حق تکثیر", | "برچسب نقض حق تکثیر", | ||
"نقض حق تکثیر"); | "نقض حق تکثیر"); | ||
/* لحن نامناسب */ | /* لحن نامناسب */ | ||
var EE_Tone = buttonHTMLGenerator( | var EE_Tone = buttonHTMLGenerator( | ||
"document.getElementById('wpTextbox1').value='{{لحن نامناسب}}\\n'+document.getElementById('wpTextbox1').value", | "document.getElementById('wpTextbox1').value='{{لحن نامناسب}}\\n'+document.getElementById('wpTextbox1').value", | ||
"برچسب لحن", | "برچسب لحن", | ||
false, | false, | ||
"fa/f/fc/Button_Tone.png", | "fa/f/fc/Button_Tone.png", | ||
"برچسب لحن نامناسب", | "برچسب لحن نامناسب", | ||
"لحن"); | "لحن"); | ||
// Buttons that help with wiki writing | // Buttons that help with wiki writing | ||
/* تغییر جهت */ | |||
/* تغییر جهت */ | var EE_toggleDirection = buttonHTMLGenerator( | ||
var EE_toggleDirection = buttonHTMLGenerator( | |||
"toggleDir(document.getElementById('wpTextbox1'));", | "toggleDir(document.getElementById('wpTextbox1'));", | ||
"", | "", | ||
true, | true, | ||
"fa/d/d0/Button_toggle_dir.png", | "fa/d/d0/Button_toggle_dir.png", | ||
"تغییر جهت جعبهٔ ویرایش", | "تغییر جهت جعبهٔ ویرایش", | ||
"تغییرجهت"); | "تغییرجهت"); | ||
/* پیوند درونی */ | /* پیوند درونی */ | ||
var EE_wikilink = buttonHTMLGenerator( | var EE_wikilink = buttonHTMLGenerator( | ||
"insertTags('[[',']]','مقاله');", | "insertTags('[[',']]','مقاله');", | ||
"", | "", | ||
true, | true, | ||
"fa/d/d0/Button_in_wikify.png", | "fa/d/d0/Button_in_wikify.png", | ||
"پیوند", | "پیوند", | ||
"پیوند"); | "پیوند"); | ||
/* متن خطخورده */ | /* متن خطخورده */ | ||
var EE_StrikeTextButton = buttonHTMLGenerator( | var EE_StrikeTextButton = buttonHTMLGenerator( | ||
"insertTags('<s>','</s>','متن خط خورده')", | "insertTags('<s>','</s>','متن خط خورده')", | ||
"", | "", | ||
true, | true, | ||
"commons/c/c9/Button_strike.png", | "commons/c/c9/Button_strike.png", | ||
"متن خطخورده", | "متن خطخورده", | ||
"متن خطخورده"); | "متن خطخورده"); | ||
/* نگارخانه */ | /* نگارخانه */ | ||
var EE_GalleryButton = buttonHTMLGenerator( | var EE_GalleryButton = buttonHTMLGenerator( | ||
"insertTags('\\n<gallery>\\n','\\n</gallery>','تصویر:PictureFileName.jpg|شرح\\nتصویر:PictureFileName.jpg|شرح')", | "insertTags('\\n<gallery>\\n','\\n</gallery>','تصویر:PictureFileName.jpg|شرح\\nتصویر:PictureFileName.jpg|شرح')", | ||
"", | "", | ||
true, | true, | ||
"fa/1/12/Button_gallery.png", | "fa/1/12/Button_gallery.png", | ||
"نگارخانه", | "نگارخانه", | ||
"نگارخانه"); | "نگارخانه"); | ||
/* توضیح */ | /* توضیح */ | ||
var EE_CommentButton = buttonHTMLGenerator( | var EE_CommentButton = buttonHTMLGenerator( | ||
"insertTags('<!--','-->','توضیح')", | "insertTags('<!--','-->','توضیح')", | ||
"", | "", | ||
true, | true, | ||
"commons/3/34/Button_hide_comment.png", | "commons/3/34/Button_hide_comment.png", | ||
"توضیح", | "توضیح", | ||
"توضیح"); | "توضیح"); | ||
/* ملزومات مقاله */ | /* ملزومات مقاله */ | ||
var EE_AddEssentialThings = buttonHTMLGenerator( | var EE_AddEssentialThings = buttonHTMLGenerator( | ||
"insertTags('== جستارهای وابسته ==\\n\\n== منابع ==\\n{{پانویس}}','','')", | "insertTags('== جستارهای وابسته ==\\n\\n== منابع ==\\n{{پانویس}}','','')", | ||
"", | "", | ||
true, | true, | ||
"commons/e/ef/Add_note.jpg", | "commons/e/ef/Add_note.jpg", | ||
"ملزومات مقاله", | "ملزومات مقاله", | ||
"ملزومات مقاله"); | "ملزومات مقاله"); | ||
/* خوشامدید */ | /* خوشامدید */ | ||
var EE_Welcome = buttonHTMLGenerator( | var EE_Welcome = buttonHTMLGenerator( | ||
"insertTags('{{جا" + ":خوشامدید|~~" + "~~}}','','')", | "insertTags('{{جا" + ":خوشامدید|~~" + "~~}}','','')", | ||
"خوشامدگویی", | "خوشامدگویی", | ||
true, | true, | ||
"commons/4/4a/Smilies_Alien_cool.png", | "commons/4/4a/Smilies_Alien_cool.png", | ||
"خوشامدگویی", | "خوشامدگویی", | ||
"خوشامد"); | "خوشامد"); | ||
/* چپچین */ | /* چپچین */ | ||
var EE_ChapChin = buttonHTMLGenerator( | var EE_ChapChin = buttonHTMLGenerator( | ||
"insertTags('{{چپچین}}\\n','\\n{{پایان چپچین}}','متن چپچینشده')", | "insertTags('{{چپچین}}\\n','\\n{{پایان چپچین}}','متن چپچینشده')", | ||
"", | "", | ||
true, | true, | ||
"en/e/ea/Button_align_left.png", | "en/e/ea/Button_align_left.png", | ||
"چپچینکردن متن", | "چپچینکردن متن", | ||
"چپچین"); | "چپچین"); | ||
/* سرخط */ | /* سرخط */ | ||
var EE_SareSatr = buttonHTMLGenerator( | var EE_SareSatr = buttonHTMLGenerator( | ||
"insertTags('<br />','','')", | "insertTags('<br />','','')", | ||
"", | "", | ||
true, | true, | ||
"en/1/13/Button_enter.png", | "en/1/13/Button_enter.png", | ||
"سرخط", | "سرخط", | ||
"سرخط"); | "سرخط"); | ||
/* اندیس بالا */ | /* اندیس بالا */ | ||
var EE_UpperText = buttonHTMLGenerator( | var EE_UpperText = buttonHTMLGenerator( | ||
"insertTags('<sup>','</sup>','اندیس')", | "insertTags('<sup>','</sup>','اندیس')", | ||
"", | "", | ||
true, | true, | ||
"en/8/80/Button_upper_letter.png", | "en/8/80/Button_upper_letter.png", | ||
"اندیس بالا", | "اندیس بالا", | ||
"اندیس بالا"); | "اندیس بالا"); | ||
/* اندیس پایین */ | /* اندیس پایین */ | ||
var EE_LowerText = buttonHTMLGenerator( | var EE_LowerText = buttonHTMLGenerator( | ||
"insertTags('<sub>','</sub>','اندیس')", | "insertTags('<sub>','</sub>','اندیس')", | ||
"", | "", | ||
true, | true, | ||
"en/7/70/Button_lower_letter.png", | "en/7/70/Button_lower_letter.png", | ||
"اندیس پایین", | "اندیس پایین", | ||
"اندیس پایین"); | "اندیس پایین"); | ||
/* تغییرمسیر */ | /* تغییرمسیر */ | ||
var EE_RedirectButton = buttonHTMLGenerator( | var EE_RedirectButton = buttonHTMLGenerator( | ||
"document.getElementById('wpTextbox1').value='';insertTags('#تغییرمسیر [[',']]','پیوند')", | "document.getElementById('wpTextbox1').value='';insertTags('#تغییرمسیر [[',']]','پیوند')", | ||
"", | "", | ||
true, | true, | ||
"en/c/c8/Button_redirect.png", | "en/c/c8/Button_redirect.png", | ||
"تغییرمسیر", | "تغییرمسیر", | ||
"تغییرمسیر"); | "تغییرمسیر"); | ||
/* سال میلادی */ | /* سال میلادی */ | ||
var EE_GregYear = buttonHTMLGenerator( | var EE_GregYear = buttonHTMLGenerator( | ||
"insertTags('[[',' (میلادی)|'+']]','سال')", | "insertTags('[[',' (میلادی)|'+']]','سال')", | ||
"", | "", | ||
true, | true, | ||
"fa/a/a7/Button_cal.png", | "fa/a/a7/Button_cal.png", | ||
"سال میلادی", | "سال میلادی", | ||
"میلادی"); | "میلادی"); | ||
/* کد */ | /* کد */ | ||
var EE_CodeButton = buttonHTMLGenerator( | var EE_CodeButton = buttonHTMLGenerator( | ||
"insertTags('<code>','</code>','کد')", | "insertTags('<code>','</code>','کد')", | ||
"", | "", | ||
true, | true, | ||
"fa/2/23/Button_code.png", | "fa/2/23/Button_code.png", | ||
"برچسب کد", | "برچسب کد", | ||
"کد"); | "کد"); | ||
/* مرتبسازی */ | /* مرتبسازی */ | ||
var EE_sorttext = buttonHTMLGenerator( | var EE_sorttext = buttonHTMLGenerator( | ||
"applyOnSelection(SortText)", | "applyOnSelection(SortText)", | ||
"", | "", | ||
true, | true, | ||
"fa/3/33/Button_sort.png", | "fa/3/33/Button_sort.png", | ||
"مرتبسازی بر اساس الفبا", | "مرتبسازی بر اساس الفبا", | ||
"مرتبسازی"); | "مرتبسازی"); | ||
/* شد! */ | /* شد! */ | ||
var EE_shod = buttonHTMLGenerator( | var EE_shod = buttonHTMLGenerator( | ||
"void(document.getElementById('wpTextbox1').value=document.getElementById('wpTextbox1').value+'\n:{{شد}} ~~" + "~~')", | "void(document.getElementById('wpTextbox1').value=document.getElementById('wpTextbox1').value+'\n:{{شد}} ~~" + "~~')", | ||
"شد", | "شد", | ||
true, | true, | ||
"commons/5/5b/Button_check.png", | "commons/5/5b/Button_check.png", | ||
"شد", | "شد", | ||
"شد"); | "شد"); | ||
// Default configuartion | // Default configuartion | ||
var EE_Spacer = " "; | |||
var EE_Spacer = " "; | var EE_NewRow = "<br />"; | ||
var EE_NewRow = "<br />"; | |||
if ( | if (mw.config.get('wgUserGroups').indexOf('autoconfirmed') === -1) { | ||
//only 'autoconfirmed' | // only 'autoconfirmed' users can use EE_Dictation tool! | ||
if (typeof (ExtraEditButtons) === "undefined") { | if (typeof (ExtraEditButtons) === "undefined") { | ||
var ExtraEditButtons = EE_toggleDirection + EE_Spacer + EE_YKArabic + EE_zwnj + EE_nonS + EE_Dig + EE_Punc + EE_STool + EE_Spacer + EE_Dictation + EE_Spacer + EE_URLFIX + EE_Spacer + EE_Welcome + EE_AddEssentialThings + EE_NoS + EE_Sus + EE_Tone + EE_Wikify + EE_shod + EE_Cleanup + EE_SpeedyDel + EE_PROD + EE_Spacer + EE_RedirectButton + EE_GregYear + EE_StrikeTextButton + EE_ChapChin + EE_CommentButton + EE_Spacer + EE_sorttext + EE_NewRow; | |||
} | } | ||
} else { | } else { | ||
if (typeof (ExtraEditButtons) === "undefined") { | if (typeof (ExtraEditButtons) === "undefined") { | ||
var ExtraEditButtons = EE_toggleDirection + EE_Spacer + EE_YKArabic + EE_zwnj + EE_nonS + EE_Dig + EE_Punc + EE_STool + EE_Spacer + EE_URLFIX + EE_Spacer + EE_Welcome + EE_AddEssentialThings + EE_NoS + EE_Sus + EE_Tone + EE_Wikify + EE_shod + EE_Cleanup + EE_SpeedyDel + EE_PROD + EE_Spacer + EE_RedirectButton + EE_GregYear + EE_StrikeTextButton + EE_ChapChin + EE_CommentButton + EE_Spacer + EE_sorttext + EE_NewRow; | |||
} | } | ||
} | } | ||
if (typeof (ExtraMoveButtons) === "undefined") { | if (typeof (ExtraMoveButtons) === "undefined") { | ||
var ExtraMoveButtons = EE_STool_move + EE_Spacer + EE_toggleDirection + EE_Spacer + EE_YKArabic + EE_zwnj + EE_nonS + EE_Dig_move + EE_Punc + EE_Spacer + EE_Dictation; | var ExtraMoveButtons = EE_STool_move + EE_Spacer + EE_toggleDirection + EE_Spacer + EE_YKArabic + EE_zwnj + EE_nonS + EE_Dig_move + EE_Punc + EE_Spacer + EE_Dictation; | ||
} | } | ||
// Onload hooks | // Onload hooks | ||
$(function () { | $(function () { | ||
if ($("#wpTextbox1")) { | if ($("#wpTextbox1").length !== 0) { | ||
$("<tooly />").html(ExtraEditButtons).before("#wpTextbox1"); | |||
} | } | ||
}); | }); | ||
$(function () { | $(function () { | ||
if ($("#movepage")) { | if ($("#movepage")) { | ||
var ButtonsHTML = "<span>" + ExtraMoveButtons + "</span>"; | |||
$(ButtonsHTML).insertAfter("#wpNewTitleMain"); | |||
} | } | ||
}); | }); | ||
}()); | |||
نسخهٔ ۱۲ ژوئن ۲۰۱۳، ساعت ۲۳:۴۲
/*jslint indent: 2*/
(function () {
'use strict';
/**
* Make HTML of button from a common pattern
*/
function buttonHTMLGenerator(javascriptCode, summaryText, replaceSummary, imageSuffix, title, alt) {
var result = [];
result.push("<a href=\"javascript:" + javascriptCode + ";");
if (summaryText) {
result.push("void(addEditSummary('" + summaryText + "',");
if (replaceSummary) {
result.push("true");
} else {
result.push("false");
}
result("));");
}
result.push("\"><img src=\"//upload.wikimedia.org/wikipedia/" + imageSuffix + "\"");
result.push(" title=\"" + title + "\" alt=\"" + alt + " \"></a>");
return result.join('');
}
function addEditSummary(summaryText, replaceSummary) {
if (document.location.href.indexOf("§ion=new") > -1 || summaryText == "") return;
if (!document.getElementById('wpSummary')) return;
var summaryPrefix = "";
if (document.getElementById('wpSummary').value.indexOf("*/ ") > -1) {
pos = document.getElementById('wpSummary').value.indexOf("*/ ");
summaryPrefix = document.getElementById('wpSummary').value.substr(0, pos + 3);
}
if (replaceSummary) {
document.getElementById('wpSummary').value = summaryPrefix + summaryText;
} else {
if (document.getElementById('wpSummary').value == summaryPrefix) {
document.getElementById('wpSummary').value += summaryText;
} else {
if (document.getElementById('wpSummary').value.search(summaryText) == -1) { // do not repeat in edit summary
document.getElementById('wpSummary').value += "، " + summaryText;
}
}
}
}
// Buttons that FIX wikitext
/* ی ک */
var EE_YKArabic = buttonHTMLGenerator(
"applyOnSelection(YKarabic)",
"اصلاح نویسههای عربی",
false,
"commons/8/88/Button_YehKeh.png",
"اصلاح ی و ک",
"ی و ک"
);
/* فاصلهٔ مجازی */
var EE_zwnj = buttonHTMLGenerator(
"applyOnSelection(FM)",
"اصلاح فاصلهٔ مجازی",
false,
"fa/d/d0/Button_ZWNJ.png",
"فاصلهٔ مجازی",
"فاصلهٔ مجازی"
);
/* نویسهٔ غیراستاندارد */
var EE_nonS = buttonHTMLGenerator(
"applyOnSelection(NonStandard)",
"اصلاح نویسه",
false,
"fa/9/94/Button_non_standard.png",
"نویسههای غیراستاندارد",
"نویسههای غیراستاندارد"
);
/* اصلاح ارقام */
var EE_Dig = buttonHTMLGenerator(
"applyOnSelection(digits)",
"اصلاح ارقام",
false,
"fa/4/4a/Button_numbers.png",
"اصلاح ارقام",
"ارقام"
);
/* اصلاح ارقام مخصوص صفحه انتقال */
var EE_Dig_move = buttonHTMLGenerator(
"applyOnSelection(digits_move)",
"اصلاح ارقام",
false,
"fa/4/4a/Button_numbers.png",
"اصلاح ارقام",
"ارقام");
/* یونیکدسازی نشانیهای وب */
var EE_URLFIX = buttonHTMLGenerator(
"applyOnSelection(URLfix)",
"اصلاح نشانی وب",
false,
"fa/b/ba/Button_decode_URI.png",
"یونیکدسازی نشانیها",
"یونیکدسازی");
/* اصلاح علامت @ */
var EE_AtSignFix = buttonHTMLGenerator(
"applyOnSelection(AtSignReplace)",
"اصلاح @",
false,
"fa/7/7f/Button_at_sign.png",
"اصلاح علامت @",
"@");
/* ابرابزار */
var EE_STool = buttonHTMLGenerator(
"applyOnSelection(SuperTool)",
"ابرابزار",
false,
"fa/f/fc/Button_super_tool.png",
"ابرابزار",
"ابرابزار");
/* ابرابزار مخصوص صفحه انتقال */
var EE_STool_move = buttonHTMLGenerator(
"applyOnSelection(SuperTool_move)",
"ابرابزار",
false,
"fa/f/fc/Button_super_tool.png",
"ابرابزار",
"ابرابزار");
/* ابزار املا */
var EE_Dictation = buttonHTMLGenerator(
"applyOnSelection(ZWNJ_Dictation)",
"اصلاح املا",
false,
"commons/a/a3/Button_Dictation-fa.png",
"املا",
"املا");
/* اصلاحات نقطهگذاری */
var EE_Punc = buttonHTMLGenerator(
"applyOnSelection(Punctuation)",
"اصلاح سجاوندی",
false,
"fa/e/ed/Button_punctuation.png",
"نقطهگذاری",
"نقطهگذاری");
// Buttons that add tags
/* برچسب ویکیسازی */
var EE_Wikify = buttonHTMLGenerator(
"void(document.getElementById('wpTextbox1').value='{{ویکیسازی}}\\n'+document.getElementById('wpTextbox1').value)",
"برچسب ویکیسازی",
false,
"fa/3/38/Button_wikify.png",
"برچسب ویکیسازی",
"ویکیسازی");
/* بدون منبع */
var EE_NoS = buttonHTMLGenerator(
"void(document.getElementById('wpTextbox1').value='{{بدون منبع}}\\n'+document.getElementById('wpTextbox1').value)",
"برچسب منبع",
false,
"fa/8/8a/Button_no_source_fa.png",
"برچسب بدون منبع",
"بدون منبع");
/* حذف سریع */
var EE_SpeedyDel = buttonHTMLGenerator(
"temp1=document.getElementById('wpTextbox1');temp2=temp1.value;temp1.value='';insertTags('{{" + "حذف سریع|','}}\\n'+temp2,'معیار');",
"حذف سریع",
true,
"fa/c/c1/Button_delete_vote.png",
"برچسب حذف سریع",
"حذف سریع");
/* حذف زماندار */
var EE_PROD = buttonHTMLGenerator(
"temp2=document.getElementById('wpTextbox1');temp3=temp2.value;temp2.value='';insertTags('{{جا" + ":حذف زماندار|','}}\\n'+temp3,'معیار')",
"حذف زماندار",
true,
"commons/3/3f/Button_attendre.png",
"برچسب حذف زماندار",
"حذف زماندار");
/* منبع تصویر نامعلوم */
var EE_PicSource = buttonHTMLGenerator(
"document.getElementById('wpTextbox1').value='{{منبع تصویر نامعلوم}}\\n'+document.getElementById('wpTextbox1').value",
"برچسب منبع",
false,
"fa/5/59/Button_image_source.png",
"برچسب منبع تصویر نامعلوم",
"منبع تصویر نامعلوم");
/* حق تکثیر تصویر نامعلوم */
var EE_PicCopy = buttonHTMLGenerator(
"document.getElementById('wpTextbox1').value='{{جا" + ":حق تکثیر تصویر نامعلوم}}\\n'+ document.getElementById('wpTextbox1').value",
"برچسب حق تکثیر",
false,
"fa/7/7e/Button_image_copyright.png",
"برچسب حق تکثیر تصویر نامعلوم",
"حق تکثیر تصویر نامعلوم");
/* تمیزکاری */
var EE_Cleanup = buttonHTMLGenerator(
"void(document.getElementById('wpTextbox1').value='{{تمیزکاری}}\\n'+document.getElementById('wpTextbox1').value);",
"برچسب تمیزکاری",
false,
"commons/2/2e/Button_broom.png",
"برچسب تمیزکاری",
"تمیزکاری");
/* اخطار نگاره */
var EE_ImgWarn = buttonHTMLGenerator(
"document.getElementById('wpTextbox1').value='';insertTags('{{جا" + ":اخطار نگاره|','}}','نگاره')",
"برچسب نگاره",
false,
"commons/e/ec/Button_aviso.png",
"اخطار نگاره",
"اخطار نگاره");
/* حق تکثیر مشکوک */
var EE_Sus = buttonHTMLGenerator(
"document.getElementById('wpTextbox1').value='{{حق تکثیر مشکوک}}\\n'+document.getElementById('wpTextbox1').value",
"برچسب حق تکثیر",
false,
"fa/c/c7/Button_Sus.png",
"برچسب حق تکثیر مشکوک",
"حق تکثیر مشکوک");
/* نقض حق تکثیر */
var EE_CopyR = buttonHTMLGenerator(
"document.getElementById('wpTextbox1').value='';insertTags('{{جا" + ":نقض حق تکثیر|url=','}}','Address')",
"برچسب حق تکثیر",
false,
"fa/6/6f/Button_CopyR.png",
"برچسب نقض حق تکثیر",
"نقض حق تکثیر");
/* لحن نامناسب */
var EE_Tone = buttonHTMLGenerator(
"document.getElementById('wpTextbox1').value='{{لحن نامناسب}}\\n'+document.getElementById('wpTextbox1').value",
"برچسب لحن",
false,
"fa/f/fc/Button_Tone.png",
"برچسب لحن نامناسب",
"لحن");
// Buttons that help with wiki writing
/* تغییر جهت */
var EE_toggleDirection = buttonHTMLGenerator(
"toggleDir(document.getElementById('wpTextbox1'));",
"",
true,
"fa/d/d0/Button_toggle_dir.png",
"تغییر جهت جعبهٔ ویرایش",
"تغییرجهت");
/* پیوند درونی */
var EE_wikilink = buttonHTMLGenerator(
"insertTags('[[',']]','مقاله');",
"",
true,
"fa/d/d0/Button_in_wikify.png",
"پیوند",
"پیوند");
/* متن خطخورده */
var EE_StrikeTextButton = buttonHTMLGenerator(
"insertTags('<s>','</s>','متن خط خورده')",
"",
true,
"commons/c/c9/Button_strike.png",
"متن خطخورده",
"متن خطخورده");
/* نگارخانه */
var EE_GalleryButton = buttonHTMLGenerator(
"insertTags('\\n<gallery>\\n','\\n</gallery>','تصویر:PictureFileName.jpg|شرح\\nتصویر:PictureFileName.jpg|شرح')",
"",
true,
"fa/1/12/Button_gallery.png",
"نگارخانه",
"نگارخانه");
/* توضیح */
var EE_CommentButton = buttonHTMLGenerator(
"insertTags('<!--','-->','توضیح')",
"",
true,
"commons/3/34/Button_hide_comment.png",
"توضیح",
"توضیح");
/* ملزومات مقاله */
var EE_AddEssentialThings = buttonHTMLGenerator(
"insertTags('== جستارهای وابسته ==\\n\\n== منابع ==\\n{{پانویس}}','','')",
"",
true,
"commons/e/ef/Add_note.jpg",
"ملزومات مقاله",
"ملزومات مقاله");
/* خوشامدید */
var EE_Welcome = buttonHTMLGenerator(
"insertTags('{{جا" + ":خوشامدید|~~" + "~~}}','','')",
"خوشامدگویی",
true,
"commons/4/4a/Smilies_Alien_cool.png",
"خوشامدگویی",
"خوشامد");
/* چپچین */
var EE_ChapChin = buttonHTMLGenerator(
"insertTags('{{چپچین}}\\n','\\n{{پایان چپچین}}','متن چپچینشده')",
"",
true,
"en/e/ea/Button_align_left.png",
"چپچینکردن متن",
"چپچین");
/* سرخط */
var EE_SareSatr = buttonHTMLGenerator(
"insertTags('<br />','','')",
"",
true,
"en/1/13/Button_enter.png",
"سرخط",
"سرخط");
/* اندیس بالا */
var EE_UpperText = buttonHTMLGenerator(
"insertTags('<sup>','</sup>','اندیس')",
"",
true,
"en/8/80/Button_upper_letter.png",
"اندیس بالا",
"اندیس بالا");
/* اندیس پایین */
var EE_LowerText = buttonHTMLGenerator(
"insertTags('<sub>','</sub>','اندیس')",
"",
true,
"en/7/70/Button_lower_letter.png",
"اندیس پایین",
"اندیس پایین");
/* تغییرمسیر */
var EE_RedirectButton = buttonHTMLGenerator(
"document.getElementById('wpTextbox1').value='';insertTags('#تغییرمسیر [[',']]','پیوند')",
"",
true,
"en/c/c8/Button_redirect.png",
"تغییرمسیر",
"تغییرمسیر");
/* سال میلادی */
var EE_GregYear = buttonHTMLGenerator(
"insertTags('[[',' (میلادی)|'+']]','سال')",
"",
true,
"fa/a/a7/Button_cal.png",
"سال میلادی",
"میلادی");
/* کد */
var EE_CodeButton = buttonHTMLGenerator(
"insertTags('<code>','</code>','کد')",
"",
true,
"fa/2/23/Button_code.png",
"برچسب کد",
"کد");
/* مرتبسازی */
var EE_sorttext = buttonHTMLGenerator(
"applyOnSelection(SortText)",
"",
true,
"fa/3/33/Button_sort.png",
"مرتبسازی بر اساس الفبا",
"مرتبسازی");
/* شد! */
var EE_shod = buttonHTMLGenerator(
"void(document.getElementById('wpTextbox1').value=document.getElementById('wpTextbox1').value+'\n:{{شد}} ~~" + "~~')",
"شد",
true,
"commons/5/5b/Button_check.png",
"شد",
"شد");
// Default configuartion
var EE_Spacer = " ";
var EE_NewRow = "<br />";
if (mw.config.get('wgUserGroups').indexOf('autoconfirmed') === -1) {
// only 'autoconfirmed' users can use EE_Dictation tool!
if (typeof (ExtraEditButtons) === "undefined") {
var ExtraEditButtons = EE_toggleDirection + EE_Spacer + EE_YKArabic + EE_zwnj + EE_nonS + EE_Dig + EE_Punc + EE_STool + EE_Spacer + EE_Dictation + EE_Spacer + EE_URLFIX + EE_Spacer + EE_Welcome + EE_AddEssentialThings + EE_NoS + EE_Sus + EE_Tone + EE_Wikify + EE_shod + EE_Cleanup + EE_SpeedyDel + EE_PROD + EE_Spacer + EE_RedirectButton + EE_GregYear + EE_StrikeTextButton + EE_ChapChin + EE_CommentButton + EE_Spacer + EE_sorttext + EE_NewRow;
}
} else {
if (typeof (ExtraEditButtons) === "undefined") {
var ExtraEditButtons = EE_toggleDirection + EE_Spacer + EE_YKArabic + EE_zwnj + EE_nonS + EE_Dig + EE_Punc + EE_STool + EE_Spacer + EE_URLFIX + EE_Spacer + EE_Welcome + EE_AddEssentialThings + EE_NoS + EE_Sus + EE_Tone + EE_Wikify + EE_shod + EE_Cleanup + EE_SpeedyDel + EE_PROD + EE_Spacer + EE_RedirectButton + EE_GregYear + EE_StrikeTextButton + EE_ChapChin + EE_CommentButton + EE_Spacer + EE_sorttext + EE_NewRow;
}
}
if (typeof (ExtraMoveButtons) === "undefined") {
var ExtraMoveButtons = EE_STool_move + EE_Spacer + EE_toggleDirection + EE_Spacer + EE_YKArabic + EE_zwnj + EE_nonS + EE_Dig_move + EE_Punc + EE_Spacer + EE_Dictation;
}
// Onload hooks
$(function () {
if ($("#wpTextbox1").length !== 0) {
$("<tooly />").html(ExtraEditButtons).before("#wpTextbox1");
}
});
$(function () {
if ($("#movepage")) {
var ButtonsHTML = "<span>" + ExtraMoveButtons + "</span>";
$(ButtonsHTML).insertAfter("#wpNewTitleMain");
}
});
}());