सदस्य:Mayur/transliterationtool.js

विकिपुस्तक से

ध्यान दें: प्रकाशित करने के बाद बदलाव देखने के लिए आपको अपने ब्राउज़र के कैश को हटाना पड़ सकता है।

  • Firefox/Safari: Reload क्लिक समय Shift दबाएँ, या फिर Ctrl-F5 या Ctrl-R दबाएँ (Mac पर ⌘-R)
  • Google Chrome: Ctrl-Shift-R दबाएँ (Mac पर ⌘-Shift-R)
  • Internet Explorer/Edge: Refresh पर क्लिक करते समय Ctrl दबाएँ, या Ctrl-F5 दबाएँ
  • Opera: Ctrl-F5 दबाएँ।
/**
 * Beginning of Transliteration Tool
 * @authors: Junaid P V ([[user:Junaidpv]])
 * @Maintainer: Mayur ([[user:Mayur]])

 */
function addCheckBoxToSimpleSearch() {
	//To add "देवनागरी" transliteration tool
	//********************* देवनागरी **********************************
	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=".5em";
	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="-4.5em"
	 
	var linktohelp = document.createElement ('a')
        linktohelp.href= "http://hi.wikipedia.org/wiki/विकिपीडिया:देवनागरी_में_कैसे_टाइप_करें";
        linktohelp.title= "Phonetic Roman-to-Devanagari: Ctrl + M";
        linktohelp.appendChild( document.createTextNode('देवनागरी') );
	chkboxlabel.appendChild(linktohelp);
	chkboxlabel.appendChild(document.createElement('br'));
	firstone.insertBefore(chkboxelement,nextone);
	firstone.insertBefore(chkboxlabel,nextone);
	firstone.style.position ="relative";
	//firstone.style.top="-1.6em";
	}
	catch(ex)
	{
	//finished script written by junaid and sajid from malayalam wiki(thanks to them)
	}
	 
	}
	//************************* end of script ****************************
}
importScript('User:Mayur/DevnagriRules.js‎');
importScript('User:Mayur/Translit.js‎‎');
$(window).load( function() {
	transliterate('searchInput', 'wpTextbox1', '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');
	CHECKBOX_TEXT = "देवनागरी (Ctrl+M)";
	addTransliterationOption( 'wpSummary', 'searchText', '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('searchInput', 'wpTextbox1', '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 */