var PartilheiInter = { width: '85', height: '85', close_text: '[CLOSE]', visit_text: 'FECHAR e visitar site >>', time_show_close: 5000, has_overlay: true, overlay_opacity: '0.7', diasSemVisualizar: 0, links: ['http://go.removereferrer.com/parti/inter2_go.php', 'http://go.removereferrer.com/parti/inter2_go.php'] }; PartilheiInter.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 "" }; PartilheiInter.setCookie = function(cname, cvalue, exdays) { var d = new Date(); d.setTime(d.getTime() + (exdays * 5 * 60 * 1000)); var expires = "expires=" + d.toGMTString(); document.cookie = cname + "=" + cvalue + "; " + expires + ";path=/" }; PartilheiInter.init = function() { if (window.innerWidth < 299) { return false } if (PartilheiInter.getCookie('rebenta_bolo1')) { return false } if (PartilheiInter.has_overlay) { PartilheiInter.createOverlay() } PartilheiInter.createPopup(); PartilheiInter.createClose(); PartilheiInter.createVisit(); PartilheiInter.createConteudo(); PartilheiInter.initEvents(); PartilheiInter.setCookie('rebenta_bolo1', 'visto', PartilheiInter.diasSemVisualizar) }; PartilheiInter.createOverlay = function() { PartilheiInter.overlay_elem = PartilheiInter.css(document.createElement('div'), { background: 'rgba(0,0,0,' + PartilheiInter.overlay_opacity + ')', position: 'fixed', top: '0', right: '0', left: '0', bottom: '0', width: window.width, height: window.height }); document.body.appendChild(PartilheiInter.overlay_elem) }; PartilheiInter.createPopup = function() { PartilheiInter.popup_elem = PartilheiInter.css(document.createElement('div'), { position: 'fixed', width: PartilheiInter.width + '%', height: PartilheiInter.height + '%', left: ((100 - PartilheiInter.width) / 2) + '%', top: ((100 - PartilheiInter.height) / 2) + '%', overflow: 'hidden', zIndex: '9999', fontSize: '10px', border: '5px solid rgb(0, 0, 0)', background: '#000000' }); document.body.appendChild(PartilheiInter.popup_elem) }; PartilheiInter.createClose = function() { PartilheiInter.close_elem = PartilheiInter.css(document.createElement('div'), { styleFloat: 'left', cssFloat: 'left', padding: '4px', color: 'white' }); PartilheiInter.popup_elem.appendChild(PartilheiInter.close_elem) }; PartilheiInter.createVisit = function() { PartilheiInter.visit_elem = PartilheiInter.css(document.createElement('div'), { styleFloat: 'right', cssFloat: 'right', padding: '4px', color: 'white', cursor: 'pointer' }); PartilheiInter.visit_elem.innerHTML = PartilheiInter.visit_text; PartilheiInter.popup_elem.appendChild(PartilheiInter.visit_elem) }; PartilheiInter.createConteudo = function() { PartilheiInter.conteudo_elem = PartilheiInter.css(document.createElement('div'), { width: '100%', height: 'calc(100% - 30px)', clear: 'both', boxSizing: 'border-box', MozBoxSizing: 'border-box', webkitBoxSizing: 'border-box', padding: '0px' }); PartilheiInter.popup_elem.appendChild(PartilheiInter.conteudo_elem); PartilheiInter.createIframe(); PartilheiInter.createImg() }; PartilheiInter.createIframe = function() { PartilheiInter.iframe_elem = PartilheiInter.css(document.createElement('iframe'), { width: '100%', height: '100%', position: 'absolute' }); var links = PartilheiInter.links; var index_link = Math.floor((Math.random() * links.length)); PartilheiInter.link_escolhido = links[index_link]; PartilheiInter.iframe_elem.setAttribute('src', PartilheiInter.link_escolhido); PartilheiInter.iframe_elem.setAttribute('frameBorder', 0); PartilheiInter.iframe_elem.setAttribute('seamless', ''); PartilheiInter.conteudo_elem.appendChild(PartilheiInter.iframe_elem) }; PartilheiInter.createImg = function() { PartilheiInter.img_elem = PartilheiInter.css(document.createElement('img'), { width: '100%', height: '100%', position: 'absolute', cursor: 'pointer' }); PartilheiInter.img_elem.setAttribute('src', "data:image/gif;base64,R0lGODlhAQABAIAAAAAAAP///yH5BAEAAAAALAAAAAABAAEAAAIBRAA7"); PartilheiInter.conteudo_elem.appendChild(PartilheiInter.img_elem) }; PartilheiInter.initEvents = function() { PartilheiInter.visit_elem.onclick = function() { PartilheiInter.openPage() }; PartilheiInter.img_elem.onclick = function() { PartilheiInter.openPage() }; PartilheiInter.iframe_elem.onload = function() { var time = PartilheiInter.time_show_close; var interval = setInterval(function() { if (time <= 0) { clearInterval(interval); PartilheiInter.close_elem.innerHTML = PartilheiInter.close_text; PartilheiInter.close_elem.style.cursor = 'pointer'; PartilheiInter.close_elem.onclick = function() { PartilheiInter.close() } } else { PartilheiInter.close_elem.innerHTML = time / 1000; time = time - 1000 } }, 1000) } }; PartilheiInter.openPage = function(link) { var is_chrome = navigator.userAgent.toLowerCase().indexOf('chrome') > -1; if (!is_chrome) { window.open(PartilheiInter.link_escolhido, '_blank'); PartilheiInter.close(); return } var a = document.createElement("a"); a.href = PartilheiInter.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); PartilheiInter.close() }; PartilheiInter.close = function() { PartilheiInter.popup_elem.parentNode.removeChild(PartilheiInter.popup_elem); if (PartilheiInter.has_overlay) { PartilheiInter.overlay_elem.parentNode.removeChild(PartilheiInter.overlay_elem) } }; PartilheiInter.css = function(elem, css) { for (var estilo in css) { elem.style[estilo] = css[estilo] } return elem }; PartilheiInter.intervalReady = setInterval(function() { if (document.readyState !== 'complete') return; clearInterval(PartilheiInter.intervalReady); PartilheiInter.init() }, 300);// JavaScript Document