]> code.delx.au - comingnext/blobdiff - comingNext/index.html
added option to anonymize debug logfiles
[comingnext] / comingNext / index.html
index 3016c5d5c6e5ee800ef6fdc2cd9cc5ef7de8f780..abc25fd051ae52d4f80860abf259cc9280bc65fb 100644 (file)
@@ -60,6 +60,7 @@ var config = {
        showCalendarIndicator: { Type: 'Bool', Default: true, Value: true,},\r
        excludedCalendars: { Type: 'Array', Default: [], Value: [],},\r
        enableLogging: { Type: 'Bool', Default: false, Value: false,},\r
+       anonymizeLogging: { Type: 'Bool', Default: false, Value: false,},\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
@@ -741,14 +742,14 @@ function updateData()
                if (mode == 0) {\r
                        if (config['fontsize'].Value == config['fontsize'].ValidValues[0]) {\r
                                fontsize = parseInt(72 / config['eventsPerWidget'].Value) + 'px';\r
-                               lineheight = parseInt(82 / config['eventsPerWidget'].Value) + 'px';\r
+                               lineheight = parseInt(72 / config['eventsPerWidget'].Value) + 'px';\r
                        }\r
                }\r
                if (config['fontsize'].Value != config['fontsize'].ValidValues[0]) {\r
                        fontsize = config['fontsize'].Value + 'px';\r
                        lineheight = fontsize;\r
                }\r
-               changeCssClass('.icon', config['cssStyle_icon'].Value + '; width:' + lineheight + '; height:' + lineheight + ';');\r
+               changeCssClass('.icon', config['cssStyle_icon'].Value + '; width:' + fontsize + '; height:' + 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
@@ -893,7 +894,7 @@ function updateData()
                                // generate html output\r
                                entriesHtml += '<tr>';\r
                                if (config['showCalendarIndicator'].Value && calendarList.length - config['excludedCalendars'].Value.length > 1) {\r
-                                       entriesHtml += '<td><span class="calendar' + calendarColors[entry.CalendarName] + '">&nbsp;</span></td>';\r
+                                       entriesHtml += '<td><div class="calendar' + calendarColors[entry.CalendarName] + '" style="height:' + (lineheight.split("px")[0] - 1) + 'px; width:4px;"></div></td>';\r
                                }\r
                                if (config['showIcons'].Value)\r
                                        entriesHtml += '<td><img class="icon" align="top" src="' + entry.Type + '.png" /></td>';\r
@@ -1618,6 +1619,12 @@ function listToArray(list, calendarName)
                if (!itemCopy['CalendarName']) {\r
                        itemCopy['CalendarName'] = calendarName;\r
                }\r
+               if (config['anonymizeLogging'].Value && config['enableLogging'].Value) {\r
+                       if (itemCopy['Summary'])\r
+                               itemCopy['Summary'] = getHashForString(itemCopy['Summary']);\r
+                       if (itemCopy['Location'])\r
+                               itemCopy['Location'] = getHashForString(itemCopy['Location']);\r
+               }\r
                array.push(itemCopy);\r
                txt += array[array.length - 1].Summary + ", ";\r
        }\r
@@ -1752,12 +1759,23 @@ function getDefaultFontSize()
        return defaultFontSize;\r
 }\r
 \r
+function getHashForString(string)\r
+{\r
+       // cheap hashing, loosly based on Java's String.hashCode()\r
+       for (var hash = 0, i = 0; i < string.length; i++)\r
+               hash = (hash << 5) - hash + string.charCodeAt(i);\r
+       hash = hash & hash; // Convert to 32bit integer\r
+       if (hash < 0)\r
+               hash = -hash;\r
+       return hash.toString(16).toUpperCase();\r
+}\r
+\r
 </script>\r
 \r
 <style type="text/css">\r
 a { color:#aaccff }\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
+td { padding:0px 5px 0px 0px; white-space:nowrap; overflow:visible; 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