Page Menu
Home
WickedGov Phorge
Search
Configure Global Search
Log In
Files
F5975030
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
const
watchstar
=
require
(
'mediawiki.page.watch.ajax'
).
watchstar
;
const
WATCHED_ICON_CLASS
=
'minerva-icon--unStar'
;
const
TEMP_WATCHED_ICON_CLASS
=
'minerva-icon--halfStar'
;
const
UNWATCHED_ICON_CLASS
=
'minerva-icon--star'
;
/**
* Tweaks the global watchstar handler in core to use the correct classes for Minerva.
*
* @param {jQuery} $icon
* @ignore
*/
function
init
(
$icon
)
{
const
$watchlink
=
$icon
.
find
(
'a'
);
watchstar
(
$watchlink
,
mw
.
config
.
get
(
'wgRelevantPageName'
),
toggleClasses
);
}
/**
* @param {jQuery} $link
* @param {boolean} isWatched
* @param {string} expiry
* @private
*/
function
toggleClasses
(
$link
,
isWatched
,
expiry
)
{
const
$icon
=
$link
.
find
(
'.minerva-icon'
);
$icon
.
removeClass
(
[
WATCHED_ICON_CLASS
,
UNWATCHED_ICON_CLASS
,
TEMP_WATCHED_ICON_CLASS
]
)
.
addClass
(
()
=>
{
let
classes
=
UNWATCHED_ICON_CLASS
;
if
(
isWatched
)
{
if
(
expiry
!==
null
&&
expiry
!==
undefined
&&
expiry
!==
'infinity'
)
{
classes
=
TEMP_WATCHED_ICON_CLASS
;
}
else
{
classes
=
WATCHED_ICON_CLASS
;
}
}
return
classes
;
}
);
}
module
.
exports
=
{
init
:
init
,
test
:
{
toggleClasses
,
TEMP_WATCHED_ICON_CLASS
,
WATCHED_ICON_CLASS
,
UNWATCHED_ICON_CLASS
}
};
File Metadata
Details
Attached
Mime Type
text/plain
Expires
Sat, Oct 3, 17:55 (21 h, 19 m)
Storage Engine
local-disk
Storage Format
Raw Data
Storage Handle
73/70/c9e8df10b27c9781499fe6636ca2
Default Alt Text
watchstar.js (1 KB)
Attached To
Mode
rMWPROD MediaWiki Production
Attached
Detach File
Event Timeline
Log In to Comment