Debian Codegraph @

skins/MinervaNeue/resources/skins.minerva.scripts/setup.js

raw symbols SCIP
1 /**
2 * This setups the Minerva skin.
3 * It should run without errors even if MobileFrontend is not installed.
4 *
5 * @ignore
6 */
7 const ms = require( 'mobile.startup' );
8 const reportIfNightModeWasDisabledOnPage = require( './reportIfNightModeWasDisabledOnPage.js' );
9 const addPortletLink = require( './addPortletLink.js' );
10 const teleportTarget = require( 'mediawiki.page.ready' ).teleportTarget;
11
12 function init() {
13 const permissions = mw.config.get( 'wgMinervaPermissions' ) || {};
14 // eslint-disable-next-line no-jquery/no-global-selector
15 const $watch = $( '#page-actions-watch' );
16
17 if ( permissions.watch ) {
18 require( './watchstar.js' ).init( $watch );
19 }
20
21 addPortletLink.init();
22 mw.hook( 'util.addPortletLink' ).add(
23 addPortletLink.hookHandler
24 );
25
26 // Setup Minerva with MobileFrontend
27 if ( ms && !ms.stub ) {
28 require( './initMobile.js' )();
29 } else {
30 // MOBILEFRONTEND IS NOT INSTALLED.
31 // setup search for desktop Minerva at mobile resolution without MobileFrontend.
32 require( './searchSuggestReveal.js' )();
33 }
34
35 // This hot fix should be reviewed and possibly removed circa January 2021.
36 // It's assumed that Apple will prioritize fixing this bug in one of its next releases.
37 // See T264376.
38 if ( navigator.userAgent.match( /OS 14_[0-9]/ ) ) {
39 document.body.classList.add( 'hotfix-T264376' );
40 }
41
42 // Apply content styles to teleported elements
43 teleportTarget.classList.add( 'content' );
44 reportIfNightModeWasDisabledOnPage(
45 document.documentElement, mw.user.options, mw.user.isNamed()
46 );
47 }
48
49 if ( !window.QUnit ) {
50 init();
51 }
52
53 module.exports = {
54 // Version number allows breaking changes to be detected by other extensions
55 VERSION: 1
56 };