agenda: added dynamic, short and range fields to clkinfo
parent
7ea4276694
commit
4a47b49c1c
|
|
@ -9,3 +9,4 @@
|
||||||
Fix clkinfo icon
|
Fix clkinfo icon
|
||||||
0.09: Ensure Agenda supplies an image for clkinfo items
|
0.09: Ensure Agenda supplies an image for clkinfo items
|
||||||
0.10: Update clock_info to avoid a redraw
|
0.10: Update clock_info to avoid a redraw
|
||||||
|
0.11: Added dynamic, short and range fields to clkinfo
|
||||||
|
|
|
||||||
|
|
@ -1,7 +1,14 @@
|
||||||
(function() {
|
(function() {
|
||||||
|
function getPassedSec(date) {
|
||||||
|
var now = new Date();
|
||||||
|
var passed = (now-date)/1000;
|
||||||
|
if(passed<0) return 0;
|
||||||
|
return passed;
|
||||||
|
}
|
||||||
var agendaItems = {
|
var agendaItems = {
|
||||||
name: "Agenda",
|
name: "Agenda",
|
||||||
img: atob("GBiBAAAAAAAAAADGMA///w///wf//wAAAA///w///w///w///x///h///h///j///D///X//+f//8wAABwAADw///w///wf//gAAAA=="),
|
img: atob("GBiBAAAAAAAAAADGMA///w///wf//wAAAA///w///w///w///x///h///h///j///D///X//+f//8wAABwAADw///w///wf//gAAAA=="),
|
||||||
|
dynamic: true,
|
||||||
items: []
|
items: []
|
||||||
};
|
};
|
||||||
var locale = require("locale");
|
var locale = require("locale");
|
||||||
|
|
@ -15,11 +22,15 @@
|
||||||
var title = entry.title.slice(0,12);
|
var title = entry.title.slice(0,12);
|
||||||
var date = new Date(entry.timestamp*1000);
|
var date = new Date(entry.timestamp*1000);
|
||||||
var dateStr = locale.date(date).replace(/\d\d\d\d/,"");
|
var dateStr = locale.date(date).replace(/\d\d\d\d/,"");
|
||||||
|
var shortStr = ((date-now) > 86400000 || entry.allDay) ? dateStr : locale.time(date,1);
|
||||||
dateStr += entry.durationInSeconds < 86400 ? "/ " + locale.time(date,1) : "";
|
dateStr += entry.durationInSeconds < 86400 ? "/ " + locale.time(date,1) : "";
|
||||||
|
|
||||||
agendaItems.items.push({
|
agendaItems.items.push({
|
||||||
name: "Agenda "+i,
|
name: "Agenda "+i,
|
||||||
get: () => ({ text: title + "\n" + dateStr, img: agendaItems.img }),
|
hasRange: true,
|
||||||
|
get: () => ({ text: title + "\n" + dateStr,
|
||||||
|
img: agendaItems.img, short: shortStr.trim(),
|
||||||
|
v: getPassedSec(date), min: 0, max: entry.durationInSeconds}),
|
||||||
show: function() {},
|
show: function() {},
|
||||||
hide: function () {}
|
hide: function () {}
|
||||||
});
|
});
|
||||||
|
|
|
||||||
|
|
@ -1,7 +1,7 @@
|
||||||
{
|
{
|
||||||
"id": "agenda",
|
"id": "agenda",
|
||||||
"name": "Agenda",
|
"name": "Agenda",
|
||||||
"version": "0.10",
|
"version": "0.11",
|
||||||
"description": "Simple agenda",
|
"description": "Simple agenda",
|
||||||
"icon": "agenda.png",
|
"icon": "agenda.png",
|
||||||
"screenshots": [{"url":"screenshot_agenda_overview.png"}, {"url":"screenshot_agenda_event1.png"}, {"url":"screenshot_agenda_event2.png"}],
|
"screenshots": [{"url":"screenshot_agenda_overview.png"}, {"url":"screenshot_agenda_event1.png"}, {"url":"screenshot_agenda_event2.png"}],
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue