mirror of
https://github.com/MichMich/MagicMirror.git
synced 2025-06-27 19:53:36 +00:00
Update compliments.js
This commit is contained in:
parent
3b442d4bfc
commit
42c13fa584
@ -22,8 +22,7 @@ Module.register("compliments", {
|
|||||||
afternoonStartTime: 12,
|
afternoonStartTime: 12,
|
||||||
afternoonEndTime: 17,
|
afternoonEndTime: 17,
|
||||||
random: true,
|
random: true,
|
||||||
mockDate: null,
|
mockDate: null
|
||||||
advice: false
|
|
||||||
},
|
},
|
||||||
lastIndexUsed: -1,
|
lastIndexUsed: -1,
|
||||||
// Set currentweather from module
|
// Set currentweather from module
|
||||||
@ -46,18 +45,6 @@ Module.register("compliments", {
|
|||||||
self.config.compliments = JSON.parse(response);
|
self.config.compliments = JSON.parse(response);
|
||||||
self.updateDom();
|
self.updateDom();
|
||||||
});
|
});
|
||||||
} else if (this.config.advice) {
|
|
||||||
var xobj = new XMLHttpRequest();
|
|
||||||
xobj.overrideMimeType("application/json");
|
|
||||||
xobj.open("GET", "https://api.adviceslip.com/advice", true);
|
|
||||||
xobj.onreadystatechange = function () {
|
|
||||||
if (xobj.readyState === 4 && xobj.status === 200) {
|
|
||||||
const adviceResp = JSON.parse(xobj.responseText);
|
|
||||||
self.config.compliments = adviceResp.slip.advice;
|
|
||||||
self.updateDom();
|
|
||||||
}
|
|
||||||
};
|
|
||||||
xobj.send(null);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// Schedule update timer.
|
// Schedule update timer.
|
||||||
|
Loading…
x
Reference in New Issue
Block a user