-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathMMM-Regenradar.js
64 lines (54 loc) · 1.73 KB
/
MMM-Regenradar.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
/* Magic Mirror
* Module: MMM-Regenradar
*
* By Linas1234
* MIT Licensed.
*/
Module.register("MMM-Regenradar", {
// Default module config.
defaults: {
height: "400px",
width: "auto",
plz: "13156",
delay: "70",
type: "1",
zoomlvl: "4",
bar: "0",
map: "0",
textcol: "ffffff",
bgcol: "00000",
updateInterval: 5,
},
start: function() {
var self = this;
setInterval(function() {
self.updateDom(); // no speed defined, so it updates instantly.
}, this.config.updateInterval*60*1000);
},
getStyles: function() {
return ["MMM-Regenradar.css"]
},
// Override dom generator.
getDom: function() {
var wrapper = document.createElement("div"); // main Wrapper that containts the others
var image = document.createElement("img");
var getTimeStamp = new Date();
image.classList.add = "radar";
image.src = 'https://morgenwirdes.de/api/v3/gif6.php?plz=' + this.config.plz + '&delay=' + this.config.delay + '&type=' + this.config.type + '&zoomlvl=' + this.config.zoomlvl + '&bar=' + this.config.bar + '&map=' + this.config.map + '&textcol=' + this.config.textcol + '&bgcol=' + this.config.bgcol + '?seed=' + getTimeStamp;
image.style.height = this.config.height;
image.style.width = this.config.width;
wrapper.appendChild(image); //request the image to be displayed
return wrapper;
},
///// Add this function to the modules you want to control with voice //////
/*
notificationReceived: function(notification, payload) {
if (notification === 'HIDE_REGENRADAR') {
this.hide();
}
else if (notification === 'SHOW_REGENRADAR'{
this.show(1000);
}
},
*/
});