ผู้ใช้:Bebiezaza/กระบะทราย/วิกิพีเดีย:สคริปต์ผู้ใช้
WP:US[แก้]
สคริปต์เครื่องมือ[แก้]
เพิ่มแท็บด้านบน[แก้]
outdated
เพิ่มเมนู เครื่องมือ ด้านซ้าย[แก้]
outdated
อ่านชื่อของหน้านั้น[แก้]
ไม่ต้องมีหรอก
สคริปต์เฉพาะทาง[แก้]
ใส่ข้อความต้องการความช่วยเหลือ[แก้]
ใช้ไม่ได้แล้ว
ควรเปลี่ยนจาก{{ช่วยดูหน่อย}} เป็น {{เก็บกวาด}}
แจ้งโฆษณา[แก้]
ใช้ได้outdated
แจ้งลบ[แก้]
ใช้ได้outdated แต่ใส่เหตุผลไม่ได้
แจ้งละเมิดลิขสิทธิ์[แก้]
ใช้ไม่ได้แล้ว
เก็บกวาดนโยบายเก่า[แก้]
ใช้ไม่ได้แล้ว
สลับเปลี่ยนระหว่างตัวเลขอารบิกกับเลขไทย[แก้]
ใช้ไม่ได้แล้ว ยกเว้น replace string
แก้ย่อหน้าแรกสุด (ย่อหน้าสรุป)[แก้]
ใช้ไม่ได้แล้ว Uncaught ReferenceError: ta is not defined at addEditSection0 (<anonymous>:5:673)
ดูความแตกต่างล่าสุด[แก้]
ใช้ไม่ได้แล้ว
fixed[แก้]
ใส่ข้อความต้องการความช่วยเหลือ -> แจ้งต้องการเก็บกวาด[แก้]
แจ้งโฆษณา[แก้]
แจ้งลบ[แก้]
แจ้งละเมิดลิขสิทธิ์[แก้]
เก็บกวาดนโยบายเก่า[แก้]
สลับเปลี่ยนระหว่างตัวเลขอารบิกกับเลขไทย[แก้]
// ========== 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 = "เปลี่ยนเลขไทยเป็นอารบิก";
}
$(document).ready(function() {
if (mw.config.get('wgAction').indexOf("edit") == 0) mw.util.addPortletLink("p-cactions", "javascript:doConvertNumber()", "๒ ->2", "ca-tanum", "เปลี่ยนเลขไทยเป็นอารบิก");
});
// ========== 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 = "เปลี่ยนเลขอารบิกเป็นไทย";
}
$(document).ready(function() {
if (mw.config.get('wgAction').indexOf("edit") == 0) mw.util.addPortletLink("p-cactions", "javascript:doConvertToThaiNumber()", "2 ->๒", "ca-atnum", "เปลี่ยนเลขอารบิกเป็นไทย");
});
แก้ย่อหน้าแรกสุด (ย่อหน้าสรุป)[แก้]
// ========== Edit Section 0 ==========
$(document).ready(function() {
var x;
if (!(x = document.getElementById('ca-edit') )) return;
var url;
if (!(url = x.getElementsByTagName('a')[0] )) return;
if (!(url = url.href )) return;
if (mw.config.get('skin') != "vector") {
var y = mw.util.addPortletLink('p-cactions', url+"§ion=0", '0', 'ca-edit-0', 'แก้ไขย่อหน้าแรกสุด', '0', x.nextSibling);
y.className = x.className; // steal classes from the the edit tab...
x.className = 'istalk'; // ...and make the edit tab have no right margin
// exception: don't steal the "selected" class unless actually editing section 0:
if (/(^| )selected( |$)/.test(y.className)) {
if (!document.editform || !document.editform.wpSection
|| document.editform.wpSection.value != "0") {
y.className = y.className.replace(/(^| )selected( |$)/g, "$1");
x.className += ' selected';
}
}
} else {
mw.util.addPortletLink('p-views', url+"§ion=0", '0', 'ca-edit-0', 'แก้ไขย่อหน้าแรกสุด', '0', x.nextSibling);
}
});
ดูความแตกต่างล่าสุด[แก้]
// ========== ดูความแตกต่างล่าสุด (Last diff) ==========
function doLastDiff() {
document.location = mw.config.get('wgServer') + mw.config.get('wgScript') + "?title=" + encodeURIComponent(mw.config.get('wgPageName')) + "&diff=cur&oldid=prev";
}
$(document).ready(function() {
if (mw.config.get('wgNamespaceNumber') >= 0 && mw.config.get('wgArticleId') > 0) {
if (mw.config.get('skin') == "vector") {
mw.util.addPortletLink("p-views", "javascript:doLastDiff()", "ล่าสุด", "ca-ldff", "ดูความแตกต่างล่าสุด", "", document.getElementById('ca-history').nextSibling);
} else {
mw.util.addPortletLink("p-cactions", "javascript:doLastDiff()", "ล่าสุด", "ca-ldff", "ดูความแตกต่างล่าสุด", "", document.getElementById('ca-history').nextSibling);
}
}
});