Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
function handleClicks(e) {
const clicked = $(e.target);
const clickedLink = clicked.closest('a');
const isLink = clickedLink.length > 0;
const url = isLink && clickedLink.attr('href');
const isTabLink = isLink && clickedLink.hasClass('tab-link') && (clickedLink.attr('data-tab') || (url && url.indexOf('#') === 0));
// Check if link is external
if (isLink) {
// eslint-disable-next-line
if (clickedLink.is(app.params.clicks.externalLinks) || (url && url.indexOf('javascript:') >= 0)) {
const target = clickedLink.attr('target');
if (
url
&& window.cordova
&& window.cordova.InAppBrowser
&& (target === '_system' || target === '_blank')
) {
e.preventDefault();
window.cordova.InAppBrowser.open(url, target);
}
return;
}
}
// Modules Clicks
Object.keys(app.modules).forEach((moduleName) => {
const moduleClicks = app.modules[moduleName].clicks;
if (!moduleClicks) return;
Object.keys(moduleClicks).forEach((clickSelector) => {
const matchingClickedElement = clicked.closest(clickSelector).eq(0);
const url = isLink && $clickedLinkEl.attr('href');
// const isTabLink = isLink && $clickedLinkEl.hasClass('tab-link') && ($clickedLinkEl.attr('data-tab') || (url && url.indexOf('#') === 0));
// Check if link is external
if (isLink) {
// eslint-disable-next-line
if ($clickedLinkEl.is(app.params.clicks.externalLinks) || (url && url.indexOf('javascript:') >= 0)) {
const target = $clickedLinkEl.attr('target');
if (
url
&& window.cordova
&& window.cordova.InAppBrowser
&& (target === '_system' || target === '_blank')
) {
e.preventDefault();
window.cordova.InAppBrowser.open(url, target);
}
return;
}
}
// Modules Clicks
Object.keys(app.modules).forEach((moduleName) => {
const moduleClicks = app.modules[moduleName].clicks;
if (!moduleClicks) return;
if (e.preventF7Router) return;
Object.keys(moduleClicks).forEach((clickSelector) => {
const matchingClickedElement = $clickedEl.closest(clickSelector).eq(0);
if (matchingClickedElement.length > 0) {
moduleClicks[clickSelector].call(app, matchingClickedElement, matchingClickedElement.dataset(), e);
}
});
const ua = window.navigator.userAgent;
const device = {
ios: false,
android: false,
androidChrome: false,
desktop: false,
iphone: false,
ipod: false,
ipad: false,
edge: false,
ie: false,
firefox: false,
macos: false,
windows: false,
cordova: !!(window.cordova || window.phonegap),
phonegap: !!(window.cordova || window.phonegap),
electron: false,
};
const screenWidth = window.screen.width;
const screenHeight = window.screen.height;
const android = ua.match(/(Android);?[\s\/]+([\d.]+)?/); // eslint-disable-line
let ipad = ua.match(/(iPad).*OS\s([\d_]+)/);
const ipod = ua.match(/(iPod)(.*OS\s([\d_]+))?/);
const iphone = !ipad && ua.match(/(iPhone\sOS|iOS)\s([\d_]+)/);
const ie = ua.indexOf('MSIE ') >= 0 || ua.indexOf('Trident/') >= 0;
const edge = ua.indexOf('Edge/') >= 0;
const firefox = ua.indexOf('Gecko/') >= 0 && ua.indexOf('Firefox/') >= 0;
const windows = platform === 'Win32';
const electron = ua.toLowerCase().indexOf('electron') >= 0;
function handleClicks(e) {
const clicked = $(e.target);
const clickedLink = clicked.closest('a');
const isLink = clickedLink.length > 0;
const url = isLink && clickedLink.attr('href');
const isTabLink = isLink && clickedLink.hasClass('tab-link') && (clickedLink.attr('data-tab') || (url && url.indexOf('#') === 0));
// Check if link is external
if (isLink) {
// eslint-disable-next-line
if (clickedLink.is(app.params.clicks.externalLinks) || (url && url.indexOf('javascript:') >= 0)) {
const target = clickedLink.attr('target');
if (
url
&& window.cordova
&& window.cordova.InAppBrowser
&& (target === '_system' || target === '_blank')
) {
e.preventDefault();
window.cordova.InAppBrowser.open(url, target);
}
return;
}
}
// Modules Clicks
Object.keys(app.modules).forEach((moduleName) => {
const moduleClicks = app.modules[moduleName].clicks;
if (!moduleClicks) return;
Object.keys(moduleClicks).forEach((clickSelector) => {
const matchingClickedElement = clicked.closest(clickSelector).eq(0);
if (matchingClickedElement.length > 0) {
const Device = (function Device() {
const ua = window.navigator.userAgent;
const device = {
ios: false,
android: false,
androidChrome: false,
desktop: false,
windows: false,
iphone: false,
iphoneX: false,
ipod: false,
ipad: false,
cordova: window.cordova || window.phonegap,
phonegap: window.cordova || window.phonegap,
};
const windows = ua.match(/(Windows Phone);?[\s\/]+([\d.]+)?/); // eslint-disable-line
const android = ua.match(/(Android);?[\s\/]+([\d.]+)?/); // eslint-disable-line
const ipad = ua.match(/(iPad).*OS\s([\d_]+)/);
const ipod = ua.match(/(iPod)(.*OS\s([\d_]+))?/);
const iphone = !ipad && ua.match(/(iPhone\sOS|iOS)\s([\d_]+)/);
const iphoneX = iphone && window.screen.width === 375 && window.screen.height === 812;
// Windows
if (windows) {
device.os = 'windows';
device.osVersion = windows[2];
device.windows = true;
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,
windows: false,
cordova: !!(window.cordova || window.phonegap),
phonegap: !!(window.cordova || window.phonegap),
electron: false,
};
const screenWidth = window.screen.width;
const screenHeight = window.screen.height;
const windowsPhone = ua.match(/(Windows Phone);?[\s\/]+([\d.]+)?/); // eslint-disable-line
const android = ua.match(/(Android);?[\s\/]+([\d.]+)?/); // eslint-disable-line
let ipad = ua.match(/(iPad).*OS\s([\d_]+)/);
const ipod = ua.match(/(iPod)(.*OS\s([\d_]+))?/);
const iphone = !ipad && ua.match(/(iPhone\sOS|iOS)\s([\d_]+)/);
const iphoneX = iphone && (
(screenWidth === 375 && screenHeight === 812) // X/XS
|| (screenWidth === 414 && screenHeight === 896) // XR / XS Max
);
const ie = ua.indexOf('MSIE ') >= 0 || ua.indexOf('Trident/') >= 0;
const url = isLink && clickedLink.attr('href');
const isTabLink = isLink && clickedLink.hasClass('tab-link') && (clickedLink.attr('data-tab') || (url && url.indexOf('#') === 0));
// Check if link is external
if (isLink) {
// eslint-disable-next-line
if (clickedLink.is(app.params.clicks.externalLinks) || (url && url.indexOf('javascript:') >= 0)) {
const target = clickedLink.attr('target');
if (
url
&& window.cordova
&& window.cordova.InAppBrowser
&& (target === '_system' || target === '_blank')
) {
e.preventDefault();
window.cordova.InAppBrowser.open(url, target);
}
return;
}
}
// Modules Clicks
Object.keys(app.modules).forEach((moduleName) => {
const moduleClicks = app.modules[moduleName].clicks;
if (!moduleClicks) return;
Object.keys(moduleClicks).forEach((clickSelector) => {
const matchingClickedElement = clicked.closest(clickSelector).eq(0);
if (matchingClickedElement.length > 0) {
moduleClicks[clickSelector].call(app, matchingClickedElement, matchingClickedElement.dataset());
}
});
});
const Device = (function Device() {
const ua = window.navigator.userAgent;
const device = {
ios: false,
android: false,
androidChrome: false,
desktop: false,
windows: false,
iphone: false,
iphoneX: false,
ipod: false,
ipad: false,
cordova: window.cordova || window.phonegap,
phonegap: window.cordova || window.phonegap,
};
const windows = ua.match(/(Windows Phone);?[\s\/]+([\d.]+)?/); // eslint-disable-line
const android = ua.match(/(Android);?[\s\/]+([\d.]+)?/); // eslint-disable-line
const ipad = ua.match(/(iPad).*OS\s([\d_]+)/);
const ipod = ua.match(/(iPod)(.*OS\s([\d_]+))?/);
const iphone = !ipad && ua.match(/(iPhone\sOS|iOS)\s([\d_]+)/);
const iphoneX = iphone && window.screen.width === 375 && window.screen.height === 812;
// Windows
if (windows) {
device.os = 'windows';
device.osVersion = windows[2];
device.windows = true;
}
function handleClicks(e) {
const clicked = $(e.target);
const clickedLink = clicked.closest('a');
const isLink = clickedLink.length > 0;
const url = isLink && clickedLink.attr('href');
const isTabLink = isLink && clickedLink.hasClass('tab-link') && (clickedLink.attr('data-tab') || (url && url.indexOf('#') === 0));
// Check if link is external
if (isLink) {
// eslint-disable-next-line
if (clickedLink.is(app.params.clicks.externalLinks) || (url && url.indexOf('javascript:') >= 0)) {
const target = clickedLink.attr('target');
if (url && (target === '_system' || target === '_blank' || target === '_browser')) {
e.preventDefault();
if (target !== '_browser' && window.cordova && window.cordova.InAppBrowser) {
window.cordova.InAppBrowser.open(url, target);
} else {
window.open(url, target);
}
}
return;
}
}
// Modules Clicks
Object.keys(app.modules).forEach((moduleName) => {
const moduleClicks = app.modules[moduleName].clicks;
if (!moduleClicks) return;
Object.keys(moduleClicks).forEach((clickSelector) => {
const matchingClickedElement = clicked.closest(clickSelector).eq(0);
if (matchingClickedElement.length > 0) {
function handleClick(e) {
const target = e.target;
const $target = $(target);
const keyboardOpened = !app.device.desktop && app.device.cordova && ((window.Keyboard && window.Keyboard.isVisible) || (window.cordova.plugins && window.cordova.plugins.Keyboard && window.cordova.plugins.Keyboard.isVisible));
if (keyboardOpened) return;
if ($target.closest(popover.el).length === 0) {
if (
popover.params.closeByBackdropClick
&& popover.params.backdrop
&& popover.backdropEl
&& popover.backdropEl === target
) {
popover.close();
} else if (popover.params.closeByOutsideClick) {
popover.close();
}
}
}