X-Git-Url: https://code.delx.au/comingnext/blobdiff_plain/acfbf19b3369a48d769521ffd226ca9bfbc9da68..7462eb0578c84056fb0934aa0cbd1acb4873a993:/comingNext/index.html diff --git a/comingNext/index.html b/comingNext/index.html index 8241fe9..f30cb7d 100644 --- a/comingNext/index.html +++ b/comingNext/index.html @@ -83,7 +83,7 @@ var config = { // Nothing of interest from here on... //------------------------------------------------------- var panelNum = 0; // use 1 for second panel -var version = "1.34"; +var version = "1.37"; var versionURL = "http://comingnext.sourceforge.net/version.xml"; var calendarService = null; var cacheEntriesHtml = []; @@ -107,6 +107,7 @@ var errorOccured = false; var entryLists = null; // stores all fetched calendar entries until data is refreshed 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. var use12hoursTimeFormat = false; // defines how time should be formated: 19:00 or 07:00 pm +var timeFormatSeparator = ":"; // format time 19:00 or 19.00 depending on system setting // vars for daylight saving time var summertime = false; // true, if current date is in summer, false if in winter @@ -346,6 +347,7 @@ function collectLocales() var curWeekday = ""; while (weekdaylist && (entry = weekdaylist.getNext()) != undefined) { + detectTimeFormat(entry.StartTime + ''); curWeekday = (entry.StartTime + '').split(',')[0]; log(entry.StartTime + ' -> ' + curWeekday + ' ' + counter2); ids[counter + counter2] = entry.id; @@ -373,6 +375,19 @@ function collectLocales() } } +function stringEndsWith(str, suffix) +{ + return str.indexOf(suffix, str.length - suffix.length) !== -1; +} + +// detects the system's current time format by parsing a native calendar timestamp (this is the only reliable formating across all devices and firmwares) +function detectTimeFormat(localeTimeString) +{ + localeTimeString = localeTimeString.toLowerCase(); + use12hoursTimeFormat = stringEndsWith(localeTimeString, "am") || stringEndsWith(localeTimeString, "pm"); + timeFormatSeparator = localeTimeString.indexOf(":") != -1 ? ":" : "."; +} + function requestNotification() { var criteria = new Object(); @@ -492,10 +507,6 @@ function parseDate(dateString) if (dateArr.length == 6 && dateArr[5].toLowerCase() == 'am' && hours == 12) hours = 0; - // remember if date was formated using 12h time format, we need to use this information later when formating time - if (dateArr.length == 6 && (dateArr[5].toLowerCase() == 'am' || dateArr[5].toLowerCase() == 'pm')) - use12hoursTimeFormat = true; - result = new Date(year, month - 1, day, hours, minutes, seconds); } @@ -521,7 +532,7 @@ function parseDate(dateString) function getWeekdayLocalized(date) { var localizedString = date.toLocaleDateString(); - if (localizedString.match(/\d\d.\d\d.\d\d/)) { + if (localizedString.indexOf(",") == -1) { return weekdays_translated[date.getDay()]; } else return localizedString.split(',')[0]; @@ -593,15 +604,11 @@ function formatDate(date, format) function formatTime(date) { // date is a Date() object - date.setSeconds(0); // we don't care about seconds - var time = date.toLocaleTimeString().replace(/[\.:]00/, ''); // remove seconds from string - if (time.replace(/\./, ':').split(':')[0].length < 2) - time = '0' + time; - - // 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 - if (use12hoursTimeFormat && time.toLowerCase().indexOf('am') == -1 && time.toLowerCase().indexOf('pm') == -1) { - var hour = date.getHours(); - var minute = date.getMinutes(); + var hour = date.getHours(); + var minute = date.getMinutes(); + + // don't use Date().toLocaleTimeString() as it is utterly broken on newer firmwares + if (use12hoursTimeFormat) { var ap = "AM"; if (hour > 11) ap = "PM"; @@ -613,11 +620,19 @@ function formatTime(date) hour = "0" + hour; if (minute < 10) minute = "0" + minute; - time = hour + ":" + minute + " " + ap; + time = hour + timeFormatSeparator + minute + " " + ap; + } + else { + if (hour < 10) + hour = "0" + hour; + if (minute < 10) + minute = "0" + minute; + time = hour + timeFormatSeparator + minute; } if (config['showNowAsText'].Value && date.getTime() == now.getTime()) time = '' + config['nowText'].Value + ''; + log("formatTime(): " + time + ", use12hoursTimeFormat=" + use12hoursTimeFormat + ", timeFormatSeparator=" + timeFormatSeparator + ", date.toLocateTimeString(): " + date.toLocaleTimeString()); return time; } @@ -926,6 +941,7 @@ function updateData() var text = config['nothingText'].Value.replace(/%d/, config['monthRange'].Value); entriesHtml = '
' + text + '
'; } + log("output: " + entriesHtml); if (cacheEntriesHtml != entriesHtml) { if (mode == 0) document.getElementById('calendarList').innerHTML = entriesHtml; @@ -944,16 +960,21 @@ function updateData() // called by handleOnShow() and onResize events function updateScreen() { - log('updateScreen()'); + log('updateScreen(): mode=' + mode + ', window.innerHeight=' + window.innerHeight); // check if opening fullscreen - if( window.innerHeight > 91 && mode == 0) { + + // Note: according to Nokia's documentation, an innerHeight of >91 is an indicator for fullscreen view. + // However a bug in E6's firmware causes different window widths and heights (disabled compatibility scaling). + // So far, values of 104 and 115 for window.innerHeight were reported, we use a safty margin here and check + // for 150 instead. + if( window.innerHeight > 150 && mode == 0) { mode = 1; cacheEntriesHtml = ''; document.getElementById('body').style.backgroundImage = ""; showFullscreen(); } - else if (window.innerHeight <= 91 && mode != 0) { + else if (window.innerHeight <= 150 && mode != 0) { mode = 0; cacheEntriesHtml = ''; showHomescreen(); @@ -1284,7 +1305,7 @@ function loadSettings() log('Warning: unknown or invalid setting: ' + stringlist[i]); continue; } - log('stringlist: ' + key + '=\'' + value + '\''); + log('stringlist[' + i + ']: ' + key + '=\'' + value + '\''); if (config[key].Type == 'Int') { config[key].Value = Number(value); if (isNaN(config[key].Value)) @@ -1376,7 +1397,7 @@ function printHintBox(text) { uniqueId++; return '' + getLocalizedText('settings.help') + ''+ - '
' + text + '
'; + ''; } function showAbout() @@ -1756,11 +1777,15 @@ hr { color:#ffffff; background-color:#ffffff; height:1px; text-align:left; borde

Contributions:

Paul Moore (bug fixes, new features and code cleanup)

Manfred Hanselmann (DST support)

-

Christophe Milsent (translation support & french translation)

-

Flavio Nathan (portuguese-brazilian translation)

-

Tokeda (russian translation)

-

Marcella Ferrari (italian translation)

-

Venos (italian translation)

+

Christophe Milsent (translation support & French translation)

+

Flavio Nathan (Portuguese-Brazilian translation)

+

Tokeda (Russian translation)

+

Marcella Ferrari (Italian translation)

+

Venos (Italian translation)

+

Francisco Rodero (Catalan translation)

+

zbigzbig20 (Polish translation)

+

Streamkeskus (Finnish translation)

+

renek (Czech translation)

This software is open source and licensed under the GPLv3.

Visit comingnext.sf.net for free updates.