Page Menu
Home
WickedGov Phorge
Search
Configure Global Search
Log In
Files
F4138029
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
icons
=
require
(
'../icons'
);
/**
* A clickable watchstar for logged in users.
* Should not be used for anonymous users.
*
* @param {Object} options Configuration options
* @param {Page} options.page
* @param {boolean} options.isWatched is the article watched?
* @return {IconButton}
*/
module
.
exports
=
function
(
options
)
{
const
isWatched
=
options
.
isWatched
,
watchstar
=
__non_webpack_require__
(
'mediawiki.page.watch.ajax'
).
watchstar
,
action
=
isWatched
?
'unwatch'
:
'watch'
,
iconProps
=
{
href
:
mw
.
Title
.
newFromText
(
options
.
page
.
title
).
getUrl
(
{
action
}
)
},
watchButton
=
icons
.
watch
(
iconProps
),
watchedButton
=
icons
.
watched
(
iconProps
),
WATCH_BUTTON_CLASS
=
watchButton
.
getClassName
(),
WATCHED_BUTTON_CLASS
=
watchedButton
.
getClassName
(),
WATCH_CLASS
=
watchButton
.
getIcon
().
getClassName
(),
WATCHED_CLASS
=
watchedButton
.
getIcon
().
getClassName
(),
activeIcon
=
isWatched
?
watchedButton
:
watchButton
,
callback
=
(
$link
,
watched
)
=>
{
$link
.
attr
(
'class'
,
watched
?
WATCHED_BUTTON_CLASS
:
WATCH_BUTTON_CLASS
);
const
$icon
=
$link
.
find
(
'.mf-icon'
);
$icon
.
attr
(
'class'
,
watched
?
WATCHED_CLASS
:
WATCH_CLASS
);
};
watchstar
(
activeIcon
.
$el
,
options
.
page
.
title
,
callback
);
return
activeIcon
;
};
File Metadata
Details
Attached
Mime Type
text/plain
Expires
Wed, Aug 19, 14:27 (3 w, 4 d ago)
Storage Engine
local-disk
Storage Format
Raw Data
Storage Handle
2e/03/0523964dc73d48d31467d574dbc9
Default Alt Text
watchstar.js (1 KB)
Attached To
Mode
rMWPROD MediaWiki Production
Attached
Detach File
Event Timeline
Log In to Comment