r2.dotdigital-pages.com
Open in
urlscan Pro
104.17.127.171
Public Scan
URL:
http://r2.dotdigital-pages.com/resources/sharing/popoverv2.js?sharing=lp-popover
Submission: On March 08 via manual from US — Scanned from DE
Submission: On March 08 via manual from US — Scanned from DE
Form analysis
0 forms found in the DOMText Content
var __extends = (this && this.__extends) || (function () { var extendStatics = function (d, b) { extendStatics = Object.setPrototypeOf || ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; }; return extendStatics(d, b); }; return function (d, b) { if (typeof b !== "function" && b !== null) throw new TypeError("Class extends value " + String(b) + " is not a constructor or null"); extendStatics(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; })(); var landingpages; (function (landingpages) { var sharing; (function (sharing) { var UtilFunctions = (function () { function UtilFunctions() { } UtilFunctions.bindEvent = function (target, event, method) { if (target.addEventListener) { target.addEventListener(event, method, false); } else if (target['attachEvent']) { target['attachEvent']('on' + event, method); } }; UtilFunctions.unbindEvent = function (target, event, method) { if (target.removeEventListener) { target.removeEventListener(event, method, false); } else if (target['detachEvent']) { target['detachEvent']('on' + event, method); } }; UtilFunctions.preventDefault = function (event) { event = event || window.event; if (event.preventDefault) event.preventDefault(); event.returnValue = false; }; UtilFunctions.disableMouseWheel = function () { var _this = this; for (var i = 0; i < this.wheelEvents.length; i++) this.bindEvent(window, this.wheelEvents[i], function (event) { return _this.preventDefault(event); }); }; UtilFunctions.enableMouseWheel = function () { var _this = this; for (var i = 0; i < this.wheelEvents.length; i++) this.unbindEvent(window, this.wheelEvents[i], function (event) { return _this.preventDefault(event); }); }; UtilFunctions.extend = function (trgt, src) { for (var prop in src) trgt[prop] = src[prop]; }; UtilFunctions.viewport = function () { var el = window, param = 'inner'; if (!('innerWidth' in window)) { el = document.documentElement || document.body; param = 'client'; } return { width: el["".concat(param, "Width")], height: el["".concat(param, "Height")] }; }; UtilFunctions.currentProtocol = function () { var re = /^https:/i, protocol = re.test(location.protocol) ? "https:" : "http:"; if (document.getElementsByTagName) { var baseElements = document.getElementsByTagName("base"); if (baseElements.length) { var baseHref = baseElements[0].href; if (baseHref && baseHref.length >= 6) protocol = re.test(baseHref) ? "https:" : "http:"; } } return protocol; }; UtilFunctions.wheelEvents = 'onwheel' in document || document.documentMode >= 9 ? ['wheel'] : ['mousewheel', 'DomMouseScroll', 'MozMousePixelScroll']; return UtilFunctions; }()); sharing.UtilFunctions = UtilFunctions; })(sharing = landingpages.sharing || (landingpages.sharing = {})); })(landingpages || (landingpages = {})); var landingpages; (function (landingpages) { var sharing; (function (sharing) { var Properties = (function () { function Properties(pageDomain, pageId, appearance, autoShow, keyDismiss, delay, showMobile, surveyWidth, transparent, shroudColor, shroudOpacity, attach, description) { if (attach === void 0) { attach = ""; } this.pageDomain = pageDomain; this.shroudColor = shroudColor; this.attach = attach; this.appearance = 0; this.autoShow = true; this.keyDismiss = false; this.delay = 0; this.showMobile = false; this.surveyWidth = 600; this.transparent = false; this.pageId = pageId.split('/')[0]; if (appearance) this.appearance = appearance === 'uc' ? 'uc' : parseInt(appearance); if (/false/i.test(autoShow)) this.autoShow = false; if (/true/i.test(keyDismiss)) this.keyDismiss = true; if (delay) this.delay = parseInt(delay); if (/true/i.test(showMobile)) this.showMobile = true; if (surveyWidth) this.surveyWidth = parseInt(surveyWidth) || this.surveyWidth; if (/true/i.test(transparent)) this.transparent = true; this.shroudOpacity = parseInt(shroudOpacity) || 0; this.description = description; } Properties.create = function (script) { if (/\?.*sharing=lp-/.test(script.src)) { return this.createFromSrc(script.src); } else { return this.createFromAttributes(script); } }; Properties.createFromSrc = function (src) { var query = src.match(/\?(.+)#?/)[1].split(/&/), values = {}; for (var i = 0; i < query.length; i++) { var split = query[i].split(/=/); if (split.length === 2) values[split[0]] = decodeURIComponent(split[1]); } return this.parseAndCreate(values); }; Properties.parseAndCreate = function (values) { return new Properties(values['domain'] || '', values['id'] || '', values['appearance'], values['auto'], values['keydismiss'], values['delay'], values['mobile'], values['width'], values['transparent'], values['shroudcolor'], values['shroudopacity'], values['attach'], values['description']); }; Properties.createFromAttributes = function (script) { return new Properties(script.getAttribute('data-page-domain'), script.getAttribute('data-page-id'), script.getAttribute('data-appearance'), script.getAttribute('auto'), script.getAttribute('data-key-dismiss'), script.getAttribute('data-delay'), script.getAttribute('data-mobile'), null, null, null, null, null, null); }; return Properties; }()); sharing.Properties = Properties; })(sharing = landingpages.sharing || (landingpages.sharing = {})); })(landingpages || (landingpages = {})); var landingpages; (function (landingpages) { var sharing; (function (sharing) { var SharingBase = (function () { function SharingBase(script) { this.script = script; this.sandbox = 'allow-modals allow-downloads allow-top-navigation allow-forms allow-same-origin allow-scripts allow-popups allow-popups-to-escape-sandbox allow-top-navigation-by-user-activation'; this.properties = sharing.Properties.create(script); this.iframe = document.createElement('iframe'); if (!window.ecPF) window.ecPF = new landingpages.sharing.EmbeddingAPI(this.properties.pageDomain); window.ecPF._register(this, this.properties.pageId); } SharingBase.getScripts = function (selector) { return document.querySelectorAll("script[src*=\"sharing=lp-".concat(selector, "\"],script[data-sharing=lp-").concat(selector, "]")); }; return SharingBase; }()); sharing.SharingBase = SharingBase; })(sharing = landingpages.sharing || (landingpages.sharing = {})); })(landingpages || (landingpages = {})); var landingpages; (function (landingpages) { var sharing; (function (sharing) { var EmbeddingAPI = (function () { function EmbeddingAPI(pageDomain) { var _this = this; this.pages = []; this.complete = []; window.lpXD.receiveMessage(function (msg) { return _this.messageRecieved(msg); }, landingpages.sharing.UtilFunctions.currentProtocol() + pageDomain); } EmbeddingAPI.prototype._register = function (form, pageId) { this.pages.push({ form: form, pageId: this.getId(pageId) }); }; EmbeddingAPI.prototype.messageRecieved = function (message) { var data = null; try { data = JSON.parse(message.data); } catch (e) { } if (data && data.complete && data.name) this.processComplete(data); }; EmbeddingAPI.prototype.processComplete = function (data) { this.complete.filter(function (x) { return x.pageId === data.name || x.pageId === ''; }).forEach(function (x) { return x.method(data.formData); }); if (data && data.formData && data.formData.contactEmail && window.dmPt) { try { window.dmPt('identify', data.formData.contactEmail); } catch (e) { } } }; EmbeddingAPI.prototype.onComplete = function (fn, pageId) { if (pageId === void 0) { pageId = ''; } this.complete.push({ pageId: this.getId(pageId), method: fn }); }; EmbeddingAPI.prototype.open = function (pageId) { if (pageId === void 0) { pageId = ''; } this.getForms(pageId).forEach(function (x) { return x.form.open(); }); }; EmbeddingAPI.prototype.close = function (pageId) { if (pageId === void 0) { pageId = ''; } this.getForms(pageId).forEach(function (x) { return x.form.close(); }); }; EmbeddingAPI.prototype.getForms = function (name) { var _this = this; var forms = this.pages; if (name) { forms = forms.filter(function (x) { return x.pageId === _this.getId(name); }); } return forms; }; EmbeddingAPI.prototype.getId = function (pageId) { return pageId.split('/')[0]; }; return EmbeddingAPI; }()); sharing.EmbeddingAPI = EmbeddingAPI; })(sharing = landingpages.sharing || (landingpages.sharing = {})); })(landingpages || (landingpages = {})); var landingpages; (function (landingpages) { var sharing; (function (sharing) { if (!window.lpXD) { window.lpXD = function () { var interval_id, last_hash, cache_bust = 1, attached_callback, window = this; return { postMessage: function (message, target_url, target) { if (!target_url) { return; } target = target || parent; if (/dsid=/.test(location.search)) { var dsid = location.search.replace(/.*dsid=([^&]+)/, '$1'); message = message.replace(/\}\s*$/, ",\"islpsurvey\":true, \"dsid\":\"".concat(dsid, "\"}")); } if (window['postMessage']) { target['postMessage'](message, target_url.replace(/([^:]+:\/\/[^\/]+).*/, '$1')); } else if (target_url) { target.location = target_url.replace(/#.*$/, '') + '#' + (+new Date) + (cache_bust++) + '&' + message; } }, receiveMessage: function (callback, source_origin) { if (window['postMessage']) { if (callback) { attached_callback = function (e) { if ((Object.prototype.toString.call(source_origin) === "[object Function]" && source_origin(e.origin) === !1)) { return !1; } callback(e); }; } if (window['addEventListener']) { window[callback ? 'addEventListener' : 'removeEventListener']('message', attached_callback, !1); } else { window[callback ? 'attachEvent' : 'detachEvent']('onmessage', attached_callback); } } else { interval_id && clearInterval(interval_id); interval_id = null; if (callback) { interval_id = setInterval(function () { var hash = document.location.hash, re = /^#?\d+&/; if (hash !== last_hash && re.test(hash)) { last_hash = hash; callback({ data: hash.replace(re, '') }); } }, 100); } } } }; }(); } })(sharing = landingpages.sharing || (landingpages.sharing = {})); })(landingpages || (landingpages = {})); var landingpages; (function (landingpages) { var sharing; (function (sharing) { var CookieManager = (function () { function CookieManager(id) { this.completeName = "".concat(id, "-Completed"); this.dismissedName = "".concat(id, "-Dismissed"); } CookieManager.prototype.read = function (name) { var nameEQ = "".concat(name, "="), cookies = document.cookie.split(';'); for (var i = 0; i < cookies.length; i++) { var cookie = cookies[i]; while (cookie.charAt(0) === ' ') cookie = cookie.substring(1, cookie.length); if (cookie.indexOf(nameEQ) === 0) return cookie.substring(nameEQ.length, cookie.length); } return null; }; CookieManager.prototype.write = function (name, value, days) { var expires = ""; if (days) { var date = new Date(); date.setTime(date.getTime() + (days * 24 * 60 * 60 * 1000)); expires = "; expires=".concat(date.toUTCString()); } document.cookie = "".concat(name, "=").concat(value).concat(expires, ";secure=true; path=/"); }; CookieManager.prototype.clear = function (name) { document.cookie = "".concat(name, "=;secure=true; expires=Thu, 01 Jan 1970 00:00:00 UTC; path=/;"); }; return CookieManager; }()); sharing.CookieManager = CookieManager; })(sharing = landingpages.sharing || (landingpages.sharing = {})); })(landingpages || (landingpages = {})); var landingpages; (function (landingpages) { var sharing; (function (sharing) { var CssFactory = (function () { function CssFactory() { } CssFactory.initStyleSheet = function () { return "#_lpSurveyPopover { ".concat(this.buildStyle(CssFactory.styles.hidePopover), " }"); }; CssFactory.updateStyleSheet = function (maxZIndex, positionData, properties) { var cleanSlate = this.extend(CssFactory.styles.cleanSlate, { 'z-index': maxZIndex }), shroud = this.extend(cleanSlate, CssFactory.styles.shroud), pop_over = this.extend(cleanSlate, CssFactory.styles.pop_over), shroudShow = this.extend({}, CssFactory.styles.shroudShow); if (properties.transparent) pop_over['background-color'] = 'transparent'; if (properties.shroudColor) shroud['background-color'] = properties.shroudColor; if (properties.shroudOpacity) shroudShow['opacity'] = properties.shroudOpacity; var pop_over_positioned = this.extend(pop_over, { height: positionData.height, width: positionData.width, 'margin-left': "".concat(positionData.popOverMarginLeft, "px"), 'margin-top': "".concat(positionData.popOverMarginTop, "px") }), closeButton = this.extend(cleanSlate, CssFactory.styles.closeButton), closeButton_positioned = this.extend(closeButton, { 'margin-left': "".concat(positionData.closeButtonMarginLeft, "px"), 'margin-top': "".concat(positionData.closeButtonMarginTop, "px") }), iframe = this.extend(cleanSlate, CssFactory.styles.iframe), iframe_positioned = this.extend(iframe, { height: positionData.height, width: positionData.width }), styleRules = "#_lpSurveyPopover { ".concat(this.buildStyle(pop_over_positioned), " }") + "#_lpSurveyPopover.block { ".concat(this.buildStyle(CssFactory.styles.pop_overBlock), " }") + "#_lpSurveyPopover.show { ".concat(this.buildStyle(CssFactory.styles.pop_overShow), " }") + "#_lpSurveyPopover #lpshroud { ".concat(this.buildStyle(shroud), " }") + "#_lpSurveyPopover.show #lpshroud { ".concat(this.buildStyle(shroudShow), " }") + "#_lpSurveyPopover #lpdialog { ".concat(this.buildStyle(iframe_positioned), " }") + "#_lpSurveyPopover.show #lpdialog { ".concat(this.buildStyle(CssFactory.styles.iframeShow), " }") + "#_lpSurveyPopover #lpclose { ".concat(this.buildStyle(closeButton_positioned), " }") + "#_lpSurveyPopover.show #lpclose { ".concat(this.buildStyle(CssFactory.styles.closeButtonShow), " }") + "#_lpSurveyPopover.transition-all { ".concat(this.buildStyle(CssFactory.styles.transitionAll), " }") + "#_lpSurveyPopover.transition-all #lpclose { ".concat(this.buildStyle(CssFactory.styles.transitionAll), " }"); if (positionData.iosModTop) { var iosMod = this.extend(CssFactory.styles.ios_mod, { top: positionData.iosModTop }); styleRules += "#_lpSurveyPopover.ios { " + this.buildStyle(iosMod) + " } #_lpSurveyPopover.ios #lpclose { " + this.buildStyle({ top: '2%', left: '40%' }) + " }"; } return styleRules; }; CssFactory.buildStyle = function (css) { var builder = []; for (var prop in css) builder.push("".concat(prop, ":").concat(css[prop], "!important;")); return builder.join(''); }; CssFactory.extend = function (trgt, src) { var result = {}; for (var prop in trgt) result[prop] = trgt[prop]; for (var prop in src) result[prop] = src[prop]; return result; }; CssFactory.styles = { cleanSlate: { 'background-attachment': 'scroll', 'background-color': 'transparent', 'background-image': 'none', 'background-position': '0 0', 'background-repeat': 'repeat', 'border-color': 'black', 'border-radius': '0', 'border-style': 'none', 'border-width': 'medium', bottom: 'auto', 'box-sizing': 'content-box', clear: 'none', clip: 'auto', color: 'inherit', cursor: 'auto', direction: 'inherit', display: 'block', 'float': 'none', height: 'auto', left: 'auto', 'line-height': 'inherit', margin: '0', opacity: 0, overflow: 'visible', padding: '0', position: 'relative', right: 'auto', 'table-layout': 'auto', top: 'auto', visibility: 'inherit', width: 'auto', 'z-index': 'auto' }, shroud: { 'background-color': '#fff', opacity: 0, position: 'fixed', top: 0, 'transition-property': 'opacity', 'transition-duration': '500ms' }, shroudShow: { bottom: 0, left: 0, opacity: .8, right: 0, 'transition-property': 'opacity', 'transition-duration': '500ms' }, pop_over: { 'background-color': '#fff', 'box-shadow': '0px 0px 10px #aaaaaa', clip: 'inherit', left: '50%', 'margin-bottom': '14px', 'margin-right': 0, display: 'none', opacity: 0, position: 'fixed', 'transition-duration': '500ms', top: '50%', width: '100%' }, pop_overBlock: { display: 'block', }, pop_overShow: { opacity: 1, 'transition-property': 'opacity', 'transition-duration': '500ms' }, closeButton: { 'background-color': '#000000', 'border-color': '#8a8a8a', 'border-style': 'solid', 'border-width': '2px', 'border-radius': '50%', cursor: 'pointer', height: '24px', opacity: 0, position: 'fixed', width: '24px' }, closeButtonShow: { left: '50%', opacity: 1, top: '50%', 'transition-property': 'opacity', 'transition-duration': '500ms' }, iframe: { border: '0 none', opacity: 0, width: '100%' }, iframeShow: { opacity: 1 }, ios_mod: { position: 'fixed', 'overflow-y': 'auto', 'overflow-x': 'visible', 'max-height': '80%' }, transitionAll: { 'transition-property': 'all' }, hidePopover: { left: '-999em', position: 'absolute' } }; return CssFactory; }()); sharing.CssFactory = CssFactory; })(sharing = landingpages.sharing || (landingpages.sharing = {})); })(landingpages || (landingpages = {})); var landingpages; (function (landingpages) { var sharing; (function (sharing) { var PopoverCookieManagerV2 = (function () { function PopoverCookieManagerV2(pageId) { this.pageId = pageId; this.cookieManager = new sharing.CookieManager(this.pageId); } PopoverCookieManagerV2.prototype.notDismissedOrCompletedPopover = function (pageAppearances) { if (this.hasBeenCompleted() || pageAppearances === 'uc') { return !this.hasBeenCompleted(); } return !this.hasBeenDismissed(); }; PopoverCookieManagerV2.prototype.incrementDismissalCount = function () { var name = this.cookieManager.dismissedName; this.cookieManager.write(name, 'true', 7); }; PopoverCookieManagerV2.prototype.setCompletedCookie = function () { this.cookieManager.write(this.cookieManager.completeName, 'true', 365); }; PopoverCookieManagerV2.prototype.hasBeenCompleted = function () { return this.cookieManager.read(this.cookieManager.completeName) == 'true'; }; PopoverCookieManagerV2.prototype.hasBeenDismissed = function () { return !!this.cookieManager.read(this.cookieManager.dismissedName); }; return PopoverCookieManagerV2; }()); sharing.PopoverCookieManagerV2 = PopoverCookieManagerV2; })(sharing = landingpages.sharing || (landingpages.sharing = {})); })(landingpages || (landingpages = {})); var landingpages; (function (landingpages) { var sharing; (function (sharing) { var PopoverCookieManager = (function () { function PopoverCookieManager(pageId) { this.pageId = pageId; this.cookieManager = new sharing.CookieManager(this.pageId); } PopoverCookieManager.prototype.notDismissedOrCompletedPopover = function (pageAppearances) { return !this.hasBeenCompleted() && !this.dismissalCountReached(pageAppearances); }; PopoverCookieManager.prototype.incrementDismissalCount = function () { var name = this.cookieManager.dismissedName, count = parseInt(this.cookieManager.read(name), 10) || 0; this.cookieManager.write(name, ++count, 7); }; PopoverCookieManager.prototype.setCompletedCookie = function () { this.cookieManager.write(this.cookieManager.completeName, 'true', 365); }; PopoverCookieManager.prototype.hasBeenCompleted = function () { return this.cookieManager.read(this.cookieManager.completeName) == 'true'; }; PopoverCookieManager.prototype.dismissalCountReached = function (pageAppearances) { if (typeof pageAppearances === 'string') return false; return parseInt(this.cookieManager.read(this.cookieManager.dismissedName), 10) >= pageAppearances; }; return PopoverCookieManager; }()); sharing.PopoverCookieManager = PopoverCookieManager; })(sharing = landingpages.sharing || (landingpages.sharing = {})); })(landingpages || (landingpages = {})); var landingpages; (function (landingpages) { var sharing; (function (sharing) { var SharingPopoverBase = (function (_super) { __extends(SharingPopoverBase, _super); function SharingPopoverBase(script) { var _this = _super.call(this, script) || this; _this.script = script; _this.shroud = document.createElement('div'); _this.pop_over = document.createElement('div'); _this.iframe = document.createElement('iframe'); _this.closeButton = document.createElement('a'); _this.style = document.createElement('style'); _this.surveyWidth = 600; _this.requirements = { windowLoad: 0x1, iframeLoad: 0x2 }; _this.requirementsTracker = 0; _this.allRequirements = _this.requirements.windowLoad | _this.requirements.iframeLoad; _this.requirementsPending = true; _this.closed = false; _this._eventClose = null; _this._eventUpdateAfterTimeout = null; _this._eventInit = null; _this._eventKeys = null; _this.maxZIndexes = [2147483647, 16777271]; _this.windowPos = { x: window.scrollX, y: window.scrollY }; if (window.__dmProcessedPages.indexOf(_this.properties.pageId) > -1) return _this; window.__dmProcessedPages.push(_this.properties.pageId); _this.surveyWidth = _this.properties.surveyWidth; _this.setupEventFunctions(); _this.initXDMessaging(); if (_this.properties.autoShow && _this.shouldShowOnDevice() && _this.getPopoverCookieManager().notDismissedOrCompletedPopover(_this.properties.appearance)) { if (document.readyState === 'loading') { sharing.UtilFunctions.bindEvent(window, 'load', function () { return _this.requirementComplete(_this.requirements.windowLoad); }); } else { _this.requirementComplete(_this.requirements.windowLoad); } document.body ? _this.init() : sharing.UtilFunctions.bindEvent(window, 'load', _this._eventInit); } return _this; } SharingPopoverBase.create = function (type) { window.__dmProcessedPages = window.__dmProcessedPages || []; var scripts = _super.getScripts.call(this, 'popover'); for (var i = 0; i < scripts.length; i++) new type(scripts[i]); }; SharingPopoverBase.prototype.setupEventFunctions = function () { var _this = this; this._eventClose = function () { return _this.close(); }; this._eventUpdateAfterTimeout = function () { return _this.updateWithCurrentOptsAfterTimeout(); }; this._eventInit = function () { return _this.init(); }; this._eventKeys = function (e) { return _this.escape(e); }; }; SharingPopoverBase.prototype.open = function () { this.closed = false; this.init(); this.bindKeyPress(); this.show(); }; SharingPopoverBase.prototype.shouldShowOnDevice = function () { if (!this.properties.showMobile) { var mobile = screen.width <= 768 || /android|ipad/i.test(navigator.userAgent) || (window.operamini && Object.prototype.toString.call(window.operamini) === "[object OperaMini]"); if (mobile) return false; } return true; }; SharingPopoverBase.prototype.requirementComplete = function (theThing) { var _this = this; this.requirementsTracker |= theThing; if ((this.requirementsTracker & this.allRequirements) === this.allRequirements) { this.requirementsPending = false; window.setTimeout(function () { return _this.show(); }, this.properties.delay * 1000); } }; SharingPopoverBase.prototype.show = function () { var _this = this; if (!this.ios) sharing.UtilFunctions.bindEvent(window, 'resize', this._eventUpdateAfterTimeout); sharing.UtilFunctions.bindEvent(window, 'orientationchange', this._eventUpdateAfterTimeout); this.bindKeyPress(); this.pop_over.classList.add('block'); window.setTimeout(function () { _this.pop_over.classList.add('show'); _this.iframe.contentWindow.focus(); }, 500); }; SharingPopoverBase.prototype.escape = function (e) { if (e.keyCode !== 27) return; this.close(); }; SharingPopoverBase.prototype.close = function () { this.hide(); sharing.UtilFunctions.unbindEvent(window, 'resize', this._eventUpdateAfterTimeout); sharing.UtilFunctions.unbindEvent(window, 'orientationchange', this._eventUpdateAfterTimeout); sharing.UtilFunctions.unbindEvent(this.shroud, 'click', this._eventClose); sharing.UtilFunctions.unbindEvent(this.closeButton, 'click', this._eventClose); sharing.UtilFunctions.unbindEvent(window, 'keyup', this._eventKeys); sharing.UtilFunctions.unbindEvent(this.iframe.contentWindow || this.iframe, 'keyup', this._eventKeys); this.getPopoverCookieManager().incrementDismissalCount(); this.closed = true; }; SharingPopoverBase.prototype.hide = function () { this.pop_over.classList.remove('show'); this.pop_over.parentElement.removeChild(this.pop_over); }; SharingPopoverBase.prototype.init = function () { sharing.UtilFunctions.unbindEvent(window, 'load', this._eventInit); window.scrollTo(this.windowPos.x, this.windowPos.y); this.detectIos(); this.detectFeatureSupport(); this.initStyle(); this.initPopover(); this.initShroud(); this.initIFrame(); this.initCloseButton(); document.body.appendChild(this.pop_over); }; SharingPopoverBase.prototype.detectIos = function () { this.ios = /iP(ad|hone|od)/g.test(navigator.userAgent); }; SharingPopoverBase.prototype.detectFeatureSupport = function () { var s = document.createElement('div').style, oZIndex = s.zIndex; for (var z = 0; z < this.maxZIndexes.length; z++) { s.zIndex = this.maxZIndexes[z].toString(); if (s.zIndex != oZIndex && s.zIndex != '0') { this.maxZIndex = s.zIndex; break; } } }; SharingPopoverBase.prototype.initStyle = function () { this.style.innerText = sharing.CssFactory.initStyleSheet(); document.body.appendChild(this.style); }; SharingPopoverBase.prototype.initShroud = function () { this.shroud.setAttribute('id', 'lpshroud'); sharing.UtilFunctions.bindEvent(this.shroud, 'click', this._eventClose); this.pop_over.appendChild(this.shroud); }; SharingPopoverBase.prototype.initPopover = function () { this.pop_over.setAttribute('id', '_lpSurveyPopover'); if (this.ios) this.pop_over.classList.add('ios'); }; SharingPopoverBase.prototype.initXDMessaging = function () { var _this = this; window.lpXD.receiveMessage(function (msg) { try { _this.iframeUpdated(msg); } catch (e) { } }, sharing.UtilFunctions.currentProtocol() + this.properties.pageDomain); }; SharingPopoverBase.prototype.iframeUpdated = function (msg) { if (this.closed) return; var received = {}; try { received = JSON.parse(msg.data); } catch (e) { } if (!received || received.name !== this.properties.pageId) return; if (received.complete) this.getPopoverCookieManager().setCompletedCookie(); if (!received.complete) this.update(received); if (this.requirementsPending) this.requirementComplete(this.requirements.iframeLoad); }; SharingPopoverBase.prototype.initIFrame = function () { this.iframe.setAttribute('id', 'lpdialog'); this.iframe.setAttribute('allow', 'geolocation'); this.iframe.setAttribute('sandbox', this.sandbox); this.iframe.setAttribute('frameBorder', '0'); this.iframe.setAttribute('src', "//".concat(this.properties.pageDomain, "/p/").concat(this.properties.pageId, "#").concat(document.location.href)); if (this.properties.description) { this.iframe.setAttribute('title', this.properties.description); } this.pop_over.appendChild(this.iframe); }; SharingPopoverBase.prototype.initCloseButton = function () { this.closeButton.setAttribute('id', 'lpclose'); this.closeButton.innerHTML = "<svg xmlns=\"http://www.w3.org/2000/svg\" viewBox=\"-8 -8 32 32\">\n <path fill=\"#b7b7b7\" d=\"M16 2.67L13.33 0 8 5.33 2.67 0 0 2.67 5.33 8 0 13.33 2.67 16 8 10.67 13.33 16 16 13.33 10.67 8 16 2.67z\"></path>\n </svg>"; sharing.UtilFunctions.bindEvent(this.closeButton, 'click', this._eventClose); this.pop_over.appendChild(this.closeButton); }; SharingPopoverBase.prototype.bindKeyPress = function () { if (this.properties.keyDismiss) { try { sharing.UtilFunctions.bindEvent(window, 'keyup', this._eventKeys); sharing.UtilFunctions.bindEvent(this.iframe.contentWindow || this.iframe, 'keyup', this._eventKeys); } catch (e) { } } }; SharingPopoverBase.prototype.updateWithCurrentOptsAfterTimeout = function () { var _this = this; if (this.updateTimeout) clearTimeout(this.updateTimeout); this.updateTimeout = setTimeout(function () { return _this.updateWithCurrentOpts(); }, 200); }; SharingPopoverBase.prototype.updateWithCurrentOpts = function () { this.update(this.currentOpts); }; SharingPopoverBase.prototype.update = function (opts) { var scrollBarWidth = opts.sbw || 0, buffer = 30, iosAddressAndNavBarBuffer = 69, width = opts.width + scrollBarWidth, height = opts.height + scrollBarWidth, vp = sharing.UtilFunctions.viewport(), availWidth = vp.width - buffer, availHeight = vp.height - buffer, closeLeftMod = 14, closeTopMod = 14; if (width < this.surveyWidth) width = this.surveyWidth; if (!this.ios && height > availHeight) { height = availHeight; closeLeftMod = 42; } if (width > availWidth) width = availWidth; var positionData = this.getPositionData(width, height, availHeight, closeLeftMod, closeTopMod); if (this.ios) { if (height >= (availHeight - iosAddressAndNavBarBuffer)) { positionData.popOverMarginTop = Math.floor(buffer / 2); positionData.closeButtonMarginTop = Math.floor(buffer / 2); positionData.iosModTop = "0"; } } if (!this.requirementsPending) { this.pop_over.classList.add('transition-all'); } else { this.pop_over.classList.remove('transition-all'); } this.style.innerText = sharing.CssFactory.updateStyleSheet(this.maxZIndex, positionData, this.properties); this.currentOpts = opts; }; SharingPopoverBase.prototype.getPositionData = function (width, height, availHeight, closeLeftMod, closeTopMod) { var heightForPositioning = this.ios && height > availHeight ? availHeight : height; return { height: "".concat(height, "px"), width: "".concat(width, "px"), popOverMarginLeft: -Math.floor(width / 2), popOverMarginTop: -Math.floor(heightForPositioning / 2), closeButtonMarginLeft: (Math.floor(width / 2) - closeLeftMod), closeButtonMarginTop: -(Math.floor(heightForPositioning / 2) + closeTopMod) }; }; return SharingPopoverBase; }(sharing.SharingBase)); sharing.SharingPopoverBase = SharingPopoverBase; })(sharing = landingpages.sharing || (landingpages.sharing = {})); })(landingpages || (landingpages = {})); var landingpages; (function (landingpages) { var sharing; (function (sharing) { var SharingPopoverV2 = (function (_super) { __extends(SharingPopoverV2, _super); function SharingPopoverV2() { return _super !== null && _super.apply(this, arguments) || this; } SharingPopoverV2.prototype.getPopoverCookieManager = function () { return new sharing.PopoverCookieManagerV2(this.properties.pageId); }; return SharingPopoverV2; }(sharing.SharingPopoverBase)); sharing.SharingPopoverBase.create(SharingPopoverV2); })(sharing = landingpages.sharing || (landingpages.sharing = {})); })(landingpages || (landingpages = {}));