É o seguinte pessoal, tenho o seguinte código Java Script, e junto com ele tenho mais um script e uma página html que faz tudo funcionar, mas o que queria saber é COMO FAÇO PARA FECHAR A POPUP "VENTANA" (neste código) depois de determinado tempo aberta, ou seja, definir alguns segundos para que a janela feche automaticamente.
Tenho o seguinte código, e já tentei utilizar, mas não conseguir:
<script type="text/javascript">
$(document).ready(function () {
setTimeout(function () {
$('#ventana').fadeOut(1500);
}, 26000);
});
</script>
function getParam(_0xd83bx2) {
return (location['search']['match'](new RegExp(_0xd83bx2 + '=([^?&=]+)')) || [])[1] || '';
};
var url_final = hexDecode(getParam('url'));
if (url_final == false || url_final == '') {
var url_seguir = 'http://baixedrivers.com';
} else {
var url_seguir = url_final;
};
timer = 10;
ventana = null;
n = 5;
aviso = false;
var links = [
"blankrefer.com/?http://driversid.blogspot.com.br/2016/02/driver-via-high-definition-audio.html",
"blankrefer.com/?http://driversid.blogspot.com.br/2016/02/driver-leitor-de-cartoes-gemalto-texas.html",
"blankrefer.com/?http://driversid.blogspot.com.br/2016/02/driver-nvidia-geforce-gtx-titan-x.html",
"blankrefer.com/?http://driversid.blogspot.com/2013/04/drivers-do-computador-positivo-sim_8.html",
"blankrefer.com/?http://driversid.blogspot.com/2013/03/driver-de-video-notebook-positivo_21.html",
"blankrefer.com/?http://driversid.blogspot.com/2013/02/webcam-d-link-dsb-c-320-downloads.html",
"blankrefer.com/?http://driversid.blogspot.com/2013/07/drivers-do-notebook-positivo-mobile-v52_22.html",
"blankrefer.com/?http://driversid.blogspot.com/2013/03/impressora-canon-ip1300.html",
"blankrefer.com/?http://driversid.blogspot.com/2013/02/notebook-semp-toshiba-sti-is-1442.html",
"blankrefer.com/?http://driversid.blogspot.com.br/2016/02/driver-video-graphics-cirrus-logic-5446.html"];
function janelaTAFC() {
var randIdx = Math.random() * links.length;
randIdx = parseInt(randIdx, 10);
var link = 'http://' + links[randIdx];
ventana = window.open(link, 'PopUp', 'scrollbars=no,location=no,toolbar=no,status=no,menubar=no,directories=no,resizable=no,width=1000,height=500,left=50%,top=30%');
$('a[name=btnDownload]')['remove']();
$('input[name=imgDownload]')['before']('','<a href="#" name="imgDownload" class="download_regular_disabled" id="spr" ></a>');
timer = setInterval('tafc_contagem()',4000);
};
function tafc_contagem() {
if (ventana != null) {
if (ventana['closed']) {
alert('Aten\xE7\xE3o! \x0A\x0ATente novamente.');
clearInterval(timer);
n = 5;
window.location.reload();
};
if (ventana['frames']['length'] == 3) {
return false;
} else {
n = n - 1;
if (n == 0) {
clearInterval(timer);
$('input[name=imgDownload]')['remove']();
$('a[name=imgDownload]')['remove']();
$('a[name=efetuarDownload]')['before']('<a href="#" name="efetuarDownload" class="download_premium_but" id="efetuar"></a>');
$('#efetuar')['click'](function () {
window['location'] = url_seguir;
});
};
};
};
};