[DE PE] adapt mobile app launch markup

This commit is contained in:
Maxim Kadushkin 2021-09-28 11:10:26 +03:00
parent 24024fac8f
commit 5b6869d265
2 changed files with 22 additions and 14 deletions

View file

@ -23,7 +23,11 @@
<link rel="apple-touch-icon" href="static/icons/apple-touch-icon.png">
<link rel="icon" href="static/icons/favicon.png">
<link rel="stylesheet" type="text/css" href="../../common/mobile/resources/less/skeleton.css">
<% if (!htmlWebpackPlugin.options.skeleton.stylesheet) { %>
<link rel="stylesheet" href="../../common/mobile/resources/css/skeleton.css">
<% } else { %>
<style><%= htmlWebpackPlugin.options.skeleton.stylesheet %></style>
<% } %>
<!-- built styles file will be auto injected -->
</head>
@ -42,11 +46,11 @@
// Framework7 doesn't set Device.android flag when navigator.platform == 'Win32', change it for debug
navigator.__defineGetter__('platform', () => 'Win32Debug');
const element_add_class = (el, cls) => (el && el.classList.add(cls));
let navbar = document.querySelector('.skl-navbar');
if ( window.devicePixelRatio ) {
if ( navbar ) {
navbar.classList.add(`skl-pixel-ratio--${Math.floor(window.devicePixelRatio)}`);
}
element_add_class(navbar, `skl-pixel-ratio--${Math.floor(window.devicePixelRatio)}`);
}
if ( !isAndroid ) {
@ -58,11 +62,11 @@
Object.defineProperty(navigator, 'userAgent', {
get: function () { return `iPad; CPU OS 11_0 ${ua}`; }
});
} else {
element_add_class(navbar, `skl-navbar--ios`);
}
} else {
if ( navbar ) {
navbar.classList.add('skl-navbar--md');
}
element_add_class(navbar, `skl-navbar--md`);
}
const getUrlParams = () => {

View file

@ -23,7 +23,11 @@
<link rel="apple-touch-icon" href="static/icons/apple-touch-icon.png">
<link rel="icon" href="static/icons/favicon.png">
<link rel="stylesheet" type="text/css" href="../../common/mobile/resources/less/skeleton.css">
<% if (!htmlWebpackPlugin.options.skeleton.stylesheet) { %>
<link rel="stylesheet" href="../../common/mobile/resources/css/skeleton.css">
<% } else { %>
<style><%= htmlWebpackPlugin.options.skeleton.stylesheet %></style>
<% } %>
<!-- built styles file will be auto injected -->
</head>
@ -37,11 +41,11 @@
// Framework7 doesn't set Device.android flag when navigator.platform == 'Win32', change it for debug
navigator.__defineGetter__('platform', () => 'Win32Debug');
const element_add_class = (el, cls) => (el && el.classList.add(cls));
let navbar = document.querySelector('.skl-navbar');
if ( window.devicePixelRatio ) {
if ( navbar ) {
navbar.classList.add(`skl-pixel-ratio--${Math.floor(window.devicePixelRatio)}`);
}
element_add_class(navbar, `skl-pixel-ratio--${Math.floor(window.devicePixelRatio)}`);
}
if ( !isAndroid ) {
@ -53,11 +57,11 @@
Object.defineProperty(navigator, 'userAgent', {
get: function () { return `iPad; CPU OS 11_0 ${ua}`; }
});
} else {
element_add_class(navbar, `skl-navbar--ios`);
}
} else {
if ( navbar ) {
navbar.classList.add('skl-navbar--md');
}
element_add_class(navbar, `skl-navbar--md`);
}
const getUrlParams = () => {