Languages: English | 中文
Nuvola apps important
This script is for PERSONAL use only!
You are free to install this script for yourself, but it is not allowed to be used wiki-wide (e.g., in MediaWiki:Common.js or MediaWiki:Wikia.js), as it would violate FANDOM's Terms of Use.
(See the customization policy)

AutoPurge is a JavaScript snippet that enables users to automatically purge certain pages listed in a window.autoPurgePages array.

Alternatively, if users wish to purge all pages in a specific namespace, this can be achieved through a slight modification of the window variable, as shown in the "Installation" section.


Add the following to your common.js or global.js files:

window.autoPurgePages = ["Your_page_1", "Your_page_2"];
    type: "script",
    articles: [

Pages the user wishes to have automatically purged are stored in a window variable, to be inserted prior to the importArticles statement:

window.autoPurgePages = ["User:Count_of_Howard", "User_talk:Count_of_Howard"];

Alternatively, if the user wishes to purge each page in a namespace, the following code may be used:

if (mw.config.get("wgNamespaceNumber") === 2) {
    window.autoPurgePages = [mw.config.get("wgPageName")];

A list of namespaces is provided below:

ID Namespace Description
-2 Media Used for direct linking to images. For example, Media:Wiki.png links directly to the image page.
-1 Special Special pages. Used by MediaWiki code and extensions
0 Mainspace Articles
1 Talk Article discussion
2 User Personal user pages
3 User talk Pages for discussion with users
4 Project/Sitename Wiki-related content
5 Project talk/Sitename talk Discussion of Project pages
6 Image/File File descriptions
7 Image talk/File talk File discussion
8 MediaWiki System messages and configuration
9 MediaWiki talk Discussion of MediaWiki pages
10 Template Templates
11 Template talk Template discussion
12 Help Help pages, also see Shared Help
13 Help talk Discussion about Help pages
14 Category Categories
15 Category talk Category discussion
110 Forum Old forum pages
111 Forum talk Discussion about old forum pages
500 User blog Blog pages
501 User blog comment User blog comments
502 Blog Blog listing pages
503 Blog talk Blog listing page discussion. Generally unused
828 Module Lua module pages
829 Module talk Lua module discussion pages
1200 Message Wall Pages used for the Wall extension. Touch only if you know what are you doing.
1201 Thread Message Wall thread namespace
1202 Message Wall Greeting Pages used for content above message boxes on Message Walls
2000 Board Board namespace. Used for storing board descriptions
2001 Board Thread Forum threads
importArticles — Best Practices for installing JavaScript on FANDOM
The importArticles statement is designed to combine multiple HTTP requests into a single data transfer, allowing multiple scripts to load and execute faster. If you've been installing several different scripts, your JavaScript file has probably accumulated unnecessary import statements. Click "Expand" to learn how to efficiently batch import scripts to speed up performance and make your code look cleaner. One other approach is by using the MediaWiki:ImportJS.
If your JavaScript file has several lines of code that say importScript, importScriptPage, or importArticles, you may be able to combine them! By batch importing a collection of scripts with a single import, your JavaScript code will load faster and look cleaner. Consider the example below. On the left is an example of what your JavaScript file might currently look like. On the right is how you could improve that code.
Multiple imports — messy and slow One import — clean and efficient
  type: 'script',
  article: 'u:dev:FloatingToc/code.js'
importScriptPage('page1.js', 'wikiname');
importScriptPage('page2.js', 'wikiname');
    type: 'script',
    articles: [
Note: In this example, pay close attention to the placement of commas and other punctuation. For people who aren't familiar with programming (and even those who are!), a common mistake when writing code is to accidentally delete, forget, or misplace critical symbols like commas or quotation marks. This can cause a syntax error that breaks the code. Carefully follow the convention shown here when using importArticles.
But there's much more to importArticles than just this! For more examples and advanced usage, see the help page at Help:Including additional JavaScript and CSS.


  • 04-08-17 - Initial revision