2018-11-16 15:16:25 +00:00
|
|
|
( function ( M ) {
|
2017-07-12 15:12:40 +00:00
|
|
|
|
2019-07-11 00:56:04 +00:00
|
|
|
var
|
|
|
|
mobile = M.require( 'mobile.startup' ),
|
|
|
|
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 );
|
2017-07-12 15:12:40 +00:00
|
|
|
|
2018-11-16 15:16:25 +00:00
|
|
|
}( mw.mobileFrontend ) );
|