Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
const Support = (function Support() {
return {
touch: (function checkTouch() {
return !!((window.navigator.maxTouchPoints > 0) || ('ontouchstart' in window) || (window.DocumentTouch && document instanceof window.DocumentTouch));
}()),
pointerEvents: !!(window.navigator.pointerEnabled || window.PointerEvent || ('maxTouchPoints' in window.navigator && window.navigator.maxTouchPoints > 0)),
prefixedPointerEvents: !!window.navigator.msPointerEnabled,
observer: (function checkObserver() {
return ('MutationObserver' in window || 'WebkitMutationObserver' in window);
}()),
passiveListener: (function checkPassiveListener() {
let supportsPassive = false;
try {
const opts = Object.defineProperty({}, 'passive', {
// eslint-disable-next-line
get() {
supportsPassive = true;
},
});
window.addEventListener('testPassiveListener', null, opts);
} catch (e) {
}
const passedParams = Utils.extend({}, params);
// App Instance
const app = this;
Framework7.instance = app;
// Default
const defaults = {
version: '1.0.0',
id: 'io.framework7.testapp',
root: 'body',
theme: 'auto',
language: window.navigator.language,
routes: [],
name: 'Framework7',
lazyModulesPath: null,
initOnDeviceReady: true,
init: true,
autoDarkTheme: false,
};
// Extend defaults with modules params
app.useModulesParams(defaults);
// Extend defaults with passed params
app.params = Utils.extend(defaults, params);
const $rootEl = $(app.params.root);
const Browser = (function Browser() {
function isSafari() {
const ua = window.navigator.userAgent.toLowerCase();
return (ua.indexOf('safari') >= 0 && ua.indexOf('chrome') < 0 && ua.indexOf('android') < 0);
}
return {
isIE: !!window.navigator.userAgent.match(/Trident/g) || !!window.navigator.userAgent.match(/MSIE/g),
isSafari: isSafari(),
isUiWebView: /(iPhone|iPod|iPad).*AppleWebKit(?!.*Safari)/i.test(window.navigator.userAgent),
};
}());
touch: (function checkTouch() {
return !!((window.navigator.maxTouchPoints > 0) || ('ontouchstart' in window) || (window.DocumentTouch && document instanceof window.DocumentTouch));
}()),
function isSafari() {
const ua = window.navigator.userAgent.toLowerCase();
return (ua.indexOf('safari') >= 0 && ua.indexOf('chrome') < 0 && ua.indexOf('android') < 0);
}
return {
event() {
if (window.navigator.userAgent.indexOf('firefox') > -1) return 'DOMMouseScroll';
return isEventSupported() ? 'wheel' : 'mousewheel';
},
normalize(e) {
event: (function getEvent() {
if (window.navigator.userAgent.indexOf('firefox') > -1) return 'DOMMouseScroll';
return isEventSupported() ? 'wheel' : 'mousewheel';
}()),
normalize(e) {
event() {
if (window.navigator.userAgent.indexOf('firefox') > -1) return 'DOMMouseScroll';
return isEventSupported() ? 'wheel' : 'mousewheel';
},
normalize(e) {
function isSafari() {
const ua = window.navigator.userAgent.toLowerCase();
return (ua.indexOf('safari') >= 0 && ua.indexOf('chrome') < 0 && ua.indexOf('android') < 0);
}
return {
const Device = (function Device() {
const platform = window.navigator.platform;
const ua = window.navigator.userAgent;
const device = {
ios: false,
android: false,
androidChrome: false,
desktop: false,
windowsPhone: false,
iphone: false,
iphoneX: false,
ipod: false,
ipad: false,
edge: false,
ie: false,
firefox: false,
macos: false,