JavaScript gadget to add specific functionality on special pages which list other pages. This affects namely watchlists and on “recent changes”.
Currently eight features are supported:
mw.loader.load("https://en.wikipedia.org/?title=User:PerfektesChaos/js/listPageOptions/r.js&action=raw&bcache=1&maxage=86400&ctype=text/javascript",
"text/javascript");
Basically, you have to decide on global Preferences for all following calls if you want multiple activities per page listed. In the “Watchlist options” block a checkbox is added, which is preselected by your most recent known preference. If you click the on/off link or add/remove the checkbox tic and press Go the subsequent pages keep this behaviour; the links on time intervals and various options are preserving the checkbox state.
Affected pages:
If you look at a special page which provides multiple entries for the same page, there is a general user preference to group them by page, and expand that page later on click.
This goes for all views now, which is not always appropriate. This gadget provides you with a way to toggle this feature within a track if it shall not be applied, or to jump in temporarily without changing your global preferences.
In the “Watchlist options” block (or “Recent changes options”) a checkbox is added, which is preselected by your most recent known preference. If you click the on/off link or add/remove the checkbox tic and press Go later the subsequent pages keep this behaviour; the links on time intervals and various options are preserving the checkbox state. If the extended watchlist was not defined yet, the “multiple entries” option is set automatically.
Affected pages:
This fixes a nasty inconvenience of the interface behaviour:
This tool will adapt the direct links according to the namespace and other control settings. You may collect option changes by using form controls, and finally request the page update by clicking on a link or Go all option changes come into effect together.
Affected pages:
Mainly on “recent changes” survey you might want to get rid of less dramatic activities, like some log entries or talk pages.
By user option you can establish a permanent filter, removing entries which distract your attention.
Affected pages:
A link (like + [Unwatch]) is added to the portlet toolbox (usually on left hand side) of the watchlist. It adds an “unwatch” link (like [—]) to every page entry on the current list. If you click one of them, the action will be performed by API. If this was clicked by mistake, another click will bring the watched status back.
Affected pages:
Since Summer 2017 a Wiki preference „Add direct unwatch/watch markers (×/+) to watched pages with changes (JavaScript required for toggle functionality)“ could equip always every entry with a similar button.
By user option a link (like + [Visited]) is added to the portlet toolbox (usually on left hand side) of the watchlist. It adds a “visited” link (like [+]) to every page entry on the current list. If you click one of them, the action will be performed by API. Then the appearance should change and the page should behave as if visited recently. Also initially all unvisited pages may be equipped with buttons.
Affected pages:
The simple on/off switch options can be set interactively on Special:Blankpage as soon as the script library has been loaded.
When reloading a page the preferences declared here come into effect. This dynamic assignment overrides the static setting by JavaScript.
These user preferences are not visible to other users.
Even anonymous users may store preferences in their local browser profile. They have no access to the watchlist, but aspects of recent changes my be customized.
Insert the following lines into your common.js (best before mw.loader.load, if present):
if ( typeof mw.libs.listPageOptions !== "object" ) {
mw.libs.listPageOptions = { };
}
mw.libs.listPageOptions.key1 = value1;
Key | Value | Bedeutung |
---|---|---|
lean
|
true
|
Compressed option box. Default: false – unchanged layout
|
learnt
|
true
|
Visited pages toggling. Default: null – no additional link
|
leyo
|
true
|
Hide “last edit your own” blocks. Default: null – no hiding
|
looked
|
true
|
Mark pages as visited. Default: null – no portlet link, no buttons
|
lower
|
true
|
Hide options box. Default: null – no toggle buttons
|
luxury
|
true
|
Additional checkboxes for hide/show. Default: false – no additional checkboxes
|
hide
|
Array
|
Hide particular pages or patterns. Default: No hiding. |
Example:
if ( typeof mw.libs.listPageOptions !== "object" ) {
mw.libs.listPageOptions = { };
}
mw.libs.listPageOptions.learn = true;
mw.libs.listPageOptions.hide = true, "Log/articlefeedback", 2 ],
false, "User:", 2 ],
false, "([A-Z][a-z]+_)?[Tt]alk:", 2 ],
false, "Wikipedia:Sandbox", 2
];
If someone needs to adapt some other of the described functionality, do not hesitate to post your deepest desires on the talk page.
The hide
option is an Array
, which contains Array
s of rules.
Every rule element is an Array
with two until four elements:
[0]
|
Special page indicator.true = special and false = regular page
|
[1]
|
Page name pattern. Regular expression style, as string. Reflects the format as used in URL. Literal URL encoding may be used, or formatted page title with spaces. |
[2]
|
(optional) Limit rule to certain page listings.
|
[3]
|
(optional) User name pattern (contributor). Regular expression style, as string. |
[4]
|
(optional) Minor edits only. |
"Log/(articlefeedback|block|upload)"
""
hides any reference to a special page. The GUI offered by system does not maintain such capability.false
.By boolean value .learnt
an additional link is offered, which hides and shows entries already visited.
false
– Show all entries initially (begin of browser session)true
– Hide visited pages initiallyIf all pages were visited or none yet, the toggle will be greyed out. Updating is done by the server and requires a new page request.
The last known state will be remembered by a session cookie.
Affected pages:
The options in the box are (with or without gadget) grouped and divided in and by lines. By setting the .lean
option they can be arranged flowing to save screen space.
Affected pages:
If you want to save screen space on top of the watchlist, you may also want to add the following CSS rule to your common.css:
form#mw-watchlist-resetbutton ul li {
display: none;
}
If activated, every page entry may be equipped with a small button ( + ) that simulates a pages to be visited.
Boolean values launch this feature:
false
– Add link to the portlet toolbox that will equip all unvisited pages with a button.
true
– Add buttons initially to all unvisited pagesIf you are suffering from limited screen size, you might want to economize the options area (and notices inside). By boolean value .lower
buttons are offered, which hide ( X ) and show again the options area.
false
– Show option box initially (begin of browser session)true
– Hide option box initiallyThe last known state will be remembered by a session cookie.
Affected pages:
On watchlists in “group by page” mode you can hide the entire block if you have made the most recent edit (answered on a talk page, rollback): Set .leyo
on true
and ensure hideOwn=0
mode.
Actually, there is no need to perform this functionality by an external gadget. Maybe it is replaced by a Mediawiki server solution one day, at least the temporary switches into extended and enhanced mode.
Source code |
|
ResourceLoader |
|
Namespaces | -1 ( Watchlist , Recentchanges , Blankpage )
|
Cookies |
|
mw.libs
|
listPageOptions
|
MediaWiki |
|
This gadget is prepared for multilingual support.
POpt.texts
mapping on top of
source code.