-
Notifications
You must be signed in to change notification settings - Fork 0
/
MMM-lichess-daily.js
36 lines (31 loc) · 1.04 KB
/
MMM-lichess-daily.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
Module.register("MMM-lichess-daily", {
// Module config defaults.
defaults: {
// blue, blue2, blue3, canvas, wood, wood2, wood3, maple, green, marble, brown, leather, grey, metal, olive, purple
theme: "auto",
// light, dark
bg: "auto",
width: "224px",
height: "264px",
updateInterval: 60 * 60 * 1000,
},
// Define start sequence.
start: function() {
Log.info("Starting module: " + this.name);
var self = this;
setInterval(function() {
self.updateDom();
}, this.config.updateInterval);
},
getDom: function() {
var wrapper = document.createElement("div");
var frame = document.createElement("iframe");
frame.src = "http://lichess.org/training/frame?bg=" + this.config.bg + "&theme=" + this.config.theme;
frame.class = "lichess-training-iframe";
frame.allowtransparency = "true";
frame.frameBorder = "0";
frame.style = "width: " + this.config.width + "; height: " + this.config.height + ";";
wrapper.appendChild(frame);
return wrapper;
},
});