mirror of
https://github.com/MichMich/MagicMirror.git
synced 2025-06-27 11:50:00 +00:00
Merge branch 'patch-4' of https://github.com/yo-less/MagicMirror into yo-less-patch-4
# Conflicts: # CHANGELOG.md
This commit is contained in:
commit
29d87d7c48
@ -6,14 +6,18 @@ This project adheres to [Semantic Versioning](http://semver.org/).
|
|||||||
|
|
||||||
### Added
|
### Added
|
||||||
- Finnish translation.
|
- Finnish translation.
|
||||||
- Danish translation
|
- Danish translation.
|
||||||
- Method to overwrite the module's header. [See documentation.](https://github.com/MichMich/MagicMirror/tree/develop/modules#getheader)
|
- Method to overwrite the module's header. [See documentation.](https://github.com/MichMich/MagicMirror/tree/develop/modules#getheader)
|
||||||
- Option to limit access to certain IP addresses based on the value of `ipWhitelist` in the `config.js`, default is access from localhost only (Issue [#456](https://github.com/MichMich/MagicMirror/issues/456))
|
- Option to limit access to certain IP addresses based on the value of `ipWhitelist` in the `config.js`, default is access from localhost only (Issue [#456](https://github.com/MichMich/MagicMirror/issues/456)).
|
||||||
|
- Added ability to change the point of time when calendar events get relative.
|
||||||
|
|
||||||
### Updated
|
### Updated
|
||||||
- Modified translations for Frysk.
|
- Modified translations for Frysk.
|
||||||
- Updated package.json as a result of Snyk security update.
|
- Updated package.json as a result of Snyk security update.
|
||||||
|
|
||||||
|
### Changed
|
||||||
|
- Calendar times are now uniformly capitalized.
|
||||||
|
|
||||||
## [2.0.5] - 2016-09-20
|
## [2.0.5] - 2016-09-20
|
||||||
|
|
||||||
### Added
|
### Added
|
||||||
|
@ -126,6 +126,13 @@ The following properties can be configured:
|
|||||||
<br><b>Default value:</b> <code>relative</code>
|
<br><b>Default value:</b> <code>relative</code>
|
||||||
</td>
|
</td>
|
||||||
</tr>
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<td><code>getRelative</code></td>
|
||||||
|
<td>How much time (in hours) should be left until calendar events start getting relative?<br>
|
||||||
|
<br><b>Possible values:</b> <code>0</code> (events stay absolute) - <code>48</code> (48 hours before the event starts)
|
||||||
|
<br><b>Default value:</b> <code>6</code>
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
<tr>
|
<tr>
|
||||||
<td><code>urgency</code></td>
|
<td><code>urgency</code></td>
|
||||||
<td>When using a timeFormat of <code>absolute</code>, the <code>urgency</code> setting allows you to display events within a specific time frame as <code>relative</code>
|
<td>When using a timeFormat of <code>absolute</code>, the <code>urgency</code> setting allows you to display events within a specific time frame as <code>relative</code>
|
||||||
|
@ -23,6 +23,7 @@ Module.register("calendar",{
|
|||||||
fade: true,
|
fade: true,
|
||||||
urgency: 7,
|
urgency: 7,
|
||||||
timeFormat: "relative",
|
timeFormat: "relative",
|
||||||
|
getRelative: 6,
|
||||||
fadePoint: 0.25, // Start on 1/4th of the list.
|
fadePoint: 0.25, // Start on 1/4th of the list.
|
||||||
calendars: [
|
calendars: [
|
||||||
{
|
{
|
||||||
@ -147,18 +148,14 @@ Module.register("calendar",{
|
|||||||
var one_day = one_hour * 24;
|
var one_day = one_hour * 24;
|
||||||
if (event.fullDayEvent) {
|
if (event.fullDayEvent) {
|
||||||
if (event.today) {
|
if (event.today) {
|
||||||
timeWrapper.innerHTML = this.translate("TODAY");
|
timeWrapper.innerHTML = this.capFirst(this.translate("TODAY"));
|
||||||
} else if (event.startDate - now < one_day && event.startDate - now > 0) {
|
} else if (event.startDate - now < one_day && event.startDate - now > 0) {
|
||||||
timeWrapper.innerHTML = this.translate("TOMORROW");
|
timeWrapper.innerHTML = this.capFirst(this.translate("TOMORROW"));
|
||||||
} else if (event.startDate - now < 2*one_day && event.startDate - now > 0) {
|
} else if (event.startDate - now < 2*one_day && event.startDate - now > 0) {
|
||||||
/*Provide ability to show "the day after tomorrow" instead of "in a day"
|
|
||||||
*if "DAYAFTERTOMORROW" is configured in a language's translation .json file,
|
|
||||||
*,which can be found in MagicMirror/translations/
|
|
||||||
*/
|
|
||||||
if (this.translate('DAYAFTERTOMORROW') !== 'DAYAFTERTOMORROW') {
|
if (this.translate('DAYAFTERTOMORROW') !== 'DAYAFTERTOMORROW') {
|
||||||
timeWrapper.innerHTML = this.translate("DAYAFTERTOMORROW");
|
timeWrapper.innerHTML = this.capFirst(this.translate("DAYAFTERTOMORROW"));
|
||||||
} else {
|
} else {
|
||||||
timeWrapper.innerHTML = moment(event.startDate, "x").fromNow();
|
timeWrapper.innerHTML = this.capFirst(moment(event.startDate, "x").fromNow());
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
/* Check to see if the user displays absolute or relative dates with their events
|
/* Check to see if the user displays absolute or relative dates with their events
|
||||||
@ -171,24 +168,24 @@ Module.register("calendar",{
|
|||||||
if (this.config.timeFormat === "absolute") {
|
if (this.config.timeFormat === "absolute") {
|
||||||
if ((this.config.urgency > 1) && (event.startDate - now < (this.config.urgency * one_day))) {
|
if ((this.config.urgency > 1) && (event.startDate - now < (this.config.urgency * one_day))) {
|
||||||
// This event falls within the config.urgency period 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();
|
timeWrapper.innerHTML = this.capFirst(moment(event.startDate, "x").fromNow());
|
||||||
} else {
|
} else {
|
||||||
timeWrapper.innerHTML = moment(event.startDate, "x").format("MMM Do");
|
timeWrapper.innerHTML = this.capFirst(moment(event.startDate, "x").format("MMM Do"));
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
timeWrapper.innerHTML = moment(event.startDate, "x").fromNow();
|
timeWrapper.innerHTML = this.capFirst(moment(event.startDate, "x").fromNow());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
if (event.startDate >= new Date()) {
|
if (event.startDate >= new Date()) {
|
||||||
if (event.startDate - now < 2 * one_day) {
|
if (event.startDate - now < 2 * one_day) {
|
||||||
// This event is within the next 48 hours (2 days)
|
// This event is within the next 48 hours (2 days)
|
||||||
if (event.startDate - now < 6 * one_hour) {
|
if (event.startDate - now < this.config.getRelative * one_hour) {
|
||||||
// If event is within 6 hour, display 'in xxx' time format or moment.fromNow()
|
// If event is within 6 hour, display 'in xxx' time format or moment.fromNow()
|
||||||
timeWrapper.innerHTML = moment(event.startDate, "x").fromNow();
|
timeWrapper.innerHTML = this.capFirst(moment(event.startDate, "x").fromNow());
|
||||||
} else {
|
} else {
|
||||||
// Otherwise just say 'Today/Tomorrow at such-n-such time'
|
// Otherwise just say 'Today/Tomorrow at such-n-such time'
|
||||||
timeWrapper.innerHTML = moment(event.startDate, "x").calendar();
|
timeWrapper.innerHTML = this.capFirst(moment(event.startDate, "x").calendar());
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
/* Check to see if the user displays absolute or relative dates with their events
|
/* Check to see if the user displays absolute or relative dates with their events
|
||||||
@ -201,16 +198,16 @@ Module.register("calendar",{
|
|||||||
if (this.config.timeFormat === "absolute") {
|
if (this.config.timeFormat === "absolute") {
|
||||||
if ((this.config.urgency > 1) && (event.startDate - now < (this.config.urgency * one_day))) {
|
if ((this.config.urgency > 1) && (event.startDate - now < (this.config.urgency * one_day))) {
|
||||||
// This event falls within the config.urgency period 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();
|
timeWrapper.innerHTML = this.capFirst(moment(event.startDate, "x").fromNow());
|
||||||
} else {
|
} else {
|
||||||
timeWrapper.innerHTML = moment(event.startDate, "x").format("MMM Do");
|
timeWrapper.innerHTML = this.capFirst(moment(event.startDate, "x").format("MMM Do"));
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
timeWrapper.innerHTML = moment(event.startDate, "x").fromNow();
|
timeWrapper.innerHTML = this.capFirst(moment(event.startDate, "x").fromNow());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
timeWrapper.innerHTML = this.translate("RUNNING") + ' ' + moment(event.endDate,"x").fromNow(true);
|
timeWrapper.innerHTML = this.capFirst(this.translate("RUNNING")) + ' ' + moment(event.endDate,"x").fromNow(true);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
//timeWrapper.innerHTML += ' - '+ moment(event.startDate,'x').format('lll');
|
//timeWrapper.innerHTML += ' - '+ moment(event.startDate,'x').format('lll');
|
||||||
@ -348,6 +345,15 @@ Module.register("calendar",{
|
|||||||
return string;
|
return string;
|
||||||
},
|
},
|
||||||
|
|
||||||
|
/* capFirst(string)
|
||||||
|
* Capitalize the first letter of a string
|
||||||
|
* Eeturn capitalized string
|
||||||
|
*/
|
||||||
|
|
||||||
|
capFirst: function(string) {
|
||||||
|
return string.charAt(0).toUpperCase() + string.slice(1);
|
||||||
|
},
|
||||||
|
|
||||||
/* titleTransform(title)
|
/* titleTransform(title)
|
||||||
* Transforms the title of an event for usage.
|
* Transforms the title of an event for usage.
|
||||||
* Replaces parts of the text as defined in config.titleReplace.
|
* Replaces parts of the text as defined in config.titleReplace.
|
||||||
|
Loading…
x
Reference in New Issue
Block a user