2022-12-09 13:14:02 +00:00
|
|
|
(function() {
|
2023-11-11 18:21:45 +00:00
|
|
|
var settings = require("Storage").readJSON("clkinfocal.json",1)||{};
|
2023-11-11 18:42:08 +00:00
|
|
|
settings.fmt = settings.fmt||"DDD";
|
2024-04-19 14:30:18 +00:00
|
|
|
|
2023-11-11 18:21:45 +00:00
|
|
|
var getDateString = function(dt) {
|
|
|
|
switch(settings.fmt) {
|
2023-11-11 18:42:08 +00:00
|
|
|
case "dd MMM":
|
2024-05-22 19:42:55 +00:00
|
|
|
return require("locale").month(dt,1).toUpperCase();
|
2023-11-11 18:42:08 +00:00
|
|
|
case "DDD dd":
|
2023-11-11 18:21:45 +00:00
|
|
|
return require("locale").dow(dt,1).toUpperCase() + ' ' + dt.getDate();
|
|
|
|
default: // DDD
|
|
|
|
return require("locale").dow(dt,1).toUpperCase();
|
|
|
|
}
|
|
|
|
};
|
|
|
|
|
2022-12-09 13:14:02 +00:00
|
|
|
return {
|
|
|
|
name: "Bangle",
|
|
|
|
items: [
|
|
|
|
{ name : "Date",
|
|
|
|
get : () => {
|
|
|
|
let d = new Date();
|
|
|
|
let g = Graphics.createArrayBuffer(24,24,1,{msb:true});
|
2024-05-01 12:27:37 +00:00
|
|
|
g.transparent = 0;
|
2022-12-09 13:14:02 +00:00
|
|
|
g.drawImage(atob("FhgBDADAMAMP/////////////////////8AADwAAPAAA8AADwAAPAAA8AADwAAPAAA8AADwAAPAAA8AADwAAP///////"),1,0);
|
|
|
|
g.setFont("6x15").setFontAlign(0,0).drawString(d.getDate(),11,17);
|
|
|
|
return {
|
2023-11-11 18:21:45 +00:00
|
|
|
text : getDateString(d),
|
2022-12-09 13:14:02 +00:00
|
|
|
img : g.asImage("string")
|
|
|
|
};
|
|
|
|
},
|
|
|
|
show : function() {
|
|
|
|
this.interval = setTimeout(()=>{
|
|
|
|
this.emit("redraw");
|
|
|
|
this.interval = setInterval(()=>{
|
|
|
|
this.emit("redraw");
|
|
|
|
}, 86400000);
|
|
|
|
}, 86400000 - (Date.now() % 86400000));
|
|
|
|
},
|
|
|
|
hide : function() {
|
|
|
|
clearInterval(this.interval);
|
|
|
|
this.interval = undefined;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
]
|
|
|
|
};
|
|
|
|
})
|