mirror of
https://gerrit.wikimedia.org/r/mediawiki/skins/Vector.git
synced 2024-11-12 09:21:11 +00:00
3e40a753b1
These interfere with the toggle on certain pages see T317710#8389485 Bug: T322673 Change-Id: I3e40cc0c5701a3c055ced1c74e9cac1b369586a3
29 lines
893 B
JavaScript
29 lines
893 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(
|
|
// Vector attaches two icon classes to the element.
|
|
// Remove the mw-ui-icon one rather than managing both.
|
|
'mw-ui-icon-star',
|
|
'mw-ui-icon-unStar',
|
|
'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' );
|
|
}
|
|
}
|
|
);
|
|
};
|