if(!document.getElementById('MEOVGO_CSS_STYLE')){ var head=document.getElementsByTagName('head')[0]; var link=document.createElement('link'); link.id='MEOVGO_CSS_STYLE'; link.rel='stylesheet'; link.type='text/css'; link.href='//dd3gy7mtoah62.cloudfront.net/portal/public/img/mail/video5/video5modalv5.css?v=1518203111'; link.media='all'; head.appendChild(link) } function MEOVGoPopup(vin){ var MEOVGoPopupId="MEOVGoPopup_"+vin; var h=380; var w=680; var ratio = w / h; var t=!1; var f=!1; var isMobile = false; try{ w=screen.availWidth; h=screen.availHeight; console.log(orientation) t=!0; f=!0; isMobile = w < 500; }catch(err){ console.log(err); } //console.log("w: " + w + ", h: " + h); if (isMobile) { t=!0; f=!0; w = parseInt(w * 0.85); h = parseInt(w / ratio); } else { if(w<=320){ w=300*1.5; h=170*2; t=!0; f=!0 }else if(w>=320&&w<=375){ w=360*1.5; h=203*2.5; t=!0; f=!0; }else if(w>375&&w<=414){ w=400*1.5; h=203*2.5; t=!0; }else if(w>414&&w<=768){ h=280*2; w=500*1.5; t=!0; }else{ h=380; w=680; } } //console.log("w: " + w + ", h: " + h); var centerLeft=(t)?0:parseInt((window.screen.availWidth-w)/2); var centerTop=(t)?0:parseInt(((window.screen.availHeight-h)/2)); var popupURl="https://dashboard.autosonvideo.com/video5video.go?did=1041884&vin="+vin+"&t=1&height="+h+"&width="+w+"&modal=true&full="+f; var elm = document.getElementById("MEOVGO_" + vin); //alert(elm); elm.innerHTML += '
×
'; let header = document.getElementById('header'); if (!header) { let elems = document.getElementsByTagName('header'); if (elems && elems.length > 0) { header = elems[0]; } } if (header) { header.style['z-index']=0; } return!1; } function MEOVGoClose(id){ var elem=document.getElementById(id); return elem.parentNode.removeChild(elem); } function MEOVGoVideo(vin,width){ width=typeof width!=='undefined'?width:200; if(typeof(vin)!=undefined&&vin!=null&&vin.length>1){ var $vElm=document.getElementById('MEOVGO_'+vin); if($vElm!==null&&$vElm!==undefined){ if(1041884>0){ $vElm.addEventListener('eventName',MEOVGoCheck($vElm,vin,width),!0) }else{ $vElm.innerHTML='Video Go'; } } } } var initialDate = new Date(); var hasFrame = false; function MEOVGoCheck($vElm,vin,width){ try{ function checkFrame() { // meov-video-frame let frames = Array.from(document.getElementsByClassName('meov-video-frame')); if (frames) { hasFrame = true; console.log('MEOV HAS FRAME ON SCREEN'); // meov_container let videosButtons = Array.from(document.getElementsByClassName('meov_container')); if (videosButtons) { console.log('MEOV HAS VIDEO BUTTON ON SCREEN'); videosButtons.forEach( function (item) { if (item.innerHTML && item.innerHTML.length > 0) { console.log('MEOV REMOVING ADDITIONAL BUTTON'); item.innerHTML = ''; } } ); } } } var request=new XMLHttpRequest(); request.open('GET',"https://1ayw5382i2.execute-api.us-west-2.amazonaws.com/prod/video5check?did=1041884&vin="+vin+"",!0); request.send(null);request.onload=function(e){ if(request.status===200){ checkFrame(); setTimeout(function(){ if (hasFrame) return; var json=JSON.parse(request.responseText); var count=parseInt(json.Count); if(count>0){ var meovgoButton = 'https://dd3gy7mtoah62.cloudfront.net/portal/public/img/mail/video5/video5_btn2.png'; if(1041884==='1041883' || 1041884===1041883){ meovgoButton = meovgoButton.replace(/video5_.*.png/gm, 'video5_btn12.png') } $vElm.innerHTML='Video Go'; checkFrame(); } },10); } } let now = new Date(); if (!initialDate) { initialDate = now; } let diff = Math.abs(now.getTime() - initialDate.getTime()); let seconds = ((diff / 1000)); if (seconds < 15) { setTimeout(() => { checkFrame(); }, 1000); } else { console.log('MEOV SCRIPT DONE') } }catch(err){ console.log(err) } }