Template:Userscript/sandbox: Difference between revisions

Content deleted Content added
comments
comments
 
(5 intermediate revisions by the same user not shown)
Line 1:
<includeonly><!--
 
https://en.wikipedia.org/wiki/Template:Userscript
Line 63:
_____-->{{#tag:ref|Copy the following code, '''<span title="Click here to edit your common.js page" class="plainlinks"><!--
_____-->[{{fullurl:Special:MyPage/common.js|action=edit}} click here]</span>''', then paste:<br /><!--
__________--><code>/* {{subst:iusc|1={{{code| {{#ifexist: {{{doc|}}}.js | {{{doc|}}}.js| <!--nothing--> }}}}}{{#ifeq:{{{backlink|}}}|<!--nothing-->|<!-- do nothing -->|{{!}}2{{=}}{{{backlink}}}<!-- else do this --> }}}} *</code><!--
importScript( '{{{code| {{#ifexist: {{{doc|}}}.js | {{{doc|}}}.js| }}}}}{{#ifeq:{{{backlink|}}}|||{{!}}2{{=}}{{{backlink}}} }}' );// Backlink: [[{{{code| {{#ifexist: {{{doc|}}}.js | {{{doc|}}}.js| }}}}}{{#ifeq:{{{backlink|}}}|||{{!}}2{{=}}{{{backlink}}} }}]] </code><!--
_____-->}} |<!--nothing-->}}<!-- close ifeq
-->}}<!-- close if
Line 87 ⟶ 86:
_____ -->><!-- close span tag
--></span><!--
-->}}<!-- end of ifeq
 
 
 
 
https://en.wikipedia.org/wiki/Help:Magic_words
 
{{#ifexist:pagetitle |result1 |result2}} Outputs result1 if the page [[pagetitle]] exists, otherwise outputs result2. Note that underscores are needed for spaces in namespaces.
 
 
{{#if:string |result1 |result2}} Outputs result2 if string is empty, otherwise outputs result1.
 
{{#ifeq:string1|string2 |result1 |result2}} Outputs result1 if string1 and string2 are equal (alphabetically or numerically), otherwise outputs result2.
 
{{#tag:tag|content |p1=v1 |p2=v2}} An equivalent to the HTML <tag>...</tag> that is useful when e.g. nesting references.
 
https://en.wikipedia.org/wiki/Template:InstallUserScript
 
In order to install a user script for your Wikipedia account, add the following line to Special:MyPage/Common.js or Special:MyPage/Skin.js:
 
{{subst:iusc| script_path }}
 
Replace script_path with the full .js page name of the user script to be installed.
The template must but substituted (subst:), or else it won't work.
Bypass your cache after saving the page.
 
 
https://en.wikipedia.org/wiki/Template:= This template allows "=" to be used in template parameters.
 
https://en.wikipedia.org/wiki/Template:! outputs a pipe symbol.
 
https://en.wikipedia.org/wiki/Module:String
 
https://meta.wikimedia.org/wiki/Help:Page_name "{{SUBPAGENAME:a/b/c}}" → "c"
 
 
 
 
 
 
 
 
 
--></includeonly><noinclude>{{doc}}</noinclude>