-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathmmm-udr.js
64 lines (54 loc) · 1.83 KB
/
mmm-udr.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
/*
_________ .__
\_ ___ \_______|__| _____ __________ ____
/ \ \/\_ __ \ |/ \ / ___/ _ \ / \
\ \____| | \/ | Y Y \\___ ( <_> ) | \
\______ /|__| |__|__|_| /____ >____/|___| /
\/ \/ \/ Clyde \/
Author: CrimsonClyde
Stardate: 35c3
Location: Somewhere deep in the assemblys
Module name: MagicMirrorModule - Ultimate Day Reminder
Description:
A module which will display what a special day currently is.
You can define it for yourself in udr-cal.txt file.
*/
// Register Module
Module.register("mmm-udr",{
// Default module config.
defaults: {
moduleName: "mmm-udr", // Module Name
headerName: "Ultimate Day Reminder", // Display header
updateInterval: 60*60*1000 //reads the file every 60 mins
},
// Initiate SocketNotifications
start: function() {
this.sendSocketNotification('START', this.config);
},
// Declare SocketNotifications
socketNotificationReceived: function(notification, payload) {
// Notificiation data from file
if(notification === 'EVENT'){
this.dataFile = payload;
// Update after receiving notification
this.updateDom();
}
},
// Override dom generator
getDom: function() {
var wrapper = document.createElement("div");
var space = '       ';
if(this.dataFile){
wrapper.innerHTML = '<p id="mmm-udr" style="line-height:0.6;font-size:12px;text-decoration:underline;">' +
space + this.config.headerName + space +
'</p>' +
this.dataFile;
} else {
wrapper.innerHTML = '<p id="mmm-udr" style="line-height:0.6;font-size:12px;text-decoration:underline;">' +
space + this.config.headerName + space +
'</p>' +
'Nothing special today - enjoy!';
}
return wrapper
}
});