![]() | This is a documentation subpage for Template:Userscript. It may contain usage information, categories and other content that is not part of the original template page. |
This template is used to create userscript listings, primarily for use at Wikipedia:User scripts, but it can be used on any page.
Usage
{{userscript |code= [.js address] |name= [script name] |doc= [documentation page address] }}
Either |code
, - or - |name
+ |doc
, are required. If you enter only name and doc without a code address, make sure the documentation page contains complete installation instructions, along with any page addresses required.
- The name will be linked to the documentation page.
- The code page will be linked from a separate "(source)" link.
Defaults
If you enter a code address and no name, the name defaults to the code page's name, without its path or ".js".
- Example: Entering
|code=User:TheDJ/sharebox.js
defaults to "sharebox".
If you enter a code address and no doc, and a documentation page exists with a name that matches the code page name (without its .js extension), that documentation page will be linked by default.
- Example: Entering
|code=User:TheDJ/Sharebox.js
will look for a page named User:TheDJ/Sharebox, and if found, will be linked as the documentation page.
You can override the default name and/or documentation page defaults by entering those parameters explicitly.
Examples
All parameters specified: {{userscript|name=Sharebox|code=User:TheDJ/sharebox.js|doc=User:TheDJ/Sharebox}}
Name + doc specified: {{userscript|name=Sharebox|doc=User:TheDJ/Sharebox}}
- Produces: Sharebox
Code only: {{userscript|code=User:TheDJ/sharebox.js}}
Additional parameter
This template enables an automatic installation link for editors who use automatic installer scripts like User:Equazcion/ScriptInstaller. If you have reason to disable automatic installation for a particular script (eg. because it requires more than just the usual importScript line), add the following parameter:
|noautoinstall=yes
- ^ Copy the following code, edit your user JavaScript, then paste:
{{subst:lusc|1=User:TheDJ/sharebox.js}}
- ^ Copy the following code, edit your user JavaScript, then paste:
{{subst:lusc|1=User:TheDJ/sharebox.js}}