مدیاویکی:Gadget-Extra-Editbuttons.js: تفاوت میان نسخهها
ظاهر
imported>Ebrahim تغییرات اساسی! |
imported>Ebrahim بدون خلاصۀ ویرایش |
||
| خط ۱: | خط ۱: | ||
/*jslint indent: 2*/ | /*jslint indent: 2*/ | ||
(function () { | //(function () { | ||
'use strict'; | 'use strict'; | ||
/** | /** | ||
| خط ۴۲: | خط ۴۲: | ||
} | } | ||
} | } | ||
// Buttons that FIX wikitext | // Buttons that FIX wikitext | ||
/* ی ک */ | /* ی ک */ | ||
var EE_YKArabic = buttonHTMLGenerator( | |||
"applyOnSelection(YKarabic)", | "applyOnSelection(YKarabic)", | ||
"اصلاح نویسههای عربی", | "اصلاح نویسههای عربی", | ||
| خط ۵۷: | خط ۵۵: | ||
/* فاصلهٔ مجازی */ | /* فاصلهٔ مجازی */ | ||
var EE_zwnj = buttonHTMLGenerator( | |||
"applyOnSelection(FM)", | "applyOnSelection(FM)", | ||
"اصلاح فاصلهٔ مجازی", | "اصلاح فاصلهٔ مجازی", | ||
| خط ۶۷: | خط ۶۵: | ||
/* نویسهٔ غیراستاندارد */ | /* نویسهٔ غیراستاندارد */ | ||
var EE_nonS = buttonHTMLGenerator( | |||
"applyOnSelection(NonStandard)", | "applyOnSelection(NonStandard)", | ||
"اصلاح نویسه", | "اصلاح نویسه", | ||
| خط ۷۷: | خط ۷۵: | ||
/* اصلاح ارقام */ | /* اصلاح ارقام */ | ||
var EE_Dig = buttonHTMLGenerator( | |||
"applyOnSelection(digits)", | "applyOnSelection(digits)", | ||
"اصلاح ارقام", | "اصلاح ارقام", | ||
| خط ۸۷: | خط ۸۵: | ||
/* اصلاح ارقام مخصوص صفحه انتقال */ | /* اصلاح ارقام مخصوص صفحه انتقال */ | ||
var EE_Dig_move = buttonHTMLGenerator( | |||
"applyOnSelection(digits_move)", | "applyOnSelection(digits_move)", | ||
"اصلاح ارقام", | "اصلاح ارقام", | ||
| خط ۹۳: | خط ۹۱: | ||
"fa/4/4a/Button_numbers.png", | "fa/4/4a/Button_numbers.png", | ||
"اصلاح ارقام", | "اصلاح ارقام", | ||
"ارقام" | "ارقام"); | ||
/* یونیکدسازی نشانیهای وب */ | /* یونیکدسازی نشانیهای وب */ | ||
var EE_URLFIX = buttonHTMLGenerator( | |||
"applyOnSelection(URLfix)", | "applyOnSelection(URLfix)", | ||
"اصلاح نشانی وب", | "اصلاح نشانی وب", | ||
| خط ۱۰۳: | خط ۱۰۰: | ||
"fa/b/ba/Button_decode_URI.png", | "fa/b/ba/Button_decode_URI.png", | ||
"یونیکدسازی نشانیها", | "یونیکدسازی نشانیها", | ||
"یونیکدسازی" | "یونیکدسازی"); | ||
/* اصلاح علامت @ */ | /* اصلاح علامت @ */ | ||
var EE_AtSignFix = buttonHTMLGenerator( | |||
"applyOnSelection(AtSignReplace)", | "applyOnSelection(AtSignReplace)", | ||
"اصلاح @", | "اصلاح @", | ||
| خط ۱۱۳: | خط ۱۰۹: | ||
"fa/7/7f/Button_at_sign.png", | "fa/7/7f/Button_at_sign.png", | ||
"اصلاح علامت @", | "اصلاح علامت @", | ||
"@" | "@"); | ||
/* ابرابزار */ | /* ابرابزار */ | ||
var EE_STool = buttonHTMLGenerator( | |||
"applyOnSelection(SuperTool)", | "applyOnSelection(SuperTool)", | ||
"ابرابزار", | "ابرابزار", | ||
| خط ۱۲۳: | خط ۱۱۸: | ||
"fa/f/fc/Button_super_tool.png", | "fa/f/fc/Button_super_tool.png", | ||
"ابرابزار", | "ابرابزار", | ||
"ابرابزار" | "ابرابزار"); | ||
/* ابرابزار مخصوص صفحه انتقال */ | /* ابرابزار مخصوص صفحه انتقال */ | ||
var EE_STool_move = buttonHTMLGenerator( | |||
"applyOnSelection(SuperTool_move)", | "applyOnSelection(SuperTool_move)", | ||
"ابرابزار", | "ابرابزار", | ||
| خط ۱۳۳: | خط ۱۲۷: | ||
"fa/f/fc/Button_super_tool.png", | "fa/f/fc/Button_super_tool.png", | ||
"ابرابزار", | "ابرابزار", | ||
"ابرابزار" | "ابرابزار"); | ||
/* ابزار املا */ | /* ابزار املا */ | ||
var EE_Dictation = buttonHTMLGenerator( | |||
"applyOnSelection(ZWNJ_Dictation)", | "applyOnSelection(ZWNJ_Dictation)", | ||
"اصلاح املا", | "اصلاح املا", | ||
| خط ۱۴۳: | خط ۱۳۶: | ||
"commons/a/a3/Button_Dictation-fa.png", | "commons/a/a3/Button_Dictation-fa.png", | ||
"املا", | "املا", | ||
"املا" | "املا"); | ||
/* اصلاحات نقطهگذاری */ | /* اصلاحات نقطهگذاری */ | ||
var EE_Punc = buttonHTMLGenerator( | |||
"applyOnSelection(Punctuation)", | "applyOnSelection(Punctuation)", | ||
"اصلاح سجاوندی", | "اصلاح سجاوندی", | ||
| خط ۱۵۷: | خط ۱۴۹: | ||
// Buttons that add tags | // Buttons that add tags | ||
/* برچسب ویکیسازی */ | /* برچسب ویکیسازی */ | ||
var EE_Wikify = buttonHTMLGenerator( | |||
"void(document.getElementById('wpTextbox1').value='{{ویکیسازی}}\\n'+document.getElementById('wpTextbox1').value)", | "void(document.getElementById('wpTextbox1').value='{{ویکیسازی}}\\n'+document.getElementById('wpTextbox1').value)", | ||
"برچسب ویکیسازی", | "برچسب ویکیسازی", | ||
| خط ۱۶۳: | خط ۱۵۵: | ||
"fa/3/38/Button_wikify.png", | "fa/3/38/Button_wikify.png", | ||
"برچسب ویکیسازی", | "برچسب ویکیسازی", | ||
"ویکیسازی" | "ویکیسازی"); | ||
/* بدون منبع */ | /* بدون منبع */ | ||
var EE_NoS = buttonHTMLGenerator( | |||
"void(document.getElementById('wpTextbox1').value='{{بدون منبع}}\\n'+document.getElementById('wpTextbox1').value)", | "void(document.getElementById('wpTextbox1').value='{{بدون منبع}}\\n'+document.getElementById('wpTextbox1').value)", | ||
"برچسب منبع", | "برچسب منبع", | ||
| خط ۱۷۳: | خط ۱۶۴: | ||
"fa/8/8a/Button_no_source_fa.png", | "fa/8/8a/Button_no_source_fa.png", | ||
"برچسب بدون منبع", | "برچسب بدون منبع", | ||
"بدون منبع" | "بدون منبع"); | ||
/* حذف سریع */ | /* حذف سریع */ | ||
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,'معیار');", | ||
"حذف سریع", | "حذف سریع", | ||
| خط ۱۸۳: | خط ۱۷۳: | ||
"fa/c/c1/Button_delete_vote.png", | "fa/c/c1/Button_delete_vote.png", | ||
"برچسب حذف سریع", | "برچسب حذف سریع", | ||
"حذف سریع" | "حذف سریع"); | ||
/* حذف زماندار */ | /* حذف زماندار */ | ||
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,'معیار')", | ||
"حذف زماندار", | "حذف زماندار", | ||
| خط ۱۹۳: | خط ۱۸۲: | ||
"commons/3/3f/Button_attendre.png", | "commons/3/3f/Button_attendre.png", | ||
"برچسب حذف زماندار", | "برچسب حذف زماندار", | ||
"حذف زماندار" | "حذف زماندار"); | ||
/* منبع تصویر نامعلوم */ | /* منبع تصویر نامعلوم */ | ||
var EE_PicSource = buttonHTMLGenerator( | |||
"document.getElementById('wpTextbox1').value='{{منبع تصویر نامعلوم}}\\n'+document.getElementById('wpTextbox1').value", | "document.getElementById('wpTextbox1').value='{{منبع تصویر نامعلوم}}\\n'+document.getElementById('wpTextbox1').value", | ||
"برچسب منبع", | "برچسب منبع", | ||
| خط ۲۰۳: | خط ۱۹۱: | ||
"fa/5/59/Button_image_source.png", | "fa/5/59/Button_image_source.png", | ||
"برچسب منبع تصویر نامعلوم", | "برچسب منبع تصویر نامعلوم", | ||
"منبع تصویر نامعلوم" | "منبع تصویر نامعلوم"); | ||
/* حق تکثیر تصویر نامعلوم */ | /* حق تکثیر تصویر نامعلوم */ | ||
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( | |||
"void(document.getElementById('wpTextbox1').value='{{تمیزکاری}}\\n'+document.getElementById('wpTextbox1').value);", | "void(document.getElementById('wpTextbox1').value='{{تمیزکاری}}\\n'+document.getElementById('wpTextbox1').value);", | ||
"برچسب تمیزکاری", | "برچسب تمیزکاری", | ||
| خط ۲۲۳: | خط ۲۰۹: | ||
"commons/2/2e/Button_broom.png", | "commons/2/2e/Button_broom.png", | ||
"برچسب تمیزکاری", | "برچسب تمیزکاری", | ||
"تمیزکاری" | "تمیزکاری"); | ||
/* اخطار نگاره */ | /* اخطار نگاره */ | ||
var EE_ImgWarn = buttonHTMLGenerator( | |||
"document.getElementById('wpTextbox1').value='';insertTags('{{جا" + ":اخطار نگاره|','}}','نگاره')", | "document.getElementById('wpTextbox1').value='';insertTags('{{جا" + ":اخطار نگاره|','}}','نگاره')", | ||
"برچسب نگاره", | "برچسب نگاره", | ||
| خط ۲۳۳: | خط ۲۱۸: | ||
"commons/e/ec/Button_aviso.png", | "commons/e/ec/Button_aviso.png", | ||
"اخطار نگاره", | "اخطار نگاره", | ||
"اخطار نگاره" | "اخطار نگاره"); | ||
/* حق تکثیر مشکوک */ | /* حق تکثیر مشکوک */ | ||
var EE_Sus = buttonHTMLGenerator( | |||
"document.getElementById('wpTextbox1').value='{{حق تکثیر مشکوک}}\\n'+document.getElementById('wpTextbox1').value", | "document.getElementById('wpTextbox1').value='{{حق تکثیر مشکوک}}\\n'+document.getElementById('wpTextbox1').value", | ||
"برچسب حق تکثیر", | "برچسب حق تکثیر", | ||
| خط ۲۴۳: | خط ۲۲۷: | ||
"fa/c/c7/Button_Sus.png", | "fa/c/c7/Button_Sus.png", | ||
"برچسب حق تکثیر مشکوک", | "برچسب حق تکثیر مشکوک", | ||
"حق تکثیر مشکوک" | "حق تکثیر مشکوک"); | ||
/* نقض حق تکثیر */ | /* نقض حق تکثیر */ | ||
var EE_CopyR = buttonHTMLGenerator( | |||
"document.getElementById('wpTextbox1').value='';insertTags('{{جا" + ":نقض حق تکثیر|url=','}}','Address')", | "document.getElementById('wpTextbox1').value='';insertTags('{{جا" + ":نقض حق تکثیر|url=','}}','Address')", | ||
"برچسب حق تکثیر", | "برچسب حق تکثیر", | ||
| خط ۲۵۳: | خط ۲۳۶: | ||
"fa/6/6f/Button_CopyR.png", | "fa/6/6f/Button_CopyR.png", | ||
"برچسب نقض حق تکثیر", | "برچسب نقض حق تکثیر", | ||
"نقض حق تکثیر" | "نقض حق تکثیر"); | ||
/* لحن نامناسب */ | /* لحن نامناسب */ | ||
var EE_Tone = buttonHTMLGenerator( | |||
"document.getElementById('wpTextbox1').value='{{لحن نامناسب}}\\n'+ | "document.getElementById('wpTextbox1').value='{{لحن نامناسب}}\\n'+document.getElementById('wpTextbox1').value", | ||
"برچسب لحن", | "برچسب لحن", | ||
false, | false, | ||
| خط ۲۶۸: | خط ۲۴۹: | ||
// Buttons that help with wiki writing | // Buttons that help with wiki writing | ||
/* تغییر جهت */ | /* تغییر جهت */ | ||
var EE_toggleDirection = buttonHTMLGenerator( | |||
"toggleDir(document.getElementById('wpTextbox1'));", | "toggleDir(document.getElementById('wpTextbox1'));", | ||
"", | "", | ||
| خط ۲۷۴: | خط ۲۵۵: | ||
"fa/d/d0/Button_toggle_dir.png", | "fa/d/d0/Button_toggle_dir.png", | ||
"تغییر جهت جعبهٔ ویرایش", | "تغییر جهت جعبهٔ ویرایش", | ||
"تغییرجهت" | "تغییرجهت"); | ||
/* پیوند درونی */ | /* پیوند درونی */ | ||
var EE_wikilink = buttonHTMLGenerator( | |||
"insertTags('[[',']]','مقاله');", | "insertTags('[[',']]','مقاله');", | ||
"", | "", | ||
| خط ۲۸۴: | خط ۲۶۴: | ||
"fa/d/d0/Button_in_wikify.png", | "fa/d/d0/Button_in_wikify.png", | ||
"پیوند", | "پیوند", | ||
"پیوند" | "پیوند"); | ||
/* متن خطخورده */ | /* متن خطخورده */ | ||
var EE_StrikeTextButton = buttonHTMLGenerator( | |||
"insertTags('<s>','</s>','متن خط خورده')", | "insertTags('<s>','</s>','متن خط خورده')", | ||
"", | "", | ||
| خط ۲۹۴: | خط ۲۷۳: | ||
"commons/c/c9/Button_strike.png", | "commons/c/c9/Button_strike.png", | ||
"متن خطخورده", | "متن خطخورده", | ||
"متن خطخورده" | "متن خطخورده"); | ||
/* نگارخانه */ | /* نگارخانه */ | ||
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|شرح')", | ||
"", | "", | ||
| خط ۳۰۴: | خط ۲۸۲: | ||
"fa/1/12/Button_gallery.png", | "fa/1/12/Button_gallery.png", | ||
"نگارخانه", | "نگارخانه", | ||
"نگارخانه" | "نگارخانه"); | ||
/* توضیح */ | /* توضیح */ | ||
var EE_CommentButton = buttonHTMLGenerator( | |||
"insertTags('<!--','-->','توضیح')", | "insertTags('<!--','-->','توضیح')", | ||
"", | "", | ||
| خط ۳۱۴: | خط ۲۹۱: | ||
"commons/3/34/Button_hide_comment.png", | "commons/3/34/Button_hide_comment.png", | ||
"توضیح", | "توضیح", | ||
"توضیح" | "توضیح"); | ||
/* ملزومات مقاله */ | /* ملزومات مقاله */ | ||
var EE_AddEssentialThings = buttonHTMLGenerator( | |||
"insertTags('== جستارهای وابسته ==\\n\\n== منابع ==\\n{{پانویس}}','','')", | "insertTags('== جستارهای وابسته ==\\n\\n== منابع ==\\n{{پانویس}}','','')", | ||
"", | "", | ||
| خط ۳۲۴: | خط ۳۰۰: | ||
"commons/e/ef/Add_note.jpg", | "commons/e/ef/Add_note.jpg", | ||
"ملزومات مقاله", | "ملزومات مقاله", | ||
"ملزومات مقاله" | "ملزومات مقاله"); | ||
/* خوشامدید */ | /* خوشامدید */ | ||
var EE_Welcome = buttonHTMLGenerator( | |||
"insertTags('{{جا" + ":خوشامدید|~~" + "~~}}','','')", | "insertTags('{{جا" + ":خوشامدید|~~" + "~~}}','','')", | ||
"خوشامدگویی", | "خوشامدگویی", | ||
| خط ۳۳۴: | خط ۳۰۹: | ||
"commons/4/4a/Smilies_Alien_cool.png", | "commons/4/4a/Smilies_Alien_cool.png", | ||
"خوشامدگویی", | "خوشامدگویی", | ||
"خوشامد" | "خوشامد"); | ||
/* چپچین */ | /* چپچین */ | ||
var EE_ChapChin = buttonHTMLGenerator( | |||
"insertTags('{{چپچین}}\\n','\\n{{پایان چپچین}}','متن چپچینشده')", | "insertTags('{{چپچین}}\\n','\\n{{پایان چپچین}}','متن چپچینشده')", | ||
"", | "", | ||
| خط ۳۴۴: | خط ۳۱۸: | ||
"en/e/ea/Button_align_left.png", | "en/e/ea/Button_align_left.png", | ||
"چپچینکردن متن", | "چپچینکردن متن", | ||
"چپچین" | "چپچین"); | ||
/* سرخط */ | /* سرخط */ | ||
var EE_SareSatr = buttonHTMLGenerator( | |||
"insertTags('<br />','','')", | "insertTags('<br />','','')", | ||
"", | "", | ||
| خط ۳۵۴: | خط ۳۲۷: | ||
"en/1/13/Button_enter.png", | "en/1/13/Button_enter.png", | ||
"سرخط", | "سرخط", | ||
"سرخط" | "سرخط"); | ||
/* اندیس بالا */ | /* اندیس بالا */ | ||
var EE_UpperText = buttonHTMLGenerator( | |||
"insertTags('<sup>','</sup>','اندیس')", | "insertTags('<sup>','</sup>','اندیس')", | ||
"", | "", | ||
| خط ۳۶۴: | خط ۳۳۶: | ||
"en/8/80/Button_upper_letter.png", | "en/8/80/Button_upper_letter.png", | ||
"اندیس بالا", | "اندیس بالا", | ||
"اندیس بالا" | "اندیس بالا"); | ||
/* اندیس پایین */ | /* اندیس پایین */ | ||
var EE_LowerText = buttonHTMLGenerator( | |||
"insertTags('<sub>','</sub>','اندیس')", | "insertTags('<sub>','</sub>','اندیس')", | ||
"", | "", | ||
| خط ۳۷۷: | خط ۳۴۸: | ||
/* تغییرمسیر */ | /* تغییرمسیر */ | ||
var EE_RedirectButton = buttonHTMLGenerator( | |||
"document.getElementById('wpTextbox1').value='';insertTags('#تغییرمسیر [[',']]','پیوند')", | "document.getElementById('wpTextbox1').value='';insertTags('#تغییرمسیر [[',']]','پیوند')", | ||
"", | "", | ||
| خط ۳۸۳: | خط ۳۵۴: | ||
"en/c/c8/Button_redirect.png", | "en/c/c8/Button_redirect.png", | ||
"تغییرمسیر", | "تغییرمسیر", | ||
"تغییرمسیر" | "تغییرمسیر"); | ||
/* سال میلادی */ | /* سال میلادی */ | ||
var EE_GregYear = buttonHTMLGenerator( | |||
"insertTags('[[',' (میلادی)|'+']]','سال')", | "insertTags('[[',' (میلادی)|'+']]','سال')", | ||
"", | "", | ||
| خط ۳۹۳: | خط ۳۶۳: | ||
"fa/a/a7/Button_cal.png", | "fa/a/a7/Button_cal.png", | ||
"سال میلادی", | "سال میلادی", | ||
"میلادی" | "میلادی"); | ||
/* کد */ | /* کد */ | ||
var EE_CodeButton = buttonHTMLGenerator( | |||
"insertTags('<code>','</code>','کد')", | "insertTags('<code>','</code>','کد')", | ||
"", | "", | ||
| خط ۴۰۳: | خط ۳۷۲: | ||
"fa/2/23/Button_code.png", | "fa/2/23/Button_code.png", | ||
"برچسب کد", | "برچسب کد", | ||
"کد" | "کد"); | ||
/* مرتبسازی */ | /* مرتبسازی */ | ||
var EE_sorttext = buttonHTMLGenerator( | |||
"applyOnSelection(SortText)", | "applyOnSelection(SortText)", | ||
"", | "", | ||
| خط ۴۱۳: | خط ۳۸۱: | ||
"fa/3/33/Button_sort.png", | "fa/3/33/Button_sort.png", | ||
"مرتبسازی بر اساس الفبا", | "مرتبسازی بر اساس الفبا", | ||
"مرتبسازی" | "مرتبسازی"); | ||
/* شد! */ | /* شد! */ | ||
var EE_shod = buttonHTMLGenerator( | |||
"void(document.getElementById('wpTextbox1').value=document.getElementById('wpTextbox1').value+'\n:{{شد}} ~~" + "~~')", | "void(document.getElementById('wpTextbox1').value=document.getElementById('wpTextbox1').value+'\n:{{شد}} ~~" + "~~')", | ||
"شد", | "شد", | ||
| خط ۴۲۳: | خط ۳۹۰: | ||
"commons/5/5b/Button_check.png", | "commons/5/5b/Button_check.png", | ||
"شد", | "شد", | ||
"شد" | "شد"); | ||
var | // Default configuartion | ||
var EE_Spacer = " "; | |||
var EE_NewRow = "<br />"; | |||
if (mw.config.get('wgUserGroups').indexOf('autoconfirmed') === -1) { | if (mw.config.get('wgUserGroups').indexOf('autoconfirmed') === -1) { | ||
// only 'autoconfirmed' users | // 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 () { | $(function () { | ||
if ($("#wpTextbox1").length !== 0) { | if ($("#wpTextbox1").length !== 0) { | ||
$("< | $("<tooly />").html(ExtraEditButtons).insertBefore("#wpTextbox1"); | ||
} | } | ||
}); | |||
$(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.push("));");
}
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).insertBefore("#wpTextbox1");
}
});
$(function () {
if ($("#movepage")) {
var ButtonsHTML = "<span>" + ExtraMoveButtons + "</span>";
$(ButtonsHTML).insertAfter("#wpNewTitleMain");
}
});
//}());