Jump to content

User:Perhelion/userstatus

From Meta, a Wikimedia project coordination wiki

Installation

[edit]

Copy the following code in your global.js or common.js:

// [[File:Perhelion/userstatus.js]]
if ( [ 2, 3 ].indexOf( mw.config.get( 'wgNamespaceNumber' ) ) !== -1 && ( !mw.config.get( 'wgArticleId' ) || mw.config.get( 'wgAction' ) === 'view' ) )
	mw.loader.load( '//meta.wikimedia.org/w/index.php?title=User:Perhelion/userstatus.js&action=raw&ctype=text/javascript' );
Example in German

Manual run

[edit]

For a manual start, the script can be installed with a tool-link, hier "ExtendedUserinfo":

// [[File:Perhelion/userstatus.js]]
if ( [ 2, 3 ].indexOf( mw.config.get( 'wgNamespaceNumber' ) ) !== -1 && ( !mw.config.get( 'wgArticleId' ) || mw.config.get( 'wgAction' ) === 'view' ) )
	$.when( mw.loader.using( 'mediawiki.util' ), $.ready ).then( function () {
		mw.util.addPortletLink(
			'p-tb',
			'#',
			'ExtendedUserinfo',
			't-mworg2',
			'Load extended userinfo',
			'm',
			'#t-print' ).addEventListener( 'click', function () {
				mw.loader.load( '//meta.wikimedia.org/w/index.php?title=User:Perhelion/userstatus.js&action=raw&ctype=text/javascript' );
		} );
	} );

Configuration

[edit]

The script can be controlled by several variables. For this purpose add following code (at best before the integration):

$(document).on("loadWikiScript", function (e, userstatus) {
	if (userstatus.name === "Userstatus") {
		userstatus.lastEditSeconds = true; // Show seconds of last edit
		userstatus.styleMissingData = "color: #987; font-style: italic";
		userstatus.styleLoading = "font-style: italic";
		userstatus.styleBlocked = "color: #c20";
		userstatus.styleNotBlocked = "color: #182";
	}
});
Parameter Beschreibung Werte Standardwert
userstatus.lastEditSeconds Bei der Berechnung des letzten Edits Sekunden mit angeben boolean false
userstatus.viewPatrolNumber Anzeige der Sichtungen des Benutzers, benutzt die Daten von HRoestBot boolean true
userstatus.styleMissingData für fehlende Daten CSS-String "color: #999; font-style: italic"
userstatus.styleLoading für Daten, die gerade geladen werden CSS-String "font-style: italic",
userstatus.styleBlocked für die Blockstatusanzeige, falls der Benutzer gesperrt ist CSS-String "color: #c00",
userstatus.styleNotBlocked für die Blockstatusanzeige, falls der Benutzer ungesperrt ist. CSS-String "color: #080"

Other languages

[edit]

This gadget is prepared for multilingual support.

  • If you like a version in your own language, please forward translations to me:
    • This documentation page.
    • The var msg mapping on top of source code.
    • Further ISO 639 language codes your translation might support.
  • Current supported languages
    • German, English

Codes

[edit]
Source code
Namespaces 2, 3
mw.hook
-
mw.libs userstatus
Cookies If not supported localStorage
  • indexedDB.Userstatus
MediaWiki
  • 1.26 > (not sure known yet)
Browser
  • IE: >8 required.
  • No other limitation known.