FANDOM


Traduction incomplète

Cette page, ou certaines sections de cette page, n'ont pas encore été traduites. Veuillez la traduire vers la langue appropriée (Français).

AddRailModule ajoute un module au rail Wikia du Wiki concerné (côté latéral).

Les informations pour le module à afficher sont stockées dans Modèle:RailModule. Ce modèle doit être créé sur le Wiki concerné contenant ce que vous aimeriez ajouter dans le module.

Installation

Configuration

To add the contents of Template:RailModule as a module towards the top of the side rail:

window.AddRailModule = [{prepend: true}];

To add multiple modules (e.g., the contents of Template:Foo, Template:Bar, and Template:Baz) towards the bottom of the side rail:

window.AddRailModule = ['Template:Foo', 'Template:Bar', 'Template:Baz'];

To add multiple modules towards both the top and bottom of the side rail:

window.AddRailModule = [
    {page: 'Template:Foo', prepend: true},
    'Template:Bar',
    'Template:Baz',
];

NB: If you specify more than two modules for prepending, only the first two will be honored.

window.AddRailModule = [
    {page: 'Template:Foo', prepend: true},  // okay
    {page: 'Template:Bar', prepend: true},  // okay
    {page: 'Template:Baz', prepend: true},  // not okay; will be added towards the bottom of the side rail instead
];

The contents of each module may be cached for up to maxAge seconds. By default, this is 300 seconds (five minutes). If your module is short-lived—i.e. it updates often (like polls), or is random in nature, or relies on page name variables like {{PAGENAME}}—then set maxAge to 0 seconds. Conversely, if your module is long-lived, then maxAge can be set up to 86,400 seconds (one day).

window.AddRailModule = [
    {page: 'Template:RandomGreeting', prepend: true, maxAge: 0},
    {page: 'Template:FAQs', maxAge: 86400},
];

Using configuration options with Fandom Developers Wiki scripts

The instructions on this page describe how to use configuration options with a script. Here on the Fandom Developers Wiki, many scripts provide optional configuration settings as a mean to alter or enhance the default behavior of the script. When installing configuration options in your JavaScript file, please note that they need to go above the import statement in order to work — unless the directions say otherwise. In case MediaWiki:ImportJS is used to load the scripts, it will be executed last.

Configuration options load too late, don't work
// 1. AjaxRC import statement
importScriptPage('AjaxRC/code.js','dev');
 
// 2. AjaxRC configuration option
var ajaxRefresh = 30000;
Proper placement of configuration options
// 1. AjaxRC configuration option
var ajaxRefresh = 30000;
 
// 2. AjaxRC import statement
importScriptPage('AjaxRC/code.js','dev');


Styling

To target all custom modules, use the selector .railModule.

To target specific custom modules, consider wrapping the contents of each module in their own unique container element in your templates, and selecting that instead.

Advanced usage

If your module makes use of parser tags like <gallery/> or <twitter/>, you may find that they don't load properly. If this is the case, check whether they're listed under Rewire § Support, and if they are, add dev:Rewire.js to your MediaWiki:ImportJS.

Community content is available under CC-BY-SA unless otherwise noted.

Fandom may earn an affiliate commission on sales made from links on this page.

Stream the best stories.

Fandom may earn an affiliate commission on sales made from links on this page.

Get Disney+