If you're changing that code anyway, could you please also take care of
the following change:
  setTimeout("updateClock();",(60-d.getUTCSeconds())*1000);
to
  setTimeout(updateClock,(60-d.getUTCSeconds())*1000);

(i.e. pass the function itself to setTimeout, instead of passing a
string to be evaluated).

Personally, I don't see the need for a clock on a web page, in general.
Most screens have a clock in a corner somewhere anyway.


On 01/21/2014 02:59 PM, Jan Nijtmans wrote:
> The fossil web-sites mentioned have a little running clock
> just below the "Not logged in" string (or the username for
> people who are logged in). In IE8, this clock doesn't
> work, and (when opening the debugger) gives javascript
> errors. The reason is that Date.toISOString() is not
> supported in IE8. Coolpit is the function updateClock():
> 
> function updateClock(){
>   var e = document.getElementById("clock");
>   if(e){
>     var d = new Date();
>     e.innerHTML=d.toISOString().replace("T"," ").replace(/:\d\d\.\d+Z/,"");
>     setTimeout("updateClock();",(60-d.getSeconds())*1000);
>   }
> }
> 
> Here is a version of the same function which works
> with IE8 and gives exactly the same output:
> 
> function updateClock(){
>   var e = document.getElementById("clock");
>   if(e){
>     var d = new Date();
>     function f(n) {
>       return n < 10 ? '0' + n : n;
>     }
>     e.innerHTML = d.getUTCFullYear()+ '-' +
>       f(d.getUTCMonth() + 1) + '-' +
>       f(d.getUTCDate())      + ' ' +
>       f(d.getUTCHours())     + ':' +
>       f(d.getUTCMinutes());
>     setTimeout("updateClock();",(60-d.getUTCSeconds())*1000);
>   }
> }
> 
> The standard styles included in Fossil don't have such a clock
> (but it would be a nice addition....... hint .....)
> 
> Regards,
>         Jan Nijtmans
> _______________________________________________
> fossil-users mailing list
> [email protected]
> http://lists.fossil-scm.org:8080/cgi-bin/mailman/listinfo/fossil-users
> 


-- 
Martijn Coppoolse
_______________________________________________
fossil-users mailing list
[email protected]
http://lists.fossil-scm.org:8080/cgi-bin/mailman/listinfo/fossil-users

Reply via email to