FANDOM


CustomButton adds a custom button to the page controls allowing users to have custom page controls. This works for links and JS operations and can be excluded from certain pages or even namespaces.

Advantage

  • Doesn't require too much knowledge of JS
  • To find the namespace number without using JS, use the syntax {{NAMESPACENUMBER}} on a page in the wanted namespace
  • If you can't edit a page (such as special pages) you will have to open your browser's console and type in
    wgNamespaceIds.NAMESPACE
    but replace NAMESPACE with your target namespace.

Usage


Configuration

exclude = [
    'PAGENAME',
    'ANOTHERPAGENAME'
];
excludens = [
    'NAMESPACE#',
    'ANOTHERNAMESPACE#'
];
link = 'URL';
id = 'ID';
tooltip = 'HOVERTEXT';
target = 'TARGETMETHOD';
accesskey = 'ACCESSKEY';
JS = 'JAVASCRIPT';
wikitext = 'TEXT';
Using configuration options with FANDOM Open Source Library scripts
The instructions on this page describe how to use configuration options with a script. Here on the FANDOM Open Source Library, 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
Proper placement of configuration options
// 1. AjaxRC import statement
importScriptPage('AjaxRC/code.js','dev');
 
// 2. AjaxRC configuration option
var ajaxRefresh = 30000;
// 1. AjaxRC configuration option
var ajaxRefresh = 30000;
 
// 2. AjaxRC import statement
importScriptPage('AjaxRC/code.js','dev');