/*
Original by * jDigiClock plugin 2.1
*
* [
Link nur für registrierte Mitglieder sichtbar. Bitte einloggen oder neu registrieren ]
*
* Copyright (c) 2009 Radoslav Dimov
*
* Dual licensed under the MIT and GPL licenses:
* [
Link nur für registrierte Mitglieder sichtbar. Bitte einloggen oder neu registrieren ]
* [
Link nur für registrierte Mitglieder sichtbar. Bitte einloggen oder neu registrieren ]
*
*/
var Digital;
var hours;
var minutes;
var month;
var date;
var day;
var year;
var currDate;
var timeUpdate;
var ampm = false;
var vvv = 0;
var MonthsOfYear = new Array(12);
MonthsOfYear[0] = "01";
MonthsOfYear[1] = "02";
MonthsOfYear[2] = "03";
MonthsOfYear[3] = "04";
MonthsOfYear[4] = "05";
MonthsOfYear[5] = "06";
MonthsOfYear[6] = "07";
MonthsOfYear[7] = "08";
MonthsOfYear[8] = "09";
MonthsOfYear[9] = "10";
MonthsOfYear[10] = "11";
MonthsOfYear[11] = "12";
var DaysOfWeek = new Array(7);
var DaysOfWeekS = new Array(7);
var MonthNames = new Array(12);
switch(GetLanguage()){
case "en":
DaysOfWeek[0] = "Sunday";
DaysOfWeek[1] = "Monday";
DaysOfWeek[2] = "Tuesday";
DaysOfWeek[3] = "Wednesday";
DaysOfWeek[4] = "Thursday";
DaysOfWeek[5] = "Friday";
DaysOfWeek[6] = "Saturday";
DaysOfWeekS[0] = "Sun";
DaysOfWeekS[1] = "Mon";
DaysOfWeekS[2] = "Tue";
DaysOfWeekS[3] = "Wed";
DaysOfWeekS[4] = "Thu";
DaysOfWeekS[5] = "Fri";
DaysOfWeekS[6] = "Sat";
MonthNames[0] = 'Jan';
MonthNames[1] = 'Feb';
MonthNames[2] = 'Mar';
MonthNames[3] = 'Apr';
MonthNames[4] = 'May';
MonthNames[5] = 'Jun';
MonthNames[6] = 'Jul';
MonthNames[7] = 'Aug';
MonthNames[8] = 'Sep';
MonthNames[9] = 'Oct';
MonthNames[10] = 'Nov';
MonthNames[11] = 'Dec';
break;
case "es":
DaysOfWeek[0] = "Sonntag";
DaysOfWeek[1] = "Montag";
DaysOfWeek[2] = "Dienstag";
DaysOfWeek[3] = "Mittwoch";
DaysOfWeek[4] = "Donnerstag";
DaysOfWeek[5] = "Freitag";
DaysOfWeek[6] = "Samstag";
DaysOfWeekS[0] = "So";
DaysOfWeekS[1] = "Mo";
DaysOfWeekS[2] = "Di";
DaysOfWeekS[3] = "Mi";
DaysOfWeekS[4] = "Do";
DaysOfWeekS[5] = "Fr";
DaysOfWeekS[6] = "Sa";
MonthNames[0] = 'Jan';
MonthNames[1] = 'Feb';
MonthNames[2] = 'Mär';
MonthNames[3] = 'Apr';
MonthNames[4] = 'Mai';
MonthNames[5] = 'Jun';
MonthNames[6] = 'Jul';
MonthNames[7] = 'Aug';
MonthNames[8] = 'Sep';
MonthNames[9] = 'Okt';
MonthNames[10] = 'Nov';
MonthNames[11] = 'Dez';
break;
default:
DaysOfWeek[0] = "Sonntag";
DaysOfWeek[1] = "Montag";
DaysOfWeek[2] = "Dienstag";
DaysOfWeek[3] = "Mittwoch";
DaysOfWeek[4] = "Donnerstag";
DaysOfWeek[5] = "Freitag";
DaysOfWeek[6] = "Samstag";
DaysOfWeekS[0] = "So";
DaysOfWeekS[1] = "Mo";
DaysOfWeekS[2] = "Di";
DaysOfWeekS[3] = "Mi";
DaysOfWeekS[4] = "Do";
DaysOfWeekS[5] = "Fr";
DaysOfWeekS[6] = "Sa";
MonthNames[0] = 'Jan';
MonthNames[1] = 'Feb';
MonthNames[2] = 'Mär';
MonthNames[3] = 'Apr';
MonthNames[4] = 'Mai';
MonthNames[5] = 'Jun';
MonthNames[6] = 'Jul';
MonthNames[7] = 'Aug';
MonthNames[8] = 'Sep';
MonthNames[9] = 'Okt';
MonthNames[10] = 'Nov';
MonthNames[11] = 'Dez';
}
function init(){
getTime();
//setTimeout("getTime()", 5000);
}
function getTime() {
Digital = new Date();
hours = Digital.getHours();
minutes = Digital.getMinutes();
month = MonthsOfYear[Digital.getMonth()];
date = Digital.getDate();
day = Digital.getDay();
year = Digital.getFullYear();
var now = new Date();
var now_hours, now_minutes, old_hours, old_minutes, timeOld = '';
now_hours = now.getHours();
now_minutes = now.getMinutes();
if (ampm) {
var am_pm = now_hours > 11 ? 'pm' : 'am';
now_hours = ((now_hours > 12) ? now_hours - 12 : now_hours);
document.getElementById('iap').src = 'images/clock/' + am_pm + '.png';
}
now_hours = ((now_hours < 10) ? "0" : "") + now_hours;
now_minutes = ((now_minutes < 10) ? "0" : "") + now_minutes;
date = ((date < 10) ? "0" : "") + date;
// data - verificar formato: dd/mm/yyyy ou yyyy/dd/mm ou outro
//currDate = date + "/" + month + "/" + year;
/*
dd/mm/aaaa Fri 23 Apr 2010
mm/dd/aaaa Fri Apr 23 2010
aaaa/mm/dd 2010 Apr 23 Fri
aaaa/dd/mm 2010 23 Apr Fri
*/
currDate = Digital.toLocaleDateString();
var ary = new Array();
ary = currDate.split(" ");
if(isNaN(ary[0])){
currDate = DaysOfWeekS[day]+', ';
if(isNaN(ary[1])){
currDate += MonthNames[Digital.getMonth()] + ' ' +date+',*'+year;
}else{
currDate += date + ' ' + MonthNames[Digital.getMonth()] + ', *' + year;
}
}else{
if(isNaN(ary[1])){
currDate = year + ' ' + MonthNames[Digital.getMonth()] + ' ' + date + ', ' + DaysOfWeekS[day];
}else{
currDate = year + ' ' + date + ' ' + MonthNames[Digital.getMonth()] + ', ' + DaysOfWeekS[day];
}
}
timeOld += '<div id="hours"><div class="line"></div>';
timeOld += '<div id="hours_bg">';
timeOld += '<img id="hours_bg1" src="images/clock/clockbg1.png" /></div>';
timeOld += '<img src="images/clock/clockbg-blank.png" id="fhd" class="first_digit" />';
timeOld += '<img src="images/clock/clockbg-blank.png" id="shd" class="second_digit" />';
timeOld += '</div>';
timeOld += '<div id="minutes"><div class="line"></div>';
if (ampm) {
timeOld += '<div id="am_pm"><img src="images/clock/apm.png" /></div>';
}
timeOld += '<div id="minutes_bg"><img id="minutes_bg1" src="images/clock/clockbg1.png" /></div>';
timeOld += '<img src="images/clock/clockbg-blank.png" id="fmd" class="first_digit" />';
timeOld += '<img src="images/clock/clockbg-blank.png" id="smd" class="second_digit" />';
timeOld += '</div>';
document.getElementById('clock').innerHTML = timeOld;
document.getElementById("date").innerHTML = currDate;
document.getElementById('fhd').src = 'images/clock/' + now_hours.substr(0,1) + '.png';
document.getElementById('shd').src = 'images/clock/' + now_hours.substr(1,1) + '.png';
document.getElementById('fmd').src = 'images/clock/' + now_minutes.substr(0,1) + '.png';
document.getElementById('smd').src = 'images/clock/' + now_minutes.substr(1,1) + '.png';
//setTimeout("getTime()",(60 - now.getSeconds()) * 1000);
setTimeout("getTime()", 4000);
}
function GetLanguage(){
try
{
return widget.sysInfo.getLanguage();
}catch(E){
return "pt";
}
}