const config = {
messagingSenderId: "88136297585"
};
let dataConfig;
let token;
let pushConfig;
dataConfig = {
text:
{
portalName: "Business Insider Polska",
submitButton: "Włącz powiadomienia",
closeButton: "Zamknij",
default: "Czy chciałbyś otrzymywać powiadomienia o najważniejszych wydarzeniach?",
termsLink: "https://businessinsider.com.pl/o-nas/regulamin/rpe3hvv",
instructionLink: "https://businessinsider.com.pl/o-nas/instrukcja-ustawiania-powiadomien/gf3nbgj",
granted: "Dzięki, teraz zawsze będziesz na bieżąco"
},
configStyles:
{
general: {
defaultPopUp: {
backgroundColor: "#fff",
submitBackgroundColor: "#299ecc",
submitColor: "#fff",
mainFontFamily: "'grotesque-regular', Helvetica, Arial, sans-serif",
nameFontFamily: "'grotesque-black', Helvetica, Arial, sans-serif",
borderColor: "#185F7C"
},
grantedPopUp: {
backgroundColor: "#fff",
fontFamily: "'grotesque-regular', Helvetica, Arial, sans-serif",
borderColor: "#185F7C"
},
deniedPopUp: {
backgroundColor: "#fff",
fontFamily: "'grotesque-regular', Helvetica, Arial, sans-serif"
},
icons: {
thanks: "https://businessinsider.ocdn.eu/static/push/ic_podziekowanie.svg",
close: "https://businessinsider.ocdn.eu/static/push/ic_zamknij.svg"
}
},
desktop: {
bell: {
url: "https://businessinsider.ocdn.eu/static/push/ic_dzwonek_desktop.svg"
},
logo: {
url: "https://businessinsider.ocdn.eu/static/push/bi_logo_desktop.svg"
}
},
mobile: {
bell: {
url: "https://businessinsider.ocdn.eu/static/push/ic_dzwonek_mobile.svg"
},
logo: {
url: "https://businessinsider.ocdn.eu/static/push/bi_logo_mobile.svg"
}
}
}
};
const dataDefault = {
text:
{
portalName: "Portal Name",
submitButton: "Włącz powiadomienia",
closeButton: "Zamknij",
default: "Czy chciałbyś otrzymywać powiadomienia o najważniejszych wydarzeniach?",
termsLink: "https://businessinsider.com.pl/o-nas/regulamin/rpe3hvv",
instructionLink: "https://businessinsider.com.pl/o-nas/instrukcja-ustawiania-powiadomien/gf3nbgj",
granted: "Dzięki, teraz zawsze będziesz na bieżąco"
},
configStyles:
{
general: {
defaultPopUp: {
backgroundColor: "#fff",
submitBackgroundColor: "#000",
submitColor: "#fff",
mainFontFamily: "Helvetica, Arial, sans-serif",
nameFontFamily: "Helvetica, Arial, sans-serif",
borderColor: "#000"
},
grantedPopUp: {
backgroundColor: "#fff",
fontFamily: "Helvetica, Arial, sans-serif",
borderColor: "#000"
},
deniedPopUp: {
backgroundColor: "#fff",
fontFamily: "Helvetica, Arial, sans-serif"
},
icons: {
thanks: "https://businessinsider.ocdn.eu/static/push/ic_podziekowanie.svg",
close: "https://businessinsider.ocdn.eu/static/push/ic_zamknij.svg"
}
},
desktop: {
bell: {
url: "https://businessinsider.ocdn.eu/static/push/ic_dzwonek_desktop.svg"
},
logo: {
url: "https://businessinsider.ocdn.eu/static/push/bi_logo_desktop.svg"
}
},
mobile: {
bell: {
url: "https://businessinsider.ocdn.eu/static/push/ic_dzwonek_mobile.svg"
},
logo: {
url: "https://businessinsider.ocdn.eu/static/push/bi_logo_mobile.svg"
}
}
}
}
var txt = ( dataConfig && dataConfig.text ? dataConfig.text : dataDefault.text);
var pushStyles = (dataConfig && dataConfig.configStyles ? generateStyles(dataConfig.configStyles) : generateStyles(dataDefault.configStyles));
var getHostConfig = () => {
if (pushConfig) {
return Promise.resolve(pushConfig);
}
return new Promise((resolve, reject) => {
var httpConfig = new XMLHttpRequest();
httpConfig.open("POST", "/getHostTopics");
httpConfig.setRequestHeader("Content-Type", "application/json;charset=UTF-8");
httpConfig.onload = function () {
if (httpConfig.status === 200 && httpConfig.readyState === 4) {
resolve(httpConfig.responseText);
}
else {
reject(Error("Request error" + httpConfig.statusText));
}
};
httpConfig.send(JSON.stringify({
"host": window.location.host
}));
});
};
var sendTokenToServer = (currentToken, data) => {
var xmlhttp = new XMLHttpRequest();
xmlhttp.open("POST", "/subscribetotopic");
xmlhttp.setRequestHeader("Content-Type", "application/json;charset=UTF-8");
xmlhttp.send(JSON.stringify({
"jsonrpc": "2.0",
"method": "subscribeToTopic",
"params": {
"token": currentToken,
"topics": data,
"host": window.location.host,
"platform": "web"
}
}));
}
var notificationHandler = (payload) => {
var income = payload.data;
var messageData = {
title: income.title,
body: income.body,
icon: income.icon,
data: income.data,
image: income.image,
onClick: JSON.parse(income.data).openUrl
}
navigator.serviceWorker.getRegistration().then(function (registration) {
registration.showNotification(messageData.title, messageData)
dataLayer.push({
'pwaEventAction': 'PWAShowNotification',
'pwaEventLabel': 'PWA Show Notification',
'event': 'PWAShowNotification'
});
registration.onnotificationclick = function (item) {
dataLayer.push({
'pwaEventAction': 'PWAOpenNotification',
'pwaEventLabel': 'PWA Open Notification',
'event': 'PWAOpenNotification'
});
this.close();
window.open(messageData.onClick)
};
registration.onnotificationclose = function (item) {
dataLayer.push({
'pwaEventAction': 'PWACloseNotification',
'pwaEventLabel': 'PWA Close Notification',
'event': 'PWACloseNotification'
});
};
})
}
var pushTrigger = function (data) {
navigator.serviceWorker.getRegistration().then(function (registration) {
if(firebase.apps.length === 0){
firebase.initializeApp(config);
messaging = firebase.messaging();
messaging.useServiceWorker(registration);
}
registration.pushManager.getSubscription().then(pushSubscription => {
// if (!pushSubscription) {
messaging.requestPermission().then(function () {
dataLayer.push({
'pwaEventAction': 'PWANotificationRequestAccept',
'pwaEventLabel': 'PWA Notification Request Accept',
'event': 'PWANotificationRequestAccept'
});
messaging.getToken().then(function (currentToken) {
if (currentToken) {
getHostConfig().then(function(hostConfig) {
pushConfig = hostConfig;
localStorage.setItem('isPushToken', '1');
sendTokenToServer(currentToken, JSON.parse(pushConfig));
permissionGrantingHandler();
}).catch(function(error) {
console.error(error);
});
}
}).catch(function (err) {
console.log(err.message);
});
}).catch(function (err) {
permissionHandle("denied");
console.log('Unable to get permission to notify.', err.message);
});
// }
}).catch(function (err) {
console.log('Unable to get subscription data.', err.message);
});
});
}
var pushHandler = function(){
navigator.serviceWorker.getRegistration().then(function (registration) {
if(firebase.apps.length === 0){
firebase.initializeApp(config);
messaging = firebase.messaging();
messaging.useServiceWorker(registration);
}
messaging.onTokenRefresh(function () {
messaging.getToken().then(function (refreshedToken) {
if (refreshedToken) {
getHostConfig().then(function(hostConfig) {
pushConfig = hostConfig;
localStorage.setItem('isPushToken', '1');
sendTokenToServer(refreshedToken, JSON.parse(pushConfig));
}).catch(function(error) {
console.error(error);
});
}
}).catch(function (err) {
console.log(err.message);
});
})
messaging.onMessage(function (payload) {
notificationHandler(payload)
});
});
}
document.addEventListener("DOMContentLoaded", function (event) {
if (navigator.userAgent.indexOf('Safari') != -1 && navigator.userAgent.indexOf('Chrome') == -1)
return;
else {
if (navigator.serviceWorker) {
pushHandler();
permissionHandle(Notification.permission)
}
}
});
var deniedToGranted = function () {
var pushVisitedTime = localStorage.getItem('pushUserVisited');
document.body.appendChild(createElement('pushBell', pushStyles.bellStyle,'pushBell'));
var bellExists = document.querySelector('.pushBell');
if (pushVisitedTime){
token = localStorage.getItem('isPushToken');
if(!token) {
createDefaultPopUp(pushStyles, document.body);
disable(bellExists);
}
else {
bellExists.style.display = 'none';
}
}
if(bellExists){
bellExists.addEventListener('click', function () {
dataLayer.push({
'pwaEventAction': 'PWADefaultBellClick',
'pwaEventLabel': 'PWA default bell click',
'event': 'PWADefaultBellClick'
});
var container = document.getElementById('pushPopUp');
disable(bellExists);
if (container)
setStylesOnElement({ display: 'block' }, container);
else
createDefaultPopUp(pushStyles);
});
}
};
var permissionHandle = function(flag){
switch(flag){
case "granted":
deniedToGranted();
break;
case "denied":
localStorage.removeItem('isPushToken');
document.body.appendChild(createElement("pushBell", pushStyles.bellStyle,"pushBell"))
var bellExists = document.getElementById("pushBell");
if (bellExists) {
var clicked = false;
bellExists.addEventListener("click", function (event) {
dataLayer.push({
'pwaEventAction': 'PWADeniedBellClick',
'pwaEventLabel': 'PWA denied bell click',
'event': 'PWADeniedBellClick'
});
var pushAlert = document.getElementById("pushAlert");
if(clicked){
bellExists.removeChild(pushAlert);
clicked = false;
}
else{
clicked = true;
bellExists.appendChild(createElement("pushAlert",pushStyles.deniedPopUp,"pushAlert",
"Przeglądarka blokuje powiadomienia - sprawdź jak zmienić ustawienia",));
}
});
}
break;
case "default":
document.body.appendChild(createElement("pushBell", pushStyles.bellStyle,"pushBell"));
var bellExists = document.getElementById("pushBell");
var timeToExpire = 14 * 24 * 60 * 60 * 1000;
var pushVisitedTime = localStorage.getItem('pushUserVisited');
if (!pushVisitedTime || parseInt(pushVisitedTime, 10) + timeToExpire < new Date().getTime()){
createDefaultPopUp(pushStyles,document.body);
disable(bellExists);
localStorage.setItem('pushUserVisited', new Date().getTime().toString());
}
if(bellExists){
bellExists.addEventListener("click", function () {
dataLayer.push({
'pwaEventAction': 'PWADefaultBellClick',
'pwaEventLabel': 'PWA default bell click',
'event': 'PWADefaultBellClick'
});
var container = document.getElementById("pushPopUp");
disable(bellExists);
if (container)
setStylesOnElement({ display: "block" }, container);
else
createDefaultPopUp(pushStyles);
});
}
break;
default:
console.log("Flag not specified");
break;
}
}
var createDefaultPopUp = function(styles){
var popUp = createElement("pushPopUp",styles.defaultPopUp,"pushDefaultPopUp");
var popUpImages = createElement("pushDefaultPopUpImages",styles.defaultPopUpImages);
var popUpLogo = createElement("pushLogo",styles.defaultPopUpLogo);
popUpImages.appendChild(popUpLogo);
var popUpBell = createElement(undefined,styles.defaultPopUpBell);
popUpImages.appendChild(popUpBell);
var popUpClose = createElement("closePopUp",styles.defaultPopUpClose,"closePopUp",isMobileDevice() ? undefined : txt.closeButton);
popUpClose.addEventListener("click", () => {
dataLayer.push({
'pwaEventAction': 'PWAcancelButtonClick',
'pwaEventLabel': 'PWA cancel button click',
'event': 'PWAcancelButtonClick'
});
var isPopUp = document.getElementById("pushDefaultPopUp");
var isBell = document.getElementById("pushBell");
if(isPopUp)
isPopUp.remove();
if (isBell) {
enable(isBell);
}
});
popUpImages.appendChild(popUpClose);
var popUpInfo = createElement("pushDefaultPopInfo",styles.defaultPopUpInfo);
var popUpPortalName = createElement(undefined,styles.defaultPopUpPortalName,undefined,txt.portalName);
var popUpText = createElement(undefined,styles.defaultPopUpText,undefined,txt.default);
popUpInfo.appendChild(popUpPortalName);
popUpInfo.appendChild(popUpText);
var popUpSubmitContainer = createElement("pushDefaultPopUpSubmitContainer",styles.defaultPopUpSubmitContainer);
var submitButton = createElement("pushSubmitButton",styles.defaultPopUpSubmitButton,undefined,txt.submitButton);
submitButton.addEventListener("click", () => {
dataLayer.push({
'pwaEventAction': 'PWAtriggerNativePopUp',
'pwaEventLabel': 'PWA trigger native pop up',
'event': 'PWAtriggerNativePopUp'
});
pushTrigger();
var isPopUp = document.getElementById("pushDefaultPopUp");
var isBell = document.getElementById("pushBell");
if(isPopUp)
isPopUp.remove();
if (isBell) {
isBell.remove();
}
});
popUpSubmitContainer.appendChild(submitButton)
var termsTxt = "Wyrażając zgodę na otrzymywanie powyższych powiadomień, oświadczam iż zapoznałam/em się z Regulaminem usługi i zgadzam się na stosowanie jego postanowień.";
var popUpTerms = createElement("pushDefaultPopUpTerms",styles.defaultPopUpTerms,undefined,termsTxt);
popUp.appendChild(popUpImages);
popUp.appendChild(popUpInfo);
popUp.appendChild(popUpSubmitContainer);
popUp.appendChild(popUpTerms);
document.body.appendChild(popUp);
if(document.body.contains(document.getElementById("pushDefaultPopUp"))){
dataLayer.push({
'pwaEventAction': 'PWAshowDefaultPopUp',
'pwaEventLabel': 'PWA show default pop up',
'event': 'PWAshowDefaultPopUp'
});
var timeToExpire = 14 * 24 * 60 * 60 * 1000;
var pushVisitedTime = localStorage.getItem('pushUserVisited');
if (!pushVisitedTime || parseInt(pushVisitedTime, 10) + timeToExpire < new Date().getTime()) {
localStorage.setItem('pushUserVisited', new Date().getTime().toString());
}
}
}
var permissionGrantingHandler = function(){
var createdStyleTag = document.createElement("style");
createdStyleTag.textContent = "@keyframes slide{"+
"from { opacity: 0; transform: translateX(100%);}"+
"to{ opacity: 1; transform: translateX(-10%); }"+
"}";
document.body.appendChild(createdStyleTag);
var isBell = document.getElementById("pushBell");
if(isBell)
isBell.remove();
var grantedPopUp = createElement("pushGrantedPopUp",pushStyles.grantedPopUp,"pushGrantedPopUp");
var grantedMessage = createElement(undefined,pushStyles.grantedMessage,undefined,txt.granted,"p");
grantedPopUp.appendChild(grantedMessage);
var grantedTick = createElement(undefined,pushStyles.grantedTick);
grantedPopUp.appendChild(grantedTick);
var grantedClose = createElement("grantedClose",pushStyles.grantedClose,"pushGrantedClose");
if(grantedClose){
grantedClose.addEventListener("click", function (event) {
this.parentNode.remove();
});
grantedPopUp.appendChild(grantedClose);
}
document.body.appendChild(grantedPopUp);
if(document.body.contains(document.getElementById("pushGrantedPopUp"))){
dataLayer.push({
'pwaEventAction': 'PWAshowGrantedPopUp',
'pwaEventLabel': 'PWA show granted pop up',
'event': 'PWAshowGrantedPopUp'
});
}
}
var createElement = function (elementClass=null, styles, id=null, text=null, type="div") {
var element = document.createElement(type);
setStylesOnElement(styles, element);
if(elementClass)
element.classList.add(elementClass);
if(id)
element.setAttribute("id",id);
if(text)
element.innerHTML = text;
return element;
}
function generateStyles(stylesConfig) {
var styles;
if (isMobileDevice()) {
styles = {
bellStyle: {
zIndex: '999',
background: "url(" + stylesConfig.mobile.bell.url + ") no-repeat",
position: "fixed",
width: "45px",
height: "45px",
right: "15px",
bottom: "15px",
cursor:"pointer",
},
defaultPopUp: {
boxSizing: "border-box",
fontFamily: stylesConfig.general.defaultPopUp.mainFontFamily,
backgroundColor: stylesConfig.general.defaultPopUp.backgroundColor,
position: "fixed",
zIndex: "9999999",
overflowY: "scroll",
width: "100%",
height: "100%",
left: "50%",
top: "50%",
transform: "translate(-50%, -50%)",
boxShadow: "3px 3px 47px -7px rgba(0,0,0,0.84)",
display: "flex",
flexDirection: "column",
justifyContent: "space-around",
padding: "0 10px",
borderBottom: "10px solid " + stylesConfig.general.defaultPopUp.borderColor
},
defaultPopUpImages: {
width: "100%",
flex: "0 0 47%",
display: "flex",
},
defaultPopUpLogo: {
background: "url(" + stylesConfig.mobile.logo.url + ") no-repeat",
height: "85px",
width: "85px",
position: "fixed",
},
defaultPopUpBell: {
background: "url(" + stylesConfig.mobile.bell.url + ") no-repeat",
width: "160px",
height: "160px",
margin: "18vh auto 0"
},
defaultPopUpClose: {
background: "url(" + stylesConfig.general.icons.close + ") no-repeat",
position: "fixed",
top: "10px",
right: "10px",
width: "35px",
height: "35px",
opacity: "0.4",
},
defaultPopUpInfo: {
flex: "0 0 15%",
textAlign: "center",
},
defaultPopUpPortalName: {
fontFamily: stylesConfig.general.defaultPopUp.nameFontFamily,
fontSize: "26px",
lineHeight: "26px"
},
defaultPopUpText: {
fontSize: "21px",
paddingTop: "10px",
opacity: "0.8"
},
defaultPopUpSubmitContainer: {
width: "100%",
flex: "0 0 10%",
},
defaultPopUpSubmitButton: {
backgroundColor: stylesConfig.general.defaultPopUp.submitBackgroundColor,
color: stylesConfig.general.defaultPopUp.submitColor,
borderRadius: "5px",
border: "none",
cursor: "pointer",
padding: "12px 0px",
width: "280px",
textAlign: "center",
margin: "0 auto",
textTransform: "uppercase"
},
defaultPopUpTerms: {
width: "100%",
flex: "0 0 10%",
fontSize: "16px",
lineHeight: "16px",
textAlign: "center",
opacity: "0.4"
},
deniedPopUp: {
backgroundColor: stylesConfig.general.deniedPopUp.backgroundColor,
fontFamily: stylesConfig.general.deniedPopUp.fontFamily,
position: "fixed",
width:"100%",
lineHeight: "20px",
bottom: "75px",
right: "0",
fontSize: "17px",
textAlign: "center",
boxShadow:"3px 3px 47px -7px rgba(0,0,0,0.84)",
padding: '10px',
},
grantedPopUp: {
backgroundColor: stylesConfig.general.grantedPopUp.backgroundColor,
fontFamily: stylesConfig.general.grantedPopUp.fontFamily,
display: "flex",
alignItems: "center",
position: "fixed",
zIndex: "9999999",
left: "50%",
bottom: "0",
transform: "translate(-50%, 0)",
width: "100%",
height: "90px",
padding: "10px",
boxShadow:"3px 3px 47px -7px rgba(0,0,0,0.84)",
borderBottom: "3px solid " + stylesConfig.general.grantedPopUp.borderColor
},
grantedMessage: {
fontFamily: stylesConfig.general.grantedPopUp.fontFamily,
margin: "0 auto 0 60px",
opacity: "0.7",
fontSize: "17px",
lineHeight: "17px"
},
grantedTick: {
background: "url(" + stylesConfig.general.icons.thanks + ") no-repeat",
height: "50px",
width: "50px",
position: "fixed",
},
grantedClose: {
background: "url(" + stylesConfig.general.icons.close + ") no-repeat",
position: "fixed",
top: "10px",
right: "10px",
width: "25px",
height: "25px",
opacity: "0.4",
}
}
}
else {
styles = {
bellStyle: {
zIndex: '999',
background: "url(" + stylesConfig.desktop.bell.url + ") no-repeat",
position: "fixed",
width: "45px",
height: "45px",
right: "15px",
bottom: "15px",
cursor:"pointer",
},
defaultPopUp: {
fontFamily: stylesConfig.general.defaultPopUp.mainFontFamily,
backgroundColor: stylesConfig.general.defaultPopUp.backgroundColor,
position: "fixed",
zIndex: "9999999",
width: "680px",
height: "400px",
left: "50%",
top: "50%",
transform: "translate(-50%, -50%)",
boxShadow: "3px 3px 47px -7px rgba(0,0,0,0.84)",
display: "flex",
flexDirection: "column",
padding: "15px",
borderBottom: "10px solid " + stylesConfig.general.defaultPopUp.borderColor
},
defaultPopUpImages: {
width: "100%",
flex: "0 0 50%",
display: "flex",
},
defaultPopUpLogo: {
background: "url(" + stylesConfig.desktop.logo.url + ") no-repeat",
height: "115px",
width: "115px",
position: "fixed",
},
defaultPopUpBell: {
background: "url(" + stylesConfig.desktop.bell.url + ") no-repeat",
width: "160px",
height: "160px",
margin: "30px auto 0"
},
defaultPopUpClose: {
background: "url(" + stylesConfig.general.icons.close + ") no-repeat",
position: "fixed",
backgroundPosition: "45px 0px",
top: "15px",
right: "15px",
textTransform: "uppercase",
fontSize: "9px",
width: "70px",
height: "24px",
lineHeight: "24px",
opacity: "0.4",
cursor: "pointer"
},
defaultPopUpInfo: {
width: "100%",
flex: "0 0 20%",
textAlign: "center",
padding: "20px 0"
},
defaultPopUpPortalName: {
fontFamily: stylesConfig.general.defaultPopUp.nameFontFamily,
fontSize: "26px",
lineHeight: "26px"
},
defaultPopUpText: {
fontSize: "21px",
paddingTop: "10px",
opacity: "0.8"
},
defaultPopUpSubmitContainer: {
width: "100%",
flex: "0 0 10%",
},
defaultPopUpSubmitButton: {
backgroundColor: stylesConfig.general.defaultPopUp.submitBackgroundColor,
color: stylesConfig.general.defaultPopUp.submitColor,
borderRadius: "5px",
border: "none",
cursor: "pointer",
padding: "8px 30px",
width: "180px",
textAlign: "center",
margin: "0 auto",
textTransform: "uppercase"
},
defaultPopUpTerms: {
width: "100%",
flex: "0 0 10%",
fontSize: "11px",
lineHeight: "13px",
textAlign: "center",
opacity: "0.4",
marginTop: "15px"
},
deniedPopUp: {
backgroundColor: stylesConfig.general.deniedPopUp.backgroundColor,
fontFamily: stylesConfig.general.deniedPopUp.fontFamily,
position: "fixed",
width:"270px",
lineHeight: "20px",
bottom: "4.5vw",
right: "2vw",
fontSize: "1vw",
textAlign: "center",
boxShadow:"3px 3px 47px -7px rgba(0,0,0,0.84)",
padding: '10px',
},
grantedPopUp: {
backgroundColor: stylesConfig.general.grantedPopUp.backgroundColor,
fontFamily: stylesConfig.general.grantedPopUp.fontFamily,
display: "flex",
alignItems: "center",
position: "fixed",
zIndex: "9999999",
right: "0",
top: "0",
width: "270px",
height: "57px",
padding: "10px",
boxShadow:"3px 3px 47px -7px rgba(0,0,0,0.84)",
borderBottom: "3px solid " + stylesConfig.general.grantedPopUp.borderColor,
animation: "slide 0.4s ease"
},
grantedMessage: {
fontFamily: stylesConfig.general.grantedPopUp.fontFamily,
margin: "0 auto 0 55px",
width: "190px",
opacity: "0.7",
fontSize: "14px",
lineHeight: "14px"
},
grantedTick: {
background: "url(" + stylesConfig.general.icons.thanks + ") no-repeat",
height: "40px",
width: "40px",
position: "fixed",
},
grantedClose: {
background: "url(" + stylesConfig.general.icons.close + ") no-repeat",
position: "fixed",
top: "10px",
right: "10px",
width: "18px",
height: "18px",
opacity: "0.4",
cursor: "pointer"
}
}
}
return styles;
}
var disable = function (element) {
setStylesOnElement({ pointerEvents: "none", opacity: "0.4" }, element);
}
var enable = function (element) {
setStylesOnElement({ pointerEvents: "initial", opacity: "1" }, element);
}
var setStylesOnElement = function (styles, element) {
Object.assign(element.style, styles);
}
function isMobileDevice() {
return (typeof window.orientation !== "undefined") || (navigator.userAgent.indexOf('IEMobile') !== -1);
}