User:Mandards/monobook.js

// //============================================================ // en: ADD SOME EXTRA BUTTONS TO THE EDITPANEL // de: FÜGE NEUE BUTTON IN DIE WERKZEUGLEISTE //============================================================ // Vorschläge für neue Buttons werden gerne entgegengenommen // Die Reihenfolge und Anzahl der Buttons ist über die (alphabetische) Variable XEBOrder wählbar. if (typeof XEBOrder == 'undefined') // can be modified XEBOrder="A,B,D,C,D1,F,U,S,I1,I2,J1,E,G,Q,W,X,K,L,M,H,O,R,T,V"; if (XEBOrder == 'all') XEBOrder="A,B,D,C,D1,F,U,S,I1,I2,J1,E,G,Q,W,X,K,L,M,H,O,R,T,V,FS,J2,N,P,P1,R1,R2,R3,R4,T1,Y1,Y2,Z,AI"; //fills the variable mwCustomEditButtons (s. function in /wikibits.js), with buttons for the Toolbar function addCustomButton(imageFile, speedTip, tagOpen, tagClose, sampleText){ mwCustomEditButtons.push({ "imageFile": imageFile,  "speedTip": speedTip,  "tagOpen": tagOpen,  "tagClose": tagClose,  "sampleText": sampleText}); } var Isrc='http://upload.wikimedia.org/wikipedia/commons/'; var BDict={ 'A':['e/e9/Button_headline2.png','दुय्यम मथळा','\n===','===','Secondary headline'], 'B':['1/13/Button_enter.png','नवीन ओळ',' ',,], 'C':['5/5f/Button_center.png','Center',' \n','\n<\/div>','Centred text'], 'D':['e/ea/Button_align_left.png','Left-Align',' \n','\n<\/div>','Left-aligned text'], 'D1':['a/a5/Button_align_right.png','Right-Align',' \n','\n<\/div>','Right-aligned text'], 'E':['0/04/Button_array.png','तक्ता','\n{| class="wikitable" \n|- \n| 1 || 2\n|- \n| 3 || 4','\n|}\n',''], 'F':['1/1e/Button_font_color.png','रंगीत मजकूर','Coloured text<\/span>','ColourName'], 'FS':['1/1b/Button_miss_signature.png','Unsigned post',,,'user name or IP'], 'G':, 'H':['7/74/Button_comment.png','Comment',"",'Comment'], 'I1':['6/6a/Button_sup_letter.png','Superscript',' ','<\/sup>','Superscript text'], 'I2':['a/aa/Button_sub_letter.png','Subscript',' ','<\/sub>','Subscript text'], 'J1':['5/58/Button_small.png','लहान आकाराचा मजकूर',' ','<\/small>','Small Text'], 'J2':['5/56/Button_big.png','मोठ्या आकाराचा मजकूर',' ','<\/big>','Big text'], 'K':['b/b4/Button_category03.png','Category',"वर्ग:","",'Category name'], 'L':['8/8e/Button_shifting.png','Insert tab(s)',':','',':'], 'M':['f/fd/Button_blockquote.png','Insert block of quoted text','\n','\n<\/blockquote>','Block quote'], 'N':['4/4b/Button_nbsp.png','nonbreaking space',' ',,], 'O':['2/23/Button_code.png','Insert code',' ','<\/code>','Code'], 'P':['3/3c/Button_pre.png','Pre formatted Text',' ','<\/pre>','Pre formatted text'], 'P1':['9/93/Button_sub_link.png','Insert link to sub-page','','/Sub_Page','Page'], 'Q':['d/d3/Button_definition_list.png','Insert definition list','\n; ','\n: Item 1\n: Item 2','Definition'], 'R':['7/79/Button_reflink.png','Insert a reference',' ','Reference material'], 'R3':['2/28/Button_reflink_advanced_3.gif','No reference material',,'"/>',], 'R4':['9/9a/Button_references.png','Reference footer',"\n==Notes==\n\n\n \n ",,], 'S':['c/c9/Button_strike.png','काट मारलेला मजकूर',' ','<\/s>','Struck out text'], 'T':['e/eb/Button_plantilla.png','वर्गीकरण','','Template name'], 'T1':['3/30/Tt_icon.png','Teletype text','','<\/tt>','Teletype Text'], 'U':['f/fd/Button_underline.png','अधोरेखित मजकूर'," ","<\/u>",'Underlined text'], 'V':['c/c8/Button_redirect.png','पुनर्निर्देशन',"#REDIRECT ","",'Article Name'], 'W':['8/88/Btn_toolbar_enum.png','Numbering',"\n# ","\n# Element 2\n# Element 3",'Element 1'], 'X':['1/11/Btn_toolbar_liste.png','यादी',"\n* ","\n* Element B\n* Element C",'Element A'], 'Y1':['c/ce/Button_no_include.png','No Include'," ","<\/noinclude>",'Text'], 'Y2':['7/79/Button_include.png','Include only'," ","<\/includeonly>",'Text'], 'Z':['3/35/Button_substitute.png','Substitute',"",'Template'], 'AI': } XEBOrder=XEBOrder.split(","); for (var b in XEBOrder) { var bc = BDict[XEBOrder[b]]; addCustomButton(Isrc+bc[0],bc[1],bc[2],bc[3],bc[4]) } // /* मुखपृष्ठावर "लेख"च्या जागी मुखपृष्ठ दिसण्यासाठी जावास्क्रीप्ट */ var mpTitle = "मुखपृष्ठ"; var isMainPage = (document.title.substr(0, document.title.lastIndexOf(" - ")) == mpTitle); var isDiff = (document.location.search && (document.location.search.indexOf("diff=") != -1 || document.location.search.indexOf("oldid=") != -1)); if (isMainPage && !isDiff) { document.write('/*<![CDATA[*/ #siteSub, #contentSub, h1.firstHeading { visibility:visible !important; } /*]]>*/ '); } //Main page tab no longer says article function mainpg { if ((isMainPage || /[\/=:]Main_Page/.test(document.location)) && document.getElementById('ca-nstab-main')) { document.getElementById('ca-nstab-main').firstChild.innerHTML = 'मुखपृष्ठ'; }  } addOnloadHook(mainpg); //the section below adds a phonetic keyboard document.write(' '); function addLoadEvent(func) {  if (window.addEventListener) window.addEventListener("load", func, false); else if (window.attachEvent) window.attachEvent("onload", func); } function addTranslit(editForm, textBox) {  checkrt(editForm); if (textBox.addEventListener) textBox.addEventListener("keypress", processKeys, false); else if (textBox .attachEvent) textBox.attachEvent("onkeypress", processKeys); } function addTextEvent { //cookie for remembering transliteration choice if(new_getCookie('newWikiTranslit')!=null && new_getCookie('newWikiTranslit')!="") realTime=(new_getCookie('newWikiTranslit')=="true")?true:false; // add transliteration feature to main edit box var editForm =document.getElementById('editform'); if(editForm != null) { var textBox=document.getElementById('wpTextbox1'); var textSummary = document.getElementById('wpSummary'); addTranslit(editForm,textBox); addCheckbox(editForm,textBox ); if(textSummary) { addTranslit(editForm,textSummary); } }  // add transliteration feature to search form var searchForm = document.getElementById('searchform'); if( searchForm != null ) { try { var searchBox = document.getElementById('searchInput'); // add IME checkbox control to searchForm if (searchBox != null || searchForm != null) { var element = document.createElement("input"); element.setAttribute("type","checkbox"); element.setAttribute("id","sbrealtime"); if (element.addEventListener) element.addEventListener("click", rtClick, false); else if (element.attachEvent) element.attachEvent("onclick", rtClick); // var labelcheckBox = document.createTextNode('देवनागरी'); var chkSpan = document.createElement("span"); chkSpan.setAttribute("id","spnRealtime"); var searchBody = document.getElementById('searchBody'); searchBody.appendChild(element); searchBody.appendChild(chkSpan); // searchForm.insertBefore(element,searchBox); document.getElementById("sbrealtime").checked = realTime; document.getElementById('spnRealtime').innerHTML = 'देवनागरी'; // searchForm.insertBefore(chkSpan,searchBox); // var p = document.createElement("p"); // p.setAttribute("style","width:100%;height:1px;"); // searchForm.insertBefore(p,searchBox); }			 }			 catch(ex) {			 //ऎऱऱिनॆ ओटिक्कुक. }			 if(searchBox) { addTranslit(searchForm,searchBox); } }               // add transliteration feature to power search var powerSearchForm = document.getElementById('search'); if( powerSearchForm != null) { var powerSearchBox = document.getElementById('lsearchbox'); if( powerSearchBox ) { addTranslit(powerSearchForm, powerSearchBox );} }  // add transliteration feature to move page var movePageForm = document.getElementById('movepage'); if( movePageForm != null ) { var newTitleBox = document.getElementById('wpNewTitle'); var reasonBox = document.getElementById('wpReason'); if( newTitleBox ) {addTranslit(movePageForm, newTitleBox);} if( reasonBox ) {addTranslit(movePageForm, reasonBox ); } }  // add transliteration feature to upload feature page var upForm=document.getElementById('upload'); if(upForm) {     var upName=document.getElementById('wpDestFile'); var upComment=document.getElementById('wpUploadDescription'); if(upName) addTranslit(upForm,upName); if(upComment) addTranslit(upForm,upComment); }  // add transliteration feature to create inputbox var crForm=document.getElementById('createbox'); if(crForm) {     var crName=crForm.title; if(crName) addTranslit(crForm,crName); } } function addCheckbox(editform,textBox ) {  var element = document.createElement("input"); element.setAttribute("type","checkbox"); element.setAttribute("id","realtime"); if (element.addEventListener) element.addEventListener("click", rtClick, false); else if (element.attachEvent) element.attachEvent("onclick", rtClick); var ellabel = document.createElement("label"); //ellabel.setAttribute("for","realtime"); ellabel.setAttribute("id","labelrealtime"); ellabel.innerHTML = 'देवनागरीत लिहीण्यासाठी डावीकडील डबीत टिचकवा.(परीक्षणकाल) लिपी बदलण्यासाठी Esc दाबा, (IE मध्ये Esc नंतर Ctrl+z दाबा.)'; editform.insertBefore(element,textBox); document.getElementById("realtime").checked = realTime; //editform.insertBefore(labelcheckBox,textBox); editform.insertBefore(ellabel,textBox); document.getElementById("labelrealtime").htmlFor = "realtime"; } function processKeys(event) {  if (rtsupported) {    if (event.keyCode == 27) // ESC  - for ie, Press ctrl+z after pressing ESC {       //escape to toggle realTime = !realTime; new_setCookie('newWikiTranslit',realTime,1);//save status in a cookie var chk = document.getElementById('realtime'); if (chk) { chk.checked = realTime; } return false; }    else if (realTime) {      translitonkey(event); }  } } var realTime = true; function rtClick(event) {  realTime = !realTime; new_setCookie('newWikiTranslit',realTime,1);//save status in a cookie } var rtsupported = false; var error; function checkrt(editform) {  try {    /* var nav = navigator.userAgent.toUpperCase; rtsupported = (nav.indexOf("GECKO") >= 0 || nav.indexOf("OPERA") >= 0 || nav.indexOf("SAFARI") >= 0); */    rtsupported = (document.selection != undefined) if (!rtsupported) {      var element = document.createElement("TEXTAREA"); editform.appendChild(element); if(element.selectionStart != undefined) rtsupported = true; editform.removeChild(element); }  }   catch (error) {} } // function to handle cookies function new_getCookie(cookieName) {   if (document.cookie.length>0) {       cookieStart=document.cookie.indexOf(cookieName + "="); if (cookieStart!=-1) {            cookieStart=cookieStart + cookieName.length+1; cookieEnd=document.cookie.indexOf(";",cookieStart); if (cookieEnd==-1) cookieEnd=document.cookie.length; return unescape(document.cookie.substring(cookieStart,cookieEnd)); }     }    return ""; } function new_setCookie(cookieName,value,expiredays) {  var exdate=new Date; exdate.setDate(exdate.getDate+expiredays); document.cookie=cookieName+ "=" +escape(value)+"; path=/"+ ((expiredays==null) ? "" : "; expires="+exdate.toGMTString); } addLoadEvent(addTextEvent)