Any way to format the date from
Sat Jul 14 2012 21:19:18 GMT+0200 (Västeuropa, sommartid)
to
Jul 14 2012 - 21:19:18
I didn't tackle the date because that's the only built-in date format in Javascript (and it's locale-specific). To get a date formatted the way you like, you've got to build it yourself. I'm sure there are other alternatives, too, like using a JQuery plug-in.
For the format you specified, add the following code to the TournamentStatus.js file (you can just paste it at the end of the file):
TDStatus.getDateTime = function(inDate)
{
// Jul 14 2012 - 21:19:18
var theMon = [ "Jan", "Feb", "Mar", "Apr", "May", "Jun", "Jul", "Aug", "Sep", "Oct", "Nov", "Dec" ];
return theMon[inDate.getMonth()] + " " + inDate.getDate() + " " + inDate.getFullYear() + " - " + (inDate.getHours() + 1) + ":" + TDStatus.pad(inDate.getMinutes(), 2) + ":" + TDStatus.pad(inDate.getSeconds(), 2);
}
Then change this line:
TDStatus.setValue("lastupdated", "" + new Date(parseInt(TDStatus.Vars["time"]) * 1000));
to this:
TDStatus.setValue("lastupdated", TDStatus.getDateTime(new Date(parseInt(TDStatus.Vars["time"]) * 1000)));
And am i suppose to set the "update frequency" in TD3 to a very small number like 2 or 3 as well as in the TournamentStatus.js to get allmost instant uppdates?
You can set the update frequency in TD3 as low as 1 second. Since the TD basically does a "fire and forget" (it doesn't care really what the server says in response), you should be able to safely have it update once per second.
You'll have to experiment with the refresh setting in TournamentStatus.js. As I said, I didn't really examine how it might behave if your server is slow to respond, or timeouts occur. Might be fine, might not, I can't say. Probably will be fine, but again, I just can't really say. FYI, the refresh rate setting in TournamentStatus.js. is defined in seconds, but you can give it fractions, too. Set it to .5 to have it update every 1/2 second.