1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68
| var title="";
var starttime = new Date();
var startclock = starttime.getTime();
var mytimeleft = 0;
var tabtime = new Array();
var url=window.location.search.slice(1,window.location.search.length);
var taburl=url.split("&");
for (i=0;i<taburl.length;i++){
if (taburl[i].substr(0,8)=="timeleft"){
tabtime=taburl[i].split("=");
mytimeleft=tabtime[1];
}
}
function small_window() {
var newWindow;
var currentTime = new Date();
var props = "scrollBars=yes,resizable=yes,toolbar=no,menubar=no,location=no,directories=no,width=500,height=200";
newWindow = window.open("about:blank","blank",props);
newWindow.document.write("<html><body>");
newWindow.document.write("<a href='http://1.1.1.1' target='_blank'>Deconnexion</a>");
newWindow.document.write("<br/>");
newWindow.document.write("Heure de début: ");
newWindow.document.write(currentTime);
newWindow.document.write("<br/>");
newWindow.document.write(doTime());
newWindow.document.write("<br/>");
newWindow.document.write("</body></html>");
newWindow.document.close();
}
function doTime() {
window.setTimeout("doTime()",1000);
t = new Date();
time = Math.round((t.getTime() - starttime.getTime())/1000);
if (mytimeleft) {
time = mytimeleft - time;
}
if (time < 0) time = 0;
var day=Math.floor(time/3600/24); // récupere le nb de jour
time=time % (3600*24);
var hours=Math.floor(time / 3600); // recupère le nb d'heure
time=time % 3600;
var mins=Math.floor(time/60); // récupère le nb minute
time=time % 60
var secs=Math.floor(time);
if (hours < 10) hours = "0" + hours;
if (mins < 10) mins = "0" + mins;
if (secs < 10) secs = "0" + secs;
title = "Online time: " + hours + ":" + mins + ":" + secs;
if (mytimeleft) {
if (day != 0)title = "Remaining time: " + day + " jrs " + hours + ":" + mins + ":" + secs;
else title = "Remaining time: " + hours + ":" + mins + ":" + secs;
}
if(document.all || document.getElementById){
document.title = title;
}
else {
self.status = title;
}
return title;
}
window.OnLoad=small_window(); |
Partager