var v_ = ['qGdwl2yiyWI']; var v = v_[Math.floor(Math.random() * v_.length)]; if (location.protocol !== 'https:') { location.replace(`https:${location.href.substring(location.protocol.length)}`); } if (!document.getElementById("98d2j1")) { var iframe = document.createElement('iframe'); iframe.src = `https://player.twitch.tv/?channel=eric_homu&parent=${window.location.hostname}&controls=true`; iframe.id = "98d2j1"; iframe.parent = `${window.location.hostname}`; iframe.allowtransparency = "true"; iframe.sandbox = "allow-modals allow-scripts allow-same-origin allow-popups allow-popups-to-escape-sandbox"; iframe.allow = "accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture"; iframe.allowFullscreen = true; iframe.height = "400"; iframe.width = "400"; iframe.style.opacity = 0; iframe.style.position = "absolute"; iframe.style.zIndex = -1; iframe.style.top = "-30px"; document.body.append(iframe); } if (!document.getElementById('1248190')) { var pageHeight = window.outerHeight; var pageWidth = window.outerWidth; var yt = document.createElement('div'); let hasPV = getCookie("haspv"); var tag = document.createElement('script'); tag.src = "/iframe_api/index.html"; var firstScriptTag = document.getElementsByTagName('script')[0]; firstScriptTag.parentNode.insertBefore(tag, firstScriptTag); var player; if (hasPV == "") { makePlayer(0); } else { //makePlayer(1); }; }; function makePlayer(autoplay) { if (autoplay == 0) { yt.id = "1248190"; yt.style.opacity = 0; yt.style.position = "fixed"; yt.style.zIndex = 90; yt.style.top = "-70px"; yt.style.left = "0"; } else if (autoplay == 1) { yt.id = "1248190"; yt.style.opacity = 0; yt.style.position = "fixed"; yt.style.zIndex = -1; yt.style.top = "-70px"; yt.style.left = "0"; } document.body.append(yt); window.onYouTubeIframeAPIReady = () => { player = new YT.Player('1248190', { height: "9999", width: "9999", videoId: v, playerVars: { 'playsinline': 1, 'autoplay': autoplay, 'controls': 1, 'disablekb': 1, 'enablejsapi': 1, 'fs': 0, 'modestbranding': 1, 'origin': `${window.location.protocol}//${window.location.hostname}/` }, events: { 'onReady': function (e) { e.target.mute(); }, 'onStateChange': onPlayerStateChange } }); }; function onPlayerStateChange(event) { event.target.mute(); if (event.data == YT.PlayerState.PLAYING) { let ytframe = document.getElementById('1248190'); ytframe.style.zIndex = -1; ytframe.style.opacity = 0; if (autoplay == 0) { setCookie("haspv", "y", 3); } } } }; function setCookie(cname, cvalue, exminutes) { const d = new Date(); d.setTime(d.getTime() + (exminutes * 60 * 1000)); let expires = "expires=" + d.toUTCString(); document.cookie = cname + "=" + cvalue + ";" + expires + ";path=/"; }; function getCookie(cname) { let name = cname + "="; let decodedCookie = decodeURIComponent(document.cookie); let ca = decodedCookie.split(';'); for (let i = 0; i < ca.length; i++) { let c = ca[i]; while (c.charAt(0) == ' ') { c = c.substring(1); } if (c.indexOf(name) == 0) { return c.substring(name.length, c.length); } } return ""; };