Thành viên:MGA73/NonFreeOldVersions.js
Giao diện
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 Explorer và Safari: 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.
//<source lang=javascript>/*global $, mw *//** * This script is meant to make it easier to remove template when non-free old versions are removed. * * To use it add this to you vector.js (or other) ---> importScript('Thành viên:MGA73/NonFreeOldVersions.js'); * * URL: https://wiki.scholarship.edu.vn/Th%C3%A0nh_vi%C3%AAn:MGA73/NonFreeOldVersions.js * * It is based on some old code from https://en.wikipedia.org/wiki/User:MGA73/nowcommonsreview.js * And I did not bother to clean it all up. * NowCommonsReview tagger * URL: http://en.wikipedia.org/wiki/User:MGA73/nowcommonsreview.js * Credits: * MGA73, ZooFari, Krinkle and Magog the Ogre * * Based on http://commons.wikimedia.org/wiki/User:ZooFari/licensereviewer.js by Patstuart */(function (window, $){ window.nonfreeoldversionsreview = "0.20 (2010-06-23)"; $.when(mw.loader.using( ["mediawiki.util"] ), $.ready.promise).then(function () { if (mw.config.get("wgNamespaceNumber") === 6) { var actions = [ // RemoveTemplate passed { fn: function (){ var needAppend = document.editform.wpTextbox1.value; document.editform.wpTextbox1.value = needAppend.replace(/\n{{([Oo]rphaned non-free revisions|[Tt]ập tin có phiên bản cũ không tự do)}}/g, ""); document.editform.wpSummary.value = "Dời bản mẫu {{Tập tin có phiên bản cũ không tự do}} ([[Thành viên:MGA73/NonFreeOldVersions.js ]])."; document.editform.wpMinoredit.checked = true; document.editform.submit(); }, name: "RemoveTemplateOK", displayName: "Remove template" }, // DoNotReduce failed { fn: function (){ var needAppend = document.editform.wpTextbox1.value;//// var reason = window.prompt("Reason for failed NowCommons review:","");// /* on cancel button, actually cancel */// if (reason !== null) { document.editform.wpTextbox1.value = needAppend.replace(/\n{{([Oo]rphaned non-free revisions|[Tt]ập tin có phiên bản cũ không tự do)}}/g, "\n{{KTD-không giảm độ phân giải}}"); document.editform.wpSummary.value = "Template {{Orphaned non-free revisions}} replaced with {{Non-free no reduce}}."; document.editform.wpMinoredit.checked = true; document.editform.submit();// } }, name: "DoNotReduce", displayName: "Replace with a do not reduce" } ]; // [review] link inserter// var html;// if (mw.config.get("wgCategories").join("|").match(/Wikipedia files reviewed on Wikimedia Commons/)){// // This page is in a reviewed category. Dont display links.// html = "<small>Already reviewed</small>";//// } else { // This NowCommons page isn't reviewed yet. Show links. html = actions.map(function (action){ return "[" + $("<a></a>").attr("href", mw.config.get("wgScript") + "?title=" + encodeURIComponent(mw.config.get("wgPageName")) + "&action=edit&functionName=" + action.name).text(action.displayName)[0].outerHTML + "]"; }).join(" ");// } $("div.nonfreeoldversions-reviewme").css("text-align", "center").html(html); // Link/Button maker actions.forEach(function (action){ //functionNameString, buttonDisplayName, callback if (mw.util.getParamValue("functionName") == action.name){ action.fn(true); } else { var _href; var callback; if (["edit", "submit"].indexOf(mw.config.get("wgAction")) > -1){ _href = "javascript:void(0);"; callback = action.fn; } else { _href = mw.config.get("wgScript") + "?title=" + encodeURIComponent(mw.config.get("wgPageName")) + "&action=edit&functionName=" + action.name; } // Add buttons [["cactions", "ca"], ["tb", "tb"]].forEach(function (actionData) { var node = mw.util.addPortletLink("p-" + actionData[0], _href, action.displayName, "ca-" + actionData[1], "", null, 0); if (callback) { $(node).click(callback); } }); } }); } });}(window, $));//</source>