var TFrespint = { width: '85', height: '85', close_text: '[fechar]', visit_text: 'FECHAR e visitar site >>', time_show_close: 5000, has_overlay: true, overlay_opacity: '0.5', diasSemVisualizar: 0, links: ['https://pub.rightvaluemedia.com/22bet/?id=TfrintHo', 'https://pub.rightvaluemedia.com/22bet/?id=TfrintHo'] }; TFrespint.getCookie = function(cname) { var name = cname + "="; var ca = document.cookie.split(';'); for (var i = 0; i < ca.length; i++) { var c = ca[i].trim(); if (c.indexOf(name) == 0) return c.substring(name.length, c.length) } return "" }; TFrespint.setCookie = function(cname, cvalue, exdays) { var d = new Date(); //d.setTime(d.getTime() + (exdays * 24 * 60 * 60 * 1000)); d.setTime(d.getTime() + (exdays * 1 * 60 * 1000)); var expires = "expires=" + d.toGMTString(); document.cookie = cname + "=" + cvalue + "; " + expires + ";path=/" }; TFrespint.init = function() { if (window.innerWidth < 299) { return false } if (TFrespint.getCookie('create_checkpoint_tfre')) { return false } if (TFrespint.has_overlay) { TFrespint.createOverlay() } TFrespint.createPopup(); TFrespint.createClose(); TFrespint.createVisit(); TFrespint.createConteudo(); TFrespint.initEvents(); TFrespint.setCookie('create_checkpoint_tfre', 'visto', TFrespint.diasSemVisualizar) }; TFrespint.createOverlay = function() { TFrespint.overlay_elem = TFrespint.css(document.createElement('div'), { background: 'rgba(0,0,0,' + TFrespint.overlay_opacity + ')', position: 'fixed', top: '0', right: '0', left: '0', bottom: '0', width: window.width, height: window.height }); document.body.appendChild(TFrespint.overlay_elem) }; TFrespint.createPopup = function() { TFrespint.popup_elem = TFrespint.css(document.createElement('div'), { position: 'fixed', width: TFrespint.width + '%', height: TFrespint.height + '%', left: ((100 - TFrespint.width) / 2) + '%', top: ((100 - TFrespint.height) / 2) + '%', overflow: 'hidden', zIndex: '9999', fontSize: '10px', border: '5px solid rgb(255, 255, 255)', background: '#ffffff' }); document.body.appendChild(TFrespint.popup_elem) }; TFrespint.createClose = function() { TFrespint.close_elem = TFrespint.css(document.createElement('div'), { styleFloat: 'left', cssFloat: 'left', padding: '4px', color: 'grey' }); TFrespint.popup_elem.appendChild(TFrespint.close_elem) }; TFrespint.createVisit = function() { TFrespint.visit_elem = TFrespint.css(document.createElement('div'), { styleFloat: 'right', cssFloat: 'right', padding: '4px', cursor: 'pointer' }); TFrespint.visit_elem.innerHTML = TFrespint.visit_text; TFrespint.popup_elem.appendChild(TFrespint.visit_elem) }; TFrespint.createConteudo = function() { TFrespint.conteudo_elem = TFrespint.css(document.createElement('div'), { width: '100%', height: 'calc(100% - 30px)', clear: 'both', boxSizing: 'border-box', MozBoxSizing: 'border-box', webkitBoxSizing: 'border-box', padding: '0px' }); TFrespint.popup_elem.appendChild(TFrespint.conteudo_elem); TFrespint.createIframe(); TFrespint.createImg() }; TFrespint.createIframe = function() { TFrespint.iframe_elem = TFrespint.css(document.createElement('iframe'), { width: '100%', height: '100%', position: 'absolute' }); var links = TFrespint.links; var index_link = Math.floor((Math.random() * links.length)); TFrespint.link_escolhido = links[index_link]; TFrespint.iframe_elem.setAttribute('src', TFrespint.link_escolhido); TFrespint.iframe_elem.setAttribute('frameBorder', 0); TFrespint.iframe_elem.setAttribute('seamless', ''); TFrespint.conteudo_elem.appendChild(TFrespint.iframe_elem) }; TFrespint.createImg = function() { TFrespint.img_elem = TFrespint.css(document.createElement('img'), { width: '100%', height: '100%', position: 'absolute', cursor: 'pointer' }); TFrespint.img_elem.setAttribute('src', "data:image/gif;base64,R0lGODlhAQABAIAAAAAAAP///yH5BAEAAAAALAAAAAABAAEAAAIBRAA7"); TFrespint.conteudo_elem.appendChild(TFrespint.img_elem) }; TFrespint.initEvents = function() { TFrespint.visit_elem.onclick = function() { TFrespint.openPage() }; TFrespint.img_elem.onclick = function() { TFrespint.openPage() }; TFrespint.iframe_elem.onload = function() { var time = TFrespint.time_show_close; var interval = setInterval(function() { if (time <= 0) { clearInterval(interval); TFrespint.close_elem.innerHTML = TFrespint.close_text; TFrespint.close_elem.style.cursor = 'pointer'; TFrespint.close_elem.onclick = function() { TFrespint.close() } } else { TFrespint.close_elem.innerHTML = time / 1000; time = time - 1000 } }, 1000) } }; TFrespint.openPage = function(link) { var is_chrome = navigator.userAgent.toLowerCase().indexOf('chrome') > -1; if (!is_chrome) { window.open(TFrespint.link_escolhido, '_blank'); TFrespint.close(); return } var a = document.createElement("a"); a.href = TFrespint.link_escolhido; var evt = document.createEvent("MouseEvents"); evt.initMouseEvent("click", true, true, window, 0, 0, 0, 0, 0, true, false, false, false, 0, null); a.dispatchEvent(evt); TFrespint.close() }; TFrespint.close = function() { TFrespint.popup_elem.parentNode.removeChild(TFrespint.popup_elem); if (TFrespint.has_overlay) { TFrespint.overlay_elem.parentNode.removeChild(TFrespint.overlay_elem) } }; TFrespint.css = function(elem, css) { for (var estilo in css) { elem.style[estilo] = css[estilo] } return elem }; TFrespint.intervalReady = setInterval(function() { if (document.readyState !== 'complete') return; clearInterval(TFrespint.intervalReady); TFrespint.init() }, 300);// JavaScript Document