mirror of
https://github.com/MichMich/MagicMirror.git
synced 2025-06-29 12:39:45 +00:00
calendar events repeating count title for birthdayd etc
This commit is contained in:
parent
38796a0d40
commit
4e86de7fc2
@ -112,6 +112,14 @@ The following properties can be configured:
|
||||
</code>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td><code>displayRepeatingCountTitle</code></td>
|
||||
<td>Show count title for yearly repeating events (e.g. "X. Birthday", "X. Anniversary")<br>
|
||||
|
||||
<br><b>Possible values:</b> <code>true</code> or <code>false</code>
|
||||
<br><b>Default value:</b> <code>false</code>
|
||||
</td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
|
||||
@ -154,5 +162,12 @@ config: {
|
||||
<br><b>Possible values:</b> See <a href="http://fontawesome.io/icons/" target="_blank">Font Awsome</a> website.
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td><code> repeatingCountTitle </code></td>
|
||||
<td>The count title for yearly repating events in this calendar. <br>
|
||||
<br><b>Example:</b> <br>
|
||||
<code>'Birthday'</code>
|
||||
</td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
|
@ -15,6 +15,8 @@ Module.register("calendar",{
|
||||
maximumNumberOfDays: 365,
|
||||
displaySymbol: true,
|
||||
defaultSymbol: "calendar", // Fontawsome Symbol see http://fontawesome.io/cheatsheet/
|
||||
displayRepeatingCountTitle: false,
|
||||
defaultRepeatingCountTitle: '',
|
||||
maxTitleLength: 25,
|
||||
fetchInterval: 5 * 60 * 1000, // Update every 5 minutes.
|
||||
animationSpeed: 2000,
|
||||
@ -113,8 +115,24 @@ Module.register("calendar",{
|
||||
eventWrapper.appendChild(symbolWrapper);
|
||||
}
|
||||
|
||||
var titleWrapper = document.createElement("td");
|
||||
titleWrapper.innerHTML = this.titleTransform(event.title);
|
||||
var titleWrapper = document.createElement("td"),
|
||||
repeatingCountTitle = '';
|
||||
|
||||
|
||||
if (this.config.displayRepeatingCountTitle) {
|
||||
|
||||
repeatingCountTitle = this.countTitleForUrl(event.url)
|
||||
|
||||
if(repeatingCountTitle != '') {
|
||||
|
||||
var thisYear = new Date().getFullYear(),
|
||||
yearDiff = thisYear - event.firstYear;
|
||||
|
||||
repeatingCountTitle = ', '+ yearDiff + '. ' + repeatingCountTitle;
|
||||
}
|
||||
}
|
||||
|
||||
titleWrapper.innerHTML = this.titleTransform(event.title) + repeatingCountTitle;
|
||||
titleWrapper.className = "title bright";
|
||||
eventWrapper.appendChild(titleWrapper);
|
||||
|
||||
@ -239,6 +257,23 @@ Module.register("calendar",{
|
||||
|
||||
return this.config.defaultSymbol;
|
||||
},
|
||||
/* countTitleForUrl(url)
|
||||
* Retrieves the name for a specific url.
|
||||
*
|
||||
* argument url sting - Url to look for.
|
||||
*
|
||||
* return string - The Symbol
|
||||
*/
|
||||
countTitleForUrl: function(url) {
|
||||
for (var c in this.config.calendars) {
|
||||
var calendar = this.config.calendars[c];
|
||||
if (calendar.url === url && typeof calendar.repeatingCountTitle === "string") {
|
||||
return calendar.repeatingCountTitle;
|
||||
}
|
||||
}
|
||||
|
||||
return this.config.defaultRepeatingCountTitle;
|
||||
},
|
||||
|
||||
/* shorten(string, maxLength)
|
||||
* Shortens a sting if it's longer than maxLenthg.
|
||||
|
@ -84,7 +84,8 @@ var CalendarFetcher = function(url, reloadInterval, maximumEntries, maximumNumbe
|
||||
title: (typeof event.summary.val !== "undefined") ? event.summary.val : event.summary,
|
||||
startDate: startDate.format("x"),
|
||||
endDate: endDate.format("x"),
|
||||
fullDayEvent: isFullDayEvent(event)
|
||||
fullDayEvent: isFullDayEvent(event),
|
||||
firstYear: event.start.getFullYear()
|
||||
});
|
||||
}
|
||||
}
|
||||
|
68
nohup.out
Normal file
68
nohup.out
Normal file
@ -0,0 +1,68 @@
|
||||
|
||||
> magicmirror@2.0.0 start /home/pi/MagicMirror
|
||||
> electron js/electron.js
|
||||
|
||||
Loading config ...
|
||||
Loading module helpers ...
|
||||
No helper found for module: alert.
|
||||
No helper found for module: clock.
|
||||
Initializing new module helper ...
|
||||
No helper found for module: compliments.
|
||||
No helper found for module: currentweather.
|
||||
No helper found for module: weatherforecast.
|
||||
Initializing new module helper ...
|
||||
All module helpers loaded.
|
||||
Starting server op port 8080 ...
|
||||
Server started ...
|
||||
Connecting socket for: calendar
|
||||
Starting node helper for: calendar
|
||||
Connecting socket for: newsfeed
|
||||
Starting module: newsfeed
|
||||
Sockets connected & modules started ...
|
||||
[1m[47m[31mA JavaScript error occurred in the main process
|
||||
[30mUncaught Exception:
|
||||
Error: listen EADDRINUSE :::8080
|
||||
at Object.exports._errnoException (util.js:890:11)
|
||||
at exports._exceptionWithHostPort (util.js:913:20)
|
||||
at Server._listen2 (net.js:1234:14)
|
||||
at listen (net.js:1270:10)
|
||||
at Server.listen (net.js:1366:5)
|
||||
at new Server (/home/pi/MagicMirror/js/server.js:17:9)
|
||||
at /home/pi/MagicMirror/js/app.js:112:17
|
||||
at loadConfig (/home/pi/MagicMirror/js/app.js:33:4)
|
||||
at start (/home/pi/MagicMirror/js/app.js:98:3)
|
||||
at Object.<anonymous> (/home/pi/MagicMirror/js/electron.js:64:6)[0m
|
||||
Launching application.
|
||||
|
||||
> magicmirror@2.0.0 start /home/pi/MagicMirror
|
||||
> electron js/electron.js
|
||||
|
||||
Loading config ...
|
||||
Loading module helpers ...
|
||||
No helper found for module: clock.
|
||||
Initializing new module helper ...
|
||||
No helper found for module: currentweather.
|
||||
No helper found for module: weatherforecast.
|
||||
No helper found for module: voice.
|
||||
Initializing new module helper ...
|
||||
All module helpers loaded.
|
||||
Starting server op port 8080 ...
|
||||
Server started ...
|
||||
Connecting socket for: custom-calendar
|
||||
Starting node helper for: custom-calendar
|
||||
Connecting socket for: MMM-Wunderlist
|
||||
Sockets connected & modules started ...
|
||||
[1m[47m[31mA JavaScript error occurred in the main process
|
||||
[30mUncaught Exception:
|
||||
Error: listen EADDRINUSE :::8080
|
||||
at Object.exports._errnoException (util.js:890:11)
|
||||
at exports._exceptionWithHostPort (util.js:913:20)
|
||||
at Server._listen2 (net.js:1234:14)
|
||||
at listen (net.js:1270:10)
|
||||
at Server.listen (net.js:1366:5)
|
||||
at new Server (/home/pi/MagicMirror/js/server.js:17:9)
|
||||
at /home/pi/MagicMirror/js/app.js:112:17
|
||||
at loadConfig (/home/pi/MagicMirror/js/app.js:33:4)
|
||||
at start (/home/pi/MagicMirror/js/app.js:98:3)
|
||||
at Object.<anonymous> (/home/pi/MagicMirror/js/electron.js:64:6)[0m
|
||||
Launching application.
|
Loading…
x
Reference in New Issue
Block a user