mirror of
https://gerrit.wikimedia.org/r/mediawiki/skins/MinervaNeue
synced 2024-11-28 08:00:32 +00:00
e72c0d7ba4
This is a second attempt at I3892afb5ed3df628e2845043cf3bbc22a9928921 that is cached HTML friendly and won't cause T234599. This time rather than solving the entire problem, we'll start rendering the menu on the server, to allow us in future to drop the Menu code Bug: T234650 Change-Id: Iea5406ef1c561f2907ec6132481007673aabf1e9
48 lines
1.5 KiB
JavaScript
48 lines
1.5 KiB
JavaScript
// FIXME: make this an object with a constructor to facilitate testing
|
|
// (see https://bugzilla.wikimedia.org/show_bug.cgi?id=44264)
|
|
/**
|
|
* mobileFrontend namespace
|
|
* @class mw.mobileFrontend
|
|
* @singleton
|
|
*/
|
|
module.exports = function () {
|
|
// eslint-disable-next-line no-restricted-properties
|
|
var M = mw.mobileFrontend,
|
|
mobile = M.require( 'mobile.startup' ),
|
|
menus = require( './menu.js' );
|
|
|
|
// loads lazy loading images
|
|
mobile.Skin.getSingleton();
|
|
// remove transparent-shield
|
|
// FIXME: Remove when transparent-shield has been removed from Mobilefrontend Skin.js
|
|
// eslint-disable-next-line no-jquery/no-global-selector
|
|
$( '.transparent-shield:not( .mw-mf-page-center__mask )' ).remove();
|
|
|
|
// setup main menu
|
|
menus.init();
|
|
|
|
( function ( wgRedirectedFrom ) {
|
|
// If the user has been redirected, then show them a toast message (see
|
|
// https://phabricator.wikimedia.org/T146596).
|
|
|
|
var redirectedFrom, $msg, title;
|
|
|
|
if ( wgRedirectedFrom === null ) {
|
|
return;
|
|
}
|
|
|
|
redirectedFrom = mw.Title.newFromText( wgRedirectedFrom );
|
|
|
|
if ( redirectedFrom ) {
|
|
// mw.Title.getPrefixedText includes the human-readable namespace prefix.
|
|
title = redirectedFrom.getPrefixedText();
|
|
$msg = $( '<div>' ).html(
|
|
mw.message( 'mobile-frontend-redirected-from', title ).parse()
|
|
);
|
|
$msg.find( 'a' ).attr( 'href', mw.util.getUrl( title, { redirect: 'no' } ) );
|
|
mw.notify( $msg );
|
|
}
|
|
}( mw.config.get( 'wgRedirectedFrom' ) ) );
|
|
/* eslint-enable no-console */
|
|
};
|