Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
device.ipad = true;
}
if (ipod) {
device.osVersion = ipod[3] ? ipod[3].replace(/_/g, '.') : null;
device.ipod = true;
}
// iOS 8+ changed UA
if (device.ios && device.osVersion && ua.indexOf('Version/') >= 0) {
if (device.osVersion.split('.')[0] === '10') {
device.osVersion = ua.toLowerCase().split('version/')[1].split(' ')[0];
}
}
// Webview
device.webView = !!((iphone || ipad || ipod) && (ua.match(/.*AppleWebKit(?!.*Safari)/i) || window.navigator.standalone))
|| (window.matchMedia && window.matchMedia('(display-mode: standalone)').matches);
device.webview = device.webView;
device.standalone = device.webView;
// Desktop
device.desktop = !(device.ios || device.android) || electron;
if (device.desktop) {
device.electron = electron;
device.macos = macos;
device.windows = windows;
if (device.macos) {
device.os = 'macos';
}
if (device.windows) {
device.os = 'windows';
}
}
device.ipad = true;
}
if (ipod) {
device.osVersion = ipod[3] ? ipod[3].replace(/_/g, '.') : null;
device.ipod = true;
}
// iOS 8+ changed UA
if (device.ios && device.osVersion && ua.indexOf('Version/') >= 0) {
if (device.osVersion.split('.')[0] === '10') {
device.osVersion = ua.toLowerCase().split('version/')[1].split(' ')[0];
}
}
// Webview
device.webView = !!((iphone || ipad || ipod) && (ua.match(/.*AppleWebKit(?!.*Safari)/i) || window.navigator.standalone))
|| (window.matchMedia && window.matchMedia('(display-mode: standalone)').matches);
device.webview = device.webView;
device.standalone = device.webView;
// Desktop
device.desktop = !(device.ios || device.android || device.windowsPhone) || electron;
if (device.desktop) {
device.electron = electron;
device.macos = macos;
device.windows = windows;
}
// Meta statusbar
const metaStatusbar = document.querySelector('meta[name="apple-mobile-web-app-status-bar-style"]');
// Check for status bar and fullscreen app mode
device.needsStatusbarOverlay = function needsStatusbarOverlay() {
app.root[0].f7 = app;
}
// Install Modules
app.useModules();
// Init Data & Methods
app.initData();
// Auto Dark Theme
const DARK = '(prefers-color-scheme: dark)';
const LIGHT = '(prefers-color-scheme: light)';
app.mq = {};
if (window.matchMedia) {
app.mq.dark = window.matchMedia(DARK);
app.mq.light = window.matchMedia(LIGHT);
}
app.colorSchemeListener = function colorSchemeListener({ matches, media }) {
if (!matches) {
return;
}
const html = document.querySelector('html');
if (media === DARK) {
html.classList.add('theme-dark');
} else if (media === LIGHT) {
html.classList.remove('theme-dark');
}
};
// Init
if (app.params.init) {
if (Device.cordova && app.params.initOnDeviceReady) {
$(document).on('deviceready', () => {
if (app.root && app.root[0]) {
app.root[0].f7 = app;
}
// Install Modules
app.useModules();
// Init Data & Methods
app.initData();
// Auto Dark Theme
const DARK = '(prefers-color-scheme: dark)';
const LIGHT = '(prefers-color-scheme: light)';
app.mq = {};
if (window.matchMedia) {
app.mq.dark = window.matchMedia(DARK);
app.mq.light = window.matchMedia(LIGHT);
}
app.colorSchemeListener = function colorSchemeListener({ matches, media }) {
if (!matches) {
return;
}
const html = document.querySelector('html');
if (media === DARK) {
html.classList.add('theme-dark');
} else if (media === LIGHT) {
html.classList.remove('theme-dark');
}
};
// Init
if (app.params.init) {
if (Device.cordova && app.params.initOnDeviceReady) {
if (app.root && app.root[0]) {
app.root[0].f7 = app;
}
// Install Modules
app.useModules();
// Init Data & Methods
app.initData();
// Auto Dark Theme
const DARK = '(prefers-color-scheme: dark)';
const LIGHT = '(prefers-color-scheme: light)';
app.mq = {};
if (window.matchMedia) {
app.mq.dark = window.matchMedia(DARK);
app.mq.light = window.matchMedia(LIGHT);
}
app.colorSchemeListener = function colorSchemeListener({ matches, media }) {
if (!matches) {
return;
}
const html = document.querySelector('html');
if (media === DARK) {
html.classList.add('theme-dark');
} else if (media === LIGHT) {
html.classList.remove('theme-dark');
}
};
// Init
if (app.params.init) {
if (Device.cordova && app.params.initOnDeviceReady) {
app.root[0].f7 = app;
}
// Install Modules
app.useModules();
// Init Data & Methods
app.initData();
// Auto Dark Theme
const DARK = '(prefers-color-scheme: dark)';
const LIGHT = '(prefers-color-scheme: light)';
app.mq = {};
if (window.matchMedia) {
app.mq.dark = window.matchMedia(DARK);
app.mq.light = window.matchMedia(LIGHT);
}
app.colorSchemeListener = function colorSchemeListener({ matches, media }) {
if (!matches) {
return;
}
const html = document.querySelector('html');
if (media === DARK) {
html.classList.add('theme-dark');
} else if (media === LIGHT) {
html.classList.remove('theme-dark');
}
};
// Init
if (app.params.init) {
if (Device.cordova && app.params.initOnDeviceReady) {
$(document).on('deviceready', () => {
device.prefersColorScheme = function prefersColorTheme() {
let theme;
if (window.matchMedia && window.matchMedia(LIGHT).matches) {
theme = 'light';
}
if (window.matchMedia && window.matchMedia(DARK).matches) {
theme = 'dark';
}
return theme;
};
device.prefersColorScheme = function prefersColorTheme() {
let theme;
if (window.matchMedia && window.matchMedia(LIGHT).matches) {
theme = 'light';
}
if (window.matchMedia && window.matchMedia(DARK).matches) {
theme = 'dark';
}
return theme;
};
device.prefersColorScheme = function prefersColorTheme() {
let theme;
if (window.matchMedia && window.matchMedia(LIGHT).matches) {
theme = 'light';
}
if (window.matchMedia && window.matchMedia(DARK).matches) {
theme = 'dark';
}
return theme;
};
device.prefersColorScheme = function prefersColorTheme() {
let theme;
if (window.matchMedia && window.matchMedia(LIGHT).matches) {
theme = 'light';
}
if (window.matchMedia && window.matchMedia(DARK).matches) {
theme = 'dark';
}
return theme;
};