ผู้ใช้:Jutiphan/Scripts/mainTabs/monobook.js
จากวิกิพีเดีย สารานุกรมเสรี
< ผู้ใช้:Jutiphan | Scripts | mainTabs
หมายเหตุ: หลังจากบันทึกแล้ว, คุณต้องล้างแคชของเบราว์เซอร์เสียก่อน จึงจะเห็นการเปลี่ยนแปลง: Mozilla/Safari/Konqueror: กด Shift ค้าง แล้วกด Reload (หรือ Ctrl-Shift-R), IE: กด Ctrl-F5, Opera: กด F5
/* <pre><nowiki> */
// ========== ดูความแตกต่างล่าสุด ==========
function doLastDiff() {
var nurl="http://th.wikipedia.org/w/index.php?title=" + getPname() + "&diff=cur&oldid=prev";
document.location = nurl;
}
// ========== จัดรูปแบบ+เก็บกวาด ==========
// สคริปต์นี้ เปลี่ยนคำสั่งเก่า เช่น Category, Image, และข้อความเก่า
function doCleanupTag(isSpeedy) {
document.body.style.cursor = 'wait';
text = document.editform.wpTextbox1.value;
if(text.indexOf("nocleanup") >= 0) {
alert("ขออภัย หน้าดังกล่าวนั้นไม่ต้องการเก็บกวาด เนื่องจากว่าการเก็บกวาด ทำให้การแสดงตัวอย่างความสามารถเก็บกวาดในหน้านี้มีปัญหาได้");
return;
}
//Format
//text = text.replace(/<br>|<br\/>/gi, "<br />"); //<br/> -> <br />
text = text.replace(/([^\[]|^)\[([^\[^\]]*?)\]\]/gm, "$1[[$2]]"); //[ลิงก์ใน]] -> [[ลิงก์ใน]]
text = text.replace(/\[\[([^\[^\]].*?)[$[^\]]?]/gm, "[[$1]]"); //[[ลิงก์ใน] -> [[ลิงก์ใน]]
text = text.replace(/\[\[ ?([^\]\|]*?) \s*([\|\s|\]\]])/g, "[[$1$2"); //[ ลิงก์ใน ]] -> [[ลิงก์ใน]]
text = text.replace(/^([\*#]+) /gm, "$1");
text = text.replace(/^([\*#]+)/gm, "$1 ");
text = text.replace(/^= ?([^=].*?) ?=/gm,"== $1 =="); //= หัวข้อ = -> == หัวข้อ ==
text = text.replace(/^(={1,5}) *(.*?) ?(={1,5}) *$/gm, "$1 $2 $3"); //==หัวข้อ== -> == หัวข้อ ==
//text = text.replace(/ /g, " ");
text = text.replace(/′/g, "'");
text = text.replace(/&/g, "&");
text = text.replace(/−/g, "−");
text = text.replace(/×/g, "×");
text = text.replace(/—/g, "—");
text = text.replace(/–/g, "-");
//Fix lang icons: Move from front to back
text = text.replace(/\* ?({{.*?icon}}) ?(.*?)\r?\n/g,"* $2 $1\n"); //แก้ * {{...}} [...] -> * [...] {{...}}
text = text.replace(/<ref(.*?)> ?({{.*?}}) ?([^\r]*?) ?<\/ref>/g,"<ref$1>$3 $2</ref>");//แก้ <ref...> {{...}} [...] </ref> -> <ref...>[...] {{...}}</ref>
//Fix Template Parameters Layout: Move | from back to front (using Top to Bottom approach)
text = text.replace(/ *\|(?!-) *\r?\n *([^=\*<|{}]*?) ?=(?!=) *([^\|={}]*?)/g,"\n| $1 = $2"); //รวมแก้สองอย่างโดยการตรวจย้ายบนไปล่างแทน
//text = text.replace(/({{.*)(?!})\| *\r/g,"$1"); //แก้ {{... | -> {{...
//text = text.replace(/(\n) *([^|{}]*?) ?= *([^|{}]*?)\| *\r/g,"$1| $2 = $3"); //แก้ ... | -> | ...
//TODO: Need comments for code below for maintenance reasons: Hard to debug
text = text.replace(/\n *\|(?!-) *([^={}\*].*?) ?= *([^<={}]*?) \| ?( *}} *\r?\n| *\r?\n *}} *\r?\n)/g, "\n| $1 = $2\n}}\n") //รุ่นใหม่ แค่จับขึ้นบรรทัดใหม่
//text = text.replace(/(\n) *([^\|{}].*?) ?= *([^|{}]*?)(}}\r\n|\r\n *}})/g,"$1| $2 = $3\n}}");//แก้ ... -> | ...
//Fix Template Parameters Layout: Add extra space inbetweens
text = text.replace(/\n *\|(?!-) *([^=\|'"{}]*?) ?= *([^=]*?) *\r/g,"\n| $1 = $2");
//Fix Year Formatting
text = text.replace(/(พ\.ศ\.|พศ\.)(\d{1,4})/g,"พ.ศ. $2");
text = text.replace(/(ค\.ศ\.|คศ\.)(\d{1,4})/g,"ค.ศ. $2");
//Spellings
if(text.indexOf("nofixbot") == -1) {
text = text.replace(/\sกฏ/g," กฎ");
text = text.replace(/\sเกมส์/g," เกม");
text = text.replace(/ก๊กกะ|กิ๊กกะ|กิกะ/g,"จิกะ");
text = text.replace(/กฏหมาย/g,"กฎหมาย");
text = text.replace(/กรกฏาคม/g, "กรกฎาคม");
text = text.replace(/กราฟฟิค|กราฟฟิก/g,"กราฟิก");
text = text.replace(/กิติมศักดิ์/g,"กิตติมศักดิ์");
text = text.replace(/ขาดดุลย์/g,"ขาดดุล");
text = text.replace(/คลีนิก/g,"คลินิก");
text = text.replace(/คำนวน/g,"คำนวณ");
text = text.replace(/เคเบิ้ล/g,"เคเบิล");
text = text.replace(/โครงการณ์/g,"โครงการ");
text = text.replace(/งบดุลย์/g,"งบดุล");
text = text.replace(/ซอฟท์แวร์/g,"ซอฟต์แวร์");
text = text.replace(/เซ็นติ/g,"เซนติ");
text = text.replace(/เซอร์เวอร์/g,"เซิร์ฟเวอร์");
text = text.replace(/ฑูต/g,"ทูต");
text = text.replace(/ดอท ?คอม|ด็อท ?คอม|ด็อต ?คอม/g,"ดอตคอม");
text = text.replace(/ดอท ?เน็ท|ดอต ?เน็ท|ด็อต ?เน็ต|ด็อท ?เน็ต|ดอท ?เน็ต|ดอท?เนท/g,"ดอตเน็ต");
text = text.replace(/ถ่วงดุลย์/g,"ถ่วงดุล");
text = text.replace(/ธุระกิจ/g,"ธุรกิจ");
text = text.replace(/นิวยอร์ค/g, "นิวยอร์ก");
text = text.replace(/บราวเซอร์|เบราเซอร์/g, "เบราว์เซอร์");
text = text.replace(/บล็อค|บล๊อค|บล๊อก/g,"บล็อก");
text = text.replace(/เบรค/g,"เบรก");
text = text.replace(/ไบท์/g,"ไบต์");
text = text.replace(/ปฎิ/g,"ปฏิ");
text = text.replace(/ปฏิกริยา|ปฎิกริยา/g,"ปฏิกิริยา");
text = text.replace(/ปรากฎ/g,"ปรากฏ");
text = text.replace(/ปราถนา/g,"ปรารถนา");
text = text.replace(/ปีรามิด|ปิระมิด/g, "พีระมิด");
text = text.replace(/ผลลัพท์/g,"ผลลัพธ์");
text = text.replace(/ฝรั่งเศษ/g,"ฝรั่งเศส");
text = text.replace(/ฟังก์ชั่น/g,"ฟังก์ชัน");
text = text.replace(/ภาพยนต์/g,"ภาพยนตร์");
text = text.replace(/มิวสิค(?!\u0E31)/g,"มิวสิก");
text = text.replace(/ไมโครซอฟต์/g,"ไมโครซอฟท์");
text = text.replace(/ร็อค/g,"ร็อก");
text = text.replace(/ล็อค/g,"ล็อก");
text = text.replace(/ลายเซ็นต์/g,"ลายเซ็น");
text = text.replace(/ลิงค์|ลิ้งค์|ลิ๊งค์|ลิ้งก์|ลิ๊งก์/g,"ลิงก์");
text = text.replace(/เวคเตอร์/g,"เวกเตอร์");
text = text.replace(/เวทย์มนตร์|เวทย์มนต์|เวทมนต์/g,"เวทมนตร์");
text = text.replace(/เวบไซท์|เวบไซต์|เวบไซท์|เว็บไซท์|เว็บไซต(?!\u0E4C)/g, "เว็บไซต์");
text = text.replace(/เวอร์ชั่น/g,"เวอร์ชัน");
text = text.replace(/สคริปท์|สครปต์/g,"สคริปต์");
text = text.replace(/สเตชั่น/g,"สเตชัน");
text = text.replace(/สมดุลย์/g,"สมดุล");
text = text.replace(/อโดบี/g,"อะโดบี");
text = text.replace(/อนิเม(?!ช)|อานิเมะ|อะนิเม(?!\u0E30)/g,"อะนิเมะ");
text = text.replace(/อนุญาติ/g,"อนุญาต");
text = text.replace(/อลูมิเนียม/g, "อะลูมิเนียม");
text = text.replace(/ออบเจ็ค|ออปเจ็ค|ออปเจค/g,"อ็อบเจกต์");
text = text.replace(/อัพเด็ต|อัพเดต|อัพเดท|อัปเด็ต/g,"อัปเดต");
text = text.replace(/อัพโหลด/g,"อัปโหลด");
text = text.replace(/อินเตอร์เน็ต|อินเตอร์เนต|อินเทอร์เนต/g,"อินเทอร์เน็ต");
text = text.replace(/อิเล็กโทรนิกส์/g, "อิเล็กทรอนิกส์");
text = text.replace(/อิสระภาพ/g,"อิสรภาพ");
text = text.replace(/อีเอ็มไอมิวสิก/g,"อีเอ็มไอมิวสิค");
text = text.replace(/เอ็กซ์/g,"เอกซ์");
text = text.replace(/เอ็นจิ้น|เอ็นจิน|เอนจิ้น/g,"เอนจิน");
text = text.replace(/เอาท์พุต|เอาท์พุท/g, "เอาต์พุต");
text = text.replace(/แอปพลิเคชั่น|แอพพลิเคชั่น|แอพพลิเคชัน|แอพพลิคเคชัน/g, "แอปพลิเคชัน");
//text = text.replace(/เอ็กซเรย์/g, "เอกซเรย์");
//Cleanup
text = text.replace(/\[\[category:/gi,'[[หมวดหมู่:');
text = text.replace(/\[\[template:/gi,'แม่แบบ:');
text = text.replace(/image:/gi,'ภาพ:');
}
//Remove signatures on article pages
if(wgNamespaceNumber == 0 && wgPageName.indexOf("วิกิพีเดีย:") != 0) {
text = text.replace(/-{0,2} ?\[\[ผู้ใช้:.*/g,"");
}
text = text.replace(/(== ?) ?(แหล่งอ้างอิง|หนังสืออ้างอิง|เอกสารอ้างอิง|ข้อมูลอ้างอิง|แหล่งข้อมูลอ้างอิง|อ้างอิงจาก) *==/g,'$1อ้างอิง ==');
text = text.replace(/(== ?) ?(เพิ่มเติม|ดูเพิ่มเติม|ดูเพื่มเติม|ดูเพิ่มที่|อ่านเพิ่ม|อ่านเพิ่มเติม|หัวข้อที่เกี่ยวข้อง|หัวข้ออื่นที่เกี่ยวข้อง|ลิงก์ที่เกี่ยวข้อง) *==/g,'$1ดูเพิ่ม ==');
text = text.replace(/(== ?) ?(เว็บไซต์|เว็บไซต์ภายนอก|เว็บไซต์์์อื่น|เว็บไซต์์์์์์อื่น|เว็บไซต์อื่น|เว็บไซต์ที่เกี่ยวข้อง|ข้อมูลภายนอก|โยงภายนอก|เว็บลิงก์ภายนอก|ลิงก์ภายนอก|ลิงค์ภายนอก|ลิ้งค์ภายนอก|ดูลิงก์ภายนอก|แหล่งข้อมูลภายนอก|แหล่งข้อมูลเพิ่มเติม|แหล่งข้อมูลที่เกี่ยวข้อง|แหล่งข้อข้อมูลอื่น) *==/g,"$1แหล่งข้อมูลอื่น ==");
text = text.replace(/(== ?) ?(Link\s?ภายนอก|link\s?ภายนอก|ลิงก์ข้างนอก|ลิงก์ที่เกี่ยวข้อง|ลิงก์ข้อมูลเพิ่มเติม|เว็บแหล่งข้อมูลอื่น|เชื่อมแหล่งข้อมูลอื่น|ลิงก์นอก) *==/g,"$1แหล่งข้อมูลอื่น ==");
text = text.replace(/(== ?) ?(ประวัติความเป็นมา|ประวัติส่วนตัว|ความเป็นมา|ชีวประวัติ) *==/g,"$1ประวัติ ==");
//InterLink Check
if(wgNamespaceNumber == 0 && wgPageName.indexOf("วิกิพีเดีย:") != 0 && text.indexOf("{{ลิงก์ไปภาษาอื่น}}") == -1 && text.indexOf("[[:en:") != -1) {
text = "{{ลิงก์ไปภาษาอื่น}}\n" + text;
if(document.editform.wpSummary.value.length == 0) {
document.editform.wpSummary.value = "แจ้งลิงก์ข้ามภาษา";
} else {
document.editform.wpSummary.value += " +แจ้งลิงก์ข้ามภาษา";
}
}
//Category Check only for article, wikipedia, category and ignore check if editing section of article
if((wgNamespaceNumber == 0 || wgNamespaceNumber == 4 || wgNamespaceNumber == 14) && document.URL.indexOf("§ion=") == -1 && text.indexOf("#REDIRECT") == -1 && text.indexOf("{{เก็บกวาด}}") == -1 && text.indexOf("{{ต้องการหมวดหมู่}}") == -1 && text.indexOf("[[หมวดหมู่:") == -1 && text.indexOf("{{แก้กำกวม") == -1) {
text = "{{ต้องการหมวดหมู่}}\n" + text;
if(document.editform.wpSummary.value.length == 0) {
document.editform.wpSummary.value = "แจ้งต้องการหมวดหมู่";
} else {
document.editform.wpSummary.value += " +ต้องการหมวดหมู่";
}
}
document.editform.wpTextbox1.value = text;
if(isSpeedy == 1) {
if(document.editform.wpSummary.value.length == 0) {
document.editform.wpSummary.value = "เก็บกวาดทันใจด้วย[[WP:iScript|สคริปต์จัดให้]]";
document.editform.wpMinoredit.checked = true;
} else {
document.editform.wpSummary.value += " +เก็บกวาดทันใจด้วย[[WP:iScript|สคริปต์จัดให้]]";
}
} else {
if(document.editform.wpSummary.value.indexOf("เก็บกวาดด้วย[[WP:iScript|สคริปต์จัดให้]]") == -1) {
if(document.editform.wpSummary.value.length == 0) {
document.editform.wpSummary.value = "จัดรูปแบบ +เก็บกวาดด้วย[[WP:iScript|สคริปต์จัดให้]]";
} else {
var eIndex = document.editform.wpSummary.value.lastIndexOf("ด้วย[[WP:iScript|สคริปต์จัดให้]]");
if(eIndex != -1) {
var strTmp = document.editform.wpSummary.value;
document.editform.wpSummary.value = strTmp.substring(0,eIndex) + " +เก็บกวาดด้วย[[WP:iScript|สคริปต์จัดให้]]";
} else {
document.editform.wpSummary.value = document.editform.wpSummary.value + " +เก็บกวาดด้วย[[WP:iScript|สคริปต์จัดให้]]";
}
}
}
}
document.body.style.cursor = 'auto';
}
function getUploader() {
//NOTE: DOES NOT work in Edit page
// Get uploader from first point in the list under "File history"
// Uploader is stored in second A tag in UL tag under "File history"
// Returns title of user page (without name space) in URL form
var el = document.getElementById('filehistory')
if (!el) {
alert("getUploader: Cannot find filehistory ... exiting");
return null;
}
while (el.nextSibling) {
el = el.nextSibling;
if (el.tagName && el.tagName.toLowerCase() == 'ul')
break;
}
if (!el) {
alert("getUploader: Cannot find UL tag ... exiting");
return null;
}
var els = el.getElementsByTagName('li');
if (!els) {
alert("getUploader: Cannot find LI tag ... exiting");
return null;
}
var uploaders = new Array();
var re1 = new RegExp('http://' + (wgServer + '/wiki/').replace(/\./g, '\\.') + 'ผู้ใช้:(.*)$');
var re2 = new RegExp('http://' + (wgServer + '/w/index.php').replace(/\./g, '\\.') + '\\?title=ผู้ใช้:([^&]*)');
var re3 = /(คุยกับ)?ผู้ใช้:(.*)$/; // this is for IE and handling Unicode characters
var m;
var uploader;
var uploaderList = "";
var count = 0;
el = els[0];
do {
var as = el.childNodes;
for (var k=0; k<as.length; k++) {
if (as[k].tagName != 'A') continue;
m = re3.exec(as[k].title);
if (m) uploader = encodeURIComponent(m[2]);
m = re1.exec(as[k].href);
if (m) uploader = m[1];
m = re2.exec(as[k].href);
if (m) uploader = m[1];
}
if (uploaderList.indexOf(uploader) == -1) {
if (count > 0) uploaderList += "; ";
uploaderList += count + " - " + uploader;
uploaders[uploaders.length] = uploader;
count += 1;
}
el = el.nextSibling;
} while (el);
if (!uploaders || uploaders.length == 0) {
alert("getUploader: Cannot find uploader ... exiting");
return null;
}
if (uploaders.length == 1)
return uploaders[0];
var which = parseInt(window.prompt("Choose which uploader to notify: " + uploaderList));
if (isNaN(which) || which < 0 || which > uploaders.length) {
alert("getUploader: Invalid selection ... exiting");
return null;
}
return uploaders[which];
}
function assignToEditForm(iScriptAction) {
//edit page
var title = document.title.substr(0, document.title.lastIndexOf(' - วิกิพีเดีย'));
location.assign("/w/index.php?title=" + title + "&action=edit&iScriptAction=" + iScriptAction);
}
function doCele() {
//edit page
var title = document.title.substr(0, document.title.lastIndexOf(' - วิกิพีเดีย'));
title = title.replace("พูดคุย:","");
location.assign("/w/index.php?title=Talk:" + title + "&action=edit&iScriptAction=doCele");
}
function doInvalidLicense() {
var pagename = encodeURIComponent(wgPageName);
var uploader = getUploader();
if (!uploader) {
alert("ไม่สามารถดึงชื่อผู้ใช้ที่อัปโหลดภาพนี้ได้ หยุดการทำงาน กรุณารายงานปัญหานี้กับผู้ใช้:Jutiphan");
return;
}
var title = document.title.substr(0, document.title.lastIndexOf(' - วิกิพีเดีย'));
location.assign("/w/index.php?title=" + title + "&action=edit&iScriptAction=invalidLicense&Uploader=" + uploader);
}
function doNoLicense() {
var title = document.title.substr(0, document.title.lastIndexOf(' - วิกิพีเดีย'));
location.assign("/w/index.php?title=" + title + "&action=edit&iScriptAction=noLicense");
}
function notifyUploader() {
var pagename = encodeURIComponent(wgPageName);
var uploader = getUploader();
if (!uploader) return;
location.assign("/w/index.php?title=User_talk:" + uploader + "&action=edit&iScriptAction=warnNoImageLicense&target=" + pagename);
//NOTE: This will be handled in userTabs/monobook.js module
}
// ========================================================
// mainTabs
// Main Load Function
//
// User:Jutiphan Created: 7/1/2007 Last Modified: 7/1/2007
// Replaced: lastdiff, cleanup, advert, speedydel
// ========================================================
addOnloadHook( function() {
//Add Cleanup Toolbar button
var tooly = document.getElementById('toolbar');
if (tooly != null) {
var cleanupButton = "<a href=\"javascript:doCleanupTag();\"><img src=\"http://upload.wikimedia.org/wikipedia/th/9/96/Button_cleanup.png\" alt=\"เก็บกวาด\"></a>";
tooly.innerHTML = tooly.innerHTML + cleanupButton;
}
//Add SpeedyCleanup,lastDiff tabs if article, Add Advert, Qsd tabs if not in user namespace
if(wgIsArticle) {
addTab("javascript:assignToEditForm('speedyCleanup')", "★เก็บกวาด", "ca-scleanup", "เก็บกวาดทันใจ", "");
if(wgNamespaceNumber != 2 && wgNamespaceNumber != 3 && wgNamespaceNumber != 6) { //If not user, user talk & image namespace
addTab("javascript:assignToEditForm('needCleanup')", tNeedCleanup,"ca-ncleanup","แจ้งช่วยดูหน่อย","");
addTab("javascript:assignToEditForm('needCopyvioCheck')","↑ตรวจลิขสิทธิ์","ca-nCopyvioCheck","แจ้งต้องการตรวจลิขสิทธิ์","");
addTab("javascript:assignToEditForm('advert')", tAdvert, "ca-advert", "แจ้งโฆษณา", "");
if(iScriptConfig.enableTestScripts) {
addTab("javascript:assignToEditForm('resume')", "↑เรซูเม", "ca-resume", "แจ้งเรซูเม", "");
}
addTab("javascript:assignToEditForm('pThailand')", tPortalThailand, "ca-pThailand", "แจ้งเป็นสถานีย่อยประเทศไทย", "");
addTab("javascript:doCele()","↑เฉลิม.","ca-Cele","แจ้งเป็นบทความในโครงการเฉลิมพระเกียรติ","");
}
if(wgNamespaceNumber == 6) {
addTab("javascript:doInvalidLicense()",tInvalidLicense,"ca-invalidLicense","แจ้งสัญญาอนุญาตไม่ถูกต้อง และเตือนผู้ใช้","");
if(iScriptConfig.enableTestScripts) {
addTab("javascript:doNoLicense()","แจ้งไม่ได้ระบุ","ca-noLicense","แจ้งไม่ได้ระบุ","");
addTab("javascript:notifyUploader()","แจ้งผู้อัปโหลด","ca-notifyUploader","แจ้งผู้อัปโหลดภาพ","");
}
}
addTab("javascript:assignToEditForm('speedydel')", tDelete, "ca-sd", "แจ้งลบ", "");
addTab("javascript:doLastDiff()","ล่าสุด","ca-ldff","ดูความแตกต่างล่าสุด","");
}
if (document.title.indexOf("แก้ไข") != -1 && document.URL.indexOf("&iScriptAction=") != -1) {
if (wgNamespaceNumber == 0 && wgArticleId == 0) {
alert("บทความนี้ได้ถูกลบโดยผู้ดูแลระบบไปแล้ว");
return;
}
if (document.URL.lastIndexOf("&iScriptAction=speedyCleanup") != -1) {
doCleanupTag(1);
document.editform.submit();
return;
} else if (document.URL.lastIndexOf("&iScriptAction=needCleanup") != -1) {
text = document.editform.wpTextbox1.value;
text = text.replace(/{{ต้องการหมวดหมู่}}/g,"");
text = "{{เก็บกวาด}}\n" + text;
document.editform.wpTextbox1.value = text;
document.editform.wpSummary.value = "แจ้งต้องการเก็บกวาดด้วย[[WP:iScript|สคริปต์จัดให้]]";
document.editform.submit();
return;
} else if (document.URL.lastIndexOf("&iScriptAction=advert") != -1) {
document.editform.wpTextbox1.value = "{{โฆษณา}}\n" + document.editform.wpTextbox1.value;
document.editform.wpSummary.value = "แจ้งโฆษณาด้วย[[WP:iScript|สคริปต์จัดให้]]";
document.editform.submit();
return;
} else if (document.URL.lastIndexOf("&iScriptAction=resume") != -1) {
document.editform.wpTextbox1.value = "{{เรซูเม}}\n" + document.editform.wpTextbox1.value;
document.editform.wpSummary.value = "แจ้งอ่านเหมือนเรซูเมด้วย[[WP:iScript|สคริปต์จัดให้]]";
document.editform.submit();
return;
} else if (document.URL.lastIndexOf("&iScriptAction=needCopyvioCheck") != -1) {
document.editform.wpTextbox1.value = "{{ตรวจลิขสิทธิ์}}\n" + document.editform.wpTextbox1.value;
document.editform.wpSummary.value = "แจ้งต้องการตรวจลิขสิทธิ์ด้วย[[WP:iScript|สคริปต์จัดให้]]";
document.editform.submit();
return;
} else if (document.URL.lastIndexOf("&iScriptAction=speedydel") != -1) {
var textbox = document.editform.wpTextbox1.value;
if(textbox.indexOf("{{ลบ") >= 0) {
alert("บทความนี้ได้ถูกแจ้งลบไปก่อนหน้านี้แล้ว ยกเลิกการแจ้งลบเพื่อป้องกันการแจ้งซ้ำ");
return;
}
if(wgCanonicalNamespace == "" && textbox.length < 500 && textbox.indexOf("#REDIRECT") != 0) {
var qsdReason = "";
} else {
var qsdReason = prompt("กรุณาระบุสาเหตุที่แจ้งลบ (เว้นว่างและคลิก OK หากจะไม่ระบุ):", "")
if(qsdReason == undefined) {
return;
}
}
if(qsdReason.length == 0) {
if(wgNamespaceNumber == 10) {
document.editform.wpTextbox1.value = "<noinclude>{{ลบ}}</noinclude>" + document.editform.wpTextbox1.value;
} else {
document.editform.wpTextbox1.value = "{{ลบ}}\n\n" + document.editform.wpTextbox1.value;
}
document.editform.wpSummary.value = "แจ้งลบด้วย[[WP:iScript|สคริปต์จัดให้]]";
} else {
if(wgNamespaceNumber == 10) {
document.editform.wpTextbox1.value = "<noinclude>{{ลบ|" + qsdReason + "}}</noinclude>" + document.editform.wpTextbox1.value;
} else {
document.editform.wpTextbox1.value = "{{ลบ|" + qsdReason + "}}\n\n" + document.editform.wpTextbox1.value;
}
document.editform.wpSummary.value = "แจ้งลบด้วย[[WP:iScript|สคริปต์จัดให้]]: " + qsdReason;
}
document.editform.submit();
return;
} else if (document.URL.lastIndexOf("&iScriptAction=pThailand") != -1) {
if(document.editform.wpTextbox1.value.indexOf("{{วิกิประเทศไทย}}") != -1) {
alert("บทความนี้ ได้รับแจ้งเป็นสถานีย่อยประเทศไทยอยู่แล้ว");
} else {
document.editform.wpTextbox1.value = "{{วิกิประเทศไทย}}\n" + document.editform.wpTextbox1.value;
document.editform.wpSummary.value = "แจ้งเป็นสถานีย่อยประเทศไทยด้วย[[WP:iScript|สคริปต์จัดให้]]";
document.editform.submit();
}
return;
} else if (document.URL.lastIndexOf("&iScriptAction=doCele") != -1) {
if(document.editform.wpTextbox1.value.indexOf("{{บทความเฉลิมพระเกียรติ}}") != -1) {
alert("บทความนี้ ได้รับแจ้งเป็นบทความในโครงการเฉลิมพระเกียรติไปแล้ว");
} else {
var level = prompt("กรุณาระบุระดับของบทความนี้: คัดสรร คุณภาพ ดี พอใช้ โครง (เว้นว่างและคลิก OK หากจะไม่ระบุ)", "")
if(level == undefined) {
return;
}
if(level.length == 0) {
document.editform.wpTextbox1.value = "{{บทความเฉลิมพระเกียรติ}}\n" + document.editform.wpTextbox1.value;
} else {
document.editform.wpTextbox1.value = "{{บทความเฉลิมพระเกียรติ|ระดับ=" + level + "}}\n" + document.editform.wpTextbox1.value;
}
document.editform.wpSummary.value = "แจ้งอยู่ใน[[WP:Celebrate|โครงการเฉลิมพระเกียรติ]]ด้วย[[WP:iScript|สคริปต์จัดให้]]";
document.editform.submit();
}
return;
} else if (document.URL.lastIndexOf("&iScriptAction=invalidLicense") != -1) {
if(document.editform.wpTextbox1.value.indexOf("{{ภาพที่อาจจะละเมิดลิขสิทธิ์") != -1) {
alert("ภาพนี้ ได้รับแจ้งเกี่ยวกับสัญญาอนุญาตไม่ถูกต้องไปแล้ว");
} else {
var currentDay = new Date();
var thaiDate = new Date(currentDay.getTime() + 25200000);
var year = thaiDate.getUTCFullYear()+543;
var month = thaiDate.getUTCMonth()+1;
document.editform.wpTextbox1.value += "{{ภาพที่อาจจะละเมิดลิขสิทธิ์|" + thaiDate.getUTCDate() + "/" + month + "/" + year + "}}";
document.editform.wpSummary.value = "แจ้งต้องการตรวจสอบสัญญาอนุญาต";
var pagename = encodeURIComponent(wgPageName);
var uploader = getParamValue("Uploader");
if (uploader) {
openInNewWindow(wgServer + wgScriptPath + "/index.php?title=User_talk:" + uploader + "&action=edit&iScriptAction=warnInvalidImageLicense&target=" + pagename,'iScriptWarnWindow');
}
document.editform.submit();
}
return;
} else if (document.URL.lastIndexOf("&iScriptAction=noLicense") != -1) {
var currentDay = new Date();
var thaiDate = new Date(currentDay.getTime() + 25200000);
var year = thaiDate.getUTCFullYear()+543;
var month = thaiDate.getUTCMonth()+1;
document.editform.wpTextbox1.value = document.editform.wpTextbox1.value.replace(/{{ไม่ได้ระบุ}}/g,"{{ไม่ได้ระบุ|" + thaiDate.getUTCDate() + "/" + month + "/" + year + "}}");
document.editform.wpSummary.value = "แจ้งภาพไม่ได้ระบุ พร้อมใส่วันที่แจ้งด้วย[[WP:iScript|สคริปต์จัดให้]]";
document.editform.submit();
}
}
});
/* </nowiki></pre> */

