mirror of
https://gerrit.wikimedia.org/r/mediawiki/skins/Vector.git
synced 2024-11-28 17:40:12 +00:00
25 lines
729 B
JavaScript
25 lines
729 B
JavaScript
|
module.exports = function () {
|
||
|
mw.hook( 'wikipage.watchlistChange' ).add(
|
||
|
function ( /** @type {boolean} */ isWatched, /** @type {string} */ expiry ) {
|
||
|
var watchElement = document.querySelectorAll( '#ca-watch a, #ca-unwatch a' )[ 0 ];
|
||
|
if ( !watchElement ) {
|
||
|
return;
|
||
|
}
|
||
|
watchElement.classList.remove(
|
||
|
'mw-ui-icon-wikimedia-unStar',
|
||
|
'mw-ui-icon-wikimedia-star',
|
||
|
'mw-ui-icon-wikimedia-halfStar'
|
||
|
);
|
||
|
if ( isWatched ) {
|
||
|
if ( expiry === 'infinity' ) {
|
||
|
watchElement.classList.add( 'mw-ui-icon-wikimedia-unStar' );
|
||
|
} else {
|
||
|
watchElement.classList.add( 'mw-ui-icon-wikimedia-halfStar' );
|
||
|
}
|
||
|
} else {
|
||
|
watchElement.classList.add( 'mw-ui-icon-wikimedia-star' );
|
||
|
}
|
||
|
}
|
||
|
);
|
||
|
};
|