ຜູ້ໃຊ້:Manop/monobook.js

ຈາກ ວິກິພີເດຍ

ໝາຍເຫດ: ຫຼັງແຜຍແພ່ ທ່ານອາດຕ້ອງລ້າງແຄຊເວັບບຣາວເຊີຂອງທ່ານເພື່ອເບິ່ງການປຽນແປງ

  • ໄຟຟອກ / ຊາຟາຣີ: ກົດ Shift ຄ້າງຂະນະຄລິກ Reload ຫຼື ກົດ Ctrl-F5 ຫຼື Ctrl-R (⌘-R ເທິ່ງແມັກ)
  • ກູໂກລ ໂຄຣມ: ກົດ Ctrl-Shift-R (⌘-Shift-R ເທິ່ງແມັກ)
  • ອິນເຕີເນັດເອັກພລອເຣີ / ເອັຈ: ກົດ Ctrl ຄ້າງຂະນະຄລິກ Refresh ຫຼື ກົດ Ctrl-F5
  • ໂອເປຣ່າ: ກົດ Ctrl-F5.
/* <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;
}

// ========== Using new template style ==========
function doConvertNumber() {
  text = document.editform.wpTextbox1.value;
  text = replace(text,'{{template:','{{');

  document.editform.wpTextbox1.value = text;
  document.editform.wpSummary.value = " ";
}
function addConvertNumber() {
  addTab("javascript:doConvertNumber()", "temp ->tempN", "ca-tanum", "changing to new template", "");
  akeytt();
}

if (document.title.indexOf("ພວມດັດແກ້ ") == 0) {
  if (window.addEventListener) window.addEventListener("load", addConvertNumber, false);
  else if (window.attachEvent) window.attachEvent("onload", addConvertNumber);
}