FANDOM


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.

Installation

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.


See also: Help:Including additional CSS and JS, Help:Advanced CSS and JS
  • For site-wide use, an administrator can add the line below to the wiki's MediaWiki:ImportJS page. Note that JavaScript must be enabled on the wiki.
dev:AbuseLogRC.js
  • For personal use, add the code snippet below to your global.js page (for use on all wikis) or your common.js page on your wiki (for use on a single wiki). Note that personal JS must be enabled for your account.
importArticles({
    type: 'script',
    articles: [
        'u:dev:AbuseLogRC.js',
    ]
});
importArticles — Best Practices for installing JavaScript on FANDOM
The importArticles statement is designed to combine multiple HTTP requests into a single data transfer, allowing multiple scripts to load and execute faster. If you've been installing several different scripts, your JavaScript file has probably accumulated unnecessary import statements. Click "Expand" to learn how to efficiently batch import scripts to speed up performance and make your code look cleaner. One other approach is by using the MediaWiki:ImportJS.
If your JavaScript file has several lines of code that say importScript, importScriptPage, or importArticles, you may be able to combine them! By batch importing a collection of scripts with a single import, your JavaScript code will load faster and look cleaner. Consider the example below. On the left is an example of what your JavaScript file might currently look like. On the right is how you could improve that code.
Multiple imports — messy and slow One import — clean and efficient
importScriptPage('AjaxRC/code.js','dev');
 
importScript('MediaWiki:localScript.js');
 
importArticle({
  type: 'script',
  article: 'u:dev:FloatingToc/code.js'
});
 
importScriptPage('page1.js', 'wikiname');
 
importScriptPage('page2.js', 'wikiname');
importArticles({
    type: 'script',
    articles: [
        'u:dev:AjaxRC/code.js',
        'MediaWiki:localScript.js',
        'u:dev:FloatingToc/code.js',
        'u:wikiname:page1.js',
        'u:wikiname:page2.js'
    ]
});
Note: In this example, pay close attention to the placement of commas and other punctuation. For people who aren't familiar with programming (and even those who are!), a common mistake when writing code is to accidentally delete, forget, or misplace critical symbols like commas or quotation marks. This can cause a syntax error that breaks the code. Carefully follow the convention shown here when using importArticles.
But there's much more to importArticles than just this! For more examples and advanced usage, see the help page at Help:Including additional JavaScript and CSS.

Configuration

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
Variable Description Default value Type
abuseLogRC_interval Sets the refresh intervals in seconds. Limited at 5 seconds minimum. 60 number

Example:

abuseLogRC_interval = 30;
abuseLogRC_entries How many entries show in the table. 3 number

Example:

abuseLogRC_entries = 5;
abuseLogRC_showTo User group that will see the table. It can be either sysop for admins or all for every user. Note: the table will be shown to Staff, IVT and VSTF regardless. sysop string

Example:

abuseLogRC_showTo = 'all';
abuseLogRC_users Specify additional users who will see the table (useful when abuseLogRC_showTo = 'sysop';) None array

Example:

abuseLogRC_users = [ 'Leviathan 89' , 'Levibot' ];
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';
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';
abuseLogRC_collapsible true will make the table collapsible while false will not. false boolean

Example:

abuseLogRC_collapsible = false;
abuseLogRC_userInfo true will show extra details of the user while false will not. false boolean

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;
Using configuration options with Fandom Open Source Library scripts
The instructions on this page describe how to use configuration options with a script. Here on the Fandom Open Source Library, many scripts provide optional configuration settings as a mean to alter or enhance the default behavior of the script. When installing configuration options in your JavaScript file, please note that they need to go above the import statement in order to work — unless the directions say otherwise. In case MediaWiki:ImportJS is used to load the scripts, it will be executed last.
Configuration options load too late, don't work
Proper placement of configuration options
// 1. AjaxRC import statement
importScriptPage('AjaxRC/code.js','dev');
 
// 2. AjaxRC configuration option
var ajaxRefresh = 30000;
// 1. AjaxRC configuration option
var ajaxRefresh = 30000;
 
// 2. AjaxRC import statement
importScriptPage('AjaxRC/code.js','dev');

Styling

The table has various classes and IDs that allow further styling through CSS. In particular, entries are 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

AbuseLogRC custom CSS example

Example of custom CSS.

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:AbuseLogRC/stylesheet.css");

If you are importing other pages, you have to separate them with a pipe, read more at Help:Including additional JavaScript and CSS. Alternatively you can also copy and paste or edit the above CSS from AbuseLogRC/stylesheet.css.

Localization

To add other languages, provide the translations for these strings:

            // English
            en: {
                optionsHeader: 'Abuse Log Watch options',
                autoRefresh: 'Auto-refresh table every $1 seconds',
                refreshButton: 'Refresh now',
                refreshButtonDesc: 'Click here if table gets stuck',
                lastUpdate: 'Last update:',
                changeNumber: 'Change number of entries:',
                changeButton: 'Change',
                devLink: 'abuseLogRC on Dev Wiki',
                newAccount: 'new account',
                age: 'age:', // stands for "account age", from seconds to days
                globalEdits: 'global edits:',
                triggeredFilter: 'Triggered abuse filter:',
                vstfTooltip: 'Ask VSTF for help',
                apiError: 'API error:',
                ajaxError: 'AJAX error:'
            },

Note: if you need to use the character ' escape it like this \'. Don't change/remove $1.

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

Ad blocker interference detected!


Wikia is a free-to-use site that makes money from advertising. We have a modified experience for viewers using ad blockers

Wikia is not accessible if you’ve made further modifications. Remove the custom ad blocker rule(s) and the page will load as expected.