Jump to content

User:Hoo man/Scripts/Active sysops

From Meta, a Wikimedia project coordination wiki
Active sysops on a wiki with 3 active administrators
Active sysops with mark global sysop wikis and mark wikis with less than 2 administrators enabled (disabled per default, see below for instructions on how to enable)

Active sysops shows the number of active (one log entry in the last 7 days, or as configured) administrators and it can mark global sysop wikis. It uses data from the toolserver.
If you found a bug in this script or if you have a feature request please leave it here or ping me on IRC (hoo).

Installation and customization

[edit]

Installation

[edit]

To use active sysops, you just have to paste this code in your Special:Mypage/common.js (or into your Special:Mypage/global.js if you want to use it project wide):

// Shows the number of active (one log entry in the last 7 days, or as configured) sysops, uses data from the toolserver
// by [[m:user:Hoo man]] <http://meta.wikimedia.org/wiki/User:Hoo_man/Scripts/Active_sysops>
mw.loader.load('//meta.wikimedia.org/w/index.php?title=User:Hoo_man/active_sysops.js&action=raw&ctype=text/javascript');

Afterwards you may have to clear your cache:

How to clear the cache

Note: After publishing, you may have to bypass your browser's cache to see the changes.

  • Firefox / Safari: Hold Shift while clicking Reload, or press either Ctrl-F5 or Ctrl-R (⌘-R on a Mac)
  • Google Chrome: Press Ctrl-Shift-R (⌘-Shift-R on a Mac)
  • Edge: Hold Ctrl while clicking Refresh, or press Ctrl-F5.

Customization

[edit]

You can customize the tool in many ways (you can eg. completely translate it), here are the most important things you can change. Just append this to your JS file.

To fully disable the script
disable_activeSysops = true;
To mark wikis where global sysops can act (will display a good visible box at the top left)
if(typeof(activeSysopsConfig) == 'undefined') activeSysopsConfig = {};
activeSysopsConfig.markWikisGS = true;
To show a button on wikis with less than X active sysops (will display a good visible box if chosen)
if(typeof(activeSysopsConfig) == 'undefined') activeSysopsConfig = {};
activeSysopsConfig.markWikisActiveSysops = true;
activeSysopsConfig.markWikisActiveSysopsLessThan = X;


To sort the above buttons use (only effective if both buttons are activated)
Number of active administrators first
if(typeof(activeSysopsConfig) == 'undefined') activeSysopsConfig = {};
activeSysopsConfig.markWikisActiveSysopsFirst = true;


To change the the time the last action can be in add (time in seconds, default one week)
if(typeof(activeSysopsConfig) == 'undefined') activeSysopsConfig = {};
activeSysopsConfig.lastAction = 12345;
To have the link to the tool at another place
if(typeof(activeSysopsConfig) == 'undefined') activeSysopsConfig = {};
activeSysopsConfig.toolLinkMethod = 'FOO';
Can take all values which are possible in addPortletLink

Users

[edit]