RecentChangesMultiple/ja

RecentChangesMultiple is designed for monitoring multiple wikis at once, giving one central location to view all the edits. While this script is designed to emulate standard RecentChanges as close as possible, there are many subtle differences (see Notes below).

This tool is designed primarily with Fandom wikis in mind, but should work for many wikis by default, and has some settings to handle special cases for certain non-Fandom wikis (such as "&scriptdir=" below). When adding non-Fandom wikis, it's important to note that this script is designed for MediaWiki wikis, and requires the Mediawiki API to be enabled on a wiki to run.


 * Example Page

Translations / bugs can be posted on the talk page (but also make sure to message me so I don't miss it).

This script can be found on Github, along with a changelog as of V1.2.0.

HTTPS
If this script is run on a wikia/Fandom wiki with HTTPS enabled, you will not be able to load content from wikias without HTTPS. This is a security feature enabled by the browser. Currently this can cause issues even between Fandom/wikia wikis as non-English wikias do not use the HTTPS protocol while English wikis do (if enabled in user settings), and all fandom wikis do use HTTPS. This issue can currently be worked around by running this script on a non-English wikia that doesn't use HTTPS.

'''If you are having HTTPS loading issues running the script on a fandom.com wiki, try changing any wikia.com wiki links in your list to fandom.com, assuming they have been converted already. If they haven't been converted yet, you'll either need to run the script on a wiki using HTTP, or remove the wiki from the list until it's moved to fandom.com. Sorry for any inconvience this may cause.'''

Once HTTPS is enabled across all wikia/Fandom wikis this issue will be fixed for Fandom monitoring.

This issue will still effect some external wikis however that will continue to run without HTTPS. For now this can be bypassed like mentioned above, but once HTTPS is enabled on all Fandom wikis, these wikis will no longer be able to be loaded until they update to the HTTPS protocol.

Basic Usage
All that's truly need after the script is installed is a div with the "rc-content-multiple"  and a bullet list with the link of the wiki's domain (the div will need to be added via source mode). Duplicate entries are ignored. Example:
 * https://runescape.fandom.com/fr/
 * wowwiki.fandom.com
 * https://dev.fandom.com &bgcolor=green

Basic Features
While not part of Special:RecentChanges, these are some additional features included by default.
 * AjaxRC: Inspired by AjaxRC, an "auto-refresh" option is available, that when ticked will cause the list to be refreshed every 60 seconds. A cookie is used to store the setting of the checkbox once clicked.
 * Upon activating, you'll be prompted to activate HTML5 notifications (optional), which will inform you of updates when you navigate away from the window/tab. To disable them after enabling them, click the gear icon on a notification.
 * [[File:RecentChangesMultiple AjaxDiff icon.png]] AjaxDiff: Inspired by AjaxDiff / LastEdited, you can view the "diff" of a change without changing pages, by hitting the icon to the right of the "diff"/"prev"/"changes" link.
 * [[File:RecentChangesMultiple AjaxGallery icon.png]] AjaxGallery: By clicking the photo icon next to files changes (be it upload log or file page edit), you can preview the image it's related to. For grouped upload logs, you may preview a gallery of all images in the list.
 * [[File:RecentChangesMultiple AjaxPagePreview icon.png]] AjaxPagePreview: Allows you to view the page without leaving your current page.
 *  Note : This feature is fairly unpolished. Multiple CSS and JS files are not run on the preview. Thus the preview only uses the CSS from the current wiki to display pages. On browsers that support editing the shadow dom (Chrome as of writing this) or scoped styles (Firefox) some custom css from the wiki is applied (common.css it seems) as well as some JS is applied (for shadow dom), though still not all. It's still good for viewing comments/walls/board message in most cases, but for article viewing keep in mind the page may appear broken / different than expected.
 * Discussions: Inspired by DiscussionsFeed, you may now see discussions in the script. See below for information on various caveats.
 * Wiki Link Panel: To help facilitate navigation onto a specific wiki on a list, clicking one of the favicons in the "wikis loaded" section at the top of the script/along the left side of the script will give you a list of links to some common pages for that specific wiki, as well as some statistics for that wiki. If the instance only has one wiki, this panel will open by default.
 * Multiple instances: Multiple instances ("containers") may be run on the same page.
 * This includes those within tabbers and tab views.
 * It is possible to have each instance only load 1 wiki, thus allowing a more typical RecentChanges design while still viewing multiple wikis on 1 page. It's also possible to refresh all instances using the  feature.
 * Keep in mind however that some of the additional parameters below are only checked on the first instance and effect all those on the page (data-lang, data-hiderail, data-loaddelay, data-timezone).

Additional Parameters
While the above works and that's all that may be needed, there are also many other additional parameters that can be added, in 3 ways: 1 that effects every RCM, 1 that effects every wiki on a specific RCM list, and one that effects a specific wiki.

URL variables
This effects every RCM on the page. Currently the only url variables accepted are those used by a standard RecentChanges page. See more at RC Params below.

ex:

Dataset
These effect every wiki / the script as a whole for a single instance.

Show/Hide Advanced options (not necessary for most people)

datasets go directly inside the div, like so:  *list of wikis
 * Example

On List Items
Every item on the list must start with the wiki's base url, in the format "name.fandom.com" (or name.fandom.com/lang/, or "wikiname.com" (or other top level domain if the wiki doesn't have "fandom"/"wikia" in it).

These allow you to customize a specific wiki's results, instead of requiring every wiki listed to use the same options.

Each list item may have parameters added to add additional functionality for how that wiki is displayed / loaded. This can be done in one of two ways:
 * Adding  after the url. ex:
 * Adding a sub list below the entry (with or without a "&" in front of param name). ex:
 * dev.fandom.com
 * bgcolor=green

* https://fewfre.fandom.com &hideusers=Fewfre,FewBot * https://pixelmonmod.com &scriptdir=wiki &params=hidemyself:1,limit:5 * https://wiki.guildwars2.com ** favicon=wiki.guildwars2.com/images/thumb/d/df/GW2Logo_new.png/180px-GW2Logo_new.png
 * Examples

Options Panel
Offers a way to tweak "data-params=" options in real-time. The options panel does have a setting to remember the options you changed via localStorage (off by default). Any options changed before turning this feature on will also be remembered. Clicking this off again will remove the info from storage. One of the above methods should be used if you want the change to persist on a different computer / without using localStorage. The options panel also allows a way to toggle Fandom Discussions on/off.

Due to these options changing display requirements, all current changes listed on the page will be cleared and then refreshed.

RC Params
To help emulate Special:RecentChanges as much as possible, this script accepts RC-style url params (used as explained above with "data-params", "&params", URL variables, or the options panel). There are multiple params, as explained below. Please note that these effect each wiki individually (so a limit of 50 for 4 wikis is actually a limit of 200 total).

There are a few ways to specify params in the script. If more than one is specified, they will "fall through", with the more specific one overwriting the less specific one (ex: "&params" is more specific than "data-params"), but only if they both change the same thing (such as "days"). The order of specificity is as such:
 * 1) [Default values]
 * 2) User settings - uses the 4 settings under "Special:Preferences > Under the Hood > Recent changes"
 * 3) URL variables – same as a normal RecentChanges page.
 * 4) data-params
 * 5) Options panel (run-time options)
 * 6) &params (note that the "options panel" will not overwrite these)

Note that for "true/false" boolean switches, "0" is false, and "1" is true.

Refresh All
Refresh All
 * If using multiple instances on the same page, they can all be refreshed at once by giving the "rcm-refresh-all" class to an element on the page. ex:

CSS Styling
This script uses as many default RecentChanges classes as possible to allow styling to be consistent. Most RCM-specific features also use class names to allow for customization. Some useful classes are:
 * surrounds an entire entry / entry group, with $1 being the url domain with dots as dashes (ex: "dev-fandom-com"). By default this is used to style ".rcm-tiled-favicon", but it can be used to customize any data different based on it's wiki.
 * surrounds an entire entry / entry group, with $1 being the number of a namespace (ex: 0 for mainspace, 1 for talk, etc).
 * represents the icon to the left of each entry. Can be used to modify the icon / remove it.

So long as "data-extraLoadingEnabled" is not turned off, user links also have attributes added once the data is fetched. signifies a user is blocked on that wiki,  allows you to customize names based on the user's group (with "$1" being the uniq ID for that group), and   is added for anonymous users. You can find common group ids [ here] (listed as "group-$1]") and you can find a list of all groups (and the rights that come with them if curious) [//dev.fandom.com/api.php?action=query&format=xml&list=&meta=siteinfo&siprop=usergroups here] ; simply change the wiki in the url to see it for your target wiki (if it has a custom group). ex:

There are many other classes (either custom or RecentChanges classes) that can be utilized to customize the script. Best way to find them is to just inspect the element you want to customize and go from there.

Discussions
In late 2016 Fandom started pushing their discussion system onto new wikis, eventually working towards placing it on all wikis. Edits made inside the discussion area do not show up inside RecentChanges, so support has to be tacked on. This has a few potentially unexpected results:
 * Discussions are turned on by default. It can be toggled off on the option panel, or via the  attribute.
 * Not all discussions have titles, so if a title is not present, the first 35 characters of the original post are used to identify it instead.
 * As the title of a thread is not included in the api information returned for a specific post, titles often need to be retrieved separately (using the same second-load mechanic as wall/forum titles; just like those, this feature can be disabled via the  attribute).
 * Many options do not affect discussions. Some that do work are: hidemyself, hideusers, onlyshowusers, limit & days (see below for specifics).
 * Limit - only goes up to 50. Having a limit less than 50 will work.
 * hidemyself / hideusers - will affect the max number of discussions you see (since these are removed from the loaded list).
 * These changes are loaded in addition to normal changes. If a limit is set to less than or equal to 50, this can possibly double the results displayed for that wiki.
 * Discussions are only checked for on Fandom wikis (as they are Fandom-specific). However, the first time a script loads changes it needs to check all wikis to see if they exist. If they return a 404, an attempt to load that specific wiki will not happen again.
 * Since the api returns avatars and vote totals, this information is included as well. They can be removed with custom css using the  and   classes respectively.
 * Due to how the API works, edits to posts are not shown as a separate change. Instead the post will simply appear higher up on the list (if it's creation date is still within the top 50). One possible unexpected side-effect this has is that if someone edits a post the day after they created it, it won't show up under both days.

Translation
This script is translated in two separate ways: The js file for translations can be found on Github, and translations may be posted on the talk page or here. Only translate the first "TEXT" section, not "MESSAGES".
 * 1) Script Text ("TEXT" in code) – normal translation stuff like any other script that needs to be updated by hand.
 * 2) RecentChanges Text ("MESSAGES" in code) – this is done automatically, by loading the text normally found in Special:RecentChanges from the server. Any language normally supported by Fandom should be supported by this script for this type of translation.

Big thanks to various members of the Wikia Language Brigade for many of the translations done for this script.

Changelog
See the changelog for detailed changes, or the history pages for each script (/code.js for V1.0.3 and prior, /code.2.js for V1.1.7 and prior, and /core.js for current).
 * 14 February 2015 – Alpha finished (followed by break).
 * 22-27 May 2015 – Beta finished.
 * 28 June 2015 – Script published.
 * V1.1.0 – 26 July 2015 – Rewrite to use MediaWiki API (see below).
 * V1.2.0 – 12 December 2015 – Script now uses a loader to load in script.
 * V2.0 - 29 October 2016 - Script rewritten in TypeScript.
 * V2.6 - 28 January 2017 - Refreshing now only fetches and adds new items, instead of fetching and re-adding all changes. Should allow better use of large fetch limits.

26 July 2015 – MediaWiki API rewrite – V1.1.0
Show Details The main purposes of this rewrite were to:


 * 1) Add automatic translation support for RecentChanges text.
 * 2) Remove YQL dependency (info taken directly from wiki via API). Also results in faster loading.
 * 3) Using API support, add more Special:RecentChanges support (minor edits marked, more control on content ("days", "limit", "showbots", etc.)).
 * 4) Rewrite code to be a bit more efficient.


 * Important notes:
 * "&subdir" removed, and "&scriptdir" added (may be necessary for non-Fandom wikis, see above). ex:
 * "data-params" now offers much more support. "days" and "limit" now work up to same amount as normal for each wiki on the list. As such this should be limited to a few days / a lower limit to avoid loading potentially thousands of changes. Individual wikis can have these limits modified using "&params"


 * Changes:
 * Changed translating to use the exact i18n info from Fandom's github for RC_TEXT. Loads RC_TEXT from the server based on your language.
 * Boards/walls now also check for [ restore, delete, remove ] for "replies" instead of assuming it's the actual thread.
 * All (normal) RecentChanges params supported, except " hideenhanced ", "from", and viewing a select namespace.
 * Bot edits can now be shown (off by default), and "minor" edits are now marked.
 * gApp instance turned into the RecentChangesMultiple class (to potentially run multiple for whatever reason, plus I prefer "traditional" OO class structures)
 * As such, #rc-content-multiple id should now be a .rc-content-multiple class to allow for multiple instances (although using ids is still supported)
 * Additional Special:RecentChanges CSS classes used.
 * Rewrote RC / RCList objects (to bring a little more inline with how it's structured in MW system)
 * New "WikiData" class for storing wiki-specific data in a more understandable way, while also providing helper methods

Other

 * "http://" shouldn't be used in this script to avoid it automatically becoming a link (makes it annoying to deal with), and shows up on Special:LinkSearch as a page with an external link (may be undesirable).
 * Designed for Fandom wikis, but should work for any wiki (assuming it's not too out-of-date).
 * Some non-Fandom wikis simply do not seem to work, due to how they are setup (MediaWiki version is to old, API disabled, etc.).
 * The script should be run using code.2.js. Although no longer supported, the original atom-feed version can be found at code.js, with documentation for it found here.

Requirements

 * Jquery
 * All wikis in the script must:
 * Be Mediawiki wikis (Version 1.16+)
 * Have the Mediawiki Api available.
 * Browser that supports various aspects of ECMAScript5 (any up-to-date browser will basically be fine).
 * The script has to run on a Fandom wiki (to make sure it have access to things like the code for collapsing lists).