mirror of
https://gerrit.wikimedia.org/r/mediawiki/skins/Vector.git
synced 2024-11-24 15:53:46 +00:00
97cf735de2
Can be tested by appending ?vectorvisualenhancementnext=1 to URL Bug: T310838 Bug: T234990 Bug: T234550 Depends-On: I76d0d94c9006cc5f5680849ecdd1c382c16e34ba Depends-On: Ib7c3021db014827b4b88cac855afc0b54a360f8c Change-Id: Ie2ffa5c3ecf270c1bb1f315937023ae7ace5ed30
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' );
|
|
}
|
|
}
|
|
);
|
|
};
|