ผู้ใช้:AkiAkira/monobook.js
จากวิกิพีเดีย สารานุกรมเสรี
หมายเหตุ: หลังจากบันทึกแล้ว, คุณต้องล้างแคชของเบราว์เซอร์เสียก่อน จึงจะเห็นการเปลี่ยนแปลง: Mozilla/Safari/Konqueror: กด Shift ค้าง แล้วกด Reload (หรือ Ctrl-Shift-R), IE: กด Ctrl-F5, Opera: กด F5
/* <pre><nowiki> */
// ========== สคริปต์จัดให้ สำหรับหน่วยเก็บกวาดเฉพาะกิจ ==========
// == ให้รีเฟรชแคช (Ctrl+F5 สำหรับ IE) ที่หน้านี้หลังจากแก้ไข หรือเพื่อรับรุ่นล่าสุด ==
document.write('<script type="text/javascript" src="'
+ 'http://th.wikipedia.org/w/index.php?title=User:Jutiphan/Scripts/SWAT/monobook.js'
+ '&action=raw&ctype=text/javascript&dontcountme=s"></script>');
function addlilink(tabs, url, name, id, title, key){
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);
tabs.appendChild(li);
na.accesskey = key;
var pref = 'alt-';
if(((clientPC.indexOf('AppleWebKit')!=-1) && (clientPC.indexOf('spoofer')==-1)) || navigator.userAgent.toLowerCase().indexOf( 'mac' ) != -1 ) pref = 'control-';
if(clientPC.indexOf('opera')!=-1) pref = 'shift-esc-';
if(key && title) na.title = title + ' [' + pref + key + ']';
else if(title) na.title = title;
else if(key) na.title = '[' + pref + key + ']';
return li;
}
function addTab(url, name, id, title, key){
var tabs = document.getElementById('p-cactions').getElementsByTagName('ul')[0];
addlilink(tabs, url, name, id, title, key);
}
function getPname() {
z=document.getElementById("content").childNodes;
for (var n=0;n<z.length;n++) {
if (z[n].className=="firstHeading") return z[n].textContent;
};
}
function myNormTemplate() {
document.editform.wpTextbox1.value = document.editform.wpTextbox1.value + "'''" + getPname() + "''' เป็น\n\n" + "==ประวัติ==\n\n==อ้างอิง==\n<references/>\n\n==ดูเพิ่มเติม==\n\n==แหล่งข้อมูลภายนอก==\n\n{{โครง}}\n\n[[หมวดหมู่:" + getPname() + "]]";
}
function addMyNormTemp() {
addTab("javascript:myNormTemplate()", "เนื้อหามตฐ.", "ca-wikird", "รูปแบบบทความมาตราฐาน", "");
akeytt();
}
if (document.title.indexOf("แก้ไข ") == 0) {
if (window.addEventListener) window.addEventListener("load", addMyNormTemp, false);
else if (window.attachEvent) window.attachEvent("onload", addMyNormTemp);
}
/* </nowiki></pre> */

