dev

UserFunctions provides functions similar to Mw:Extension:UserFunctions. See Usage for more details.

ATTENTION: The script may not work on mobile skin.

Installation

Usage

Using HTML class attribute user-functions or UserFunctions to call the functions, any <tag> is okay.

if-logged-in

<span class="user-functions" data-if-logged-in="{boolean}">[content]</span>
demo

you are logged inyou are NOT logged in

username

<!-- basic -->
<span class="user-functions" data-username>[content]</span>
<!-- with-link -->
<span class="user-functions" data-username data-wiki-link>[link text]</span>

The content will be replaced by viewer's user name.

demo

if-username

<span class="user-functions" data-if-username="{string | string[]}">[content]</span>

The content will be displayed when the viewer's user name matches the settings.

demo

You areare NOT 机智的小鱼君~

if-usergroup

<span class="user-functions" data-if-usergroup="{string | string[]}">[content]</span>

The content will be displayed when the viewer's user groups matches the settings.

demo

You areare NOT in the "sysop" group!


Data typings

boolean

examples
<!-- true -->
<span class="user-functions" data-if-logged-in>logged in</span>
<span class="user-functions" data-if-logged-in="">logged in</span>
<span class="user-functions" data-if-logged-in="whatever">logged in</span>
<!-- false -->
<span class="user-functions" data-if-logged-in="false">not logged in</span>
<span class="user-functions" data-if-logged-in="no">not logged in</span>
<span class="user-functions" data-if-logged-in="0">not logged in</span>

string[] (array of strings)

example

foo|!bar{foo: true, bar: false}


Text above can be found here (edit)