a_clock_timer 1.0 : Page to set up custom time zones
parent
059a2e7af7
commit
8f6a80fd36
|
|
@ -1,3 +1,4 @@
|
||||||
0.01: Beta version for Bangle 2 (2021/11/28)
|
0.01: Beta version for Bangle 2 (2021/11/28)
|
||||||
0.02: Shows night time on the map (2022/12/28)
|
0.02: Shows night time on the map (2022/12/28)
|
||||||
0.03: Add 1 minute timer with upper taps (2023/01/05)
|
0.03: Add 1 minute timer with upper taps (2023/01/05)
|
||||||
|
1.00: Page to set up custom time zones (2023/01/06)
|
||||||
|
|
@ -8,11 +8,11 @@
|
||||||
* Bottom Left tap: decrease by 5 minutes
|
* Bottom Left tap: decrease by 5 minutes
|
||||||
* Short buzz at T-30, T-20, T-10 ; Double buzz at T
|
* Short buzz at T-30, T-20, T-10 ; Double buzz at T
|
||||||
* Other time zones
|
* Other time zones
|
||||||
* Currently hardcoded to Paris and Tokyo (this will be customizable in a future version)
|
* Showing Paris and Tokyo by default, but you can customize this using the dedicated configuration page on the app store
|
||||||
* World Map
|
* World Map
|
||||||
* The map shows day and night on Earth and the position of the Sun (yellow line)
|
* The map shows day and night on Earth and the position of the Sun (yellow line)
|
||||||
|
|
||||||

|

|
||||||
|
|
||||||
## Creator
|
## Creator
|
||||||
[@alainsaas](https://github.com/alainsaas)
|
[@alainsaas](https://github.com/alainsaas)
|
||||||
|
|
@ -89,6 +89,7 @@ function showWelcomeMessage() {
|
||||||
}
|
}
|
||||||
|
|
||||||
// time
|
// time
|
||||||
|
var offsets = require("Storage").readJSON("a_clock_timer.settings.json") || [ ["PAR",1], ["TYO",9] ];
|
||||||
var drawTimeout;
|
var drawTimeout;
|
||||||
|
|
||||||
function getGmt() {
|
function getGmt() {
|
||||||
|
|
@ -138,8 +139,8 @@ function draw() {
|
||||||
g.setFont("Michroma36").drawString(locale.time(date,1), g.getWidth()/2, 46);
|
g.setFont("Michroma36").drawString(locale.time(date,1), g.getWidth()/2, 46);
|
||||||
g.setFont("6x8");
|
g.setFont("6x8");
|
||||||
g.drawString(locale.date(new Date(),1), 125, 68);
|
g.drawString(locale.date(new Date(),1), 125, 68);
|
||||||
g.drawString("PAR "+locale.time(getTimeFromTimezone(1),1), 125, 80);
|
g.drawString(offsets[0][0]+" "+locale.time(getTimeFromTimezone(offsets[0][1]),1), 125, 80);
|
||||||
g.drawString("TYO "+locale.time(getTimeFromTimezone(9),1), 125, 88);
|
g.drawString(offsets[1][0]+" "+locale.time(getTimeFromTimezone(offsets[1][1]),1), 125, 88);
|
||||||
|
|
||||||
queueNextDraw();
|
queueNextDraw();
|
||||||
}
|
}
|
||||||
|
|
@ -150,4 +151,4 @@ draw();
|
||||||
Bangle.setUI("clock");
|
Bangle.setUI("clock");
|
||||||
Bangle.loadWidgets();
|
Bangle.loadWidgets();
|
||||||
Bangle.drawWidgets();
|
Bangle.drawWidgets();
|
||||||
showWelcomeMessage();
|
showWelcomeMessage();
|
||||||
|
|
@ -0,0 +1,59 @@
|
||||||
|
<html>
|
||||||
|
<head>
|
||||||
|
<link rel="stylesheet" href="../../css/spectre.min.css">
|
||||||
|
</head>
|
||||||
|
<body>
|
||||||
|
<p>You can set the 2 additional timezones displayed by the clock.</p>
|
||||||
|
<table id="a_clock_timer-offsets">
|
||||||
|
<tr>
|
||||||
|
<th>Name</th>
|
||||||
|
<th>UTC Offset (Hours)</th>
|
||||||
|
</tr>
|
||||||
|
</table>
|
||||||
|
<p>Click <button id="upload" class="btn btn-primary">Upload</button></p>
|
||||||
|
<script src="../../core/lib/customize.js"></script>
|
||||||
|
<script>
|
||||||
|
var offsets=[];
|
||||||
|
try{
|
||||||
|
var stored = localStorage.getItem('a_clock_timer-offset-list')
|
||||||
|
if(stored) offsets = JSON.parse(stored);
|
||||||
|
if (!offsets || offsets.length!=2) {
|
||||||
|
throw "Offsets invalid";
|
||||||
|
}
|
||||||
|
} catch(e){
|
||||||
|
offsets=[
|
||||||
|
["PAR",1],
|
||||||
|
["TYO",9],
|
||||||
|
];
|
||||||
|
}
|
||||||
|
console.log(offsets);
|
||||||
|
var tbl=document.getElementById("a_clock_timer-offsets");
|
||||||
|
for (var i=0; i<2; i++) {
|
||||||
|
var $offset = document.createElement('tr')
|
||||||
|
$offset.innerHTML = `
|
||||||
|
<td><input type="text" size="4" maxlength="3" id="name_${i}" value="${offsets[i][0]}"></td>
|
||||||
|
<td><input type="number" id="offset_${i}" value="${offsets[i][1]}"></td>`
|
||||||
|
tbl.append($offset);
|
||||||
|
}
|
||||||
|
document.getElementById("upload").addEventListener("click", function() {
|
||||||
|
var storage_offsets=[];
|
||||||
|
var app_offsets=[];
|
||||||
|
for (var i=0; i<2; i++) {
|
||||||
|
var name=document.getElementById("name_"+i).value;
|
||||||
|
var offset=document.getElementById("offset_"+i).value;
|
||||||
|
if (checked) {
|
||||||
|
app_offsets.push([name,offset]);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
console.log(storage_offsets);
|
||||||
|
console.log(app_offsets);
|
||||||
|
localStorage.setItem('a_clock_timer-offset-list',JSON.stringify(storage_offsets));
|
||||||
|
sendCustomizedApp({
|
||||||
|
storage:[
|
||||||
|
{name:"a_clock_timer.settings.json", content:JSON.stringify(app_offsets)},
|
||||||
|
]
|
||||||
|
});
|
||||||
|
});
|
||||||
|
</script>
|
||||||
|
</body>
|
||||||
|
</html>
|
||||||
|
|
@ -1,7 +1,7 @@
|
||||||
{
|
{
|
||||||
"id": "a_clock_timer",
|
"id": "a_clock_timer",
|
||||||
"name": "A Clock with Timer",
|
"name": "A Clock with Timer",
|
||||||
"version": "0.03",
|
"version": "1.00",
|
||||||
"description": "A Clock with Timer, Map and Time Zones",
|
"description": "A Clock with Timer, Map and Time Zones",
|
||||||
"icon": "app.png",
|
"icon": "app.png",
|
||||||
"screenshots": [{"url":"screenshot.png"}],
|
"screenshots": [{"url":"screenshot.png"}],
|
||||||
|
|
@ -10,8 +10,10 @@
|
||||||
"supports": ["BANGLEJS2"],
|
"supports": ["BANGLEJS2"],
|
||||||
"allow_emulator": true,
|
"allow_emulator": true,
|
||||||
"readme": "README.md",
|
"readme": "README.md",
|
||||||
|
"custom": "custom.html",
|
||||||
"storage": [
|
"storage": [
|
||||||
{"name":"a_clock_timer.app.js","url":"app.js"},
|
{"name":"a_clock_timer.app.js","url":"app.js"},
|
||||||
{"name":"a_clock_timer.img","url":"app-icon.js","evaluate":true}
|
{"name":"a_clock_timer.img","url":"app-icon.js","evaluate":true}
|
||||||
]
|
],
|
||||||
}
|
"data": [{"name":"a_clock_timer.settings.json"}]
|
||||||
|
}
|
||||||
Loading…
Reference in New Issue