DemoScripts

DemoScripts allows demonstrating the functionality of scripts and stylesheets on the . The demos can be configured either through its JavaScript page, or through the JSON page.
====
===General configuration===
Configuration objects in DemoScripts are regular JavaScript/JSON objects with the following properties:
*page: Name of the page which the content should load on. By default, the content is also loaded on all subpages of the specified page.
*scripts: Name of the page or an array of page names from which JavaScript content for the demo should be loaded.
*styles: Name of the page or an array of page names from which CSS content for the demo should be loaded.
*selector: CSS selector on the page which makes DemoScripts load the content on that page.
*exec: A function that should run when conditions for loading the content have been met (page name is matching or selector exists). Usually used to configure scripts for the demo before importing.
*subpages: Set to false if you don't want the content to load on subpages of the specified page.
In further sections, you can see how these configuration objects can be used. In both JavaScript and JSON configuration, please keep the list of demos in alphabetical order, unless there are certain restrictions which prevent that (for example, CSS @import only working when in the first stylesheet).
===Configuring through JSON===
As demonstrations of scripts are added rather often, having each of them pass the review process is inconvenient for both users and Fandom Staff. This is why a JSON configuration page exists, where you can add your demo and have it immediately show up on the page you want to demonstrate on. For example, the following configuration makes the script from the page MediaWiki:Script.js be loaded on the Script page and its subpages:
 "Script": {
 "page": "Script",
 "scripts": "MediaWiki:Script.js"
 },
This is the preferred way of adding demonstrations. However, there are certain restrictions to this approach. Since edits to the JSON page are not reviewed before publishing, the following are not allowed:
*The exec property is not supported because JSON is not a programming language and therefore does not support functions.
*The styles property is ignored because CSS does not go through any kind of review.
*If the current page name is Page, scripts will not be loaded if any scripts are not in the form of MediaWiki:Page.js or MediaWiki:Page/submodule.js or if any "scripts" attempt to circumvent this restriction by chaining multiple scripts using |. This is so scripts cannot be loaded on every page. This restriction is in addition to, not replacing, page and selector conditions.
*#mw-content-text is prepended to restrict the element search to the main article content area. Only the first entry in a selector list is used.
===Configuring through JavaScript===
In case the JSON configuration does not suit your needs, on the script's JavaScript page you can find an includes object in which you can add a demo configuration object in a similar manner to the JSON configuration (and, more importantly, in a similar manner to what is already on that page). For example, if you wanted to add configuration for a script which configures itself before importing and works on a pseudo-special page, it would look like this:
 Script: {
 page: 'Special:Script',
 scripts: 'MediaWiki:Script.js',
 styles: 'MediaWiki:Script.css',
 exec: function() {
 window.Script = {/*... */};
 }
 },
====
*Gadgets policies and requests