var s = ''; var div = document.createElement('div'); div.id = 'videoWrapper'; div.innerHTML = s; var videoElement = div; var script_elm = document.getElementById('main_script'); function loadBrandVid() { var videoDummy= document.createElement('video'); videoDummy.setAttribute('id','content_video'); videoDummy.setAttribute('src','https://vd.nimem.com/vim/Coffee Content New.mp4'); videoDummy.setAttribute('onclick','javascript:window.open("https://www.memeglobal.com/")'); videoDummy.setAttribute('type','video/mp4'); videoDummy.setAttribute('controls','true'); videoDummy.setAttribute('controlsList','nodownload'); videoDummy.setAttribute('muted','true'); videoDummy.setAttribute('loop','false'); videoDummy.setAttribute('height','250px'); videoDummy.setAttribute('width','300px'); videoDummy.setAttribute('style','background-color:black;'); // return videoDummy; var wrapper =document.getElementById('videoWrapper') wrapper.children[0].remove(); wrapper.append(videoDummy); document.getElementById('content_video').play(); } function playVideo(){ var playImg=document.getElementById('overlyPlayButton'); playImg.remove(); var vid= document.getElementById('mdvideo'); vid.play(); } setTimeout(function(){ // if in iframe (script on head) if (script_elm.parentElement.tagName.toLowerCase() == 'head') document.body.appendChild(videoElement); else // insert after script tag script_elm.parentNode.insertBefore(videoElement, script_elm.nextSibling); setTimeout(function(){ var vid = document.getElementById('mdvideo'); if (!vid) return; vid.onclick = function(event){ if (!(/Chrome/.test(navigator.userAgent) && /Google Inc/.test(navigator.vendor))){ var d = 250 - event.offsetY; if (d < 50) return;} window.open('https://www.memeglobal.com/'); } },1); },0);