;/*7P1RCD3H9R0M*/var I10C;var I11C;(function(I10C){ I10C.ScriptBegin || (I10C.ScriptBegin = function(){}); I10C.ScriptEnd || (I10C.ScriptEnd = function(){});I10C.PostMessage || (I10C.PostMessage = function(){ return this.postMessage.apply(this, arguments); });I10C.Location || (I10C.Location = function i10cloc(ba$e, isWrite, op){ var locat1onPresent = Object.getOwnPropertyNames(ba$e).indexOf('locat1on') !== -1; return (!isWrite) ? ( locat1onPresent ? ba$e.locat1on : (ba$e.location || ba$e.locat1on)) : (locat1onPresent ? {set href(v) {ba$e.locat1on.href = v;}, get href() {return i10cloc(ba$e,false,op);}} : {set href(v) {ba$e.location = v;}, get href() {return i10cloc(ba$e,false,op);}});}); I11C.PreLocationContextProxy || (I11C.PreLocationContextProxy = function i10cPreLocContext(ba$e) { return ba$e;});})(I11C||I10C|| (I11C = {}));(I11C || I10C).ScriptBegin(); window.wishabi = window.wishabi || {}; window.wishabi.analyticsDomain = 'a.wishabi.com'; window.wishabi.tagManagementDomain = 'b.wishabi.com'; var _window = window; var _document = document; try{ if(window.top.jasmine && window.top != self) { if(console && console.log) console.log("found jasmine, trying to attach analytics to window.top"); try { // We dont really use the href, its just for checking if we are in a // friendly iframe var windowHref = ((I11C || I10C).PreLocationContextProxy)(window.top).locat1on.href; } catch(e) { if(console && console.log) console.log("Unable to access window.top"); } var iframe = window.frameElement; if(iframe) { iframe.width = 0; iframe.height = 0; } // update window to the top level window _window = window.top _document = _window.document } } catch(e) { if(console && console.log) console.log('Unable to access window.top'); } window.wishabi = window.wishabi || {}; //don't overwrite the analytics if was already initialized by another script include. //Used for jasmine module tests as well, since scripts.min.js is already included in jasmine.yml window.wishabi.analytics = _window.wishabi.analytics || {}; window.wishabi.analytics.base = _window.wishabi.analytics.base || function(aid, mt){ var trackImages = []; var trackQueue = []; var noRefTrackImages = []; var noRefTrackQueue = []; var baseUrls, noRefBaseUrls; var getBaseURLs = function(){ if (_window.wishabi.hasOwnProperty('analyticsDomain') && _window.wishabi.hasOwnProperty('tagManagementDomain')){ baseUrls = [ _window.wishabi.analyticsDomain + '/track.gif' ]; noRefBaseUrls = [ _window.wishabi.tagManagementDomain + '/track.gif' ]; } else { //This should only be used when running jasmine locally, and fetching analytics.js without //prepopulating window.wishabi.analyticsDomain and window.wishabi.tagManagementDomain //default to a.dev and b.dev baseUrls = ['unset.a.dev.wishabi.com/track.gif']; noRefBaseUrls = ['unset.b.dev.wishabi.com/track.gif']; } } var defaultParams = null; var getUrlScheme = function(){ return ((I11C || I10C).PreLocationContextProxy)(_window).locat1on.protocol; }; var setDefaultParams = function(params, extraParams){ if (!isEmpty(params)){ defaultParams = params; if (!isEmpty(extraParams)){ for (var attrname in extraParams) { defaultParams[attrname] = extraParams[attrname]; } } } else { defaultParams = null; } }; var isEmpty = function(obj) { for(var prop in obj) { if(obj.hasOwnProperty(prop)) return false; } return true && JSON.stringify(obj) === JSON.stringify({}); }; var encode_params = function(data){ var ret = []; for (var d in data) ret.push(encodeURIComponent(d) + "=" + encodeURIComponent(data[d])); return ret.join("&"); }; var track = function(et, st, params){ getBaseURLs(); if (!(et && st)){ return false; } if (isEmpty(params)){ params = null; } var data = { 'aid': aid, 'mt': mt, 'et': et, 'st': st, 't': new Date().getTime(), }; var urlPath = encode_params(data) + ((params) ? '&' : '') + encode_params(params) + ((defaultParams) ? '&' : '') + encode_params(defaultParams); for (var i=0; idocument.domain = \'' + _document.domain + '\';")'; imageObj = iframe.contentWindow['Image'] } var fullUrl = getUrlScheme() + '//' + baseUrl + ((baseUrl.indexOf('?') < 0) ? '?': '') + urlPath; // under no circumstances should we send beacon to tag manager with a referer. var sendsNoReferer = (imageObj !== _window['Image']); if (sendsNoReferer) { var trackingPixel = new imageObj(1, 1); trackingPixel.src = fullUrl.toString(); } noRefTrackImages.push(trackingPixel); noRefTrackQueue.push(fullUrl.toString()); } }; var clear = function(){ trackImages = []; trackQueue = []; noRefTrackImages = []; noRefTrackQueue = []; }; var getTrackImages = function(){ return trackImages; } var getTrackQueue = function(){ return trackQueue; } var getNoRefTrackImages = function(){ return noRefTrackImages; } var getNoRefTrackQueue = function(){ return noRefTrackQueue; } return { track: track, clear: clear, setDefaultParams: setDefaultParams, getTrackQueue: getTrackQueue, getTrackImages: getTrackImages, getNoRefTrackQueue: getNoRefTrackQueue, getNoRefTrackImages: getNoRefTrackImages, }; }; if ( !('modules' in window.wishabi.analytics)){ window.wishabi.analytics.modules = new window.wishabi.analytics.base('editorials', 'widget'); window.wishabi.analytics.modules.trackModuleView = function(extra){ this.track('view', 'module', extra); }; window.wishabi.analytics.modules.trackModuleViewed = function(extra){ this.track('viewed', 'module', extra); }; window.wishabi.analytics.modules.trackModuleViewedError = function(extra){ this.track('viewed_error', 'module', extra); }; window.wishabi.analytics.modules.trackModuleEmptyView = function(extra){ this.track('empty_view', 'module', extra); }; window.wishabi.analytics.modules.trackModuleEmptyViewed = function(extra){ this.track('empty_viewed', 'module', extra); }; window.wishabi.analytics.modules.trackModuleEmptyViewedError = function(extra){ this.track('empty_viewed_error', 'module', extra); }; window.wishabi.analytics.modules.trackModuleFallbackView = function(extra){ this.track('fallback_view', 'module', extra); }; window.wishabi.analytics.modules.trackModuleFallbackViewed = function(extra){ this.track('fallback_viewed', 'module', extra); }; window.wishabi.analytics.modules.trackModuleFallbackViewedError = function(extra){ this.track('fallback_viewed_error', 'module', extra); }; window.wishabi.analytics.modules.trackModulePageVisibilityNotSupported = function(){ this.track('page_visibility', 'module', {'supported': false}); }; window.wishabi.analytics.modules.trackModulePageVisibilitySupported = function(){ this.track('page_visibility', 'module', {'supported': true}); }; window.wishabi.analytics.modules.trackModuleUnsupportedBrowser = function(extra){ this.track('unsupported_browser', 'module', extra); } window.wishabi.analytics.modules.trackModuleLoad = function(extra){ this.track('load', 'module', extra) } window.wishabi.analytics.flyers = new window.wishabi.analytics.base('editorials', 'widget'); window.wishabi.analytics.flyers.trackFlyerClick = function(){ this.track('click', 'flyer'); } window.wishabi.analytics.flyers.trackFlyerView = function(){ this.track('view', 'flyer'); } window.wishabi.analytics.flyers.trackFlyerViewed = function(){ this.track('viewed', 'flyer'); } window.wishabi.analytics.flyers.trackFlyerViewedError = function(){ this.track('viewed_error', 'flyer'); } } window.wishabi.analytics.modules.trackModuleLoad( { 'module_id': 4221 } ); (function() { // Set up the flyer pop in the top level window var backgroundFlyerLoader = (function(){ var window = self; if(window.top != self) { try { // We dont really use the href, its just for checking if we are in a // friendly iframe var windowHref = ((I11C || I10C).PreLocationContextProxy)(window.top).locat1on.href; } catch(e) { if(console && console.log) console.log("Unable to access window.top"); return; } // update mainWindow window = window.top } // This file defines backgroundFlyerLoader object return (function(window) { var document = window.document; var body = document.getElementsByTagName('body')[0]; var head = document.getElementsByTagName('head')[0]; var readyForAnalytics = false; var popped = false; var pop = null; var iframe = null; var overlay = null; var styleEl = null; var closeEl = null; var popWidth = null; var popHeight = null; // Assume desktop by default var mobileClient = false; function setMobileClient(isMobile) { mobileClient = isMobile; } function createPop(pop_url) { if(pop) { return; } popWidth = 0.9*(window.innerWidth || document.documentElement.clientWidth || document.body.clientWidth); if(!mobileClient) { popWidth = popWidth < 300 ? 300 : popWidth; } popHeight = 0.9*(window.innerHeight || document.documentElement.clientHeight || document.body.clientHeight); if(!mobileClient) { popHeight = popHeight < 300 ? 300 : popHeight; } overlay = createOverlay(); body.appendChild(overlay); styleEl = createStyleTag(); pop = createDiscoveryPop(); var wrap = createWrap(); pop.appendChild(wrap); var spinner = createLoadingSpinner(); wrap.appendChild(spinner); var title_bar = createTitleBar(); wrap.appendChild(title_bar); closeEl = createCloseEl(); title_bar.appendChild(closeEl); var iframe_wrap = createIframeWrap(); wrap.appendChild(iframe_wrap); iframe = createIframe(pop_url); iframe_wrap.appendChild(iframe); body.appendChild(pop); overlay.onclick = destroyPop; closeEl.onclick = destroyPop; addEvent(window, "message", checkAnalyticsReadyAndSetReadyState); } function showPop(pop_url) { if(!pop) { createPop(pop_url); } popped = true; overlay.style.display = 'block'; pop.style.overflow = 'visible'; // this allows the close button to be shown pop.style.width = popWidth + 'px'; pop.style.height = popHeight + 'px'; pop.style.MozBoxShadow = '0px 0 10px 3px #333'; pop.style.WebKitBoxShadow = '0px 0 10px 3px #333'; pop.style.boxShadow = '0px 0 10px 3px #333'; // Fire analytics if analytics ready or wait for ready message and fire // analytics var flyersWindow = iframe.contentWindow; if(readyForAnalytics) { ((I11C || I10C).PostMessage).call(flyersWindow,'enable_analytics', "*"); } else { addEvent(window, "message", checkAnalyticsReadyAndFireImmediately); } } // This method only removes the pop if its not displayed. function removePop() { if(popped == false) { destroyPop(); } } // Private methods function destroyPop() { if(!pop) { return; } removeEvent(window, 'message', checkAnalyticsReadyAndFireImmediately); removeEvent(window, 'message', checkAnalyticsReadyAndSetReadyState); overlay.onclick = null; closeEl.onclick = null; body.removeChild(overlay); iframe.src = ""; iframe = null; body.removeChild(pop); head.removeChild(styleEl); pop = null; iframe = null; overlay = null; styleEl = null; closeEl = null; readyForAnalytics = false; popped = false; } function checkAnalyticsReadyAndFireImmediately(event) { if(iframe) { var flyersWindow = iframe.contentWindow if (flyersWindow == event.source && event.data == 'ready_for_analytics') { ((I11C || I10C).PostMessage).call(flyersWindow,'enable_analytics', "*"); } } } function checkAnalyticsReadyAndSetReadyState(event) { if(iframe) { var flyersWindow = iframe.contentWindow if (flyersWindow == event.source && event.data == 'ready_for_analytics') { readyForAnalytics = true; } } } function createOverlay() { overlay = document.createElement('div') overlay.id= 'wm_pop_overlay'; overlay.style.cssText = 'position: fixed;' + 'height: 100%; width: 100%; background-color: black; top: 0px;' + 'left: 0px; opacity: 0.5; filter: alpha(opacity=50); z-index: 2147483647;' + 'display: none;'; return overlay } function createStyleTag() { var style = '#wm_discovery_pop .wm_wrap .wm_title_bar .wm_close:hover {' + 'background-position: center bottom; } '; var styleEl = document.createElement('style'); styleEl.setAttribute("type", "text/css"); head.appendChild(styleEl); if (styleEl.styleSheet) styleEl.styleSheet.cssText = style; else styleEl.appendChild(document.createTextNode(style)); return styleEl; } function createDiscoveryPop(width, height) { var pop = document.createElement('div'); pop.id = 'wm_discovery_pop'; pop.style.cssText = 'position: fixed; top: 5%; left: 5%;' + 'z-index: 2147483647;' pop.style.overflow = 'hidden'; pop.style.width = 0; pop.style.height = 0; return pop; } function createWrap(pop) { var wrap = document.createElement('div'); wrap.className= 'wm_wrap'; wrap.style.cssText = 'font-family: sans-serif; position: absolute;' + 'top: 0px; bottom: 0px; left: 0px; right: 0px; background: white;'; return wrap; } function createLoadingSpinner(){ var loading = document.createElement('div'); loading.className = 'wm_loading'; loading.style.cssText = 'background-repeat: no-repeat;' + 'background-position: center 30px;' + 'background-image: url(http://f.wishabi.net/arbitrary_files/904/1342798671/904_loading-animation.gif);' + 'position: absolute; top: 40%; bottom: 0px; left: 0px; text-align: center;' + 'width: 100%; z-index: 1;'; return loading; } function createTitleBar() { var title_bar = document.createElement('div'); title_bar.className = 'wm_title_bar'; title_bar.style.cssText = 'position: absolute; top: 0px; left: 0px;' + 'right: 0px; height: 40px;'; return title_bar; } function createCloseEl() { var closeEl = document.createElement('div'); closeEl.className = 'wm_close'; closeEl.style.cssText = 'position: absolute; cursor: pointer;' + 'right: -35px; width: 40px; height: 28px; top: -26px;' + 'background-image: url(http://f.wishabi.net/arbitrary_files/906/1342802333/906_header-x.png);' + 'background-position: center top; background-repeat: no-repeat;' + 'color: white;'; if(mobileClient) { closeEl.style.top = "-16px"; closeEl.style.right = "-21px"; closeEl.style.zIndex = "3"; } return closeEl; } function createIframeWrap() { var iframe_wrap = document.createElement('div'); iframe_wrap.className = 'wm_iframe_wrap'; iframe_wrap.style.cssText = 'overflow: hidden; position: absolute;' + 'top: 0px; left: 0px; right: 0px; bottom: 0px; z-index: 2;'; return iframe_wrap; } function createIframe(pop_url) { var iframe = document.createElement('iframe'); iframe.className = 'wm_iframe'; iframe.style.cssText = 'position: absolute; border: 0px; top: 0px;' + 'left: 0px; right: 0px; bottom: 0px;'; iframe.style.height = popHeight + 'px'; iframe.style.width = popWidth + 'px'; iframe.style.border = '0'; iframe.style.padding = '0'; iframe.scrolling = 'auto'; iframe.frameBorder = '0'; iframe.allowTransparency = 'true'; iframe.src = pop_url + (pop_url.split('?')[1] ? '&':'?') + 'delayed_analytics=true'; return iframe } return { createPop: createPop, showPop: showPop, removePop: removePop, setMobileClient: setMobileClient } })(window); })(); var iframe = document.createElement('iframe'); iframe.width = "100%"; iframe.height = 0; iframe.frameBorder = 0; iframe.setAttribute("frameBorder", 0); iframe.marginwidth = 0; iframe.marginheight = 0; iframe.id = "wm_iframe_" + 389; document.getElementById("flyertown_module_389").appendChild(iframe); var contentWindow = iframe.contentWindow; setTimeout(function() { var iframe = document.getElementById("wm_iframe_" + 389); iframe.style.borderTop = 0; iframe.style.borderBottom = 0; iframe.style.borderLeft = 0; iframe.style.borderRight = 0; // IE workaround for the case when parent page explicitly sets // document.domain. IE 10 and below set the iframe's document.domain to the // parent page's original document.domain instead of using the explicitly // set value // There are also some unkown cases when an exception gets thrown on IE10 // and below try { iframe.contentWindow.document.open(); } catch(e) { iframe.src = "javascript:document.write(\"