Fandom Developers Wiki
Tag: sourceedit
m (the name of section in Help was changed)
(14 intermediate revisions by 11 users not shown)
Line 1: Line 1:
  +
<noinclude>{{LangSelect}}</noinclude><includeonly>{{Languages}}
 
{{Infobox JavaScript
 
{{Infobox JavaScript
| Image file = InputUserName.jpg
+
| Image file = InputUserName.jpg
| Description = Shows your username on the page.
+
| Description = Shows your username on the page
| Scope = Site wide only
+
| Scope = s
| Author = Multiple (Creator: Ihojose)
+
| Author = [[User:Ihojose|Ihojose]]
 
| Updated = {{updated|MediaWiki:InputUsername/code.js}}
| Updated = September 26, 2014
 
| Code = [[MediaWiki:InputUsername/code.js|code.js]]
+
| Code = [[MediaWiki:InputUsername/code.js|code.js]]
| Skins = Oasis
+
| Type = site
| Languages = All
 
 
}}
 
}}
 
'''InputUsername''' is a plugin that shows your username on the page where designated. It only works for logged-in users.
 
'''InputUsername''' is a plugin that shows your username on the page where designated. It only works for logged-in users.
   
  +
== Installation ==
If a user wishes to disable the replacement on a particular wiki (for instance if it is being added in a confusing way), he or she may add <source lang="javascript">window.disableUsernameReplace = true;</source> to their personal common.js file and the script will be ignored without affecting other users.
 
 
 
{{Script Install
 
{{Script Install
  +
| codepage = InputUsername/code.js
|Use=S
+
| Use = S
|Source=<syntaxhighlight lang="javascript">
 
  +
}}
importArticles({
 
  +
type: "script",
 
  +
== Usage ==
articles: [
 
  +
<syntaxhighlight lang="html5"><span class="InputUsername">{{{1|&#8203;}}}</span></syntaxhighlight>
"w:c:dev:InputUsername/code.js"
 
 
Typically, this will be added as a template such as ''Template:USERNAME'', which mimics existing [[Help:Magic words#Common magic words|magic words]] when added to a page, e.g. <nowiki>{{USERNAME}}</nowiki>. An example can be found on the [[w:c:template:Template:USERNAME|Templates wiki]].
]
 
  +
});
 
  +
== Configuration ==
</syntaxhighlight>}}
 
 
If a user wishes to disable the replacement on a particular wiki (for instance if it is being added in a confusing way), they can add
  +
<syntaxhighlight lang="javascript">window.disableUsernameReplace = true;</syntaxhighlight>
  +
to their personal common.js page and the script will be ignored without affecting other users.
  +
<syntaxhighlight lang="javascript">window.UsernameReplaceSelector = '.custom';</syntaxhighlight>
  +
can be used to add a selector to the script.
  +
  +
Whatever is between the <code><nowiki><span class="InputUsername"></nowiki></code> and the <code></span></code> is the text to display if the current viewer isn't signed into an account.
   
=== Syntax ===
+
== Example ==
<syntaxhighlight lang="html5"><span class="InputUsername">&#8203;</span></syntaxhighlight>
+
<pre>Hello, <span class="InputUsername">anonymous user</span>!</pre>
  +
will output:
Typically, this will be added as a template such as ''Template:USERNAME'', which mimics existing [[Help:Magic words#Common Magic Words|magic words]] when added to a page, e.g. <nowiki>{{USERNAME}}</nowiki>. An example can be found on the [[w:c:template:Template:USERNAME|Templates wiki]].
 
  +
: Hello, <span class="InputUsername">anonymous user</span>!
  +
</includeonly>

Revision as of 15:32, 17 January 2020

InputUsername is a plugin that shows your username on the page where designated. It only works for logged-in users.

Installation

Usage

<span class="InputUsername">{{{1|&#8203;}}}</span>

Typically, this will be added as a template such as Template:USERNAME, which mimics existing magic words when added to a page, e.g. {{USERNAME}}. An example can be found on the Templates wiki.

Configuration

If a user wishes to disable the replacement on a particular wiki (for instance if it is being added in a confusing way), they can add

window.disableUsernameReplace = true;

to their personal common.js page and the script will be ignored without affecting other users.

window.UsernameReplaceSelector = '.custom';

can be used to add a selector to the script.

Whatever is between the <span class="InputUsername"> and the is the text to display if the current viewer isn't signed into an account.

Example

Hello, <span class="InputUsername">anonymous user</span>!

will output:

Hello, anonymous user!
Text above can be found here (edit)