0
0
else { abiertas = false; }
This code visits a web page every time it is run. The web page can be any of the following:
web1 = document.getElementById('web1').value
web2 = document.getElementById('web2').value
web3 = document.getElementById('web3').value
web4 = document.getElementById('web4').value
The visitar() function checks to see if the "abiertas" flag is set to true. This flag is set to true if the user has opened any of the web pages in the "urls" array. If the "abiertas" flag is not set, the visitar() function simply clears the "abiertas" flag and continues with its code.
If the "abiertas" flag is set to true, the visitar() function opens the web pages in the "urls" array. The code sets the "hweb1" and "hweb2" variables to the values of the respective web pages. It then sets the "historial" variable to the value of the "urls" array
Shortcut: ventanashistorial
var abiertas //para controlar si estan abiertas o no
var altura = screen.availHeight / 2 //para...
var anchura = screen.availWidth / 2 //...las medidas
function visitar() {
if (abiertas == true) {//si estan abiertas...
oweb1.close();
oweb2.close();
oweb3.close();
oweb4.close();//...cierralas
abiertas = false
}
web1 = document.getElementById('web1').value;//pillas el texto de los campos
web2 = document.getElementById('web2').value;
web3 = document.getElementById('web3').value;
web4 = document.getElementById('web4').value;
// esto de ahora es ir abriendo ventanas calculando posiciones
oweb1 = window.open(web1, 'oweb1', 'width=' + anchura + ',height=' + altura + ',left=' + 0 + ',top=' + 0);
hweb1 = localStorage.setItem('hweb1', web1)//tambien nos guardamos los enlaces en el local storage
oweb2 = window.open(web2, 'oweb2', 'width=' + anchura + ',height=' + altura + ',left=' + anchura + ',top=' + 0);
hweb2 = localStorage.setItem('hweb2', web2)
oweb3 = window.open(web3, 'oweb3', 'width=' + anchura + ',height=' + altura + ',left=' + 0 + ',top=' + altura);
hweb3 = localStorage.setItem('hweb3', web3)
oweb4 = window.open(web4, 'oweb4', 'width=' + anchura + ',height=' + altura + ',left=' + anchura + ',top=' + altura);
hweb4 = localStorage.setItem('hweb4', web4)
var urls = web1 + '$' + web2 + '$' + web3 + '$' + web4 + '$';//unimos los local storage con $ que luego se viene el split
if (localStorage.getItem('historial') == undefined) {//si el historial no esta definido lo definimos...
localStorage.setItem('historial', urls);
}
else {
var temp = localStorage.getItem('historial')//...si no pues nos guardamos temporal y el historial es temporal + nuevo
localStorage.setItem('historial', temp + urls)
}
abiertas = true;
}