mediawiki-skins-MinervaNeue/resources/skins.minerva.scripts/setup.js
libraryupgrader 842a91590a build: Updating npm dependencies
* eslint-config-wikimedia: 0.27.0 → 0.28.2
  The following rules are failing and were disabled:
  * tests/selenium:
    * implicit-arrow-linebreak
    * no-mixed-spaces-and-tabs
* grunt-banana-checker: 0.11.1 → 0.13.0
* stylelint-config-wikimedia: 0.16.1 → 0.17.2
  The following rules no longer exist and were removed:
  * stylistic/selector-list-comma-newline-after
* braces: 3.0.2 → 3.0.3
  * https://github.com/advisories/GHSA-grv7-fg5c-xmjg

Change-Id: Ia94454c1da778f241085714e1601a0233d547570
2024-08-01 15:27:33 +01:00

55 lines
1.6 KiB
JavaScript

/**
* This setups the Minerva skin.
* It should run without errors even if MobileFrontend is not installed.
*
* @ignore
*/
const ms = require( 'mobile.startup' );
const reportIfNightModeWasDisabledOnPage = require( './reportIfNightModeWasDisabledOnPage.js' );
const addPortletLink = require( './addPortletLink.js' );
const teleportTarget = require( 'mediawiki.page.ready' ).teleportTarget;
function init() {
const permissions = mw.config.get( 'wgMinervaPermissions' ) || {};
// eslint-disable-next-line no-jquery/no-global-selector
const $watch = $( '#page-actions-watch' );
if ( permissions.watch ) {
require( './watchstar.js' ).init( $watch );
}
addPortletLink.init();
mw.hook( 'util.addPortletLink' ).add(
addPortletLink.hookHandler
);
// 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' )();
}
// 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.
if ( navigator.userAgent.match( /OS 14_[0-9]/ ) ) {
document.body.classList.add( 'hotfix-T264376' );
}
// Apply content styles to teleported elements
teleportTarget.classList.add( 'content' );
reportIfNightModeWasDisabledOnPage(
document.documentElement, mw.user.options, mw.user.isNamed()
);
}
init();
module.exports = {
// Version number allows breaking changes to be detected by other extensions
VERSION: 1
};