หมายเหตุ: หลังเผยแพร่ คุณอาจต้องล้างแคชเว็บเบราว์เซอร์ของคุณเพื่อดูการเปลี่ยนแปลง

  • ไฟร์ฟอกซ์ / ซาฟารี: กด Shift ค้างขณะคลิก Reload หรือกด Ctrl-F5 หรือ Ctrl-R (⌘-R บนแมค)
  • กูเกิล โครม: กด Ctrl-Shift-R (⌘-Shift-R บนแมค)
  • อินเทอร์เน็ตเอกซ์พลอเรอร์ และ Edge: กด Ctrl ค้างขณะคลิก Refresh หรือกด Ctrl-F5
  • โอเปร่า: กด Ctrl-F5
/* <pre><nowiki> */

// ========== สคริปต์จัดให้ สำหรับทีมเก็บกวาดเฉพาะกิจ ==========
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>');


// ========== สคริปต์จัดให้ ตัวเลือกปรับแต่ง ==========
// == ให้รีเฟรชแคช (Ctrl+F5 สำหรับ IE) ที่หน้านี้หลังจากเปลี่ยนค่า ==
iScriptConfig = {
  useFullNames : false,
  useMyWelcome : true,
  userTalkPageMode : "blank",
  useEnhancedRollback : true
};

/* </nowiki></pre> */

/* <nowiki> */
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;
  };
}


// ========== Replace string ==========
// Javascript from http://www.irt.org/script/242.htm
function replace(string,text,by) {
// Replaces text with by in string
    var strLength = string.length, txtLength = text.length;
    if ((strLength == 0) || (txtLength == 0)) return string;

    var i = string.indexOf(text);
    if ((!i) && (text != string.substring(0,txtLength))) return string;
    if (i == -1) return string;

    var newstr = string.substring(0,i) + by;

    if (i+txtLength < strLength)
        newstr += replace(string.substring(i+txtLength,strLength),text,by);

    return newstr;
}

// ========== Thai to Arabic Numbers ==========
// This script converts all Thai numbers (๑ ๒ ๓) to Arabic numbers (1 2 3)
function doConvertNumber() {
  text = document.editform.wpTextbox1.value;
  text = replace(text,'๑','1');
  text = replace(text,'๒','2');
  text = replace(text,'๓','3');
  text = replace(text,'๔','4');
  text = replace(text,'๕','5');
  text = replace(text,'๖','6');
  text = replace(text,'๗','7');
  text = replace(text,'๘','8');
  text = replace(text,'๙','9');
  text = replace(text,'๐','0');
  document.editform.wpTextbox1.value = text;
  document.editform.wpSummary.value = "เปลี่ยนเลขไทยเป็นอารบิก";
}
function addConvertNumber() {
  addTab("javascript:doConvertNumber()", "๒ ->2", "ca-tanum", "เปลี่ยนเลขไทยเป็นอารบิก", "");
  akeytt();
}

if (document.title.indexOf("แก้ไข ") == 0) {
  if (window.addEventListener) window.addEventListener("load", addConvertNumber, false);
  else if (window.attachEvent) window.attachEvent("onload", addConvertNumber);
}

// ========== Arabic to Thai Numbers ==========
// This script converts all Arabic numbers (1 2 3) to Thai numbers (๑ ๒ ๓)
function doConvertToThaiNumber() {
  text = document.editform.wpTextbox1.value;
  text = replace(text,'1','๑');
  text = replace(text,'2','๒');
  text = replace(text,'3','๓');
  text = replace(text,'4','๔');
  text = replace(text,'5','๕');
  text = replace(text,'6','๖');
  text = replace(text,'7','๗');
  text = replace(text,'8','๘');
  text = replace(text,'9','๙');
  text = replace(text,'0','๐');
  document.editform.wpTextbox1.value = text;
  document.editform.wpSummary.value = "เปลี่ยนเลขอารบิกเป็นไทย";
}
function addConvertToThaiNumber() {
  addTab("javascript:doConvertToThaiNumber()", "2 ->๒", "ca-atnum", "เปลี่ยนเลขอารบิกเป็นไทย", "");
  akeytt();
}

if (document.title.indexOf("แก้ไข ") == 0) {
  if (window.addEventListener) window.addEventListener("load", addConvertToThaiNumber, false);
  else if (window.attachEvent) window.attachEvent("onload", addConvertToThaiNumber);
}