From 935f4132abacbfef573eb6c59fe9f8e2ee58c25d Mon Sep 17 00:00:00 2001 From: "Ashley M. Kirchner" Date: Tue, 10 May 2016 00:46:21 -0600 Subject: [PATCH 1/3] Filemode changes? --- js/electron.js | 0 modules/default/alert/classie.js | 0 modules/default/alert/modernizr.custom.js | 0 modules/default/alert/ns-default.css | 0 modules/default/calendar/vendor/ical.js/ical.js | 0 .../default/calendar/vendor/ical.js/test/test.js | 0 .../default/calendar/vendor/ical.js/test/test7.ics | 0 vendor/weather-icons/weather-icons.css | 0 .../weather-icons/weathericons-regular-webfont.eot | Bin .../weather-icons/weathericons-regular-webfont.svg | 0 .../weather-icons/weathericons-regular-webfont.ttf | Bin .../weather-icons/weathericons-regular-webfont.woff | Bin 12 files changed, 0 insertions(+), 0 deletions(-) mode change 100755 => 100644 js/electron.js mode change 100755 => 100644 modules/default/alert/classie.js mode change 100755 => 100644 modules/default/alert/modernizr.custom.js mode change 100755 => 100644 modules/default/alert/ns-default.css mode change 100755 => 100644 modules/default/calendar/vendor/ical.js/ical.js mode change 100755 => 100644 modules/default/calendar/vendor/ical.js/test/test.js mode change 100755 => 100644 modules/default/calendar/vendor/ical.js/test/test7.ics mode change 100755 => 100644 vendor/weather-icons/weather-icons.css mode change 100755 => 100644 vendor/weather-icons/weathericons-regular-webfont.eot mode change 100755 => 100644 vendor/weather-icons/weathericons-regular-webfont.svg mode change 100755 => 100644 vendor/weather-icons/weathericons-regular-webfont.ttf mode change 100755 => 100644 vendor/weather-icons/weathericons-regular-webfont.woff diff --git a/js/electron.js b/js/electron.js old mode 100755 new mode 100644 diff --git a/modules/default/alert/classie.js b/modules/default/alert/classie.js old mode 100755 new mode 100644 diff --git a/modules/default/alert/modernizr.custom.js b/modules/default/alert/modernizr.custom.js old mode 100755 new mode 100644 diff --git a/modules/default/alert/ns-default.css b/modules/default/alert/ns-default.css old mode 100755 new mode 100644 diff --git a/modules/default/calendar/vendor/ical.js/ical.js b/modules/default/calendar/vendor/ical.js/ical.js old mode 100755 new mode 100644 diff --git a/modules/default/calendar/vendor/ical.js/test/test.js b/modules/default/calendar/vendor/ical.js/test/test.js old mode 100755 new mode 100644 diff --git a/modules/default/calendar/vendor/ical.js/test/test7.ics b/modules/default/calendar/vendor/ical.js/test/test7.ics old mode 100755 new mode 100644 diff --git a/vendor/weather-icons/weather-icons.css b/vendor/weather-icons/weather-icons.css old mode 100755 new mode 100644 diff --git a/vendor/weather-icons/weathericons-regular-webfont.eot b/vendor/weather-icons/weathericons-regular-webfont.eot old mode 100755 new mode 100644 diff --git a/vendor/weather-icons/weathericons-regular-webfont.svg b/vendor/weather-icons/weathericons-regular-webfont.svg old mode 100755 new mode 100644 diff --git a/vendor/weather-icons/weathericons-regular-webfont.ttf b/vendor/weather-icons/weathericons-regular-webfont.ttf old mode 100755 new mode 100644 diff --git a/vendor/weather-icons/weathericons-regular-webfont.woff b/vendor/weather-icons/weathericons-regular-webfont.woff old mode 100755 new mode 100644 From a4c02cef5474874d151e96b6a9540aad1447090b Mon Sep 17 00:00:00 2001 From: "Ashley M. Kirchner" Date: Tue, 10 May 2016 01:01:00 -0600 Subject: [PATCH 2/3] Absolute or Relative time display on Calendar module User can now choose between an 'absolute' or 'relative time display on events. Furthermore, when set to 'absolute', there's an option to set an 'urgency' range of days and only those events within that period will be displayed with a relative time (in x days) while all others will have an absolute date. --- modules/default/calendar/README.md | 18 +++++++++++++ modules/default/calendar/calendar.js | 40 +++++++++++++++++++++++----- 2 files changed, 52 insertions(+), 6 deletions(-) diff --git a/modules/default/calendar/README.md b/modules/default/calendar/README.md index 00378263..d5a9f122 100644 --- a/modules/default/calendar/README.md +++ b/modules/default/calendar/README.md @@ -120,6 +120,24 @@ The following properties can be configured:
Default value: false + + timeFormat + How to display the time on calendar events
+ +
Possible values: relative or absolute +
Default value: relative + + + + urgency + When .timeFormat is set to absolute, this option allows you to set a specific number of days from now to display as relative.
+ For example, if urgency is set to 5, any events happening within those 5 days will be displayed as 'in x days'.
+ Any events outside of the urgency range will be displayed with an absolute date.
+ +
Possible values: positive integer for example 5 (for 5 days) +
Default value: 0 + + diff --git a/modules/default/calendar/calendar.js b/modules/default/calendar/calendar.js index 2d494499..4f65bf6a 100644 --- a/modules/default/calendar/calendar.js +++ b/modules/default/calendar/calendar.js @@ -21,6 +21,8 @@ Module.register("calendar",{ fetchInterval: 5 * 60 * 1000, // Update every 5 minutes. animationSpeed: 2000, fade: true, + urgency: 7, + timeFormat: "relative", fadePoint: 0.25, // Start on 1/4th of the list. calendars: [ { @@ -139,21 +141,47 @@ Module.register("calendar",{ var timeWrapper = document.createElement("td"); //console.log(event.today); var now = new Date(); + var one_hour = 1000 * 60 * 60; + var one_day = one_hour * 24; if (event.fullDayEvent) { if (event.today) { timeWrapper.innerHTML = this.translate("TODAY"); - } else if (event.startDate - now < 24 * 60 * 60 * 1000 && event.startDate - now > 0) { + } else if (event.startDate - now < 24 * one_hour && event.startDate - now > 0) { timeWrapper.innerHTML = this.translate("TOMORROW"); } else { - timeWrapper.innerHTML = moment(event.startDate,"x").fromNow(); + if (this.config.timeFormat === "absolute") { + if ((this.config.urgency > 1) && (event.startDate - now < (this.config.urgency * one_day))) { + // This event falls within the config.urgency time frame (in days) that the user has set + timeWrapper.innerHTML = moment(event.startDate, "x").fromNow(); + } else { + timeWrapper.innerHTML = moment(event.startDate, "x").format("MMM Do"); + } + } else { + timeWrapper.innerHTML = moment(event.startDate, "x").fromNow(); + } } } else { if (event.startDate >= new Date()) { - if (event.startDate - now > 48 * 60 * 60 * 1000) { - // if the event is no longer than 2 days away, display the absolute time. - timeWrapper.innerHTML = moment(event.startDate,"x").fromNow(); + if (event.startDate - now < 2 * one_day) { + // This event is within the next 48 hours (2 days) + if (event.startDate - now < 6 * one_hour) { + // If event is within 6 hour, display 'in xxx' time format + timeWrapper.innerHTML = moment(event.startDate, "x").fromNow(); + } else { + // Otherwise just say 'Today/Tomorrow at such-n-such time' + timeWrapper.innerHTML = moment(event.startDate, "x").calendar(); + } } else { - timeWrapper.innerHTML = moment(event.startDate,"x").calendar(); + if (this.config.timeFormat === "absolute") { + if ((this.config.urgency > 1) && (event.startDate - now < (this.config.urgency * one_day))) { + // This event falls within the config.urgency time frame (in days) that the user has set + timeWrapper.innerHTML = moment(event.startDate, "x").fromNow(); + } else { + timeWrapper.innerHTML = moment(event.startDate, "x").format("MMM Do"); + } + } else { + timeWrapper.innerHTML = moment(event.startDate, "x").fromNow(); + } } } else { timeWrapper.innerHTML = this.translate("RUNNING") + ' ' + moment(event.endDate,"x").fromNow(true); From 9558616f5946a3c367cd45a9795c54d0db86a148 Mon Sep 17 00:00:00 2001 From: "Ashley M. Kirchner" Date: Tue, 10 May 2016 11:58:05 -0600 Subject: [PATCH 3/3] Minor text changes, and updating README file --- modules/default/calendar/README.md | 22 +++++++++----------- modules/default/calendar/calendar.js | 30 ++++++++++++++++++++++------ 2 files changed, 33 insertions(+), 19 deletions(-) diff --git a/modules/default/calendar/README.md b/modules/default/calendar/README.md index d5a9f122..05d12de8 100644 --- a/modules/default/calendar/README.md +++ b/modules/default/calendar/README.md @@ -115,29 +115,25 @@ The following properties can be configured: displayRepeatingCountTitle Show count title for yearly repeating events (e.g. "X. Birthday", "X. Anniversary")
-
Possible values: true or false
Default value: false - + timeFormat - How to display the time on calendar events
- -
Possible values: relative or absolute + Display event times as absolute dates, or relative time
+
Possible values: absolute or relative
Default value: relative - + urgency - When .timeFormat is set to absolute, this option allows you to set a specific number of days from now to display as relative.
- For example, if urgency is set to 5, any events happening within those 5 days will be displayed as 'in x days'.
- Any events outside of the urgency range will be displayed with an absolute date.
- -
Possible values: positive integer for example 5 (for 5 days) -
Default value: 0 + When using a timeFormat of absolute, the urgency setting allows you to display events within a specific time frame as relative + This allows events within a certain time frame to be displayed as relative (in xx days) while others are displayed as absolute dates
+
Possible values: a positive integer representing the number of days for which you want a relative date, for example 7 (for 7 days)
+
Default value: 0 (disabled) - + diff --git a/modules/default/calendar/calendar.js b/modules/default/calendar/calendar.js index 4f65bf6a..f5c2d3f6 100644 --- a/modules/default/calendar/calendar.js +++ b/modules/default/calendar/calendar.js @@ -14,7 +14,7 @@ Module.register("calendar",{ maximumEntries: 10, // Total Maximum Entries maximumNumberOfDays: 365, displaySymbol: true, - defaultSymbol: "calendar", // Fontawsome Symbol see http://fontawesome.io/cheatsheet/ + defaultSymbol: "calendar", // Fontawesome Symbol see http://fontawesome.io/cheatsheet/ displayRepeatingCountTitle: false, defaultRepeatingCountTitle: '', maxTitleLength: 25, @@ -141,17 +141,27 @@ Module.register("calendar",{ var timeWrapper = document.createElement("td"); //console.log(event.today); var now = new Date(); - var one_hour = 1000 * 60 * 60; + // Define second, minute, hour, and day variables + var one_second = 1000; // 1,000 milliseconds + var one_minute = one_second * 60; + var one_hour = one_minute * 60; var one_day = one_hour * 24; if (event.fullDayEvent) { if (event.today) { timeWrapper.innerHTML = this.translate("TODAY"); - } else if (event.startDate - now < 24 * one_hour && event.startDate - now > 0) { + } else if (event.startDate - now < one_day && event.startDate - now > 0) { timeWrapper.innerHTML = this.translate("TOMORROW"); } else { + /* Check to see if the user displays absolute or relative dates with their events + * Also check to see if an event is happening within an 'urgency' time frameElement + * For example, if the user set an .urgency of 7 days, those events that fall within that + * time frame will be displayed with 'in xxx' time format or moment.fromNow() + * + * Note: this needs to be put in its own function, as the whole thing repeats again verbatim + */ if (this.config.timeFormat === "absolute") { if ((this.config.urgency > 1) && (event.startDate - now < (this.config.urgency * one_day))) { - // This event falls within the config.urgency time frame (in days) that the user has set + // This event falls within the config.urgency period that the user has set timeWrapper.innerHTML = moment(event.startDate, "x").fromNow(); } else { timeWrapper.innerHTML = moment(event.startDate, "x").format("MMM Do"); @@ -165,16 +175,23 @@ Module.register("calendar",{ if (event.startDate - now < 2 * one_day) { // This event is within the next 48 hours (2 days) if (event.startDate - now < 6 * one_hour) { - // If event is within 6 hour, display 'in xxx' time format + // If event is within 6 hour, display 'in xxx' time format or moment.fromNow() timeWrapper.innerHTML = moment(event.startDate, "x").fromNow(); } else { // Otherwise just say 'Today/Tomorrow at such-n-such time' timeWrapper.innerHTML = moment(event.startDate, "x").calendar(); } } else { + /* Check to see if the user displays absolute or relative dates with their events + * Also check to see if an event is happening within an 'urgency' time frameElement + * For example, if the user set an .urgency of 7 days, those events that fall within that + * time frame will be displayed with 'in xxx' time format or moment.fromNow() + * + * Note: this needs to be put in its own function, as the whole thing repeats again verbatim + */ if (this.config.timeFormat === "absolute") { if ((this.config.urgency > 1) && (event.startDate - now < (this.config.urgency * one_day))) { - // This event falls within the config.urgency time frame (in days) that the user has set + // This event falls within the config.urgency period that the user has set timeWrapper.innerHTML = moment(event.startDate, "x").fromNow(); } else { timeWrapper.innerHTML = moment(event.startDate, "x").format("MMM Do"); @@ -339,3 +356,4 @@ Module.register("calendar",{ return title; } }); +