basic clock-info add-on

master
Martin Zwigl 2025-02-23 16:13:24 +01:00
parent ec21723f99
commit 9c03c1e6f3
1 changed files with 40 additions and 0 deletions

View File

@ -0,0 +1,40 @@
(function() {
function retrieveClkInfo(strToken) {
// TODO: do something useful here -> http request to CMC
return {
text : strToken,
// color: "#f00",
img : atob("GBiBAAAAAAAAAAAAAAAYAAA8AAB+AAD/AAAAAAAAAAAAAAAYAAAYAAQYIA4AcAYAYAA8AAB+AAD/AAH/gD///D///AAAAAAAAAAAAA==")
}
}
function showClkInfo() {
this.interval = setTimeout(()=>{
this.emit("redraw");
this.interval = setInterval(()=>{
this.emit("redraw");
}, 60000);
}, 60000 - (Date.now() % 60000));
}
function hideClkInfo() {
clearInterval(this.interval);
this.interval = undefined;
}
var coinInfoItems = {
name: "CoinInfo",
// TODO: get maybe from settings
items: [
{
name: "BTC",
get : retrieveClkInfo("BTC"),
show : showClkInfo,
hide : hideClkInfo
},
]
};
return coinInfoItems;
})