-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathMMM-HumanCalendar.js
82 lines (67 loc) · 2.64 KB
/
MMM-HumanCalendar.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
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
/* Magic Mirror
* Module: MMM-HumanCalendar
*
*
* By Mykle1 - MIT Licensed
*
*/
Module.register("MMM-HumanCalendar", {
defaults: {
size: "",
dayView: "1", // 1 or 3 day view
},
getStyles: function() {
return ["MMM-HumanCalendar.css"];
},
getDom: function() {
var iframe = document.createElement("IFRAME");
iframe.classList.add("iframe");
iframe.style = "border:none"
iframe.scrolling = "no";
iframe.marginwidth = "0";
iframe.marginheight = "0";
// 3 day size options
if (this.config.size === "large" && this.config.dayView === "3") {
iframe.height = "275px";
iframe.width = "275px";
type = "text/javascript";
iframe.src = "https://api.humancalendar.com/iframe.php?t=3x3&s=275";
} else if (this.config.size === "medium" && this.config.dayView === "3") {
iframe.height = "215px";
iframe.width = "215px";
type = "text/javascript";
iframe.src = "https://api.humancalendar.com/iframe.php?t=3x3&s=215";
} else if (this.config.size === "small" && this.config.dayView === "3") {
iframe.height = "150px";
iframe.width = "150px";
type = "text/javascript";
iframe.src = "https://api.humancalendar.com/iframe.php?t=3x3&s=150";
}
// 1 day size options
if (this.config.size === "large" && this.config.dayView === "1") {
iframe.height = "275px";
iframe.width = "275px";
type = "text/javascript";
iframe.src = "https://api.humancalendar.com/iframe.php?t=2x2&s=275";
} else if (this.config.size === "medium" && this.config.dayView === "1") {
iframe.height = "215px";
iframe.width = "215px";
type = "text/javascript";
iframe.src = "https://api.humancalendar.com/iframe.php?t=2x2&s=215";
} else if (this.config.size === "small" && this.config.dayView === "1") {
iframe.height = "150px";
iframe.width = "150px";
type = "text/javascript";
iframe.src = "https://api.humancalendar.com/iframe.php?t=2x2&s=150";
}
return iframe;
},
///// Add this function to the modules you want to control with voice //////
notificationReceived: function(notification, payload) {
if (notification === 'HIDE_HUMANS') {
this.hide(1000);
} else if (notification === 'SHOW_HUMANS') {
this.show(1000);
}
},
});