Add
 
No edit summary
 
(5 intermediate revisions by 2 users not shown)
Line 1: Line 1:
/* _______________________________________________________________________________
/* XFDcloser loader: loads the discussion-closing tool on deletion-discussion pages and on pages where a deletion-discussion notice needs to be removed. */
* |                                                                              |
(function () {
* |                    === WARNING: GLOBAL GADGET FILE ===                      |
    var isNonexistentPage = mw.config.get("wgArticleId") === 0;
* |                  Changes to this page affect many users.                    |
    var isUnlinkableNamespace = [0, 6, 100].indexOf(mw.config.get("wgNamespaceNumber")) !== -1;
* |  Please discuss changes on the talk page or on [[WT:Gadget]] before editing.  |
    var isUnlinkablePage = isNonexistentPage && isUnlinkableNamespace;
* |_______________________________________________________________________________|
    if (!isUnlinkablePage && /(?:\?|&)(?:action|diff|oldid)=/.test(window.location.href)) {
*
        return;
* Built from source code at GitHub repository [https://github.com/wikimedia-gadgets/xfdcloser]
    }
* All changes should be made in the repository, otherwise they will be lost.
    var xfdpageRegex = /(Articles_for_deletion\/|Miscellany_for_deletion|(Categories|Files|Templates|Redirects)_for_discussion(?!\/(Working|Holding_cell|Speedy)))(?!\/\/?(?:Administrator_instructions|Common_outcomes)$)/;
*
    var isXfdPage = xfdpageRegex.test(mw.config.get("wgPageName"));
* To update this script from github, you must have a local repository set up. Then
    var shouldLoadScript = isXfdPage || isUnlinkablePage;
* follow the instructions at [https://github.com/wikimedia-gadgets/xfdcloser/blob/master/README.md]
    if (!shouldLoadScript) {
*
        return;
* XFDcloser: close deletion discussions at XfD venues, including actions to implement closes; see [[BP:XFDC]]
    }
* Author: Evad37
    mw.loader.load("ext.gadget.XFDcloser-core");
* Licencing and attribution: [[BP:XFDC#Licencing and attribution]]
*/
/* jshint esversion: 5, esnext:false, laxbreak: true, undef: true, eqnull: true, maxerr: 3000 */
/* globals console, document, window, $, mw, OO */
/* <nowiki> */
(function(){
// Check if on a non-existent article/file/portal (to unlink backlinks)
var isNonexistentPage = mw.config.get("wgArticleId") === 0;
var isUnlinkableNamespace = [
0, // Article
6, // File
100 // Portal
].indexOf(mw.config.get("wgNamespaceNumber")) !== -1;
var isUnlinkablePage = isNonexistentPage && isUnlinkableNamespace;
// Check for edit, history, diff, or oldid mode
if ( !isUnlinkablePage && /(?:\?|&)(?:action|diff|oldid)=/.test(window.location.href) ) {
return;
}
 
// XFDcloser options
var options;
try {
options = JSON.parse(mw.user.options.get("userjs-xfdc")) || {};
} catch(e) {
options = {};
}
 
// Check if on an XfD page
var xfdpage_regex = /(Articles_for_deletion\/|Miscellany_for_deletion|User:Cyberbot_I\/AfD's_requiring_attention|Bharatpedia:WikiProject_Deletion_sorting\/(?!(Flat|Compact)$)|(Categories|Files|Templates|Redirects)_for_discussion(?!\/(Working|Holding_cell|Speedy)))(?!\/?(?:Administrator_instructions|Common_outcomes)$)/;
var isXfdPage = xfdpage_regex.test(mw.config.get("wgPageName"));
 
// Load for XfD pages as well as unlinkable pages
var shouldLoadScript = isXfdPage || isUnlinkablePage;
if ( !shouldLoadScript ) {
return;
}
mw.loader.load( options && options.beta ? "ext.gadget.XFDcloser-core-beta" : "ext.gadget.XFDcloser-core");
})();
})();
/* </nowiki> */

Latest revision as of 17:17, 9 November 2026

/* XFDcloser loader: loads the discussion-closing tool on deletion-discussion pages and on pages where a deletion-discussion notice needs to be removed. */
(function () {
    var isNonexistentPage = mw.config.get("wgArticleId") === 0;
    var isUnlinkableNamespace = [0, 6, 100].indexOf(mw.config.get("wgNamespaceNumber")) !== -1;
    var isUnlinkablePage = isNonexistentPage && isUnlinkableNamespace;
    if (!isUnlinkablePage && /(?:\?|&)(?:action|diff|oldid)=/.test(window.location.href)) {
        return;
    }
    var xfdpageRegex = /(Articles_for_deletion\/|Miscellany_for_deletion|(Categories|Files|Templates|Redirects)_for_discussion(?!\/(Working|Holding_cell|Speedy)))(?!\/\/?(?:Administrator_instructions|Common_outcomes)$)/;
    var isXfdPage = xfdpageRegex.test(mw.config.get("wgPageName"));
    var shouldLoadScript = isXfdPage || isUnlinkablePage;
    if (!shouldLoadScript) {
        return;
    }
    mw.loader.load("ext.gadget.XFDcloser-core");
})();