/** * InRead Async * v. 1.7 * {664355} */ if (typeof adagioInReadCounter === "undefined") var adagioInReadCounter = 0; var adAgioInRead = '', ph = document.getElementById(arINRead[adagioInReadCounter]), phName = arINRead[adagioInReadCounter].replace(/-/gi,"_"), adAgioVideoSrc = '619/91_9619_2_1_SICUREZZA_PRODOTTI_PREROLL_30__1_.mp4', adAgioContainerHeight = 'auto', adAgioVolumeOn_img = '', adAgioVolumeOff_img = '', adAgioPoster_img = '', clickUrl = "//adagiofe.neodatagroup.com/ad/clk.jsp?x=484293.664355.1063.463199.-1.-1.18.91.1.10066.1.-1.-1.-1..-1.0...&link="; var getMobileOperatingSystem = function(){ var userAgent = navigator.userAgent || navigator.vendor || window.opera; if(/windows phone/i.test(userAgent)){ return "w_phone"; } if(/android/i.test(userAgent)){ return "Android"; } if(/iPhone|iPod/.test(userAgent) && !window.MSStream){ return "iOS_phone"; } if(/iPad/.test(userAgent) && !window.MSStream){ return "iOS_tab"; } return "unkown"; }; detected_os = getMobileOperatingSystem(); adAgioVolumeOn_img = (adAgioVolumeOn_img != "") ? adAgioVolumeOn_img : "//ac.neodatagroup.com/img_uploads/766/91_526766_1_audio_on.png"; adAgioVolumeOff_img = (adAgioVolumeOff_img != "") ? adAgioVolumeOff_img : "//ac.neodatagroup.com/img_uploads/766/91_526766_1_audio_off.png"; adAgioPoster_img = (adAgioPoster_img != "") ? adAgioPoster_img : "//ac.neodatagroup.com/img_uploads/766/91_526766_1_poster_mobile.png"; var adAgioVideo664355_1671570248509 = function(adAgioVideoSrc,ph){ var adVideo = document.createElement("video"), adText = document.createTextNode("Your Browser doesn't support video tag"), adSource = document.createElement("source"); adSource.src = "https://ad.neodatagroup.com/adagiovideo/"+ adAgioVideoSrc; adSource.type = "video/mp4"; adVideo.id = "adAgioVideo_"+ph; adVideo.setAttribute("preload","auto"); adVideo.appendChild(adSource); adVideo.appendChild(adText); adVideo.setAttribute("style","width:100%;cursor:pointer;"); return adVideo; }; var adAgioText664355_1671570248509 = function(ph){ var adString = document.createElement("p"); adString.insertAdjacentHTML("afterbegin", "PUBBLICITA'"); adString.id = "adAgioText_"+ph; adString.setAttribute("style","height:5px;text-align:center;color:grey;font-weight:bold"); return adString; }; var adAgioProgress664355_1671570248509 = function(ph,device){ var adProgress = document.createElement("progress"); adProgress.id = "adProgress_"+ph; adProgress.value = "0"; adProgress.max = "100"; if (device === "iOS_tab") adProgress.setAttribute('style','position:relative;background-color:#f3f3f3;border:0;height:4px;width:100%;border-radius:9px;top:-22px'); else adProgress.setAttribute('style','position:relative;background-color:#f3f3f3;border:0;height:4px;width:100%;border-radius:9px;top:-56px'); return adProgress; }; var adAgioControls664355_1671570248509 = function(adAgioVolumeOn_img, adAgioVolumeOff_img, ph){ var adControls = document.createElement("div"),adVolumeOn = document.createElement("div"), adVolumeOff = document.createElement("div"), volumeOn = document.createElement("img"), volumeOff = document.createElement("img"), buttonStyle = "width:34px;height:34px;position:absolute;right:4px;border: 0px solid !important;"; volumeOn.src = adAgioVolumeOn_img; volumeOn.alt = "audio_on"; volumeOff.src = adAgioVolumeOff_img; volumeOff.alt = "audio_off"; adVolumeOn.appendChild(volumeOn); adVolumeOff.appendChild(volumeOff); adControls.id = "adAgioControls_"+ph; adControls.setAttribute("style","width:34px;height:34px;cursor:pointer;float:right;position:relative;top:-43px;z-index:50"); volumeOn.setAttribute("style",buttonStyle); adVolumeOn.id = "adAgioVolumeOn_"+ph; volumeOff.setAttribute("style",buttonStyle); adVolumeOff.id = "adAgioVolumeOff_"+ph; adControls.appendChild(adVolumeOn); adControls.appendChild(adVolumeOff); return adControls; }; var adAgioControlsPlay664355_1671570248509 = function(ph){ var playButton = ""; var playButtonWidth = "50"; var playButtonHeight = "50"; var url = '//ac.neodatagroup.com/img_uploads/974/1012_538974_1_1012_538957_2_replay_512.png'; if(playButton!=""){ url = playButton; } adControlsPlay = document.createElement("div"),playIconAnchor = document.createElement('a'),playIconImg=document.createElement('img'); playIconAnchor.href = 'javascript:void(0)'; playIconAnchor.id = 'adagioVideo_playAnchor_'+ph; playIconImg.src = url; playIconImg.id = 'adagioVideo_playButton_'+ph; playIconImg.setAttribute("style","width:"+playButtonWidth+"px;height:"+playButtonHeight+"px;position:relative;"); playIconAnchor.appendChild(playIconImg); adControlsPlay.id = "adAgioControlsPlay_"+ph; adControlsPlay.setAttribute("style","width:100%;height:auto;cursor:pointer;position:relative;z-index:50;margin:0 auto;text-align:center;margin-top:-"+playButtonHeight+"px;"); adControlsPlay.appendChild(playIconAnchor); return adControlsPlay; }; eval("var adExec_"+phName+" = false;"); var adagio_isOnViewport = function(el, x, y){ //x = 1 & y = 1 => returns true if element is entirely within the viewport //x = 0.5 & y = 0.5 => returns true if element is at least 50% within the viewport if(x == null || typeof x == 'undefined') x = 0.5; if(y == null || typeof y == 'undefined') y = 0.5; if(!el.offsetWidth || !el.offsetHeight){ return false; } var offset = function(obj) { var curLeft = 0, curTop = 0; if (obj.offsetParent) do { curLeft += obj.offsetLeft; curTop += obj.offsetTop; } while (obj = obj.offsetParent); return { left: curLeft, top: curTop }; }; var elOffset = offset(el); /* var offset = function (elm) { var rawDom = elm; var _x = 0; var _y = 0; var body = document.documentElement || document.body; var scrollX = window.pageXOffset || body.scrollLeft; var scrollY = window.pageYOffset || body.scrollTop; _x = rawDom.getBoundingClientRect().left + scrollX; _y = rawDom.getBoundingClientRect().top + scrollY; return { left: _x, top: _y }; }; */ var viewport = { top: window.pageYOffset, bottom: window.pageYOffset + window.innerHeight, left: window.pageXOffset, right: window.pageXOffset + window.innerWidth }; var bounds = { top: elOffset.top, bottom: elOffset.top + el.offsetHeight, left: elOffset.left, right: elOffset.left + el.offsetWidth }; var visible = (!(viewport.right < bounds.left || viewport.left > bounds.right || viewport.bottom < bounds.top || viewport.top > bounds.bottom)); if(!visible){ return false; } //Check parentElement offset var offsetHeight = (el.parentElement) ? Math.min(el.parentElement.offsetHeight, el.offsetHeight) : el.offsetHeight, offsetWidth = (el.parentElement) ? Math.min(el.parentElement.offsetWidth, el.offsetWidth) : el.offsetWidth; var deltas = { top : Math.min( 1, ( bounds.bottom - viewport.top ) / offsetHeight), bottom : Math.min(1, ( viewport.bottom - bounds.top ) / offsetHeight), left : Math.min(1, ( bounds.right - viewport.left ) / offsetWidth), right : Math.min(1, ( viewport.right - bounds.left ) / offsetWidth) }; var deltaVisible = (deltas.left * deltas.right) >= x && (deltas.top * deltas.bottom) >= y; return deltaVisible; }; var adAgioForcePlayOnIPAD = function(phName){ var adAgioIpadPlayer = document.getElementById("adAgioVideo_"+phName); adAgioIpadPlayer.play(); }; var checkFocus664355_1671570248509 = function(phName,ph,adAgioContainerHeight) { if (eval("adExec_"+phName)) return; var adContainer = document.getElementById("adAgioVideo_"+phName), adParentContainer = adContainer.parentNode, rect = adContainer.parentNode.getBoundingClientRect(), parentN = adContainer.parentNode.getBoundingClientRect(), area = Math.round(rect.top + Math.round(parentN.width * 9/16/2)); var max_condition = (detected_os !== "iOS_phone") ? ((window.innerHeight || document.documentElement.clientHeight || document.body.clientHeight)) : (Math.max(window.innerHeight, document.documentElement.clientHeight,document.body.clientHeight)); var condition = (window.innerHeight || document.documentElement.clientHeight || document.body.clientHeight); if (adagio_isOnViewport(adContainer)){ eval("adExec_" + phName + "=true;"); adParentContainer.insertBefore(adAgioText664355_1671570248509(phName), adContainer); adContainer.style.height = adAgioContainerHeight; ph.style.height = "auto"; adParentContainer.appendChild(adAgioProgress664355_1671570248509(phName,detected_os)); var adVolOff = document.getElementById('adAgioVolumeOff_'+phName); var adVolOn = document.getElementById('adAgioVolumeOn_'+phName); var adControls = document.getElementById('adAgioControls_'+phName); var adControlsPlay = ""; if( detected_os === "iOS_tab" || detected_os === "iOS_phone" || detected_os === "w_phone"){ adControlsPlay = document.getElementById('adAgioControlsPlay_'+phName); } if(detected_os === "unkown"){ //adVolOff.style.display = "none"; //adVolOn.style.display = "block"; adContainer.muted = true; } else if(detected_os === "iOS_tab") { adContainer.muted = false; adVolOn.setAttribute("style","display:none !important"); adVolOff.setAttribute("style","display:none !important"); adControls.setAttribute("style","display:none !important"); } else{ adContainer.muted = true; adVolOn.style.display = "none"; adVolOff.style.display = "block";} if( detected_os === "w_phone"){ if (adAgioPoster_img != "") adContainer.setAttribute("poster",adAgioPoster_img); adContainer.setAttribute("muted","false"); adContainer.muted = false; adVolOn.style.display = "block"; adVolOff.style.display = "none"; adContainer.setAttribute("playsinline","true"); //adContainer.play(); if (detected_os === "w_phone"){ adContainer.play(); } } if(!( detected_os === "iOS_tab" || detected_os === "iOS_phone" || detected_os === "w_phone")) adContainer.play(); } else{ eval("adExec_"+phName+"=false;"); } }; var adAgioExec664355_1671570248509 = function(ph,phName, clickUrl){ var adContainer = ph; adContainer.style.height = "0px"; adContainer.style.overflow = "hidden"; var adAgioControlsPlayObj; var adAgioVideoObj = adAgioVideo664355_1671570248509(adAgioVideoSrc,phName); if(detected_os === "iOS_tab" || detected_os === "w_phone" || detected_os === "iOS_phone"){ adAgioControlsPlayObj = adAgioControlsPlay664355_1671570248509(phName); adContainer.appendChild(adAgioControlsPlayObj); } adContainer.appendChild(adAgioVideoObj); adContainer.appendChild(adAgioControls664355_1671570248509(adAgioVolumeOn_img, adAgioVolumeOff_img, phName)); var adVideo = document.getElementById("adAgioVideo_"+phName), adVolumeOn = document.getElementById("adAgioVolumeOn_"+phName), adVolumeOff = document.getElementById("adAgioVolumeOff_"+phName), adControls = document.getElementById("adAgioControls_"+phName), audioControls = false, value = 0; window.addEventListener("scroll", function(){checkFocus664355_1671570248509(phName,ph,adAgioContainerHeight)}); adVideo.addEventListener("play",function(){ var time = (1000/(document.getElementById("adProgress_"+phName).max))*(Math.round(adVideo.duration)); var updateAdProgress = setInterval(function(){ value = value +1; if(document.getElementById("adProgress_"+phName) !== null){ if(value === document.getElementById("adProgress_"+phName).max) clearInterval(updateAdProgress); else document.getElementById("adProgress_"+phName).value = value; } else clearInterval(updateAdProgress); }, time); }); adVideo.addEventListener("mouseover",function(){ if(!audioControls) { adVideo.muted = false; adVolumeOn.style.display = "block"; adVolumeOff.style.display = "none"; } }); adVideo.addEventListener("mouseout",function(){ if(!audioControls){ adVideo.muted = true; adVolumeOff.style.display = "block"; adVolumeOn.style.display = "none"; } }); adVideo.addEventListener("ended",function(){ adVideo.style.height = "0px"; adVideo.parentNode.removeChild(document.getElementById("adAgioText_"+phName)); adVideo.parentNode.removeChild(document.getElementById("adProgress_"+phName)); adContainer.removeChild(adContainer.childNodes[0]); adContainer.parentNode.removeChild(adContainer); if(detected_os === "iOS_tab" || detected_os === "iOS_phone" || detected_os === "w_phone"){ document.getElementById('adagioVideo_playButton_'+phName).style.visibility = "visible"; // window.document.removeEventListener("touchstart",function(){adAgioForcePlayOnIPAD(phName)},false); } }); if (detected_os === "iOS_phone"){ document.getElementById("adAgioControlsPlay_" + phName).addEventListener('click',function(){adVideo.setAttribute("muted","false"); adVideo.play(); document.getElementById("adAgioControlsPlay_" + phName).style.display = "none"; }); } adVolumeOn.addEventListener("click",function(event){ event.stopPropagation(); audioControls = true; adVolumeOff.style.display = "block"; adVolumeOn.style.display = "none"; if(detected_os === "iOS_tab" || detected_os === "iOS_phone"){ //window.document.removeEventListener("touchstart",function(){adAgioForcePlayOnIPAD(phName)},false); adVideo.setAttribute("muted","true"); adVideo.muted = true; } else { adVideo.muted = true; } }); adVolumeOff.addEventListener("click",function(event){ event.stopPropagation(); audioControls = true; adVolumeOff.style.display = "none"; adVolumeOn.style.display = "block"; if(detected_os === "iOS_tab" || detected_os === "iOS_phone"){ //window.document.removeEventListener("touchstart",function(){adAgioForcePlayOnIPAD(phName)},false); adVideo.setAttribute("muted","false"); adVideo.muted = false; } else { adVideo.muted = false; } }); var functionClick = function(){ if(detected_os === "iOS_tab" || detected_os === "iOS_phone" || detected_os === "w_phone"){ document.getElementById('adagioVideo_playButton_'+phName).style.visibility = "hidden"; } if(adVideo.paused){ adVideo.play(); }else{ window.open(clickUrl,"_blank"); } if(detected_os !== "unkown" && !(audioControls)) { if(detected_os === "iOS_tab" || detected_os === "iOS_phone" || detected_os === "w_phone"){ adVideo.muted = false; adVolumeOff.style.display = 'none'; adVolumeOn.style.display = 'block'; }else{ adVideo.muted = true; adVolumeOff.style.display = 'block'; adVolumeOn.style.display = 'none'; adVideo.play(); } } }; adVideo.addEventListener("click",functionClick); if(detected_os === "iOS_tab" || detected_os === "w_phone"){ adAgioControlsPlayObj.addEventListener("click",functionClick); } adVolumeOn.addEventListener('mouseover', function(event){ if(!audioControls && detected_os != "Android") { adVideo.muted = false; adVolumeOn.style.display = 'block'; adVolumeOff.style.display = 'none'; } }); adVolumeOn.addEventListener('mouseout', function(event){ if(!audioControls && detected_os != "Android") { adVideo.muted = true; adVolumeOn.style.display = 'none'; adVolumeOff.style.display = 'block'; } }); adVolumeOff.addEventListener('mouseover',function(){ if(!audioControls && detected_os != "Android"){ setTimeout(function(){adVideo.muted = false; adVolumeOff.style.display = 'none'; adVolumeOn.style.display = 'block';},500); } }); adVolumeOff.addEventListener('mouseout',function(){ if(!audioControls && detected_os != "Android"){ adVideo.muted = true; adVolumeOff.style.display = 'block'; adVolumeOn.style.display = 'none'; } }); }; var addPlayButton664355_1671570248509 = function(phName){ initWidth = document.getElementById('adAgioVideo_'+phName).clientWidth; initHeight = document.getElementById('adAgioVideo_'+phName).clientHeight; try{ adAgioControlsPlayH = document.getElementById('adagioVideo_playButton_'+phName).style.height; document.getElementById('adAgioControlsPlay_'+phName).style.top = (parseInt(adAgioControlsPlayH) + parseInt(initHeight/2) + 5 ) + "px"; } catch(e){console.debug("neo: catch addPlayButton664355_1671570248509");} }; var nextploraUrl = "https://www.prodottisicuri.it/"; if (nextploraUrl !== ""){ var a = document.createElement("img"); a.style.display = "none"; a.width = "1"; a.height = "1"; a.src = nextploraUrl; document.body.appendChild(a); } adAgioExec664355_1671570248509(ph, phName, clickUrl); adagioInReadCounter++; if(detected_os === "iOS_tab" || detected_os === "iOS_phone" || detected_os === "w_phone"){ addPlayButton664355_1671570248509(phName); }