Template:WithJs
Jump to navigation
Jump to search
[edit] [ ]
Template documentation

Usage
Add to the top of pages which use javascript. The first argument should be the javascript file to use. The script must be in the MediaWiki
namespace.
In the linked javascript file, you should add to the top of the script the following code:
document.getElementById("javascriptNotice") && document.getElementById("javascriptNotice").remove();
Examples
If you link to a page which is invalid, {{WithJs|MediaWiki:not_javascript}}
and {{WithJs|NotInCorrectNamespace.js}}
makes:
![]() | {{WithJs}} requires that the script is inside of the MediaWiki namespace, and ends with .js . |
If you link to a page which does not exist, {{WithJs|MediaWiki:thisJavascriptDoesNotExist.js}}
makes:
![]() | To enable javascript on this page, you first need to be an admin or interface op, then you need to make the javascript file MediaWiki:thisJavascriptDoesNotExist.js. If you are not an admin, then first, make the script inside your userspace, and import it from your common.js file to test. Once the script is completed, ask an admin who knows javascript to add it to the mediawiki namespace, by adding {{WithJs/askMove|User:Example/myScript.js|MediaWiki:thisJavascriptDoesNotExist.js}}. |