2019-09-18 23:07:21 +00:00
|
|
|
/**
|
|
|
|
* @param {Object} mobile mobileFrontend component library
|
|
|
|
*/
|
|
|
|
module.exports = function ( mobile ) {
|
2017-07-12 15:12:40 +00:00
|
|
|
|
2019-07-11 00:56:04 +00:00
|
|
|
var
|
|
|
|
currentPage = mobile.currentPage(),
|
|
|
|
Watchstar = mobile.Watchstar,
|
2018-11-21 19:12:41 +00:00
|
|
|
user = mw.user;
|
2017-07-12 15:12:40 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Toggle the watch status of a known page
|
|
|
|
* @method
|
|
|
|
* @param {Page} page
|
|
|
|
* @ignore
|
|
|
|
*/
|
|
|
|
function init( page ) {
|
2019-04-03 23:32:18 +00:00
|
|
|
// eslint-disable-next-line no-jquery/no-global-selector
|
2017-07-12 15:12:40 +00:00
|
|
|
var $container = $( '#ca-watch' );
|
|
|
|
if ( !page.inNamespace( 'special' ) ) {
|
|
|
|
// eslint-disable-next-line no-new
|
|
|
|
new Watchstar( {
|
|
|
|
api: new mw.Api(),
|
|
|
|
el: $container,
|
|
|
|
isWatched: page.isWatched(),
|
|
|
|
page: page,
|
|
|
|
funnel: 'page',
|
|
|
|
isAnon: user.isAnon()
|
|
|
|
} );
|
|
|
|
}
|
|
|
|
}
|
2019-07-11 00:56:04 +00:00
|
|
|
init( currentPage );
|
2019-09-18 23:07:21 +00:00
|
|
|
};
|