Page Menu
Home
WickedGov Phorge
Search
Configure Global Search
Log In
Files
F6027160
watchstar.js
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Flag For Later
Award Token
Size
1 KB
Referenced Files
None
Subscribers
None
watchstar.js
View Options
/**
* @param {HTMLElement} watchIcon
* @param {boolean} isWatched
* @param {string} expiry
*/
const
updateWatchIcon
=
(
watchIcon
,
isWatched
,
expiry
)
=>
{
watchIcon
.
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
(
mw
.
util
.
isInfinity
(
expiry
)
)
{
watchIcon
.
classList
.
add
(
'mw-ui-icon-wikimedia-unStar'
);
}
else
{
watchIcon
.
classList
.
add
(
'mw-ui-icon-wikimedia-halfStar'
);
}
}
else
{
watchIcon
.
classList
.
add
(
'mw-ui-icon-wikimedia-star'
);
}
};
const
init
=
()
=>
{
mw
.
hook
(
'wikipage.watchlistChange'
).
add
(
(
/** @type {boolean} */
isWatched
,
/** @type {string} */
expiry
)
=>
{
const
watchIcons
=
document
.
querySelectorAll
(
'.mw-watchlink .vector-icon'
);
if
(
!
watchIcons
)
{
return
;
}
Array
.
from
(
watchIcons
).
forEach
(
(
watchIcon
)
=>
{
updateWatchIcon
(
/** @type {HTMLElement} */
(
watchIcon
),
isWatched
,
expiry
);
}
);
}
);
};
module
.
exports
=
{
updateWatchIcon
,
init
};
File Metadata
Details
Attached
Mime Type
text/plain
Expires
Oct 4 2026, 16:51 (5 w, 4 d ago)
Storage Engine
local-disk
Storage Format
Raw Data
Storage Handle
33/24/51e5b7118f3d2062f0df89927bcc
Default Alt Text
watchstar.js (1 KB)
Attached To
Mode
rMWPROD MediaWiki Production
Attached
Detach File
Event Timeline
Log In to Comment