Template:Userscript/doc: Difference between revisions

Content deleted Content added
No edit summary
 
(44 intermediate revisions by 8 users not shown)
Line 1:
{{Documentation subpage}}__NOTOC__
{{intricate template}}
<!-- Categories go at the bottom of this page and interwikis go in Wikidata. -->
 
Line 5 ⟶ 6:
 
== Usage ==
<code><nowiki>{{ userscript |namecode= [script.js nameaddress] |codename= [.jsscript addressname] |doc= [documentation page address] }}</nowiki></code>
 
At least <code>|code=</code> ''' -or- ''' <code>|doc=</code> is required. The template will attempt to determine defaults for any information not entered.
All parameters are optional except for "name", however the template is not of much use without at least a .js path or a documentation path.
* '''Check the accuracy of the links after placing this template!''' If any defaults are incorrect for your script, enter the necessary parameters explicitly.
<hr>
* If you end up leaving the template with no "(source)" link produced, make sure your documentation page includes complete installation instructions, along with any necessary code page addresses.
'''Example:''' <code><nowiki>{{userscript|name=Sharebox|code=User:TheDJ/sharebox.js|doc=User:TheDJ/Sharebox}}</nowiki></code>
* You can make up any name for the <code>|name</code> parameter. It is just for display purposes.
 
{{collapse top|1=Default logic details}}
'''Produces:''' {{userscript|name=Sharebox|code=User:TheDJ/sharebox.js|doc=User:TheDJ/Sharebox}}
* The template will add .js to the documentation page name to get a default code page, or remove .js from the code page name to get a default documentation page.
** Entering <code>|code='''User:TheDJ/Sharebox'''.js</code> will look for a page named '''User:TheDJ/Sharebox''', and if found, will be linked as the documentation page.
** Entering <code>|doc='''User:TheDJ/Sharebox'''</code> will look for a page named '''User:TheDJ/Sharebox<span style="color:red">.js</span>''', and if found, will be linked as the code page.
* If the default pages don't actually exist, they won't be linked (so defaults shouldn't produce red links).
* If no name is entered, a default name will be produced from the code or doc page name.
{{collapse bottom}}
 
=== Additional parameterparameters ===
* If a documentation page exists with a name that matches the code page name (without its .js extension), that documentation page will be linked automatically, with no <code>|doc=</code> parameter required.
* This template enables an automatic installation link for editors who use automatic installer scripts like [[User:Enterprisey/script-installer]] or [[User:Equazcion/ScriptInstaller]]. ToIf you have reason to disable automatic installation for a particular script (e.g. because it requires more than just the usual importScript line), useadd the following parameter: {{para|noautoinstall|yes}}.
* You can still enter a <code>|doc=</code> parameter explicitly if you want to override the automatic link.
* To suppress the creation of a footnote with installation instructions, set {{para|noref|yes}}.
 
== Examples ==
'''Example:''' <code><nowiki>{{userscript|name=Sharebox|code=User:TheDJ/sharebox.js}}</nowiki></code>
'''ExampleAll parameters specified:''' <code><nowiki>{{userscript|name=Shareboxsharebox!!!!!|code=User:TheDJ/sharebox.js|doc=User:TheDJ/Shareboxsharebox}}</nowiki></code>
'''*Produces:''' {{userscript|name=Shareboxsharebox!!!!!|code=User:TheDJ/sharebox.js|doc=User:TheDJ/Shareboxsharebox}}
'''ExampleCode only:''' <code><nowiki>{{userscript|name=Sharebox|code=User:TheDJ/sharebox.js}}</nowiki></code>
'''*Produces:''' {{userscript|name=Sharebox|code=User:TheDJ/sharebox.js}}
Doc only: <code><nowiki>{{userscript|doc=User:TheDJ/sharebox}}</nowiki></code>
*Produces: {{userscript|doc=User:TheDJ/sharebox}}
 
Use <code><nowiki>{{reflist}}</nowiki></code> to produce specific installation instructions:
'''Produces:''' {{userscript|name=Sharebox|code=User:TheDJ/sharebox.js}}
{{reflist}}
 
==See also==
=== Additional parameter ===
* [[Wikipedia:User scripts/List]]
This template enables automatic installation for editors who use [[User:Equazcion/ScriptInstaller]]. To disable automatic installation, use the following parameter:
 
{{Wikipedia:User scripts/Navbox}}
<code><nowiki>|noautoinstall=yes</nowiki></code>
<includeonly>{{Sandbox other||
 
[[Category:Wikipedia scripts|*]]
<includeonly>
[[Category:Wikipedia user script templates]]
<!-- Categories go here, and interwikis go in Wikidata -->
}}</includeonly>
 
</includeonly>