mediawiki-skins-Vector/resources/skins.vector.js/watchstar.js
Jon Robson 97cf735de2 Icons: Watchstar and wikilove are upgraded
Can be tested by appending ?vectorvisualenhancementnext=1
to URL

Bug: T310838
Bug: T234990
Bug: T234550
Depends-On: I76d0d94c9006cc5f5680849ecdd1c382c16e34ba
Depends-On: Ib7c3021db014827b4b88cac855afc0b54a360f8c
Change-Id: Ie2ffa5c3ecf270c1bb1f315937023ae7ace5ed30
2022-09-08 19:43:35 +00:00

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' );
}
}
);
};