User talk:Gerbrant/mng/decache.js

From Wikipedia, the free encyclopedia

Gerbrant.mng.decache
This module provides a way to link to an external application to remove scripts from the cache.

Contents

[edit] Usage

When a JavaScript page is open, a "Decache" link appears in the toolbox. When clicked a popup opens, showing a list of loaded scripts. Check those you want to remove from the cache (i.e. those you have modified recently) and click the link below the list.

The following scripts are available in the list:

  1. The current JavaScript page (selected by default).
  2. Your monobook script.
  3. All scripts specified at Gerbrant.fw.load.
  4. All other scripts loaded using loadModule(s) after this script is loaded. For this reason, it's usually best to load this script before all other scripts with dependencies.

That the "Decache" link appears in the toolbar, and only when on a JavaScript page, is default behaviour. This can be customized using settings.

[edit] Installation

This script will only work in conjunction with Gerbrant.fw (documentation). If you're already using it, just add "Gerbrant.mng.decache" to the start of the list of modules to load, otherwise paste the following in your monobook.js:

Gerbrant = {fw: {load: [

"Gerbrant.mng.decache"

]}}

document.write('<script type="text/javascript" src="http://en.wikipedia.org/w/index.php?title=User:Gerbrant/fw.js&action=raw&ctype=text/javascript&dontcountme=s"></script>');

Note that currently the only scripts not loaded through Gerbrant.fw that can be decached are any JavaScript page you're viewing and your monobook script, so you might want to move other scripts that change frequently to this list as well.

[edit] Exports

Note: this module by default exports nothing when not at a Javascript page.

show()
Shows the window.
caption
String, "Decache".

[edit] Settings

onAllPages
If defined and true, this module will load on all pages, not only on JavaScript pages.
notInToolbox
If defined and true, this module won't appear in the toolbox, and you'll have to activate it in a different manner.

Example:

{
    onAllPages: true,
    notInToolbox: true
}

This example can be tested by inserting it in your monobook.js:

Gerbrant = { ...
mng: { ...
decache: <example>
... } ... }