mirror of
https://gerrit.wikimedia.org/r/mediawiki/skins/MinervaNeue
synced 2024-12-01 09:16:34 +00:00
e888b487f4
Logic is moved from server to client. Config is added via getSkinConfigVariables (e.g. passed to mw.config ) and a JavaScript if statement. The IIFE in watchstar and talk files is replaced with a module.exports function to avoid refactoring at this point and added risk. The file contents remain the same. skins.minerva.options is left as is, given the code is more experimental and used in the beta mode - should not be sent to all clients. Additional change: * Remove skins.minerva.toggling (that module has been empty for a week now and functionality moved to mobile.init module) Depends-On: Ie71adbe18e8dbeb661ddb9d7d3d1d0897891d515 Bug: T233048 Change-Id: Ife777e76d9d77894fb5d09e7c8f0238b00596a7a
34 lines
701 B
JavaScript
34 lines
701 B
JavaScript
/**
|
|
* @param {Object} mobile mobileFrontend component library
|
|
*/
|
|
module.exports = function ( mobile ) {
|
|
|
|
var
|
|
currentPage = mobile.currentPage(),
|
|
Watchstar = mobile.Watchstar,
|
|
user = mw.user;
|
|
|
|
/**
|
|
* Toggle the watch status of a known page
|
|
* @method
|
|
* @param {Page} page
|
|
* @ignore
|
|
*/
|
|
function init( page ) {
|
|
// eslint-disable-next-line no-jquery/no-global-selector
|
|
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()
|
|
} );
|
|
}
|
|
}
|
|
init( currentPage );
|
|
};
|