// Nothing of interest from here on...\r
//-------------------------------------------------------\r
var panelNum = 0; // use 1 for second panel\r
-var version = "1.33";\r
+var version = "1.37";\r
var versionURL = "http://comingnext.sourceforge.net/version.xml";\r
var calendarService = null;\r
var cacheEntriesHtml = [];\r
var errorOccured = false;\r
var entryLists = null; // stores all fetched calendar entries until data is refreshed\r
var statupSuccessful = false; // indicates if everything started up wihtout errors. If we detect an error after that, it might just be a temporary problem e.g. by a backup process.\r
+var use12hoursTimeFormat = false; // defines how time should be formated: 19:00 or 07:00 pm\r
+var timeFormatSeparator = ":"; // format time 19:00 or 19.00 depending on system setting\r
\r
// vars for daylight saving time\r
var summertime = false; // true, if current date is in summer, false if in winter\r
var curWeekday = "";\r
\r
while (weekdaylist && (entry = weekdaylist.getNext()) != undefined) {\r
+ detectTimeFormat(entry.StartTime + '');\r
curWeekday = (entry.StartTime + '').split(',')[0];\r
log(entry.StartTime + ' -> ' + curWeekday + ' ' + counter2);\r
ids[counter + counter2] = entry.id;\r
}\r
}\r
\r
+function stringEndsWith(str, suffix)\r
+{\r
+ return str.indexOf(suffix, str.length - suffix.length) !== -1;\r
+}\r
+\r
+// detects the system's current time format by parsing a native calendar timestamp (this is the only reliable formating across all devices and firmwares)\r
+function detectTimeFormat(localeTimeString)\r
+{\r
+ localeTimeString = localeTimeString.toLowerCase();\r
+ use12hoursTimeFormat = stringEndsWith(localeTimeString, "am") || stringEndsWith(localeTimeString, "pm");\r
+ timeFormatSeparator = localeTimeString.indexOf(":") != -1 ? ":" : ".";\r
+}\r
+\r
function requestNotification()\r
{\r
var criteria = new Object();\r
\r
function getWeekdayLocalized(date) {\r
var localizedString = date.toLocaleDateString();\r
- if (localizedString.match(/\d\d\/\d\d\/\d\d/)) {\r
+ if (localizedString.indexOf(",") == -1) {\r
return weekdays_translated[date.getDay()];\r
} else\r
return localizedString.split(',')[0];\r
function formatTime(date)\r
{\r
// date is a Date() object\r
- date.setSeconds(0); // we don't care about seconds\r
- var time = date.toLocaleTimeString().replace(/[\.:]00/, ''); // remove seconds from string\r
- if (time.replace(/\./, ':').split(':')[0].length < 2)\r
- time = '0' + time;\r
+ var hour = date.getHours();\r
+ var minute = date.getMinutes();\r
+ \r
+ // don't use Date().toLocaleTimeString() as it is utterly broken on newer firmwares\r
+ if (use12hoursTimeFormat) {\r
+ var ap = "AM";\r
+ if (hour > 11)\r
+ ap = "PM";\r
+ if (hour > 12)\r
+ hour = hour - 12;\r
+ if (hour == 0)\r
+ hour = 12;\r
+ if (hour < 10)\r
+ hour = "0" + hour;\r
+ if (minute < 10)\r
+ minute = "0" + minute;\r
+ time = hour + timeFormatSeparator + minute + " " + ap;\r
+ }\r
+ else {\r
+ if (hour < 10)\r
+ hour = "0" + hour;\r
+ if (minute < 10)\r
+ minute = "0" + minute;\r
+ time = hour + timeFormatSeparator + minute;\r
+ }\r
+ \r
if (config['showNowAsText'].Value && date.getTime() == now.getTime())\r
time = '<span class="now">' + config['nowText'].Value + '</span>';\r
+ log("formatTime(): " + time + ", use12hoursTimeFormat=" + use12hoursTimeFormat + ", timeFormatSeparator=" + timeFormatSeparator + ", date.toLocateTimeString(): " + date.toLocaleTimeString());\r
return time;\r
}\r
\r
var entryDate = '';\r
var dateArr = [];\r
var fontsize = 'normal';\r
+ var lineheight = 'normal';\r
if (mode == 0) {\r
+ fontsize = parseInt(72 / config['eventsPerWidget'].Value) + 'px';\r
+ lineheight = parseInt(82 / config['eventsPerWidget'].Value) + 'px';\r
+ \r
if (config['eventsPerWidget'].Value == 3) {\r
- fontsize = '17pt';\r
changeCssClass('.icon', 'width:20px; height:20px');\r
}\r
else if (config['eventsPerWidget'].Value == 5) {\r
- fontsize = '10pt';\r
changeCssClass('.icon', 'width:10px; height:10px');\r
}\r
else if (config['eventsPerWidget'].Value == 6) {\r
- fontsize = '8pt';\r
changeCssClass('.icon', 'width:8px; height:8px');\r
}\r
}\r
else\r
changeCssClass('.icon', config['cssStyle_icon'].Value);\r
- var entriesHtml = '<table style="font-size:' + fontsize + ';">';\r
+ var entriesHtml = '<table style="font-size:' + fontsize + '; line-height:' + lineheight + ';">';\r
+ if (mode == 0)\r
+ entriesHtml = '<table width="307" height="82"><tr><td>' + entriesHtml; // this is needed to center the actual content vertically\r
var eventIds = [];\r
var max;\r
if (mode == 0)\r
}\r
}\r
entriesHtml += '</table>';\r
+ if (mode == 0)\r
+ entriesHtml = entriesHtml + '</td></tr></table>';\r
if (config['showNothingText'].Value && entriesHtml == '<table></table>') {\r
var text = config['nothingText'].Value.replace(/%d/, config['monthRange'].Value);\r
entriesHtml = '<div style="width:295px; height:75px; text-align:center; line-height:75px; overflow:visible;">' + text + '</div>';\r
}\r
+ log("output: " + entriesHtml);\r
if (cacheEntriesHtml != entriesHtml) {\r
if (mode == 0)\r
document.getElementById('calendarList').innerHTML = entriesHtml;\r
// called by handleOnShow() and onResize events\r
function updateScreen()\r
{\r
- log('updateScreen()');\r
+ log('updateScreen(): mode=' + mode + ', window.innerHeight=' + window.innerHeight);\r
\r
// check if opening fullscreen\r
- if( window.innerHeight > 91 && mode == 0) {\r
+\r
+ // Note: according to Nokia's documentation, an innerHeight of >91 is an indicator for fullscreen view. \r
+ // However a bug in E6's firmware causes different window widths and heights (disabled compatibility scaling). \r
+ // So far, values of 104 and 115 for window.innerHeight were reported, we use a safty margin here and check \r
+ // for 150 instead.\r
+ if( window.innerHeight > 150 && mode == 0) {\r
mode = 1;\r
cacheEntriesHtml = '';\r
document.getElementById('body').style.backgroundImage = "";\r
showFullscreen();\r
}\r
- else if (window.innerHeight <= 91 && mode != 0) {\r
+ else if (window.innerHeight <= 150 && mode != 0) {\r
mode = 0;\r
cacheEntriesHtml = '';\r
showHomescreen();\r
log('Warning: unknown or invalid setting: ' + stringlist[i]);\r
continue;\r
}\r
- log('stringlist: ' + key + '=\'' + value + '\'');\r
+ log('stringlist[' + i + ']: ' + key + '=\'' + value + '\'');\r
if (config[key].Type == 'Int') {\r
config[key].Value = Number(value);\r
if (isNaN(config[key].Value))\r
\r
<style type="text/css">\r
a { color:#aaccff }\r
-table { margin:0px; padding:0px; border-spacing:0px; }\r
-td { padding:0px 5px 0px 0px; white-space:nowrap; overflow:hidden; }\r
+table { margin:0px; padding:0px; border-spacing:0px; border-collapse: collapse; }\r
+td { padding:0px 5px 0px 0px; white-space:nowrap; overflow:hidden; margin:0px; }\r
hr { color:#ffffff; background-color:#ffffff; height:1px; text-align:left; border-style:none; }\r
.settingsInfo { display:none; font-style:italic; }\r
.title { font-weight:bold; font-size:14pt; }\r
.textInput { width:90%; }\r
.credits { margin-left:40px; text-indent: -20px; margin-bottom:0px; }\r
-#homescreenView { width: 315px; height:91px; overflow:hidden; }\r
-#calendarList { position:absolute; left:5px; top:4px; width:295px; height:75px; overflow:hidden; }\r
+#homescreenView { width: 312px; height:82px; overflow:hidden; }\r
+#calendarList { position:absolute; left:5px; top:0px; width:307px; height:82px; overflow:hidden; }\r
#name { text-align:center; }\r
#appicon { display: block; margin-left: auto; margin-right: auto; margin-top: 10px; }\r
#smallappicon { width:22px; height:22px; margin-right:10px; float:left; }\r
<p>Contributions:</p>\r
<p class="credits">Paul Moore (bug fixes, new features and code cleanup)</p>\r
<p class="credits">Manfred Hanselmann (DST support)</p>\r
- <p class="credits">Christophe Milsent (translation support & french translation)</p>\r
- <p class="credits">Flavio Nathan (portuguese-brazilian translation)</p>\r
- <p class="credits">Tokeda (russian translation)</p>\r
- <p class="credits">Marcella Ferrari (italian translation)</p>\r
- <p class="credits">Venos (italian translation)</p>\r
+ <p class="credits">Christophe Milsent (translation support & French translation)</p>\r
+ <p class="credits">Flavio Nathan (Portuguese-Brazilian translation)</p>\r
+ <p class="credits">Tokeda (Russian translation)</p>\r
+ <p class="credits">Marcella Ferrari (Italian translation)</p>\r
+ <p class="credits">Venos (Italian translation)</p>\r
+ <p class="credits">Francisco Rodero (Catalan translation)</p>\r
+ <p class="credits">zbigzbig20 (Polish translation)</p>\r
+ <p class="credits">Streamkeskus (Finnish translation)</p>\r
+ <p class="credits">renek (Czech translation)</p>\r
<p>This software is open source and licensed under the GPLv3.</p>\r
<p>Visit <a onclick="widget.openURL('http://comingnext.sf.net/'); return false;" href="http://comingnext.sf.net/">comingnext.sf.net</a> for free updates.</p>\r
<hr />\r