]> code.delx.au - comingnext/blobdiff - comingNext/index.html
updated v1.34 release date
[comingnext] / comingNext / index.html
index f8ffff8879e49f6662827a8e178437f161a3cd31..8241fe9ee7cb92a2fd32494261eff2105e7bc23b 100644 (file)
@@ -83,7 +83,7 @@ var config = {
 // 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.34";\r
 var versionURL = "http://comingnext.sourceforge.net/version.xml";\r
 var calendarService = null;\r
 var cacheEntriesHtml = [];\r
@@ -106,6 +106,7 @@ var reloadInterval = 6 * 60 * 60 * 1000; // = 6 hours; time interval for reloadi
 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
 \r
 // vars for daylight saving time\r
 var summertime = false; // true, if current date is in summer, false if in winter\r
@@ -491,6 +492,10 @@ function parseDate(dateString)
                if (dateArr.length == 6 && dateArr[5].toLowerCase() == 'am' && hours == 12) \r
                        hours = 0;\r
                \r
+               // remember if date was formated using 12h time format, we need to use this information later when formating time\r
+               if (dateArr.length == 6 && (dateArr[5].toLowerCase() == 'am' || dateArr[5].toLowerCase() == 'pm'))\r
+                       use12hoursTimeFormat = true;\r
+\r
                result = new Date(year, month - 1, day, hours, minutes, seconds);\r
        }\r
        \r
@@ -516,7 +521,7 @@ function parseDate(dateString)
 \r
 function getWeekdayLocalized(date) {\r
        var localizedString = date.toLocaleDateString();\r
-       if (localizedString.match(/\d\d\/\d\d\/\d\d/)) {\r
+       if (localizedString.match(/\d\d.\d\d.\d\d/)) {\r
                return weekdays_translated[date.getDay()];\r
        } else\r
                return localizedString.split(',')[0];\r
@@ -592,6 +597,25 @@ function formatTime(date)
        var time = date.toLocaleTimeString().replace(/[\.:]00/, ''); // remove seconds from string\r
        if (time.replace(/\./, ':').split(':')[0].length < 2)\r
                time = '0' + time;\r
+\r
+       // workaround for bug introduced by Anna firmwares, which causes Date().toLocaleTimeString() to no longer return time in 12h format even though this has been defined in system settings\r
+       if (use12hoursTimeFormat && time.toLowerCase().indexOf('am') == -1 && time.toLowerCase().indexOf('pm') == -1) { \r
+               var hour = date.getHours();\r
+               var minute = date.getMinutes();\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 + ":" + minute + " " + ap;\r
+       }\r
+       \r
        if (config['showNowAsText'].Value && date.getTime() == now.getTime())\r
                time = '<span class="now">' + config['nowText'].Value + '</span>';\r
        return time;\r
@@ -695,23 +719,26 @@ function updateData()
                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
@@ -893,6 +920,8 @@ function updateData()
                        }\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
@@ -1687,15 +1716,15 @@ function log(message)
 \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