mirror of
https://gerrit.wikimedia.org/r/mediawiki/skins/MinervaNeue
synced 2024-11-24 14:23:53 +00:00
bf8d325388
Apply the mediawiki core watchstar to the Minerva skin. Note, watchstars in search and other locations will continue to be provided by the MobileFrontend library (see follow up patch I7b748dc87089389400b0035c62a3b9a00c2e43f9) Bug: T234970 Change-Id: I11bbe976412b50dba76a55f37887e4c9235d0be1
17 lines
527 B
JavaScript
17 lines
527 B
JavaScript
var WATCHED_CLASS = 'mw-ui-icon-wikimedia-unStar-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', UNWATCHED_CLASS ]
|
|
).addClass(
|
|
action === 'watch' ? [ WATCHED_CLASS, 'watched' ] : UNWATCHED_CLASS
|
|
);
|
|
} );
|
|
};
|