X-Git-Url: https://code.delx.au/comingnext/blobdiff_plain/a4b0671b585a25871fac3f23b69b2fbe1ad3b7fa..c6d28755aa280795cfa8a12285f929d40e475e1c:/comingNext/index.html diff --git a/comingNext/index.html b/comingNext/index.html index 5f84537..abc25fd 100644 --- a/comingNext/index.html +++ b/comingNext/index.html @@ -60,6 +60,7 @@ var config = { showCalendarIndicator: { Type: 'Bool', Default: true, Value: true,}, excludedCalendars: { Type: 'Array', Default: [], Value: [],}, enableLogging: { Type: 'Bool', Default: false, Value: false,}, + anonymizeLogging: { Type: 'Bool', Default: false, Value: false,}, cssStyle_background: { Type: 'String', Default: 'color:#ffffff; background-color:#000000', Value: 'color:#ffffff; background-color:#000000',}, cssStyle_backgroundFullscreen: { Type: 'String', Default: 'color:#ffffff; background-color:#000000', Value: 'color:#ffffff; background-color:#000000',}, cssStyle_weekDay: { Type: 'String', Default: '', Value: '',}, @@ -1618,6 +1619,12 @@ function listToArray(list, calendarName) if (!itemCopy['CalendarName']) { itemCopy['CalendarName'] = calendarName; } + if (config['anonymizeLogging'].Value && config['enableLogging'].Value) { + if (itemCopy['Summary']) + itemCopy['Summary'] = getHashForString(itemCopy['Summary']); + if (itemCopy['Location']) + itemCopy['Location'] = getHashForString(itemCopy['Location']); + } array.push(itemCopy); txt += array[array.length - 1].Summary + ", "; } @@ -1752,6 +1759,17 @@ function getDefaultFontSize() return defaultFontSize; } +function getHashForString(string) +{ + // cheap hashing, loosly based on Java's String.hashCode() + for (var hash = 0, i = 0; i < string.length; i++) + hash = (hash << 5) - hash + string.charCodeAt(i); + hash = hash & hash; // Convert to 32bit integer + if (hash < 0) + hash = -hash; + return hash.toString(16).toUpperCase(); +} +