mirror of
https://gerrit.wikimedia.org/r/mediawiki/skins/MinervaNeue
synced 2024-11-16 18:58:45 +00:00
4a3e1fa9e8
This does not complete watchlist expiry support in MinervaNeue. It only instructs the skin to show a half star instead of a full star on page load if the page is being temporarily watched. Bug: T251690 Change-Id: Ib5c479dcfe49041152ba662c56cc630c32eb220e
19 lines
617 B
JavaScript
19 lines
617 B
JavaScript
var WATCHED_CLASS = 'mw-ui-icon-wikimedia-unStar-progressive',
|
|
TEMP_WATCHED_CLASS = 'mw-ui-icon-wikimedia-halfStar-progressive',
|
|
UNWATCHED_CLASS = 'mw-ui-icon-wikimedia-star-base20';
|
|
|
|
/**
|
|
* Tweaks the global watchstar handler in core to use the correct classes for Minerva.
|
|
*
|
|
* @param {jQuery.Object} $icon
|
|
*/
|
|
module.exports = function init( $icon ) {
|
|
$icon.on( 'watchpage.mw', function ( _ev, action ) {
|
|
$( this ).find( 'a' ).removeClass(
|
|
[ WATCHED_CLASS, 'watched', TEMP_WATCHED_CLASS, UNWATCHED_CLASS ]
|
|
).addClass(
|
|
action === 'watch' ? [ WATCHED_CLASS, 'watched' ] : UNWATCHED_CLASS
|
|
);
|
|
} );
|
|
};
|