Fandom Developers Wiki
Advertisement

WikiActivity is a script that reimplements the legacy Special:WikiActivity page into the Unified Community Platform with a modernized look.

Usage

Configurations

The configuration object for the WikiActivity script is window.rwaOptions. It is important for configurations to be added before importing the script to your wiki. There are a total of 11 configurable properties at this time. The following properties are:

limit
Accepts: {number}
Default: 50
The maximum number of entries to display on the activity feed.
namespaces
Accepts: Array<number>
Default: [ 0, 1 ,2, 3, 4, 5, 6, 7, 110, 111, 500, 501, 828, 829 ]
An array of namespaces to show on the activity feed.
autoInit
Accepts: {boolean}
Default: true
Determines whether the script should be initialized on page load.
themeName
Accepts: {string}
Default: "main"
Sets the theme for the activity feed.
showBotEdits
Accepts: {boolean}
Default: false
Determines whether bot edits should be displayed.
loadModule (TODO)
Accepts: {boolean}
Default: false
Determines whether the activity feed module should be loaded.
customRendering
Accepts: {Object}
Default: { }
Allows for custom rendering of the activity feed based on the theme.
headerLink
Accepts: {boolean}
Default: false
Determines whether to revert the RecentChanges link to WikiActivity.
Note: This option should always be set to false when used site-wide.
refresh
Accepts: {boolean}
Default: false
Determines whether the activity feed should automatically refresh.
refreshDelay
Accepts: {number}
Default: 300000
The amount of time to delay refreshing the activity feed. The default refresh period is 5 minutes.
timeout (TODO)
Accepts: {number}
Default: 10000
The timeout for loading the activity feed. The default timeout period is 10 seconds.

Default configurations

window.rwaOptions = {
    limit : 50,
    namespaces : [ 0, 1, 2, 3, 4, 5, 6, 7, 110, 111, 500, 501, 828, 829 ],
    autoInit : true,
    themeName : "main",
    showBotEdits : false,
    loadModule : false,
    customRendering : { },
    headerLink : false,
    refresh : false,
    refreshDelay : 5 * 60 * 1000,
    timeout : 10 * 1000
};

Constructors

There are three constructors for this script, WAStorage, WikiActivity, and FeedUI. WAStorage is a private constructor, while WikiActivity and FeedUI is public.

WAStorage

A wrapper for localStorage made specifically for this script in mind, with a few changes, such as storing a key for a specific period of time. This constructor does not contain any params.

get
Fetches the storage key's value if it exists
<WAStorage>.get(k)
k
Accepts: {string}
The key to fetch the value from.
Returns
{any}
const s = new WAStorage( );
const v = s.get( "test" );
set
Sets the key's value or updates it when the key exists
<WAStorage>.set(k, v)
k
Accepts: {string}
The key to set (or update) the value to
v
Accepts: {string}
The value used to set (or update)
Returns
void
remove
Removes a key from the WikiActivity storage
<WAStorage>.remove(k)
k
Accepts: {string}
The key to remove
Returns
void
clear
Clears the WikiActivity storage
<WAStorage>.clear()
Returns
void
store
Similar to set; however, the values are stored for a specific period.
<WAStorage>.store(o, d)
o
Accepts: {Object}
An object of values to set
d
Accepts: {Date|number}
The expiry time for the keys
Returns
void
fetch
Similar to get; however, the key gets removed if it is past the expiry period.
<WAStorage>.fetch(k)
k
Accepts: {string}
The key to get the value from
Returns
{any}

WikiActivity

The primary constructor and controller for WikiActivity. This controller can affect the way its UI displays and how the feed entries appear. It also loads the Wiki Activity link to the toolbar, and if allowed by the script's configuration, converts the RecentChanges link to the WikiAcitivty link.

Primary methods and properties
Properties
Methods

msg
A wrapper for the I18n-js msg function.
<WikiActivity>.msg(...args)
args
Accepts: {string[]}
The arguments used for parsing an I18n-js message
Returns
<{parse: function, escape: function, plain: function, exists: boolean}>
getTimeDiff
Fetches the time difference
<WikiActivity>.getTimeDiff(x)
x
Accepts: {string|number|Date}
The number, string, or Date object used for parsing the time difference
Returns
{number}
configure
Configures all properties of the WikiActivity instance
<WikiActivity>.configure(o)
o
Accepts: {Object}
The object to configure properties with
Returns
{any}

Activity methods and properties
Fallback methods

CSS Variables

Here are the following CSS variables used for WikiActivity:

--wa-edit
Default: #feaf09
--wa-comment
Default: #dddddd
--wa-new
Default: deepskyblue
--wa-categorize
Default: #b76801
--wa-link__color
Default: Wiki link theme

Installing the script

Changelog

September 6, 2020 (v0.5b)
Initial version, script created.
September 9, 2020 (v0.6b)
Added category previews.
Added image previews.
Created a diff button when it is not a new page.
Made CSS adjustments
October 8, 2020 (v0.81b)
Fixed the checker that is supposed to prevent the UI from generating outside the Special:WikiActivity page.
Made CSS adjustments to be in line with FandomizedActivityFeed.
When outside the wiki activity page, the script simply appends a link to the toolbar.
October 9, 2020 (v0.81b)
Made a CSS fix that allowed all images to remain inside the container.
November 3, 2020 (v0.99b)
Added a few QoL changes to the activity feed.
Added support for image and social activity.
Added an options button to allow for undoing and rolling back changes.

Reported issues

  • The script does not seem to be loading for certain wikis. (almost fixed)
  • Images tend to become missing in certain feed entries.

Planned features

  • Integrate existing WikiActivity-related scripts to this script.
  • User interface enhancements.
  • Possible integration with DiscussionsActivity.
    • Image and category previews.
    • User interface configurations.
    • Breadcrumbs?
  • Theming and CSS fixes (halfway done).
  • Add more activity types.
  • Create another type of activity feed.
  • Right rail?
  • Activity feed module?
Text above can be found here (edit)
Advertisement