mediawiki-skins-MinervaNeue/resources/skins.minerva.scripts/setup.js
Jdlrobson b6ffc85cd4 Revert "The new class should be present alongside the old class for all page views"
This reverts commit bca9223bb1.

Reason for revert: This is now longer needed following the work
in Ia253de68f94236e7fe2219b736dd6084c64ce838.

Bug: T359983
Change-Id: Ibd3013169f26531a0cd879c143692e7030709808
2024-03-19 23:23:54 +00:00

53 lines
1.6 KiB
JavaScript

/**
* This setups the Minerva skin.
* It should run without errors even if MobileFrontend is not installed.
*/
var ms = require( 'mobile.startup' ),
reportIfNightModeWasDisabledOnPage = require( './reportIfNightModeWasDisabledOnPage.js' ),
addPortletLink = require( './addPortletLink.js' ),
teleportTarget = require( 'mediawiki.page.ready' ).teleportTarget;
function init() {
var permissions = mw.config.get( 'wgMinervaPermissions' ) || {},
// eslint-disable-next-line no-jquery/no-global-selector
$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
};