AbuseLogRC

AbuseLogRC adds a table on top of Special:RecentChanges showing the last triggered anti-abuse filters. Generally useful for admins, but also for anyone who wants to keep an eye on a wiki.
== ==
This script won't run on wikis without AbuseFilter enabled, but it won't create any issue either, therefore it can also be added on one's own global.js to have it enabled on any wiki with AbuseFilter.
== ==
The script can be used as it is, but it does also support these customizable variables that can be added before the import on Common.js or the chosen JS page. Common.js will run before MediaWiki:ImportJS.
General configuration 	General configuration 	General configuration 	General configuration
Variable 	Description 	Default value 	Type
abuseLogRC_interval 	Sets the refresh intervals in seconds. Limited at 5 seconds minimum. 	60 	number
Example:
abuseLogRC_interval = 30;	
Example:
abuseLogRC_interval = 30; 	
Example:
abuseLogRC_interval = 30;	
Example:
abuseLogRC_interval = 30;
abuseLogRC_entries 	How many entries show in the table. 	3 	number
Example:
abuseLogRC_entries = 5;	
Example:
abuseLogRC_entries = 5; 	
Example:
abuseLogRC_entries = 5;	
Example:
abuseLogRC_entries = 5;
abuseLogRC_showTo 	User groups—other than sysop, soap, wiki-specialist, and staff—that should see the table. For authenticated users, use the group name user. For all—including anonymous—users, use the group name *. Note: users who don't have the abusefilter-log right will not see the table.	None 	array
Example:
abuseLogRC_showTo = [ 'content-moderator' ];	
Example:
abuseLogRC_showTo = [ 'content-moderator' ]; 	
Example:
abuseLogRC_showTo = [ 'content-moderator' ];	
Example:
abuseLogRC_showTo = [ 'content-moderator' ];
abuseLogRC_users 	Specify additional users who should see the table; this is useful for when they don't belong to a unique set of groups. Note: users who don't have the abusefilter-log right will not see the table. 	None 	array
Example:
abuseLogRC_users = [ 'Leviathan 89' , 'Levibot' ];	
Example:
abuseLogRC_users = [ 'Leviathan 89' , 'Levibot' ]; 	
Example:
abuseLogRC_users = [ 'Leviathan 89' , 'Levibot' ];	
Example:
abuseLogRC_users = [ 'Leviathan 89' , 'Levibot' ];
Appearance customization	Appearance customization 	Appearance customization	Appearance customization
Variable 	Description 	Default value 	Type
abuseLogRC_order 	older will show older entries on top while newer will show the newer ones instead. 	newer 	string
Example:
abuseLogRC_order = 'older';	
Example:
abuseLogRC_order = 'older'; 	
Example:
abuseLogRC_order = 'older';	
Example:
abuseLogRC_order = 'older';
abuseLogRC_position 	after will place the table after RC's content, at the bottom of the page, while before will place it before, at the top. 	before 	string
Example:
abuseLogRC_position = 'after';	
Example:
abuseLogRC_position = 'after'; 	
Example:
abuseLogRC_position = 'after';	
Example:
abuseLogRC_position = 'after';
abuseLogRC_collapsible 	true will make the table collapsible while false will not. 	false 	boolean
Example:
abuseLogRC_collapsible = false;	
Example:
abuseLogRC_collapsible = false; 	
Example:
abuseLogRC_collapsible = false;	
Example:
abuseLogRC_collapsible = false;
abuseLogRC_userInfo 	true will show extra details of the user while false will not. 	false 	boolean
Example:
abuseLogRC_userInfo = false;	
Example:
abuseLogRC_userInfo = false; 	
Example:
abuseLogRC_userInfo = false;	
Example:
abuseLogRC_userInfo = false;
abuseLogRC_timeFrame1
abuseLogRC_timeFrame2
abuseLogRC_timeFrame3	Will set up to 3 time limits that will mark an entry with a specific CSS class allowing further customization by highlighting newer entries. Values are in hours, if you desire to "kill" a class just set the previous limit to 0. See Styling for further informations. 	
2
12
24 	number
Example:
abuseLogRC_timeFrame1 = 4;
abuseLogRC_timeFrame2 = 24;
abuseLogRC_timeFrame3 = 48;	
Example:
abuseLogRC_timeFrame1 = 4;
abuseLogRC_timeFrame2 = 24;
abuseLogRC_timeFrame3 = 48; 	
Example:
abuseLogRC_timeFrame1 = 4;
abuseLogRC_timeFrame2 = 24;
abuseLogRC_timeFrame3 = 48;	
Example:
abuseLogRC_timeFrame1 = 4;
abuseLogRC_timeFrame2 = 24;
abuseLogRC_timeFrame3 = 48;
== Styling ==
The table has various classes and IDs that allow further styling through CSS. In particular, entries have the class abItemRowFilter#, with # the ID of the triggered filter, and are also divided by the abuseLogRC_timeFrame# variables in four classes:
* abUrgency1: for entries newer then abuseLogRC_timeFrame1 hours ago.
* abUrgency2: for entries newer then abuseLogRC_timeFrame2 hours ago.
* abUrgency3: for entries newer then abuseLogRC_timeFrame3 hours ago.
* abUrgency4: for the remaining entries.
=== Example of customization ===
You can import the above customization placing this at the beginning of your MediaWiki:Common.css or personal CSS page:
@import url("/load.php?mode=articles&only=styles&articles=u:dev:MediaWiki:AbuseLogRC.css");
If you are importing other pages, you have to separate them with a pipe, read more at w:Help:Including additional CSS and JS. Alternatively you can also copy and paste or edit the above CSS from MediaWiki:AbuseLogRC.css.
== Notes ==
* There is currently a bug with the API which doesn't return all actions taken by Abuse Filter, but it lists only one instead.
== Changelog ==
Date 	Notes 	Updated by
October 1st, 2016 	Created 	leviathan 89
October 2nd, 2016 	Added support for live options 	leviathan 89
October 4th, 2016 	Added "position option" and bugfixes	leviathan 89
October 5th, 2016 	Added other languages 	leviathan 89
October 6th, 2016 	
Added collapsible table support;
added user extra info support;
added AF details support;
added MediaWiki messages support and reworked i18n;
added live sorting;
minor changes.	leviathan 89
October 7th, 2016 	
Time bugfixes;
removed custom date separator;
added more languages.	leviathan 89
October 8th, 2016 	
Fixed API permission error for non-sysops;
fixed control check for sysops and the settings to show to "all";
added a refresh every once in a while to update the HTML;
added more languages;
minor changes	leviathan 89
October 9th, 2016 	
Added more languages. 	leviathan 89
October 15th, 2016 	
Added more languages.
Shows only the last error.	leviathan 89
February 25th, 2017	
Added a link to Special:AbuseLog 	DarkBarbarian
︙ 	︙ 	︙
January 28th, 2019 	
Changed the throbber base URL to use style path from mw.config;
changed the next refresh countdown to start after the current refresh completes (instead of after it beginning);
changed error handling to disable auto-refresh on refresh failure;
removed the erroneous Tor indicator (since TorBlock has been sunset);
fixed the UI from pre-emptively reporting that a refresh has completed;
fixed hard refreshes so they no longer perform a redundant soft refresh;
fixed the caption for log details links to read "details" (instead of "examine"); and
fixed the stuck throbber on refresh failure.	puxlit
February 7th, 2019 	
Changed internals to perform proper user rights checking (instead of making assumptions based on group membership);
changed UI to show action links (like viewing log details, searching the log by a specific filter, viewing filters, or blocking users) based on the user's rights;
changed abuseLogRC_showTo to support an array of group names;
changed abuseLogRC_showTo = 'all' to mean authenticated users only (instead of all—including anonymous—users); and
fixed some inefficiencies in the bootstrap sequence.	puxlit
October 26th, 2020 	
Permit wiki managers and content team members to load this script;
replace VSTF references with SOAP;
hard-code link to w:c:dev:AbuseLogRC (to prevent malformed links on /iso wikis);
hard-code source for throbber GIF (since that asset is missing from /skins-ucp);
handle some UCP-related inconsistencies (like flakey user_groups, inaccurate user_editcounts, and missing user_ages); and
elide details prop if abuseLogRC_userInfo is set to false.	C.Syde65, DarkBarbarian, and puxlit