]> code.delx.au - comingnext/blobdiff - comingNext/index.html
* made link to homepage clickable
[comingnext] / comingNext / index.html
index 1afd1a098a56967225bcdbf48defdc94378c7c71..e8a48400f9dd05b38f3c9cee1437871ab484c19b 100644 (file)
@@ -49,6 +49,7 @@ var config = {
        enableDaylightSaving: { Type: 'Bool', Default: true, Value: true,},\r
        daylightSavingOffset: { Type: 'Int', Default: 1, Value: 1,},\r
        hideWidgetOnCalendarOpen: { Type: 'Bool', Default: false, Value: false,},\r
+       showCalendarIndicator: { Type: 'Bool', Default: true, Value: true,},\r
        cssStyle_background: { Type: 'String', Default: 'color:#ffffff; background-color:#000000', Value: 'color:#ffffff; background-color:#000000',},\r
        cssStyle_backgroundFullscreen: { Type: 'String', Default: 'color:#ffffff; background-color:#000000', Value: 'color:#ffffff; background-color:#000000',},\r
        cssStyle_weekDay: { Type: 'String', Default: '', Value: '',},\r
@@ -60,6 +61,12 @@ var config = {
        cssStyle_description: { Type: 'String', Default: '', Value: '',},\r
        cssStyle_icon: { Type: 'String', Default: 'width:15px; height:15px', Value: 'width:15px; height:15px',},\r
        cssStyle_overdue: { Type: 'String', Default: 'color:#ffff00', Value: 'color:#ffff00',},\r
+       cssStyle_calendar1: { Type: 'String', Default: 'background-color:#800000', Value: 'background-color:#800000',},\r
+       cssStyle_calendar2: { Type: 'String', Default: 'background-color:#ff0000', Value: 'background-color:#ff0000',},\r
+       cssStyle_calendar3: { Type: 'String', Default: 'background-color:#808000', Value: 'background-color:#808000',},\r
+       cssStyle_calendar4: { Type: 'String', Default: 'background-color:#ffff00', Value: 'background-color:#ffff00',},\r
+       cssStyle_calendar5: { Type: 'String', Default: 'background-color:#008000', Value: 'background-color:#008000',},\r
+       cssStyle_calendar6: { Type: 'String', Default: 'background-color:#008080', Value: 'background-color:#008080',},\r
 }\r
 \r
 \r
@@ -81,6 +88,7 @@ var settingsCalEntryId = null;
 var settingsCache = null;\r
 var notificationRequests = new Array();\r
 var calendarList = [];\r
+var calendarColors = [];\r
 \r
 // vars for daylight saving time\r
 var summertime = false; // true, if current date is in summer, false if in winter\r
@@ -90,6 +98,7 @@ var daylightSavingDates = new Object(); // caches calculated DST winter and summ
 var entryFields = [\r
        "id",\r
        "Type",\r
+       "CalendarName",\r
        "Summary",\r
        "Location",\r
        "Status",\r
@@ -331,9 +340,9 @@ function cancelNotification()
                try {\r
                        var result = calendarService.IDataSource.Cancel(notificationRequests[i]);\r
                        if (result.ErrorCode)\r
-                               error('requestNotification failed with error code ' + result.ErrorCode);\r
+                               error('cancelNotification failed with error code ' + result.ErrorCode);\r
                } catch (e) {\r
-                       error("requestNotification: " + e + ', line ' + e.line);\r
+                       error("cancelNotification: " + e + ', line ' + e.line);\r
                }\r
        }\r
 }\r
@@ -501,6 +510,7 @@ function updateData()
        var newCalendarList = listCalendars();\r
        if (newCalendarList.length != calendarList.length) {\r
                calendarList = newCalendarList;\r
+               updateCalendarColors();\r
                cancelNotification();\r
                requestNotification();\r
        }\r
@@ -710,7 +720,11 @@ function updateData()
                                }\r
 \r
                                // generate html output\r
-                               entriesHtml += '<tr><td><img class="icon" src="' + entry.Type + '.png" /></td>';\r
+                               entriesHtml += '<tr>';\r
+                               if (config['showCalendarIndicator'].Value && calendarList.length > 1) {\r
+                                       entriesHtml += '<td class="calendar' + calendarColors[entry.CalendarName] + '">&nbsp;</td>';\r
+                               }\r
+                               entriesHtml += '<td><img class="icon" src="' + entry.Type + '.png" /></td>';\r
                                if(date == null) {\r
                                        // some languages have very strange locale date formats, can't parse all those. Also some todos don't have dates at all.\r
                                        entriesHtml += '<td colspan="4"><span class="date">' + entryDate + '</span> ';\r
@@ -813,6 +827,7 @@ function init()
 \r
        calendarList = listCalendars();\r
        loadSettings();\r
+       updateCalendarColors();\r
        collectLocales();\r
        //updateData();\r
        requestNotification();\r
@@ -1359,6 +1374,17 @@ function sortCalendarEntries(a, b)
        return 0;\r
 }\r
 \r
+function updateCalendarColors()\r
+{\r
+       calendarColors = [];\r
+       if (calendarList.length > 6) {\r
+               console.info("updateCalendarColors(): Warning: more calendars than available indicator colors");\r
+       }\r
+       for(var i=0; i < calendarList.length; i++) {\r
+               calendarColors[calendarList[i]] = (i % 6) + 1;\r
+       }\r
+}\r
+\r
 </script>\r
 \r
 <style type="text/css">\r
@@ -1406,7 +1432,7 @@ hr { color:#ffffff; background-color:#ffffff; height:1px; text-align:left; borde
                <p class="credits">Flavio Nathan (portuguese-brazilian translation)</p>\r
                <p class="credits">Tokeda (russian translation)</p>\r
        <p>This software is open source and licensed under the GPLv3.</p>\r
-       <p>Visit sourceforge.net/projects/comingnext for free updates.</p>\r
+       <p>Visit <a href="http://sourceforge.net/projects/comingnext">sourceforge.net/projects/comingnext</a> for free updates.</p>\r
        <hr />\r
 </div>\r
 <div id="updateView" style="display:none">\r