X-Git-Url: https://code.delx.au/comingnext/blobdiff_plain/7b49858cd1fcb737295bcba3d1bff3ee59c7b78b..648a1b872ec560997b5e355bd654477d2ef09faf:/comingNext/index.html diff --git a/comingNext/index.html b/comingNext/index.html index b722479..334814c 100644 --- a/comingNext/index.html +++ b/comingNext/index.html @@ -17,6 +17,7 @@ .now { } .description { } .icon { } +.overdue {} @@ -35,6 +36,8 @@ var config = { tomorrowText: { Type: 'String', Default: getLocalizedText('settings.default.tomorrowText'), Value: getLocalizedText('settings.default.tomorrowText'),}, showNowAsText: { Type: 'Bool', Default: true, Value: true,}, nowText: { Type: 'String', Default: getLocalizedText('settings.default.nowText'), Value: getLocalizedText('settings.default.nowText'),}, + markOverdueTodos: { Type: 'Bool', Default: true, Value: true,}, + overdueText: {Type: 'String', Default: getLocalizedText('settings.default.overdueText'), Value: getLocalizedText('settings.default.overdueText'),}, dateSeparator: { Type: 'String', Default: getLocalizedText('settings.default.dateSeparator'), Value: getLocalizedText('settings.default.dateSeparator'),}, dateFormat: { Type: 'Enum', Default: 'auto', Value: 'auto', ValidValues: ['auto', 'DDMM', 'MMDD'],}, weekDayLength: { Type: 'Int', Default: 2, Value: 2,}, @@ -55,6 +58,7 @@ var config = { cssStyle_now: { Type: 'String', Default: 'color:#ff00ff', Value: 'color:#ff00ff',}, cssStyle_description: { Type: 'String', Default: '', Value: '',}, cssStyle_icon: { Type: 'String', Default: 'width:15px; height:15px', Value: 'width:15px; height:15px',}, + cssStyle_overdue: { Type: 'String', Default: 'color:#ffff00', Value: 'color:#ffff00',}, } @@ -150,25 +154,28 @@ function error(message) document.getElementById("calendarList").innerHTML = 'Error: ' + message; } -function isToday(date) +function areDatesEqual(date1, date2) { - if (date.getFullYear() == now.getFullYear() && date.getMonth() == now.getMonth() && date.getDate() == now.getDate()) - return true; - return false; + return (date1.getFullYear() == date2.getFullYear() && + date1.getMonth() == date2.getMonth() && + date1.getDate() == date2.getDate()); } function isTomorrow(date) { - var tomorrow = new Date (now.getTime() + 24 * 60 * 60 * 1000); - if (date.getFullYear() == tomorrow.getFullYear() && date.getMonth() == tomorrow.getMonth() && date.getDate() == tomorrow.getDate()) - return true; - else - return false; + // tommorow = now + 1 day + // ToDo: some days can be shorter as 24 hours(daylight saving change day) + return areDatesEqual(date, new Date (now.getTime() + 24*60*60*1000)); +} + +function isToday(date) +{ + return areDatesEqual(date, now); } function collectLocales() { - var tmpyear = ((panelNum == 0) ? 2000 : 2001); + var tmpyear = 2000 + panelNum; var month = 0; if (months_translated.length > 0) @@ -465,11 +472,28 @@ function updateData() var counter = 0; var entryDate = ''; var dateArr = []; - var entriesHtml = '
'; @@ -585,7 +619,10 @@ function updateData() var weekDay = date.toLocaleDateString().substr(0,config['weekDayLength'].Value); var time = formatTime(date); var dateStr = formatDate(date, entryDate); - if (entry.Type == 'ToDo' || entry.Type == 'Anniversary' || entry.Type == 'DayEvent' || entry.Type == 'Reminder') { + if (entry.Type == 'ToDo' && overdue && config['markOverdueTodos'].Value) { + dateStr = 'Overdue'; + entriesHtml += ' | ' + dateStr + ' '; + } else if (entry.Type == 'ToDo' || entry.Type == 'Anniversary' || entry.Type == 'DayEvent' || entry.Type == 'Reminder') { if ((isToday(date) || isTomorrow(date)) && config['showTodayAsText'].Value) // show weekday if the date string is not text. looks odd otherwise entriesHtml += ' | ' + dateStr + ' '; else |