Difference between revisions of "MediaWiki:Group-moderator.js"

From Team Fortress Wiki
Jump to: navigation, search
(👺)
 
m (Fix "addPortletLink" sometimes returning undefined because of being called before the DOM is loaded (Tark pls))
Line 2: Line 2:
  
 
// Begin Purge link
 
// Begin Purge link
−
if ( mw.config.get( "wgIsArticle" ) ) {
+
var purgeLink = {
−
    mw.util.addPortletLink( "p-views",
+
    init: function() {
−
        mw.util.wikiScript() + "?" + $.param( { title: mw.config.get( "wgPageName" ), action: "purge" } ),
+
        if (mw.config.get("wgIsArticle")) {
−
        "Purge",
+
            mw.util.addPortletLink("p-views",
−
        "ca-purge",
+
                mw.util.wikiScript() + "?" + $.param({ title: mw.config.get("wgPageName"), action: "purge" }),
−
        "Purge the server cache of this page"
+
                "Purge",
−
    );
+
                "ca-purge",
−
}
+
                "Purge the server cache of this page"
 +
            );
 +
        }
 +
    }
 +
};
 +
$(purgeLink.init);
 
// End Purge link
 
// End Purge link

Revision as of 21:26, 1 September 2023

/* Any JavaScript here will be loaded for moderators only */

// Begin Purge link
var purgeLink = {
    init: function() {
        if (mw.config.get("wgIsArticle")) {
            mw.util.addPortletLink("p-views",
                mw.util.wikiScript() + "?" + $.param({ title: mw.config.get("wgPageName"), action: "purge" }),
                "Purge",
                "ca-purge",
                "Purge the server cache of this page"
            );
        }
    }
};
$(purgeLink.init);
// End Purge link