'+ message.replace(/%icon(?:\[([^\]]+)\])?/gi,function(matches,group1){return'
';this.viewport=document.createElement('div');this.viewport.className='ath-viewport';if(this.options.modal){this.viewport.className+=' ath-modal';} if(this.options.mandatory){this.viewport.className+=' ath-mandatory';} this.viewport.style.position='absolute';this.element=document.createElement('div');this.element.className='ath-container ath-'+ ath.OS+' ath-'+ ath.OS+(parseInt(ath.OSVersion)||'')+' ath-'+(ath.isTablet?'tablet':'phone');this.element.style.cssText='-webkit-transition-property:-webkit-transform,opacity;-webkit-transition-duration:0s;-webkit-transition-timing-function:ease-out;transition-property:transform,opacity;transition-duration:0s;transition-timing-function:ease-out;';this.element.style.webkitTransform='translate3d(0,-'+ window.innerHeight+'px,0)';this.element.style.transform='translate3d(0,-'+ window.innerHeight+'px,0)';if(this.options.icon&&this.applicationIcon){this.element.className+=' ath-icon';this.img=document.createElement('img');this.img.className='ath-application-icon';this.img.addEventListener('load',this,false);this.img.addEventListener('error',this,false);this.img.src=this.applicationIcon.href;this.element.appendChild(this.img);} this.element.innerHTML+=message;this.viewport.style.left='-99999em';this.viewport.appendChild(this.element);this.container.appendChild(this.viewport);if(this.img){this.doLog("Add to homescreen: not displaying callout because waiting for img to load");}else{this._delayedShow();}},_delayedShow:function(e){setTimeout(this._show.bind(this),this.options.startDelay*1000+ 500);},_show:function(){var that=this;this.updateViewport();window.addEventListener('resize',this,false);window.addEventListener('scroll',this,false);window.addEventListener('orientationchange',this,false);if(this.options.modal){document.addEventListener('touchmove',this,true);} if(!this.options.mandatory){setTimeout(function(){that.element.addEventListener('click',that,true);},1000);} setTimeout(function(){that.element.style.webkitTransitionDuration='1.2s';that.element.style.transitionDuration='1.2s';that.element.style.webkitTransform='translate3d(0,0,0)';that.element.style.transform='translate3d(0,0,0)';},0);if(this.options.lifespan){this.removeTimer=setTimeout(this.remove.bind(this),this.options.lifespan*1000);} if(this.options.onShow){this.options.onShow.call(this);}},remove:function(){clearTimeout(this.removeTimer);if(this.img){this.img.removeEventListener('load',this,false);this.img.removeEventListener('error',this,false);} window.removeEventListener('resize',this,false);window.removeEventListener('scroll',this,false);window.removeEventListener('orientationchange',this,false);document.removeEventListener('touchmove',this,true);this.element.removeEventListener('click',this,true);this.element.addEventListener('transitionend',this,false);this.element.addEventListener('webkitTransitionEnd',this,false);this.element.addEventListener('MSTransitionEnd',this,false);this.element.style.webkitTransitionDuration='0.3s';this.element.style.opacity='0';},_removeElements:function(){this.element.removeEventListener('transitionend',this,false);this.element.removeEventListener('webkitTransitionEnd',this,false);this.element.removeEventListener('MSTransitionEnd',this,false);this.container.removeChild(this.viewport);this.shown=false;if(this.options.onRemove){this.options.onRemove.call(this);}},updateViewport:function(){if(!this.shown){return;} this.viewport.style.width=window.innerWidth+'px';this.viewport.style.height=window.innerHeight+'px';this.viewport.style.left=window.scrollX+'px';this.viewport.style.top=window.scrollY+'px';var clientWidth=document.documentElement.clientWidth;this.orientation=clientWidth>document.documentElement.clientHeight?'landscape':'portrait';var screenWidth=ath.OS=='ios'?this.orientation=='portrait'?screen.width:screen.height:screen.width;this.scale=screen.width>clientWidth?1:screenWidth/window.innerWidth;this.element.style.fontSize=this.options.fontSize/this.scale+'px';},resize:function(){clearTimeout(this.resizeTimer);this.resizeTimer=setTimeout(this.updateViewport.bind(this),100);},updateSession:function(){if(ath.hasLocalStorage===false){return;} if(localStorage){localStorage.setItem(this.options.appID,JSON.stringify(this.session));}},clearSession:function(){this.session=_defaultSession;this.updateSession();},getItem:function(item){try{if(!localStorage){throw new Error('localStorage is not defined');} return localStorage.getItem(item);}catch(e){ath.hasLocalStorage=false;}},optOut:function(){this.session.optedout=true;this.updateSession();},optIn:function(){this.session.optedout=false;this.updateSession();},clearDisplayCount:function(){this.session.displayCount=0;this.updateSession();},_preventDefault:function(e){e.preventDefault();e.stopPropagation();}};function _extend(target,obj){for(var i in obj){target[i]=obj[i];} return target;} function _removeToken(){if(document.location.hash=='#ath'){history.replaceState('',window.document.title,document.location.href.split('#')[0]);} if(_reSmartURL.test(document.location.href)){history.replaceState('',window.document.title,document.location.href.replace(_reSmartURL,'$1'));} if(_reQueryString.test(document.location.search)){history.replaceState('',window.document.title,document.location.href.replace(_reQueryString,'$2'));}} window.addToHomescreen=ath;})(window,document); ';})+'