User:Mxn/monobook.js
From Meta, a Wikimedia project coordination wiki
< User:Mxn
Note: After saving, you may have to bypass your browser's cache to see the changes. Mozilla / Firefox / Safari: hold down Shift while clicking Reload, or press Ctrl-Shift-R (Cmd-Shift-R on Apple Mac); IE: hold Ctrl while clicking Refresh, or press Ctrl-F5; Konqueror: simply click the Reload button, or press F5; Opera users may need to completely clear their cache in Tools→Preferences.
/*<pre>*/ function addLoadEvent(func) { if (window.addEventListener) window.addEventListener("load", func, false); else if (window.attachEvent) window.attachEvent("onload", func); } /* HIM - see [[:vi:Wikipedia:Gõ tiếng Việt]] */ document.write('<script type="text/javascript" src="http://meta.wikimedia.org/w/index.php?title=User:Mxn/him.js&action=raw&ctype=text/javascript&dontcountme=s"></script>'); var radio = true, runHIM = true; function HIM() { if (runHIM) { elCC = document.getElementById('p-tb'); if (elCC != null) { if (radio) { HIMHTML = '<div class="portlet"><h5><a href="http://vi.wikipedia.org/wiki/Wikipedia:Gõ_tiếng_Việt" class="extiw" title="vi:Wikipedia:Gõ tiếng Việt">Gõ tiếng Việt</a></h5><div class="pBody">'; HIMHTML += '<input id="him_auto" name="viet_method" type="radio" onclick="setMethod(0);"' + (method == 0 && on_off==1?'CHECKED':'') + '/> <label class="radio" for="him_auto">Tự động</label> <small>[F9]</small><br />'; HIMHTML += '<input id="him_telex" name="viet_method" type="radio" onclick="setMethod(1);"' + (method == 1 && on_off==1?'CHECKED':'') + ' /> <label class="radio" for="him_telex">Telex</label> <a href="http://vi.wikipedia.org/wiki/Telex#Quy_.C6.B0.E1.BB.9Bc_telex" class="extiw" title="vi:Telex#Quy ước telex" style="font-size: smaller">(?)</a><br />'; HIMHTML += '<input id="him_vni" name="viet_method" type="radio" onclick="setMethod(2);"' + (method == 2 && on_off==1?'CHECKED':'') + ' /> <label class="radio" for="him_vni">VNI</label> <a href="http://vi.wikipedia.org/wiki/VNI#Quy_.C6.B0.E1.BB.9Bc" class="extiw" title="vi:VNI#Quy ước" style="font-size: smaller">(?)</a><br />'; HIMHTML += '<input id="him_viqr" name="viet_method" type="radio" onclick="setMethod(3);"' + (method == 3 && on_off==1?'CHECKED':'') + ' /> <label class="radio" for="him_viqr">VIQR</label> <a href="http://vi.wikipedia.org/wiki/VIQR" class="extiw" title="vi:VIQR" style="font-size: smaller">(?)</a><br />'; HIMHTML += '<input id="him_viqr2" name="viet_method" type="radio" onclick="setMethod(4);"' + (method == 4 && on_off==1?'CHECKED':'') + ' /> <label class="radio" for="him_viqr2">VIQR*</label><br />'; HIMHTML += '<input id="him_off" name="viet_method" type="radio" onclick="setMethod(-1);"' + (on_off==0?'CHECKED':'') + ' /> <label class="radio" for="him_off">Tắt</label> <small>[F12]</small><hr />'; HIMHTML += '<input id="him_daucu" name="viet_method" type="checkbox" onclick="setDauCu(this);"' + (dauCu == 1?'CHECKED':'') + ' /> <label class="radio" for="him_daucu">Bỏ dấu kiểu cũ</label> <small>[F7]</small><br />'; HIMHTML += '<input id="him_ckspell" name="viet_method" type="checkbox" onclick="setSpell(this);"' + (dockspell == 1?'CHECKED':'') + ' /> <label class="radio" for="him_ckspell">Đúng chính tả</label> <small>[F8]</small></div></div>'; elCC.innerHTML = HIMHTML + elCC.innerHTML; } if(useCookie==1) { setCookie=doSetCookie; getCookie=doGetCookie } else { setCookie=noCookie; getCookie=noCookie } setCookie(); if(support) statusMessage(); runHIM = false; } else { setTimeout("HIM()", 20); } } return true; } HIM(); function stopHIM() { HIM(); if (runHIM) { if(useCookie==1) { setCookie=doSetCookie; getCookie=doGetCookie } else { setCookie=noCookie; getCookie=noCookie } setCookie(); if(support) statusMessage(); runHIM=false; } } addLoadEvent(stopHIM); /* Vietnamese Input Method - Wikipedia tiếng Việt */ method = 3; on_off = 0; dauCu = 1; /* [[w:Wikipedia:WikiProject User scripts/Scripts/addLink|addLink]] */ function addLink(where, url, name, id, title, key, after) { //* where is the id of the toolbar where the button should be added; // i.e. one of "p-cactions", "p-personal", or "p-navigation". //* url is the URL which will be called when the button is clicked. // javascript: urls can be used to do more complex things. //* name is what will appear as the name of the button. //* id is the id of the button; it's best to define one. // Use a prefix to make sure its unique. Optional. //* title is the tooltip title that gives a longer description // of the button; if you define a accesskey, mention it here. Optional. //* key is the char you want for the accesskey. Optional. //* after is the id of the button you want to follow this one. Optional. var na = document.createElement('a'); na.href = url; na.appendChild(document.createTextNode(name)); var li = document.createElement('li'); if(id) li.id = id; li.appendChild(na); var tabs = document.getElementById(where).getElementsByTagName('ul')[0]; if(after) { tabs.insertBefore(li,document.getElementById(after)); } else { tabs.appendChild(li); } if(id) { if(key && title) { ta[id] = [key, title]; } else if(key) { ta[id] = [key, '']; } else if(title) { ta[id] = ['', title];} } // re-render the title and accesskeys from existing code in wikibits.js akeytt(); return li; } /* [[w:Wikipedia:WikiProject User scripts/Scripts/Add purge to tabs|addPurge]] */ function AddPurge () { var x = document.getElementById('ca-history'); if(!x) return; if(x.children) x = x.children[0].href; else x = x.childNodes[0].href; addLink("p-cactions", x.replace(/=history/, "=purge"), 'Purge', 'ca-purge', 'Purge the internal cache for this page', 0); } addLoadEvent(AddPurge); /*</pre>*/