2019-12-18 21:15:26 +00:00
|
|
|
/**
|
|
|
|
* This setups the Minerva skin.
|
|
|
|
* It should run without errors even if MobileFrontend is not installed.
|
|
|
|
*/
|
2021-09-23 19:47:46 +00:00
|
|
|
var ms = require( 'mobile.startup' ),
|
2024-02-08 22:52:46 +00:00
|
|
|
reportIfNightModeWasDisabledOnPage = require( './reportIfNightModeWasDisabledOnPage.js' ),
|
2023-09-28 09:28:09 +00:00
|
|
|
addPortletLink = require( './addPortletLink.js' ),
|
|
|
|
teleportTarget = require( 'mediawiki.page.ready' ).teleportTarget;
|
2019-12-18 21:15:26 +00:00
|
|
|
|
|
|
|
function init() {
|
|
|
|
var permissions = mw.config.get( 'wgMinervaPermissions' ) || {},
|
|
|
|
// eslint-disable-next-line no-jquery/no-global-selector
|
|
|
|
$watch = $( '#page-actions-watch' );
|
|
|
|
|
2023-08-24 08:39:33 +00:00
|
|
|
if ( permissions.watch ) {
|
2020-09-14 20:46:26 +00:00
|
|
|
require( './watchstar.js' ).init( $watch );
|
2019-12-18 21:15:26 +00:00
|
|
|
}
|
|
|
|
|
2021-09-27 17:02:06 +00:00
|
|
|
addPortletLink.init();
|
|
|
|
mw.hook( 'util.addPortletLink' ).add(
|
|
|
|
addPortletLink.hookHandler
|
|
|
|
);
|
|
|
|
|
2019-12-18 21:15:26 +00:00
|
|
|
// Setup Minerva with MobileFrontend
|
|
|
|
if ( ms && !ms.stub ) {
|
|
|
|
require( './initMobile.js' )();
|
|
|
|
} else {
|
|
|
|
// MOBILEFRONTEND IS NOT INSTALLED.
|
|
|
|
// setup search for desktop Minerva at mobile resolution without MobileFrontend.
|
|
|
|
require( './searchSuggestReveal.js' )();
|
|
|
|
}
|
2021-09-23 19:47:46 +00:00
|
|
|
|
2020-10-05 18:27:53 +00:00
|
|
|
// This hot fix should be reviewed and possibly removed circa January 2021.
|
|
|
|
// It's assumed that Apple will prioritize fixing this bug in one of its next releases.
|
|
|
|
// See T264376.
|
2020-11-04 22:38:03 +00:00
|
|
|
if ( navigator.userAgent.match( /OS 14_[0-9]/ ) ) {
|
2020-10-05 18:27:53 +00:00
|
|
|
document.body.classList.add( 'hotfix-T264376' );
|
|
|
|
}
|
2023-09-28 09:28:09 +00:00
|
|
|
|
|
|
|
// Apply content styles to teleported elements
|
|
|
|
teleportTarget.classList.add( 'content' );
|
2024-02-08 22:52:46 +00:00
|
|
|
reportIfNightModeWasDisabledOnPage(
|
|
|
|
document.documentElement, mw.user.options, mw.user.isNamed()
|
|
|
|
);
|
2019-12-18 21:15:26 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
init();
|
|
|
|
|
|
|
|
module.exports = {
|
|
|
|
// Version number allows breaking changes to be detected by other extensions
|
|
|
|
VERSION: 1
|
|
|
|
};
|