]> code.delx.au - comingnext/blobdiff - comingNext/index.html
reduced overall widget height available for text (72 instead of 82 pixels) to give...
[comingnext] / comingNext / index.html
index 1e2f2a337b89ea7c63130de532e8377b41e42c3c..5f845372823a4eb7173b99a7b7ce8e7ec362f2ab 100644 (file)
 .calendar6 { background-color:#9fdf57 }\r
 </style>\r
 \r
-<script type="text/javascript" src="localizedTextStrings.js" charset="utf-8" />\r
-\r
-<script>\r
+<script type="text/javascript" src="localizedTextStrings.js" charset="utf-8"></script>\r
+<script type="text/javascript" src="../debug.js" charset="utf-8"></script>\r
+<script type="text/javascript">\r
 // valid types for the config object are 'Int', 'Bool', 'String', 'Enum', 'UID', 'Array'\r
 var config = {\r
+       fontsize: { Type: 'Enum', Default: 'auto', Value: 'auto', ValidValues: ['auto', '8', '9', '10', '11', '12', '13', '14', '15', '16', '17', '18', '19', '20', '21', '22', '23', '24', '25', '26', '27', '28'],},\r
+       eventsPerWidget: { Type: 'Int', Default: 4, Value: 4,},\r
        monthRange: { Type: 'Int', Default: 2, Value: 2,},\r
        includeTodos: { Type: 'Bool', Default: true, Value: true,},\r
        useBackgroundImage: { Type: 'Bool', Default: true, Value: true,},\r
        backgroundImageLocation: { Type: 'Enum', Default: 'internal', Value: 'internal', ValidValues: ['internal', 'external']},\r
        showCombinedDateTime: { Type: 'Bool', Default: false, Value: false,},\r
        showLocation: { Type: 'Bool', Default: true, Value: true,},\r
+       showIcons: { Type: 'Bool', Default: true, Value: true,},\r
        showTodayAsText: { Type: 'Bool', Default: true, Value: true,},\r
        todayText: { Type: 'String', Default: getLocalizedText('settings.default.todayText'), Value: getLocalizedText('settings.default.todayText'),},\r
        tomorrowText: { Type: 'String', Default: getLocalizedText('settings.default.tomorrowText'), Value: getLocalizedText('settings.default.tomorrowText'),},\r
@@ -49,7 +52,6 @@ var config = {
        weekDayLength: { Type: 'Int', Default: 2, Value: 2,},\r
        updateDataInterval: { Type: 'Int', Default: 5, Value: 5,},\r
        calendarApp: { Type: 'UID', Default: 0x10005901, Value: 0x10005901,},\r
-       eventsPerWidget: { Type: 'Int', Default: 4, Value: 4,},\r
        showNothingText: { Type: 'Bool', Default: true, Value: true,},\r
        nothingText: { Type: 'String', Default: getLocalizedText('settings.default.nothingText'), Value: getLocalizedText('settings.default.nothingText'),},\r
        enableDaylightSaving: { Type: 'Bool', Default: true, Value: true,},\r
@@ -67,7 +69,7 @@ var config = {
        cssStyle_time: { Type: 'String', Default: '', Value: '',},\r
        cssStyle_now: { Type: 'String', Default: 'color:#ff00ff', Value: 'color:#ff00ff',},\r
        cssStyle_description: { Type: 'String', Default: '', Value: '',},\r
-       cssStyle_icon: { Type: 'String', Default: 'width:15px; height:15px', Value: 'width:15px; height:15px',},\r
+       cssStyle_icon: { Type: 'String', Default: '', Value: '',},\r
        cssStyle_overdue: { Type: 'String', Default: 'color:#ffff00', Value: 'color:#ffff00',},\r
        cssStyle_calendar1: { Type: 'String', Default: 'background-color:#0757cf', Value: 'background-color:#0757cf',},\r
        cssStyle_calendar2: { Type: 'String', Default: 'background-color:#579f37', Value: 'background-color:#579f37',},\r
@@ -108,6 +110,7 @@ var entryLists = null; // stores all fetched calendar entries until data is refr
 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.\r
 var use12hoursTimeFormat = false; // defines how time should be formated: 19:00 or 07:00 pm\r
 var timeFormatSeparator = ":"; // format time 19:00 or 19.00 depending on system setting\r
+var defaultFontSize = null; // default browser font size will be set by init\r
 \r
 // vars for daylight saving time\r
 var summertime = false; // true, if current date is in summer, false if in winter\r
@@ -733,24 +736,19 @@ function updateData()
                var counter = 0;\r
                var entryDate = '';\r
                var dateArr = [];\r
-               var fontsize = 'normal';\r
-               var lineheight = 'normal';\r
+               var fontsize = getDefaultFontSize()[1] + 'px';\r
+               var lineheight = fontsize;\r
                if (mode == 0) {\r
-                       fontsize = parseInt(72 / config['eventsPerWidget'].Value) + 'px';\r
-                       lineheight = parseInt(82 / config['eventsPerWidget'].Value) + 'px';\r
-                       \r
-                       if (config['eventsPerWidget'].Value == 3) {\r
-                               changeCssClass('.icon', 'width:20px; height:20px');\r
-                       }\r
-                       else if (config['eventsPerWidget'].Value == 5) {\r
-                               changeCssClass('.icon', 'width:10px; height:10px');\r
-                       }\r
-                       else if (config['eventsPerWidget'].Value == 6) {\r
-                               changeCssClass('.icon', 'width:8px; height:8px');\r
+                       if (config['fontsize'].Value == config['fontsize'].ValidValues[0]) {\r
+                               fontsize = parseInt(72 / config['eventsPerWidget'].Value) + 'px';\r
+                               lineheight = parseInt(72 / config['eventsPerWidget'].Value) + 'px';\r
                        }\r
                }\r
-               else\r
-                       changeCssClass('.icon', config['cssStyle_icon'].Value);\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:' + 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
@@ -895,9 +893,12 @@ 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
-                               entriesHtml += '<td><img class="icon" src="' + entry.Type + '.png" /></td>';\r
+                               if (config['showIcons'].Value)\r
+                                       entriesHtml += '<td><img class="icon" align="top" src="' + entry.Type + '.png" /></td>';\r
+                               else\r
+                                       entriesHtml += '<td style="padding:0px;"></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
@@ -1170,8 +1171,12 @@ function showSettings()
                        settingsHtml += '<table><tr><td>' + getLocalizedText('settings.name.' + key) + '<br /><input class="textInput" name="settings.' + key + '" type="text" value="0x' + config[key].Value.toString(16) + '" /></td>' + printHintBox(getLocalizedText('settings.info.' + key)) + '<hr />';\r
                else if (config[key].Type == 'Enum') {\r
                        settingsHtml += '<table><tr><td>' + getLocalizedText('settings.name.' + key) + '<br /><select name="settings.' + key + '" size="1">';\r
-                       for(var i = 0; i < config[key].ValidValues.length; i++)\r
-                               settingsHtml += '<option value="' + config[key].ValidValues[i] + '"' + (config[key].Value == config[key].ValidValues[i] ? ' selected="selected"' : '') + '>' + getLocalizedText('settings.validValues.' + key + '.' + config[key].ValidValues[i]) + '</option>';\r
+                       for(var i = 0; i < config[key].ValidValues.length; i++) {\r
+                               var text = getLocalizedText('settings.validValues.' + key + '.' + config[key].ValidValues[i]);\r
+                               if (text.indexOf('ERROR') == 0)\r
+                                       text = config[key].ValidValues[i];\r
+                               settingsHtml += '<option value="' + config[key].ValidValues[i] + '"' + (config[key].Value == config[key].ValidValues[i] ? ' selected="selected"' : '') + '>' + text + '</option>';\r
+                       }\r
                        settingsHtml += '</select></div></td>' + printHintBox(getLocalizedText('settings.info.' + key)) + '<hr />';\r
                }\r
                else if (config[key].Type == 'Array') {\r
@@ -1397,7 +1402,7 @@ function printHintBox(text)
 {\r
        uniqueId++;\r
        return '<td width="1%" align="right" onclick="javascript:toggleVisibility(\'info' + uniqueId + '\')">' + getLocalizedText('settings.help') + '</td></tr></table>'+\r
-              '<div class="settingsInfo" id="info' + uniqueId + '">' + text + '</div>';\r
+              '<div class="settingsInfo" id="info' + uniqueId + '" style="display:none">' + text + '</div>';\r
 }\r
 \r
 function showAbout()\r
@@ -1527,7 +1532,6 @@ function checkForUpdate()
        reqV.onreadystatechange = checkForUpdateCallback;\r
        document.getElementById("updateDiv").innerHTML = getLocalizedText("update.checking");\r
        reqV.open("GET", versionURL, true);\r
-       reqV.setRequestHeader( "If-Modified-Since", "Sat, 1 Jan 2000 00:00:00 GMT" ); // disable caching\r
        reqV.send(null);\r
 }\r
 \r
@@ -1733,12 +1737,27 @@ function log(message)
        }\r
 }\r
 \r
+function getDefaultFontSize()\r
+{\r
+       if (defaultFontSize == null) {\r
+               var pa = document.body;\r
+               var who = document.createElement('div');\r
+               who.className = 'defaultEm';\r
+               who.appendChild(document.createTextNode('M'));\r
+               pa.appendChild(who);\r
+               var fs = [who.offsetWidth, who.offsetHeight];\r
+               pa.removeChild(who);\r
+               defaultFontSize = fs;\r
+       }\r
+       return defaultFontSize;\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
@@ -1749,6 +1768,7 @@ hr { color:#ffffff; background-color:#ffffff; height:1px; text-align:left; borde
 #name { text-align:center; }\r
 #appicon { display: block; margin-left: auto; margin-right: auto; margin-top: 10px; }\r
 #smallappicon { width:22px; height:22px; margin-right:10px; float:left; }\r
+.defaultEm { font-size:1em; position:absolute; line-height:1; padding:0; visibility:hidden; } \r
 </style>\r
 \r
 </head>\r