mirror of
https://gerrit.wikimedia.org/r/mediawiki/skins/MinervaNeue
synced 2024-12-18 16:51:05 +00:00
548e94da98
Added to MediaWiki core last year with I9fca9fdf9b7623b1. This fixes a confusing assertion in page-issues/index.test.js, where for "insertBannersOrNotice()" it was asserting that the HTML contain "⧼skin-minerva-issue-learn-more⧽", where the ⧼ character indicates the message is not found (i.e. an error). The test had to be written this way in order to pass, because the skins.minerva.scripts module was not actually loaded, and thus its templates and messages are not present either. This lack was filled in by index.js for mw.templates, but not mw.messages. By adopting private require(), these workarounds can all be removed. == Motivation == In change I3a4024ccf90e505581, I'm working on improving the testrunner config to enforce uselang=qqx on all tests. This is passing except for GrowthExperiments and Minerva, both of which have the above workarounds in place that caused a message to be undefined, and then kept in the assertion expectation. When using uselang=qqx, values are returned as (key) instead of ⧼key⧽, which exposes these message existence errors. By removing this workaround, the test will simply import the module in the test as normal, thus the messages will exist, and thus it will expect (key), and thus it will continue to pass even after enforcing uselang=qqx. Change-Id: Ib68f45d93a7054ed8bd35fc5644e2852f2f90248
57 lines
1.6 KiB
JavaScript
57 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()
|
|
);
|
|
}
|
|
|
|
if ( !window.QUnit ) {
|
|
init();
|
|
}
|
|
|
|
module.exports = {
|
|
// Version number allows breaking changes to be detected by other extensions
|
|
VERSION: 1
|
|
};
|