مدیاویکی:Transliterate.js
نکته: پس از انتشار ممکن است برای دیدن تغییرات نیاز باشد که حافظهٔ نهانی مرورگر خود را پاک کنید.
- فایرفاکس / سافاری: کلید Shift را نگه دارید و روی دکمهٔ Reload کلیک کنید، یا کلیدهای Ctrl-F5 یا Ctrl-R را با هم فشار دهید (در رایانههای اپل مکینتاش کلیدهای ⌘-R)
- گوگل کروم: کلیدهای Ctrl+Shift+R را با هم فشار دهید (در رایانههای اپل مکینتاش کلیدهای ⌘-Shift-R)
- اینترنت اکسپلورر/ Edge: کلید Ctrl را نگهدارید و روی دکمهٔ Refresh کلیک کنید، یا کلیدهای Ctrl-F5 را با هم فشار دهید
- اپرا: Ctrl-F5 را بفشارید.
/**
* Beginning of Transliteration Tool
* @Maintainer for fawiki: Reza1615 ([[user:Reza1615]])
* License: GPLv3, CC-BY-SA 3.0
*/
function addCheckBoxToSimpleSearch() {
//To add "farsi" transliteration tool
//********************* farsi **********************************
var firstone =document.getElementById('p-search');
if(firstone!= null) {
try
{
var nextone=document.getElementById('h5');
var chkboxelement = document.createElement("input");
chkboxelement.setAttribute("type","checkbox");
chkboxelement.setAttribute("id","searchInputcb");
chkboxelement.style.position ="relative";
chkboxelement.style.left=".2em";
chkboxelement.style.top="-3.8em";
chkboxelement.value = 'searchInput'; // specifying curresponding input filed.
chkboxelement.checked =true;
if (chkboxelement.addEventListener)
chkboxelement.addEventListener("click", transOptionOnClick, false);
else if (chkboxelement.attachEvent)
chkboxelement.attachEvent("onclick", transOptionOnClick);
var chkboxlabel = document.createElement('chkboxlabel');
chkboxlabel.style.fontSize = '.75em';
chkboxlabel.style.fontWeight = 'bold';
chkboxlabel.style.position ="relative";
chkboxlabel.style.left=".1em";
chkboxlabel.style.top="-4em"
var linktohelp = document.createElement ('a')
linktohelp.href= "http://fa.wiktionary.org/wiki/ویکیواژه:فارسینویسی";
linktohelp.title= "Phonetic Roman-to-farsi: Ctrl + M تایپ با کیبرد لاتین";
linktohelp.appendChild( document.createTextNode('تایپ فارسی با کیبرد لاتین') );
chkboxlabel.appendChild(linktohelp);
chkboxlabel.appendChild(document.createElement('fa'));
firstone.insertBefore(chkboxelement,nextone);
firstone.insertBefore(chkboxlabel,nextone);
firstone.style.position ="relative";
//firstone.style.top="-1.6em";
}
catch(ex)
{
}
}
//************************* end of script ****************************
}
importScript('Mediawiki:FarsiRules.js');
importScript('Mediawiki:Translit.js');
$(document).ready( function() {
transliterate('searchInput', 'wpTextbox1', 'hotcat_text', 'wpSummary', 'mw-wikilove-message', 'wpFilterDescription', 'wpFilterTags', 'wpFilterRules', 'wpFilterNotes', 'wikieditor-toolbar-reference-text', 'mw-upload-form', 'wpDestFile', 'wpUploadDescription', 'emailuser', 'wpSubject', 'searchText', 'powerSearchText', 'wpNewTitle', 'wpReason', 'nsfrom', 'username', 'mwProtect-reason', 'nsto','wpText');
CHECKBOX_TEXT = "تایپ فارسی با کیبرد لاتین (Ctrl+M)";
addTransliterationOption( 'wpSummary', 'hotcat_text', 'searchText', 'mw-wikilove-message', 'powerSearchText', 'wpFilterDescription', 'wpFilterTags', 'wpFilterRules', 'wpFilterNotes', 'wikieditor-toolbar-reference-text', 'mw-upload-form', 'wpDestFile', 'wpUploadDescription', 'emailuser', 'wpSubject', 'wpNewTitle', 'wpReason', 'nsfrom', 'username', 'mwProtect-reason', 'nsto','wpText');
TO_POSITION = "before";
addTransliterationOption( 'wpTextbox1');
addCheckBoxToSimpleSearch();
translitStateSynWithCookie('wpTextbox1','searchInput','hotcat_text', 'mw-wikilove-message', 'wpSummary', 'wpFilterDescription', 'wpFilterTags', 'wpFilterRules', 'wpFilterNotes', 'wikieditor-toolbar-reference-text', 'mw-upload-form', 'wpDestFile', 'wpUploadDescription', 'emailuser', 'wpSubject', 'searchText', 'powerSearchText', 'wpNewTitle', 'wpReason', 'nsfrom', 'username', 'mwProtect-reason', 'nsto','wpText');
});
/* End of Transliteration Tool */