Bước tới nội dung

Thành viên:Nvdtn19/deletionFinder.js

Bách khoa toàn thư mở Wikipedia
Chú ý: Sau khi lưu thay đổi trang, bạn phải xóa bộ nhớ đệm của trình duyệt để nhìn thấy các thay đổi. Google Chrome, Firefox, Internet ExplorerSafari: Giữ phím ⇧ Shift và nhấn nút Reload/Tải lại trên thanh công cụ của trình duyệt. Để biết chi tiết và hướng dẫn cho các trình duyệt khác, xem Trợ giúp:Xóa bộ nhớ đệm.
// Phiên bản dành cho Wikipedia tiếng Việt của [[:en:User:Writ Keeper/Scripts/deletionFinder.js]]$(document).ready(deletionChecker);// This global variable is used by the callback functionsvar encodedTitle = encodeURIComponent(mw.config.get("wgPageName"));function deletionChecker() { var delRequest = $.get("/w/api.php?action=query&list=logevents&format=json&leprop=ids&letype=delete&letitle=" + encodedTitle + "&lelimit=1", null, delCallback, "json");  if (mw.config.get("wgCanonicalNamespace") == "") { // Define the two Vietnamese AfD prefixes (URL-encoded) var prefix1_encoded = "Bi%E1%BB%83u%20quy%E1%BA%BFt%20x%C3%B3a%20b%C3%A0i%2F";  var prefix2_encoded = "Bi%E1%BB%83u%20quy%E1%BA%BFt%20xo%C3%A1%20b%C3%A0i%2F";  var afdRequest1 = $.get("/w/api.php?action=query&list=allpages&format=json&apfrom=" + prefix1_encoded + encodedTitle + "&apto=" + prefix1_encoded + encodedTitle + "&apnamespace=4&aplimit=1", null, afdCallback, "json"); var afdRequest2 = $.get("/w/api.php?action=query&list=allpages&format=json&apfrom=" + prefix2_encoded + encodedTitle + "&apto=" + prefix2_encoded + encodedTitle + "&apnamespace=4&aplimit=1", null, afdCallback, "json"); }}function delCallback(delResults) { if (delResults.query.logevents[0] != null) { var searchNode = " <a id='prevDelsLink' target='_blank'><span style='font-size:x-small;'>nhật trình xóa</span></a>" $("#firstHeading").append(searchNode); $("#prevDelsLink").attr("href", mw.config.get("wgServer") + "/w/index.php?title=Special%3ALog&type=delete&page=" + encodedTitle); }}function afdCallback(afdResults) { // Check if a result was found if (afdResults.query.allpages[0] != null) {  // Only add the link if it doesn't already exist. if ($("#prevAFDsLink").length == 0) {  var searchNode = " <a id='prevAFDsLink' target='_blank'><span style='font-size:x-small;'>BQXB</span></a>" $("#firstHeading").append(searchNode); // --- MODIFIED SECTION START ---  var baseSearch = "/w/index.php?title=Special%3ASearch&search=";  // We construct the query simply as: /PageName // %2F is the URL encoding for "/" var simpleQuery = "%2F" + encodedTitle;  // ns4=1 ensures we only search in the Wikipedia namespace (where BQXB lives) var fullURL = mw.config.get("wgServer") + baseSearch + simpleQuery + "&fulltext=Search&ns4=1";  // --- MODIFIED SECTION END ---  $("#prevAFDsLink").attr("href", fullURL); } }}