This script/stylesheet is for PERSONAL use only!
You are free to install this script/stylesheet for yourself, but it is not allowed to be used wiki-wide (e.g., in MediaWiki:ImportJS, MediaWiki:Common.js, MediaWiki:Common.css, MediaWiki:Fandomdesktop.js, MediaWiki:Fandomdesktop.css, or MediaWiki:FandomMobile.css), as it would violate Fandom's Terms of Use.
(See the customization policy)
IgnoreNotifications allows users to automatically mark notifications from OnSiteNotifications as read based on specified criteria. OnSiteNotifications is the new notification system that appears under the bell icon in the global navigation bar for logged-in users. IgnoreNotifications takes the concept used by AnnouncementsIgnore, expands it to all notification types, and adds the ability to construct complex criteria based on wiki, user, notification type, time, and exceptions.
Installation
Configuration
This section is dedicated to briefly describing the configuration settings. For more details on how the script determines which notifications to dismiss, please see the separate section about filter and notification processing.
This script depends on GetOnSiteNotifications which has its own configuration settings. The configuration settings for GetOnSiteNotifications may impact this script by limiting the permitted values for some of this script's configuration settings and/or the data this script may retrieve. For instructions on configuring GetOnSiteNotifications, please refer to the configuration section in its own documentation.
The configuration options for this script allow individuals to control the data and filters (i.e. criteria) used to determine whether or not a notification should be dismissed (i.e. marked as read). The options are properties of the script's configuration object which can be created in a user's personal JS with the following lines of code above the script import.
if (!window.andrewds1021) {
window.andrewds1021 = {
ignore_notifications: {}
};
} else if (!window.andrewds1021.ignore_notifications) {
window.andrewds1021.ignore_notifications = {};
}
To set a particular option, place a line of code between the script's configuration object and the script import. It should follow the following format where property is replaced by the option name as listed in the table below and value is replaced by the desired value.
window.andrewds1021.ignore_notifications.property = value;
This example sets no_conversion to true. This will prevent the script from converting preexisting settings for AnnouncementsIgnore into a filter.
window.andrewds1021.ignore_notifications.no_conversion = true;
| Option name | Data type | Default value | ||||||||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| Description | ||||||||||||||||||||||||||
no_conversion |
boolean | false
| ||||||||||||||||||||||||
If false, the script will check for AnnouncementsIgnore settings. If valid settings are found, the script will then convert those settings into a filter and append that filter to the list of other filters. This means replacing AnnouncementsIgnore with this script does not require any setting changes. If true, this script will not convert AnnouncementsIgnore settings even if they are present and valid.
| ||||||||||||||||||||||||||
limit |
number | default_limit from GetOnSiteNotifications
| ||||||||||||||||||||||||
This option sets the maximum number of notifications retrieved per request to Fandom's servers. Additional requests will be made until all applicable notifications have been retrieved. A lower limit means less data per request but more requests. A higher limit means the opposite; more data per request but fewer requests. If you wish to minimize loading time, higher limits are probably better than lower limits. The limit must be a positive integer and may not exceed the hard limit set by Fandom (currently 50).
| ||||||||||||||||||||||||||
all_users |
boolean | false
| ||||||||||||||||||||||||
If false, the script will retrieve only the initial information returned by Fandom's servers. This means a maximum of 5 users will be returned for each notification. If the notification involves more than 5 users, it will not be dismissed. If true, the script will attempt to retrieve all users for every notification. Assuming the attempt is successful, notifications with more than 5 users will be evaluated for dismissal using the full list of users. However, this will increase the number of requests sent to Fandom's servers and thus increase the delay between page load and notification dismissal.
| ||||||||||||||||||||||||||
ignore_errors |
boolean | false
| ||||||||||||||||||||||||
Due to the current state of Fandom's servers, it is common to encounter errors while attempting to retrieve notification data. If this option is set to false, the script will not dismiss any notifications if errors were encountered while retrieving notification data. For users with many notifications, it is almost guaranteed that an error will occur and thus it is unlikely the script will ever dismiss a notification. If set to true, the script will proceed to evaluate notifications for dismissal even if it was unable to obtain a complete set of notification data. While this will allow the script to proceed every time, it also presents a risk of dismissing a notification that should be kept.
| ||||||||||||||||||||||||||
whitelist |
boolean | false
| ||||||||||||||||||||||||
If false, the top level of filters is treated as a blacklist. In other words, a notification will be dismissed if it matches the filters. If true, the top level of filters is treated as a whitelist. This means notifications will be dismissed if they do not match the filters.
| ||||||||||||||||||||||||||
delay |
number or object | 0
| ||||||||||||||||||||||||
After dismissing a notification, additional events regarding the same target are presented in a new separate notification. If notifications are immediately dismissed, this means that each event will be given its own notification. If a particular target is very active, this could flood a user's notification dropdown. To avoid this issue, this option allows the user to set a delay. The script will not dismiss a notification if the latest event is younger than the specified age. If specified as a number, the units are milliseconds (1000 milliseconds = 1 second). The number should be a positive integer or 0. If specified as an object, the delay is the sum of times specified by the object's options (i.e. properties). The following table describes the recognized options which should all be positive finite numbers or 0. Note that notifications are deleted from Fandom's servers after 30 days. Therefore, setting the delay to more than 30 days will effectively disable the script.
| ||||||||||||||||||||||||||
filters |
object or array of objects | none | ||||||||||||||||||||||||
This is the top level of filters. It can be either a single filter or a list (i.e. array) of filters. A notification matches a list of filters if it matches at least one of the filters. Each filter is an object with one or more of the options described in the following table. IDs and names are treated as a single list when processing notifications. If a wiki/user has been specified by ID, it is not necessary to provide the name. The reverse is also true; it is not necessary to provide the ID if the name has been specified. Please see the separate section on filter and notification processing for more details regarding the decision process.
| ||||||||||||||||||||||||||
Wikis/users can be specified in filters using either their names or their numeric IDs. While it is easier to provide a name, it is slightly more effective to provide an ID. The reason is that wikis/users can change their names. If a wiki/user changes their name, the filters need to be updated with the new name in order to continue working properly. However, renaming does not change the ID. As such, providing IDs instead of names means the filters will not need to be updated should a wiki/user perform a rename. The easiest way to find the ID of a wiki is to go to Special:Version. The ID is labelled "city_id" and can be found in the "Installed Software" section of the special page. Below is a picture with the wiki ID marked with a red box.

There are at least two ways to find the ID of a user. The first is to view their list of posts in Discussions (example). The number at the end of the URL is the user's ID. You can get to this list by clicking their avatar or name on a Discussions post. If you are having trouble finding a post, you can find one using Special:UserProfileActivity. The second method is to use api.php (example). Below is a picture with the user ID marked with a red box. Note that, if the user creates a new account, that account will have a different ID.

Example
This example configures the script to ignore data retrieval errors, request full user lists, and immediately block announcements from Community Central.
window.announcementsIgnore.option = "opt-in-all";
window.announcementsIgnore.exceptWikiIds = [177];
window.andrewds1021.ignore_notifications.ignore_errors = true;
window.andrewds1021.ignore_notifications.all_users = true;
This example does the same thing as the previous one but does not use the auto-conversion of settings from AnnouncementsIgnore.
window.andrewds1021.ignore_notifications.ignore_errors = true;
window.andrewds1021.ignore_notifications.all_users = true;
window.andrewds1021.ignore_notifications.filters = {
types: "announcement-target",
wiki_ids: 177
};
This example blocks all announcements except those coming from Community Central.
window.andrewds1021.ignore_notifications.filters = {
types: "announcement-target",
not: {wiki_ids: 177}
};
This example blocks all notifications except upvotes. It also blocks upvotes from Andrewds1021 that are not from Community Central.
window.andrewds1021.ignore_notifications.whitelist = true;
window.andrewds1021.ignore_notifications.filters = {
types: "discussion-upvote",
not: {
user_ids: 9605025,
not: {wiki_ids: 177}
}
};
Just for fun, here is another way to write the previous example.
window.andrewds1021.ignore_notifications.whitelist = true;
window.andrewds1021.ignore_notifications.filters = [
{
types: "discussion-upvote",
not: {user_ids: 9605025}
},
{
types: "discussion-upvote",
user_ids: 9605025,
wiki_ids: 177
}
];
Here is yet another way to achieve the same result. Although, this one requires a bit more typing.
window.andrewds1021.ignore_notifications.filters = [
{
types: [
"announcement-target",
"article-comment-at-mention",
"article-comment-reply",
"article-comment-reply-at-mention",
"discussion-post",
"message-wall-post",
"message-wall-thread",
"post-at-mention",
"talk-page-message",
"thread-at-mention"
]
},
{
types: "discussion-upvote",
user_ids: 9605025,
not: {wiki_ids: 177}
}
];
Filter and notification processing
At start-up, the script will copy and sanitize the user-provided filters. For each filter in a list, it will check wiki_ids, wiki_names, user_ids, user_names, and types and filter out any values that are neither a string nor a number. Then age will be parsed and not will be copied and sanitized. As the script travels down a branch of filters, it keeps track of the ancestors in that branch. If not contains a reference to an ancestor, the ancestor will be removed from not and will not be processed further in the context of that branch. This is done to prevent filter loops.
The script makes dismissal decisions based on available data. If it has incomplete data, it may make an incorrect decision. The two main potential causes for incomplete data are restrictions set by the configuration of GetOnSiteNotifications and errors encountered during data retrieval.
The script has some conditions it checks for which will automatically prevent a notification from getting dismissed.
delayis specified and the latest event is younger than the specified age- the data retrieved for the notification does not contain a complete list of users
- dismissing the notification would dismiss another notification that should be kept
- The way the notification system currently works, it is not always possible to dismiss just a single notification. For instance, if a user upvotes a thread you started and replies, you will receive two notifications; one for the upvote and another for the reply. In this situation, the notification system does not allow the dismissal of just one of the two notifications.
Assuming none of the above criteria are met, the script will make dismissal decisions based on the filter mode (blacklist v. whitelist) and whether or not a notification matches the filters. The notification will be dismissed if it matches the filters in a blacklist or if it does not match the filters in a whitelist. The notification matches a list of filters if it matches at least one of the filters in the list. When determining whether or not the notification matches an individual filter, there are 5 criteria: wiki, user, notification type, age, and exceptions.
If the notification matches the exceptions list, then it does not match the filter. The exceptions list for a filter is treated as the opposite list type of the filter. In other words, the exceptions of a blacklist filter are treated as whitelist filters and the exceptions of a whitelist filter are treated as blacklist filters. If no exceptions are listed, then the notification does not match the exceptions list.
When checking the wiki from which the notification came, wiki_ids and wiki_names are effectively combined into a single list describing which wikis to look for. The notification's wiki is considered to match if either its ID or name is listed or if no wikis are listed.
When checking the users list of a notification, user_ids and user_names are similarly combined and the notification's list is considered to match if no users are listed in the filter. If users are listed in the filter, the criteria for matching depends on the filter mode. For a blacklist filter, all users in the notification's list must also be in the filter's list. For a whitelist filter, at least one of the notification's users must be in the filter's list.
Checking the notification type is straightforward. The type of the notification matches if it is in the filter's type list or if the filter does not have any types listed. If the notification's wiki, users list, and type match the filter and the notification does not match the filter's exceptions list, the notification matches the filter.
The age of the latest event of a notification is checked against age. The start time of the notification data request is considered to be an age of 0. For a blacklist, the notification matches the age criteria if the latest event is older than the specified age. For a whitelist, the notification matches the age criteria if the latest event is younger than the specified age. If no age was specified, then it is treated as a match.
Dependencies
NOTE: This script handles the import of all dependencies.
Non-backward compatible changes
- 2021-06-03: Initial addition of compatibility with the FandomDesktop skin is complete. However, due to the current state of notifications on FandomDesktop, there is a corner case where Announcements notifications may not be uniquely identifiable. This occurs when two or more different notifications are issued with the same target URL. This will cause issues when all of the following criteria are met.
- There is more than one unread announcement with the same target URL
- At least one is to be marked as read by this script
- At least one is not to be marked as read by this script
- The issue caused is the loaded notifications that should not be marked as read will be marked as read in the display. However, they will remain unread in the database and should display as such upon next page load.
- 2021-06-02: Compatibility for the legacy platform (MediaWiki 1.19.24) has been removed. This was done because it appears there are no longer any legacy wikis left intended for users.
- 2021-04-01: The list of unblockable users has been removed due to the unreliable nature of the required API endpoint. Users of this script should be aware of this and not use this script as an excuse for failing to read or respond to communications from members of global user groups such as Fandom Staff, SOAP, and Wiki Managers/Representatives.