var dmlftsphWrapperElement = document.getElementById("dml_ftsph_wrapper"); dmlftsphWrapperElement.style.transition = "all 0.5s;"; var ftsphCSSid = 'ftsphStyleSheet'; let sessionTimeString = (new Date()).getTime(); var ftsphFlLgPp = false; var ftsph_pagelink = document.createElement('link'); ftsph_pagelink.id = ftsphCSSid; ftsph_pagelink.rel = 'stylesheet'; ftsph_pagelink.type = 'text/css'; ftsph_pagelink.href = 'https://hydromasque.herokuapp.com/stylesheets/style.min.css?'+sessionTimeString; ftsph_pagelink.media = 'all'; dmlftsphWrapperElement.appendChild(ftsph_pagelink); window.ftsph_maxwidth = typeof window.ftsph_maxwidth != "undefined" ? window.ftsph_maxwidth : "100%"; window.ftsph_maxheight = typeof window.ftsph_maxheight != "undefined" ? window.ftsph_maxheight : window.innerHeight +"px"; window.ftsph_bannerwidth= typeof window.ftsph_bannerwidth != "undefined" ? window.ftsph_bannerwidth : "100%"; window.ftsph_isEmbed = typeof window.ftsph_isEmbed != "undefined" ? window.ftsph_isEmbed: true; var ftsphOpenConsentDirectly = false; /* if (!window.ftsph_isEmbed){ window.ftsph_showNavbar = true; } window.ftsph_showNavbar = typeof window.ftsph_showNavbar != "undefined" ? window.ftsph_showNavbar : false; */ window.ftsph_showLiveChat = typeof window.ftsph_showLiveChat != "undefined" ? window.ftsph_showLiveChat : true; window.ftsph_forcedLanguageCode = typeof window.ftsph_forcedLanguageCode != "undefined" ? window.ftsph_forcedLanguageCode: ""; window.ftsph_banner_cta = typeof window.ftsph_banner_cta != "undefined" ? window.ftsph_banner_cta: "customize your masque"; dmlftsphWrapperElement.style.width = window.ftsph_maxwidth; function logOnLocalHostFrontEnd(inStringBefore,inVariable){ inStringBefore = (inStringBefore === undefined) ? '' : inStringBefore; if (/localhost/g.test("https://hydromasque.herokuapp.com") || /192\.168\.0\./g.test("https://hydromasque.herokuapp.com") || /\.ngrok\.io/g.test("https://hydromasque.herokuapp.com") || /facemappingconsumer-staging\.herokuapp/g.test("https://hydromasque.herokuapp.com") || ftsphFlLgPp){ if (inVariable == undefined){ console.log(inStringBefore) }else{ console.log(inStringBefore, inVariable) } } } // GA - START window.ftsphGAsetup = false; function ftsphSendGA(eventName,eventValue){ logOnLocalHostFrontEnd("GOOGLE ANALYTICS: ",eventName + " - " + eventValue) eventValue = (eventValue == undefined) ? "" : eventValue; let eventLabel; if (typeof ftsphCustomUID == "undefined"){ eventLabel = ""; }else{ eventLabel = ftsphCustomUID; } if (typeof window.facemap != "undefined"){ if (typeof window.facemap.hashid != "undefined"){ eventLabel += " - " + window.facemap.hashid; } } if (window.ftsphGAsetup){ if (window.ga) { if (eventLabel != ""){ window.ga('ftsph_gtag.send', 'event', eventName, eventValue, eventLabel); // category - action - label }else{ window.ga('ftsph_gtag.send', 'event', eventName, eventValue); // category - action } }else if (window.gtag) { if (eventLabel != ""){ window.gtag('event', eventValue, {event_category: eventName, event_label: eventLabel}); // action - {category - label} }else{ window.gtag('event', eventName, {event_category: eventName}); // action - {category} } } else if (window._gaq) { window._gaq.push(['ftsph_gtag._trackEvent',eventName,eventValue]); // category - action } } } function ftsphSendPageViewGA(pagePath){ if (window.ftsphGAsetup){ if (window.ga) { logOnLocalHostFrontEnd("GOOGLE ANALYTICS: ga pageview event will be send"); window.ga('ftsph_gtag.set', 'page', pagePath); window.ga('ftsph_gtag.send', 'pageview'); }else if (window.gtag) { logOnLocalHostFrontEnd("GOOGLE ANALYTICS: gtag pageview event will be send"); window.gtag('config', "UA-36853599-43", {"page_title": window.location.hostname, "page_path": pagePath}); } else if (window._gaq) { logOnLocalHostFrontEnd("GOOGLE ANALYTICS: _gaq pageview event will be send"); window._gaq.push(['ftsph_gtag._trackPageview',pagePath]); } } } function ftsphSetupGA(){ let pageTitle ="not found"; pageTitle = window.location.hostname; if (window.ga) { logOnLocalHostFrontEnd("setting up GA for 'ga'",""); window.ga('create', "UA-36853599-43", 'auto', 'ftsph_gtag'); window.ga('ftsph_gtag.set','anonymizeIp', true); window.ga('ftsph_gtag.send','pageview',window.location.href); }else if (window.gtag) { logOnLocalHostFrontEnd("setting up GA for 'gtag'",""); window.gtag('config', "UA-36853599-43", { 'anonymize_ip': true, 'page_title': pageTitle , 'page_location': window.location.href }); } else if (window._gaq) { logOnLocalHostFrontEnd("setting up GA for '_gaq'",""); window._gaq.push(['ftsph_gtag._setAccount',"UA-36853599-43"],['ftsph_gtag._trackPageview']); } window.ftsphGAsetup = true; } // GA - END function getEmbedHtmlData(url, callback){ let request = new XMLHttpRequest(); request.open('GET', url, true); request.onload = function() { if (request.status >= 200 && request.status < 400) { callback({"status": "success","status_code":request.status, "data" : request.responseText}); } else { callback({"status": "success","status_code":request.status, "data" : "We reached our target server, but it returned an error"}); } }; request.onerror = function() { callback({"error": "success","status_code":request.status, "data" : "Error occured in getting html data"}); }; request.send(); } function dmlftsph_getScript(source, callback) { var script = document.createElement('script'); script.async = 1; script.onload = function(evt) { callback({"status":"success","message":"done"}); }; script.onerror = function(err){ console.log(err) callback({"status":"error", "message":"error in getting script " + source}); } script.setAttribute('type','text/javascript'); script.src = source; dmlftsphWrapperElement.appendChild(script); } function dmlftsph_getScript_withAttributes(source, attributeObj, callback) { var script = document.createElement('script'); script.async = 1; script.onload = function(evt) { callback({"status":"success","message":"done"}); }; script.onerror = function(err){ console.log(err) callback({"status":"error", "message":"error in getting script " + source}); } script.setAttribute('type','text/javascript'); try{ Object.keys(attributeObj).forEach( function(attrKey){ script.setAttribute(attrKey,attributeObj[attrKey]); }); }catch(err){ console.log(err); } script.src = source; dmlftsphWrapperElement.appendChild(script); } function ftsphOpenApp(){ let gaTimer = 100; let gacheckinterval = setInterval(function(){ if (window.ga){ logOnLocalHostFrontEnd("GA AVAILABLE - "+ gaTimer/1000 + "s",""); clearInterval(gacheckinterval); ftsphSetupGA(); }else{ if (gaTimer > 10000){ logOnLocalHostFrontEnd("GA NOT AVAILABLE - "+ gaTimer/1000 + "s",""); clearInterval(gacheckinterval); } gaTimer += 100; } },100) if (navigator.appName == 'Microsoft Internet Explorer' || !!(navigator.userAgent.match(/Trident/) || navigator.userAgent.match(/rv:11/))){ setTimeout(function(){ftsphSendGA("openApp","Browser Not Supported");},2000); //alert("We don't currently support this browser. Please reopen this page in a different browser.") if (!window.ftsph_isEmbed){ dmlftsphWrapperElement.style.height = "100vh"; } if (document.getElementById("ftsph_banner_container")){ document.getElementById("ftsph_banner_container").style.display="none" } dmlftsphWrapperElement.innerHTML = '

We don\'t currently support this browser. Please reopen this page in a different browser, such as Chrome.

' + dmlftsphWrapperElement.innerHTML; if (dmlftsphWrapperElement.offsetWidth >= 768){ dmlftsphWrapperElement.style.background = "url('https://hydromasque.herokuapp.com/img/ftsph_onboarding_bg_desktop.jpg') no-repeat center center"; }else{ dmlftsphWrapperElement.style.background = "url('https://hydromasque.herokuapp.com/img/ftsph_onboarding_mobile_bg.jpg') no-repeat center center"; } dmlftsphWrapperElement.style.backgroundSize= "cover"; }else{ setTimeout(function(){ftsphSendGA("openApp","loading full script");},2000); getEmbedHtmlData('https://hydromasque.herokuapp.com/ftsph?'+sessionTimeString, function(res) { //window.data = res.data; if (document.getElementById("ftsph_banner_container")){ document.getElementById("ftsph_banner_container").style.display="none" } dmlftsphWrapperElement.innerHTML = res.data + dmlftsphWrapperElement.innerHTML; document.getElementById("ftsph_body").style.height=window.innerHeight + "px"; let heightLimit= Math.min(screen.innerHeight ); if (document.getElementById("ftsph_body").offsetHeight > heightLimit){ document.getElementById("ftsph_body").style.height = heightLimit + "px"; } dmlftsph_getScript('https://hydromasque.herokuapp.com/script.js?'+sessionTimeString,function(){}); dmlftsphWrapperElement.style.height = window.innerHeight + "px"; }) } } function ftsphMakeBanner(){ ftsphOpenConsentDirectly = true; dmlftsphWrapperElement.innerHTML = "
" + dmlftsphWrapperElement.innerHTML; var bannerEl = document.getElementById("ftsph_banner_container"); bannerEl.innerHTML = "

feel the spheres

"+window.ftsph_banner_cta+"
"; if (dmlftsphWrapperElement.offsetWidth >=768){ dmlftsphWrapperElement.style.height = "300px"; if ( dmlftsphWrapperElement.offsetWidth < 1080){ bannerEl.classList.add("ftsph_1080"); } }else{ bannerEl.classList.add("ftsph_768") dmlftsphWrapperElement.style.height = "500px"; } } // global functions window.ftsphSetCookie = function(cname,cvalue, exdays){ var d = new Date(); d.setTime(d.getTime() + (exdays*24*60*60*1000)); var expires = "expires="+ d.toUTCString(); document.cookie = cname + "=" + cvalue + ";" + expires + ";"; } window.ftsphReadCookie= function(cname){ let name = cname + "="; let decodedCookie = decodeURIComponent(document.cookie); let ca = decodedCookie.split(';'); for(var i = 0; i