ผู้ใช้:Jutiphan/Scripts/userTabs/monobook.js
จากวิกิพีเดีย สารานุกรมเสรี
< ผู้ใช้:Jutiphan | Scripts | userTabs
หมายเหตุ: หลังจากบันทึกแล้ว, คุณต้องล้างแคชของเบราว์เซอร์เสียก่อน จึงจะเห็นการเปลี่ยนแปลง: Mozilla/Safari/Konqueror: กด Shift ค้าง แล้วกด Reload (หรือ Ctrl-Shift-R), IE: กด Ctrl-F5, Opera: กด F5
//<pre><nowiki> // ========== เพิ่มป้ายหน้าผู้ใช้+แจ้งตักเตือนอััจฉริยะ ========== function doVandalTag() { var text = document.editform.wpTextbox1.value; var regex = /\{\{test([1-5]?)\}\}|\{\{nothanks\}\}/ig; result = regex.exec(text); if(result != undefined) { if(result[1].length == 0) { no = 2; } else { no = eval(result[1]) + 1; } text = text.replace(regex,"{{test" + no + "}}"); } else { no = 1; text = "{{test}}\n\n" + text; } document.editform.wpTextbox1.value = text; document.editform.wpSummary.value = "เตือนก่อกวนครั้งที่ " + no + " ด้วย[[ผู้ใช้:Jutiphan/Scripts|สคริปต์จัดให้]]"; document.editform.submit(); } addOnloadHook(function() { if(wgCanonicalNamespace.indexOf("User_talk") >= 0 || wgCanonicalNamespace.indexOf("User") >= 0) { if (document.title.indexOf("แก้ไข") != -1) { if (document.URL.lastIndexOf("&fakeaction=speedyvandal") != -1) { doVandalTag(); } else if(document.URL.lastIndexOf("&fakeaction=speedynothanks") != -1) { doNothanks(); } return; } username = wgTitle.split('/')[0]; addTab("/wiki/พิเศษ:Contributions/" + username, "หน้าที่เขียน", "ca-log", "ดูหน้าที่เขียน", ""); addTab("http://tools.wikimedia.de/~interiot/cgi-bin/count_edits?dbname=thwiki_p&user=" + username, "สถิติ", "ca-kate", "ดูจำนวนครั้งที่แก้ไข", ""); if(wgCanonicalNamespace.indexOf("User_talk") >= 0 && wgIsArticle) { addTab("javascript:doSpeedyVandal()", "เตือนก่อกวน", "ca-svandal", "เตือนก่อกวนอััจฉริยะ", ""); addTab("javascript:doSpeedyNoThanks()","เตือนละเมิด", "ca-snothanks","เตือนละเมิดลิขสิทธิ์",""); } } }); function doSpeedyVandal() { //edit page var title = document.title.substr(0, document.title.lastIndexOf(' - วิกิพีเดีย')); location.assign("/w/index.php?title=" + title + "&action=edit&fakeaction=speedyvandal"); } function doSpeedyNoThanks() { //edit page var title = document.title.substr(0, document.title.lastIndexOf(' - วิกิพีเดีย')); location.assign("/w/index.php?title=" + title + "&action=edit&fakeaction=speedynothanks"); } function doNothanks() { if(wgPageName.indexOf(".") >= 0) { document.editform.wpTextbox1.value = "{{nothanks}}\n\n" + document.editform.wpTextbox1.value; } else { var ntArticleName = prompt("กรุณาใส่ชื่อบทความที่อาจละเมิดลิขสิทธิ์ (เว้นว่างและคลิก OK หากจะไม่ระบุ):", "") if(ntArticleName.length == 0) { document.editform.wpTextbox1.value = document.editform.wpTextbox1.value + "{{subst:nothanks0}} --~~~~" } else { document.editform.wpTextbox1.value = document.editform.wpTextbox1.value + "{{subst:nothanks0|[[" + ntArticleName + "]]}} --~~~~" } } document.editform.wpSummary.value = "พูดคุยเรื่องลิขสิทธิ์ด้วย[[ผู้ใช้:Jutiphan/Scripts|สคริปต์จัดให้]]"; document.editform.submit(); return; } function addVandalTag() { addTab("javascript:doVandalTag()", "เตือนก่อกวน", "ca-vandal", "ตักเตือนอััจฉริยะ", ""); addTab("javascript:doNothanks()","เตือนละเมิด", "ca-nothanks","เตือนละเมิดลิขสิทธิ์",""); } if (document.title.indexOf("แก้ไข ") == 0 && wgCanonicalNamespace.indexOf("User_talk") != -1 && wgArticleId == 0) { if (window.addEventListener) window.addEventListener("load", addVandalTag, false); else if (window.attachEvent) window.attachEvent("onload", addVandalTag); } //</nowiki></pre>