From 195dd618f18a7e2c6294a28afc4687024673c847 Mon Sep 17 00:00:00 2001 From: June Bennison Date: Thu, 30 Jan 2025 14:43:18 +1100 Subject: [PATCH 01/20] grandfather-clock: add initial metadata --- apps/grandfather-clock/ChangeLog | 1 + apps/grandfather-clock/README.md | 15 +++++++++++++++ apps/grandfather-clock/icon.png | Bin 0 -> 1620 bytes apps/grandfather-clock/metadata.json | 14 ++++++++++++++ apps/grandfather-clock/widget.js | 5 +++++ 5 files changed, 35 insertions(+) create mode 100644 apps/grandfather-clock/ChangeLog create mode 100644 apps/grandfather-clock/README.md create mode 100644 apps/grandfather-clock/icon.png create mode 100644 apps/grandfather-clock/metadata.json create mode 100644 apps/grandfather-clock/widget.js diff --git a/apps/grandfather-clock/ChangeLog b/apps/grandfather-clock/ChangeLog new file mode 100644 index 000000000..4c21f3ace --- /dev/null +++ b/apps/grandfather-clock/ChangeLog @@ -0,0 +1 @@ +0.01: New Widget! diff --git a/apps/grandfather-clock/README.md b/apps/grandfather-clock/README.md new file mode 100644 index 000000000..12ce92f9e --- /dev/null +++ b/apps/grandfather-clock/README.md @@ -0,0 +1,15 @@ +# Grandfather Clock + +A widget that runs in the background and chimes every 15mins (similar to Chimer), and counts out the fractions of an hour and the o'clock hour. + +## Usage + +Once installed, see the App Settings page for options. + +## Requests + +Drop me a message at @yogsoy on Discord if you need help / discover a bug that I can squash for you. + +## Creator + +Written by June B (yogsoy), inspired by aaronrolls' Chimer. diff --git a/apps/grandfather-clock/icon.png b/apps/grandfather-clock/icon.png new file mode 100644 index 0000000000000000000000000000000000000000..582cb2e0853a5a2899a3afbd7eb19cde2ee7f6a0 GIT binary patch literal 1620 zcmV-a2CMmrP)1gXjloC|3_d8m;N2OpV(|i0q4YwBna<2! zK9thw%-*|urnNbV{Gax^?eD+#{x0kLJ~)lj_;W+1>qV*k8akT^^dvctZccUyj4}H~#M%Wwee_v` zHMv7o%BM8@dBrLshn{wGD9BDl?^eV5vSM3T96;NnHvtc6La=(qzq)xrX1d8bK-TN- zrd_f$_O`9nEmS+_S7HTXK<&u;LDIW|qlN&KJvM}tt6TVVqL-AvNv`B*{NzNpBfSQwQP5~Sf(Dp@Vq1+3Q`N9wBQN2`J_?M^u0FIMlt?p^8 z%U3%80kIwg!T{E9<8J18S&$k1`eO)@HP+=TZKo(z3_A3VFYJB=sn`2^Q$mRE>02(+W)np;)L1!GUvU2{O{<&F_nE6Qe#D~Xf|dD z+?d3-D1(IUiL`C2;PPv4CKw8H)v7h8^obJ&Z6D0CjVUe8Xq_NAymxUyPAMU^CCrIu z%1M71EC`5o2if_~7E&h??0jeQ1Y3N6p?}G72FmS*)xQD)%wBE=2tW6@(+MTi!fk9H1pWKew2(jTXVu4%vk26QvSQCbGmk`Z)Y! zBIhh)6vG2)h6mF8wC^|l$M(Eo9D?JiW}=_T2jUA>LC80foTera{^p)Wi`>}Gf;(|ZwEZQ zS^k|*9wyt=f4ZOo!xty7{%}HKD9tBZ50g$=%v&&vMa!#@Nsf>EkEEDA*ST6fiC+An zsNK1#>!x0obq@j$QqYU-ad3ZvbjqUU+%iw(0WahgmHV6yeLWqoYkSl4pzFQ(_Vp&I ztO{WI-48rGLwQb?#vgVvduyd9_6W)rFRoQJq3I(J?{Xmin45#=3l9BmL6Bp<*MZej zrsWN7oRPUr7IvrHoIHOjS=gPTCw>d)^LQK+B|=f2qbGjrWaOd5D<<9Dv>MTW0X3z> zyPy}9`<>1~?NCx@m8G$_@rRTy5zH12YM&P)=tU+L^fgY z^0Z&_6^qdVuwgN3wt_Ze(10?J@%{C2grBk42hsu74qEo^nd&v`X`IHN9lrxzS~GeF S(*#!l0000 { + + + +})() From 6bf6b2c14b8c9c5834b26ba1485c895239385fdf Mon Sep 17 00:00:00 2001 From: June Bennison Date: Thu, 30 Jan 2025 16:30:54 +1100 Subject: [PATCH 02/20] grandfather-clock: initial code commit --- apps/grandfather-clock/widget.js | 62 ++++++++++++++++++++++++++++++++ 1 file changed, 62 insertions(+) diff --git a/apps/grandfather-clock/widget.js b/apps/grandfather-clock/widget.js index 4a3b50f45..33fb3059f 100644 --- a/apps/grandfather-clock/widget.js +++ b/apps/grandfather-clock/widget.js @@ -1,5 +1,67 @@ (() => { + // todo: all of these configurable through app settings menu. + const twelve_hour = true; + const swap_meridian = false; + const hour_attention_buzz_ms = 1000; + const hour_count_buzz_ms = 250; + const fraction_count_buzz_ms = 250; + const fractions_of_hour = 4; // 4 = 15min intervals + const wait_ms = 500; + const meridian_buzz_ms = 100; + const meridian_buzz_wait_ms = 50; + let date; + let fractionMs = 3600000 / fractions_of_hour + let chime = function () { + date = new Date(); + let hourFrac = Math.floor(date.getMinutes() / (60 / fractions_of_hour)); + + if (hourFrac == 0) { // if it's an o'clock hour + let chimeHour = (twelve_hour ? date.getHours() % 12 : date.getHours()); + if (chimeHour == 0) (twelve_hour ? chimeHour += 12 : chimeHour += 24); + + Bangle.buzz(hour_attention_buzz_ms).then(() => { // initial buzz + setTimeout(hourChime, wait_ms, chimeHour); // wait a period before doing the first chime + }); + } else { // if it's a fraction of an hour + fractionChime(hourFrac); + } + + queueNextChime(); + }; + + let hourChime = function (hoursLeftToChime) { + hoursLeftToChime--; + Bangle.buzz(hour_count_buzz_ms).then(() => { // recursive. buzz and wait to do the next buzz. + if (hoursLeftToChime > 0) { + setTimeout(hourChime, wait_ms, hoursLeftToChime); + } else if (twelve_hour) { // once finished with the hour count + setTimeout(meridianChime, wait_ms, (date.getHours() >= 12)); // if in twelve hour mode, queue up the meridian chime. + } + }); + }; + + let fractionChime = function (fractionsLeftToChime) { + fractionsLeftToChime--; + Bangle.buzz(fraction_count_buzz_ms).then(() => { // recursive. buzz and wait to do the next buzz. + if (fractionsLeftToChime > 0) setTimeout(fractionChime, wait_ms, fractionsLeftToChime); + }); + }; + + let meridianChime = function (meridian) { + if ((swap_meridian ? !meridian : meridian)) { // default: if PM + Bangle.buzz(meridian_buzz_ms).then(setTimeout(Bangle.buzz, meridian_buzz_wait_ms, meridian_buzz_ms)); // buzz once, wait, buzz again. + } else { // default: if AM + Bangle.buzz(meridian_buzz_ms); // buzz once. + } + }; + + let queueNextChime = function () { + let msUntilNextFraction = fractionMs - (Date.now() % fractionMs); + setTimeout(chime, msUntilNextFraction); + }; + + queueNextChime(); })() From 6fc0be482ca6f72a36c0f8760ff5b34b50c1406e Mon Sep 17 00:00:00 2001 From: June Bennison Date: Thu, 30 Jan 2025 16:38:06 +1100 Subject: [PATCH 03/20] grandfather-clock: metadata & documentation updates --- apps/grandfather-clock/README.md | 15 +++++++++++++-- apps/grandfather-clock/metadata.json | 2 +- apps/grandfather-clock/widget.js | 2 +- 3 files changed, 15 insertions(+), 4 deletions(-) diff --git a/apps/grandfather-clock/README.md b/apps/grandfather-clock/README.md index 12ce92f9e..34b0d2892 100644 --- a/apps/grandfather-clock/README.md +++ b/apps/grandfather-clock/README.md @@ -1,10 +1,21 @@ # Grandfather Clock -A widget that runs in the background and chimes every 15mins (similar to Chimer), and counts out the fractions of an hour and the o'clock hour. +A widget that runs in the background and chimes on every (configurable) fraction of an hour, similar to Chimer, and counts out the fractions and the o'clock hour. ## Usage -Once installed, see the App Settings page for options. +Once installed, see the App Settings page for options. ** This is not implemented yet. Await v0.02 + +Defaults: +- Twelve hour mode is ENABLED. +- Swap meridian is DISABLED. (in the AM, there will be a single buzz after counting the hours. in the PM, there will be two buzzes after counting the hours) +- The attention buzz for the hour chime is 1000ms long. +- The buzz for each hour count is 250ms long. +- The buzz for each fraction count is 250ms long. +- The widget will count out 4 fractions of an hour (15 min interval). +- The time between count buzzes is 500ms. +- The meridian buzzes are 100ms long. +- The time between meridian buzzes is 50ms long. ## Requests diff --git a/apps/grandfather-clock/metadata.json b/apps/grandfather-clock/metadata.json index f8fa52489..133ba3859 100644 --- a/apps/grandfather-clock/metadata.json +++ b/apps/grandfather-clock/metadata.json @@ -2,7 +2,7 @@ "name": "Grandfather Clock Bell Widget", "shortName":"Grandfather Clock", "version":"0.01", - "description": "A widget that chimes every 15mins (similar to Chimer), and counts out the fractions of an hour and the o'clock hour.", + "description": "A widget that chimes every fraction of an hour (similar to Chimer), and counts out the fractions and the o'clock hour.", "icon": "icon.png", "type": "widget", "tags": "widget", diff --git a/apps/grandfather-clock/widget.js b/apps/grandfather-clock/widget.js index 33fb3059f..3cdf66af3 100644 --- a/apps/grandfather-clock/widget.js +++ b/apps/grandfather-clock/widget.js @@ -6,7 +6,7 @@ const hour_attention_buzz_ms = 1000; const hour_count_buzz_ms = 250; const fraction_count_buzz_ms = 250; - const fractions_of_hour = 4; // 4 = 15min intervals + const fractions_of_hour = 4; // 4 = 15min intervals, 6 = 10min intervals const wait_ms = 500; const meridian_buzz_ms = 100; const meridian_buzz_wait_ms = 50; From 762219dca262da3c92a72b3981a5403498ccc87e Mon Sep 17 00:00:00 2001 From: June Bennison Date: Thu, 30 Jan 2025 16:38:42 +1100 Subject: [PATCH 04/20] =?UTF-8?q?grandfather-clock:=20missing=20semi=20?= =?UTF-8?q?=F0=9F=98=AD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- apps/grandfather-clock/widget.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/apps/grandfather-clock/widget.js b/apps/grandfather-clock/widget.js index 3cdf66af3..4b07104da 100644 --- a/apps/grandfather-clock/widget.js +++ b/apps/grandfather-clock/widget.js @@ -12,7 +12,7 @@ const meridian_buzz_wait_ms = 50; let date; - let fractionMs = 3600000 / fractions_of_hour + let fractionMs = 3600000 / fractions_of_hour; let chime = function () { date = new Date(); From 434b7848b2985d0b2c5cc65bb74482e66e646a4a Mon Sep 17 00:00:00 2001 From: June Bennison Date: Thu, 30 Jan 2025 22:08:37 +1100 Subject: [PATCH 05/20] grandfather-clock: adjust default meridian timings --- apps/grandfather-clock/README.md | 6 +++--- apps/grandfather-clock/widget.js | 4 ++-- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/apps/grandfather-clock/README.md b/apps/grandfather-clock/README.md index 34b0d2892..f0e628cda 100644 --- a/apps/grandfather-clock/README.md +++ b/apps/grandfather-clock/README.md @@ -12,10 +12,10 @@ Defaults: - The attention buzz for the hour chime is 1000ms long. - The buzz for each hour count is 250ms long. - The buzz for each fraction count is 250ms long. -- The widget will count out 4 fractions of an hour (15 min interval). +- The widget will count out 4 fractions of an hour (a 15 min interval). - The time between count buzzes is 500ms. -- The meridian buzzes are 100ms long. -- The time between meridian buzzes is 50ms long. +- The meridian buzzes are 50ms long. +- The time between meridian buzzes is 300ms. ## Requests diff --git a/apps/grandfather-clock/widget.js b/apps/grandfather-clock/widget.js index 4b07104da..86b134c15 100644 --- a/apps/grandfather-clock/widget.js +++ b/apps/grandfather-clock/widget.js @@ -8,8 +8,8 @@ const fraction_count_buzz_ms = 250; const fractions_of_hour = 4; // 4 = 15min intervals, 6 = 10min intervals const wait_ms = 500; - const meridian_buzz_ms = 100; - const meridian_buzz_wait_ms = 50; + const meridian_buzz_ms = 50; + const meridian_buzz_wait_ms = 300; let date; let fractionMs = 3600000 / fractions_of_hour; From 7b0cc119ceb7dc5f006a57864b31701c6992c2db Mon Sep 17 00:00:00 2001 From: June Bennison Date: Thu, 30 Jan 2025 22:08:55 +1100 Subject: [PATCH 06/20] grandfather-clock: remove "bell" from app name --- apps/grandfather-clock/metadata.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/apps/grandfather-clock/metadata.json b/apps/grandfather-clock/metadata.json index 133ba3859..2bd092e23 100644 --- a/apps/grandfather-clock/metadata.json +++ b/apps/grandfather-clock/metadata.json @@ -1,5 +1,5 @@ { "id": "grandfather-clock", - "name": "Grandfather Clock Bell Widget", + "name": "Grandfather Clock Widget", "shortName":"Grandfather Clock", "version":"0.01", "description": "A widget that chimes every fraction of an hour (similar to Chimer), and counts out the fractions and the o'clock hour.", From dc575281a091f3068014e5ae9ef16a0d6d307fc9 Mon Sep 17 00:00:00 2001 From: June Bennison Date: Thu, 30 Jan 2025 22:19:55 +1100 Subject: [PATCH 07/20] grandfather-clock: add icon --- apps/grandfather-clock/icon.png | Bin 1620 -> 4971 bytes 1 file changed, 0 insertions(+), 0 deletions(-) diff --git a/apps/grandfather-clock/icon.png b/apps/grandfather-clock/icon.png index 582cb2e0853a5a2899a3afbd7eb19cde2ee7f6a0..b7ca0872f2cafac763afc700a2e1916ae524b2f1 100644 GIT binary patch literal 4971 zcmeHKX;2f{7VZGDih>}xj2hwsqDeZPy(KCTkSGC0kY&^vI_XZ*Ko*h!LB|nL6vt&8 zcMy?5c_J=|3kr;i%eXuR(Ryz6ltD&)jtf|h;)eKchefQJs#jLM`DeOr?z!il^WAg5 zd+tekSyaR{SLb2Q5Cpl(!lW}n4^z$29(>2yyj}{rMj~FOlF9rbM=$`EG&_h!*?>mt zBiqnyAzPqZ0@@%TQ#Mo^M(bzoR{(ie%&@UK<3bFAXm^Af`$Ou6ZGYvkxRSQ zItFCw<7j=tfJ7np^wVVWC_2L8z$~r^_`?Vvg*hk}rXvW-;h}sEu%;D%h=@Wmyr}|# z(iW4!!BMi{V7kGmSCJ_M1X&6f{3r=K73G;5IlHukIUqgC{e0Ax$0dwahnz#o+>&x* zM}&X<#z8)8ji>jt6Nj3cFDb5`_$49EAuiCZgO=)D=s9=$>9=cwmJeYEG@Z?S`9)Lh zz^6k0aDHt|R(V1wn(wy1dX~>C=TV`Tm%>ZNs2-Y1Hsz=n+>RDrox4Jv`SM)?Hdc?+ z`MRCW*TtV6eww>^Lqq0P(aGs+g1(Iiz#9848&%D!?Ko5YVBc1C=!)=pMWUdIo|EER z6JwE>7P6(RBxzmSrJCJ_rk35YNxRb`J5NS^Jv-q(y2pJ?W!~64H~O|Ei2pvfZF5Ke zA}wg}7}<%PWv`hrE^g?GFI>uka__!6@xJ+GO8v=yZQtxU9lFh~ddIQ1%g9#Ut~&mM zwl>qot|)uLo+lN8tecTn9%-5L?4Ijwy{~KKO}4CztP{R-kulSp8=rYQ*S#IOAbP-% zBmL%Gzg2yxA@vP}Yhrf}Z*F!Q!k*b)bGCLq`k!`vWb$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TYoT% zMa!#@Nsf>EkEEDA*ST6fiC+AnsNK1#>!x0obq@j$QqYU-ad3ZvbjqUU+%iw(0Wahg zmHV6yeLWqoYkSl4pzFQ(_Vp&ItO{WI-48rGLwQb?#vgVvduyd9_6W)rFRoQJq3I(J z?{Xmin45#=3l9BmL6Bp<*MZejrhnxPZJd$0O%`^i+?+grDp}Z_q9=X}=<|3S6D2}X zo}(vz>ty7i#49G<-Lx9fe*rb6#JivumHVB}LG4gdXO*R~xABLfz>ADt4^0(GkQeZW zqQ#Jh>AK{zSO Date: Thu, 30 Jan 2025 22:20:29 +1100 Subject: [PATCH 08/20] grandfather-clock: update readme --- apps/grandfather-clock/README.md | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/apps/grandfather-clock/README.md b/apps/grandfather-clock/README.md index f0e628cda..637ab50c4 100644 --- a/apps/grandfather-clock/README.md +++ b/apps/grandfather-clock/README.md @@ -1,10 +1,10 @@ # Grandfather Clock -A widget that runs in the background and chimes on every (configurable) fraction of an hour, similar to Chimer, and counts out the fractions and the o'clock hour. +A widget that runs in the background and chimes on every (configurable*) fraction of an hour, similar to Chimer, and counts out the fractions and the o'clock hour. ## Usage -Once installed, see the App Settings page for options. ** This is not implemented yet. Await v0.02 +Once installed, see the App Settings page for options. Defaults: - Twelve hour mode is ENABLED. @@ -24,3 +24,7 @@ Drop me a message at @yogsoy on Discord if you need help / discover a bug that I ## Creator Written by June B (yogsoy), inspired by aaronrolls' Chimer. + +## Notes + +\* This is not implemented yet, sorry! Await v0.02. From 15f820f3123ab567314400b27a6a4b69819cb2d5 Mon Sep 17 00:00:00 2001 From: June Bennison Date: Thu, 30 Jan 2025 22:41:09 +1100 Subject: [PATCH 09/20] grandfather-clock: show icon for widget once settings are implemented, this will be disabled by default --- apps/grandfather-clock/widget.js | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/apps/grandfather-clock/widget.js b/apps/grandfather-clock/widget.js index 86b134c15..86294e087 100644 --- a/apps/grandfather-clock/widget.js +++ b/apps/grandfather-clock/widget.js @@ -1,5 +1,14 @@ (() => { + WIDGETS["grandfather-clock"] = { + area: "tr", + width: 24, + draw: function() { + g.reset(); + g.drawImage(atob("GBiBAAAYAAA8AAA8AAD/AAH/gAP/wAf/4Afn4Afn4Afn4Afn4Afn4Af/4Af/4Afn4Afn4A/n8A//8B//+D///AAAAAAAAAA8AAAYAA=="), this.x, this.y); + } + }; + // todo: all of these configurable through app settings menu. const twelve_hour = true; const swap_meridian = false; From 31c3725b93478b737427d78780dca8181e954f83 Mon Sep 17 00:00:00 2001 From: June Bennison Date: Thu, 30 Jan 2025 23:06:11 +1100 Subject: [PATCH 10/20] grandfather-clock: more edits to readme, todo --- apps/grandfather-clock/README.md | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/apps/grandfather-clock/README.md b/apps/grandfather-clock/README.md index 637ab50c4..fdf98dd86 100644 --- a/apps/grandfather-clock/README.md +++ b/apps/grandfather-clock/README.md @@ -4,7 +4,7 @@ A widget that runs in the background and chimes on every (configurable*) fractio ## Usage -Once installed, see the App Settings page for options. +Once installed, see the App Settings page for options. * Defaults: - Twelve hour mode is ENABLED. @@ -25,6 +25,8 @@ Drop me a message at @yogsoy on Discord if you need help / discover a bug that I Written by June B (yogsoy), inspired by aaronrolls' Chimer. -## Notes +## Todo -\* This is not implemented yet, sorry! Await v0.02. +\* App settings are not implemented yet, sorry! Await v0.02. + +A better icon would be nice. A 1-bit simplified grandfather clock. From 5c98ab8f5ad253e685cfd687c973c5f5f2655a11 Mon Sep 17 00:00:00 2001 From: June Bennison Date: Sun, 9 Feb 2025 23:47:36 +1100 Subject: [PATCH 11/20] grandfatherclock: rename app to grandfatherclock --- .../ChangeLog | 0 .../README.md | 0 .../icon.png | Bin .../metadata.json | 4 ++-- .../widget.js | 2 +- 5 files changed, 3 insertions(+), 3 deletions(-) rename apps/{grandfather-clock => grandfatherclock}/ChangeLog (100%) rename apps/{grandfather-clock => grandfatherclock}/README.md (100%) rename apps/{grandfather-clock => grandfatherclock}/icon.png (100%) rename apps/{grandfather-clock => grandfatherclock}/metadata.json (80%) rename apps/{grandfather-clock => grandfatherclock}/widget.js (98%) diff --git a/apps/grandfather-clock/ChangeLog b/apps/grandfatherclock/ChangeLog similarity index 100% rename from apps/grandfather-clock/ChangeLog rename to apps/grandfatherclock/ChangeLog diff --git a/apps/grandfather-clock/README.md b/apps/grandfatherclock/README.md similarity index 100% rename from apps/grandfather-clock/README.md rename to apps/grandfatherclock/README.md diff --git a/apps/grandfather-clock/icon.png b/apps/grandfatherclock/icon.png similarity index 100% rename from apps/grandfather-clock/icon.png rename to apps/grandfatherclock/icon.png diff --git a/apps/grandfather-clock/metadata.json b/apps/grandfatherclock/metadata.json similarity index 80% rename from apps/grandfather-clock/metadata.json rename to apps/grandfatherclock/metadata.json index 2bd092e23..4d388d0b7 100644 --- a/apps/grandfather-clock/metadata.json +++ b/apps/grandfatherclock/metadata.json @@ -1,4 +1,4 @@ -{ "id": "grandfather-clock", +{ "id": "grandfatherclock", "name": "Grandfather Clock Widget", "shortName":"Grandfather Clock", "version":"0.01", @@ -9,6 +9,6 @@ "supports" : ["BANGLEJS2"], "readme": "README.md", "storage": [ - {"name":"grandfather-clock.wid.js","url":"widget.js"} + {"name":"grandfatherclock.wid.js","url":"widget.js"} ] } diff --git a/apps/grandfather-clock/widget.js b/apps/grandfatherclock/widget.js similarity index 98% rename from apps/grandfather-clock/widget.js rename to apps/grandfatherclock/widget.js index 86294e087..fbbc260dc 100644 --- a/apps/grandfather-clock/widget.js +++ b/apps/grandfatherclock/widget.js @@ -1,6 +1,6 @@ (() => { - WIDGETS["grandfather-clock"] = { + WIDGETS["grandfatherclock"] = { area: "tr", width: 24, draw: function() { From 45cf7e3974f4611d75cfbee7371a15b1100f605c Mon Sep 17 00:00:00 2001 From: June Bennison Date: Sun, 9 Feb 2025 23:57:07 +1100 Subject: [PATCH 12/20] grandfatherclock: update icon from https://icons8.com/icon/D2sDn8Iefcjx/old-fashioned-clock --- apps/grandfatherclock/icon.png | Bin 4971 -> 979 bytes apps/grandfatherclock/widget.js | 2 +- 2 files changed, 1 insertion(+), 1 deletion(-) diff --git a/apps/grandfatherclock/icon.png b/apps/grandfatherclock/icon.png index b7ca0872f2cafac763afc700a2e1916ae524b2f1..8dc851c0432813ed8664031aa7433ce6fbc76eb2 100644 GIT binary patch delta 957 zcmV;u148`kCesIyB!3BTNLh0L01FcU01FcV0GgZ_000ApNkl=VpAk2NelW= zFATfTDNfMZyf{Txh!jseFYci8oU@&|ot=R%{NZrU!~6b!=YKrU`#wjd%D`ak_0?@o zde!Z$hg8(&tpDqF(pOYU7*fqE3W7<~ydof&Et=0M1S4SH>$(8}Unh(W4?!e61xv9g z5nkgxzpsS*4h7`<5<+PsmM+NvSeAvpu67;>dNtz!dKfw6NP{sg8-@K9^U@kl*YAP5EasZ)FNPKGzPstCk6pf0S z(&=;@fL^Z`ja`aHl?|ZLXkcMsK`=J9R;vZIT1_CVRx2znF7n3C zP3Itmu(wH8oT$mkNhmEXB@h;ih4)L0=AwwPF-rviH8C;4rBq8x3(q#{l^>wpbsZuz z(~=-uE*HdNv4n#xEYCs4*Gk}MFv=WS+HnlnFmBhuct4!DYaL~_d-tDZj zWE_BlaDUJn7Q~i#BovTtJ`~v8PLsK_WIjIb)tJ^6O6W|x+Ec0tjNwfi2MzZxn=+sK ziNj$o2O$V7Y;4SMTg1H`4?7fI<2|eyj1e;LFqg{%5Qk{B*KIN*Rm?i`vH;w*p63=b z>Wa4n!8m9*ZP0S_;oMmVVC*zBT{=e=#Dghah<~_wilWF|P1R?CvD>l_Ko)Pb!5vE_ z*Q`l}SZ|)9C~#RSp|#PLodb*y0M*)H;|%c0@7fFSR0Yj72Snp2ih_p?wb?s?g#b`u zrXrqQ1i)-KoD{&F%@!gZfa2pvi22`-cY^v@LH+^Uyl{{JyldW*)I6m`0N?d}1fZjC ze}8@gj6c{-0BX-1%0B>&x&T&scfh|VDmYPeG=BgLC5159V}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aep;5Vmye3O3_c%8e2v2*`<**agGZ*nZ4@OHDdn>0h2NdF=IW{j9Xj>Opk{)0fTR zHZ4}sI^(ivu5AQH!kD<9!c)U$p+I4L>k0JL(%+QmD$#={pwmL+oNB*XI5lcQ0&q!*`eAsmGctJnjr=rjy$T4a|yk>SwvId(gOT!WX*B6S8ikU9qPH_$E(ss?WXazPkKX z?4C6?t-gYMkGuX)k2XyBReEGYJmgwXNW*@$;SAi^g7afI^S2+g+I|$us7h opOlNhcF&_5`ir#+-kwgUO>Xz<#^+Su0oMeQg+xgA1|{bF7f!JEQUCw| diff --git a/apps/grandfatherclock/widget.js b/apps/grandfatherclock/widget.js index fbbc260dc..af2d910f9 100644 --- a/apps/grandfatherclock/widget.js +++ b/apps/grandfatherclock/widget.js @@ -5,7 +5,7 @@ width: 24, draw: function() { g.reset(); - g.drawImage(atob("GBiBAAAYAAA8AAA8AAD/AAH/gAP/wAf/4Afn4Afn4Afn4Afn4Afn4Af/4Af/4Afn4Afn4A/n8A//8B//+D///AAAAAAAAAA8AAAYAA=="), this.x, this.y); + g.drawImage(atob("EBiDASSTJJISSSSZJJJCSSTJ///ISSZP///5CTJ/////ITJ/////ITJ/+B//ITJ/+B//ITJ//+P/ITJ/////ISZP///5CSRJ///ICSQJJJJACSYBJJIBCSYABgABCSYABgABCSYAJAABCSYANgABCSYBtgABCSYNtsABCSYBtgABCSYAMAABCSYAAAABCSZJJJJJCQ=="), this.x, this.y); } }; From 717d263159e208d0310476bddb39a4a21827a972 Mon Sep 17 00:00:00 2001 From: June Bennison Date: Mon, 10 Feb 2025 00:47:16 +1100 Subject: [PATCH 13/20] grandfatherclock: remove unused widget icon space --- apps/grandfatherclock/widget.js | 1 - 1 file changed, 1 deletion(-) diff --git a/apps/grandfatherclock/widget.js b/apps/grandfatherclock/widget.js index af2d910f9..66e63830b 100644 --- a/apps/grandfatherclock/widget.js +++ b/apps/grandfatherclock/widget.js @@ -2,7 +2,6 @@ WIDGETS["grandfatherclock"] = { area: "tr", - width: 24, draw: function() { g.reset(); g.drawImage(atob("EBiDASSTJJISSSSZJJJCSSTJ///ISSZP///5CTJ/////ITJ/////ITJ/+B//ITJ/+B//ITJ//+P/ITJ/////ISZP///5CSRJ///ICSQJJJJACSYBJJIBCSYABgABCSYABgABCSYAJAABCSYANgABCSYBtgABCSYNtsABCSYBtgABCSYAMAABCSYAAAABCSZJJJJJCQ=="), this.x, this.y); From 53f441567523a59b598f683231936c65b73faaeb Mon Sep 17 00:00:00 2001 From: June Bennison Date: Mon, 10 Feb 2025 00:47:37 +1100 Subject: [PATCH 14/20] grandfatherclock: implement settings menu --- apps/grandfatherclock/settings.js | 83 +++++++++++++++++++++++++++++++ apps/grandfatherclock/widget.js | 53 ++++++++++---------- 2 files changed, 111 insertions(+), 25 deletions(-) create mode 100644 apps/grandfatherclock/settings.js diff --git a/apps/grandfatherclock/settings.js b/apps/grandfatherclock/settings.js new file mode 100644 index 000000000..6ab3b43b3 --- /dev/null +++ b/apps/grandfatherclock/settings.js @@ -0,0 +1,83 @@ +(function(back) { + + const configFile = "grandfatherclock.json"; + + let config = Object.assign({ + twelve_hour: true, + swap_meridian: false, + hour_attention_buzz_ms: 1000, + hour_count_buzz_ms: 250, + fraction_count_buzz_ms: 250, + fractions_of_hour: 4, // 4 = 15min intervals, 6 = 10min intervals + wait_ms: 500, + meridian_buzz_ms: 50, + meridian_buzz_wait_ms: 300 + }, require('Storage').readJSON("grandfatherclock.json", true) || {}); + + let writeConfig = function() { + require('Storage').writeJSON(configFile, config); + }; + + E.showMenu({ + "": {"title" : "Grandfather Clock"}, + "< Back": () => back(), + "12 / 24 hour": { + value: config.twelve_hour, + format: v => v ? "12" : "24", + onchange: v => { + config.twelve_hour = v; + writeConfig(); + } + },"Swap meridian": { + value: config.swap_meridian, + format: v => v ? "Yes" : "No", + onchange: v => { + config.swap_meridian = v; + writeConfig(); + } + },"Hr attn. buzz length (ms)": { + value: config.hour_attention_buzz_ms, + onchange: v => { + config.hour_attention_buzz_ms = v; + writeConfig(); + } + },"Hr count buzz (ms)": { + value: config.hour_count_buzz_ms, + onchange: v => { + config.hour_count_buzz_ms = v; + writeConfig(); + } + },"Frac. count buzz (ms)": { + value: config.fraction_count_buzz_ms, + onchange: v => { + config.fraction_count_buzz_ms = v; + writeConfig(); + } + },"Fracs. of hour": { + value: config.fractions_of_hour, + onchange: v => { + config.fractions_of_hour = v; + writeConfig(); + } + },"Count wait (ms)": { + value: config.wait_ms, + onchange: v => { + config.wait_ms = v; + writeConfig(); + } + },"Meridian buzz (ms)": { + value: config.meridian_buzz_ms, + onchange: v => { + config.meridian_buzz_ms = v; + writeConfig(); + } + },"Meridian wait (ms)": { + value: config.meridian_buzz_wait_ms, + onchange: v => { + config.meridian_buzz_wait_ms = v; + writeConfig(); + } + } + }); + +}) diff --git a/apps/grandfatherclock/widget.js b/apps/grandfatherclock/widget.js index 66e63830b..32162186a 100644 --- a/apps/grandfatherclock/widget.js +++ b/apps/grandfatherclock/widget.js @@ -2,36 +2,39 @@ WIDGETS["grandfatherclock"] = { area: "tr", + width: 16, draw: function() { g.reset(); g.drawImage(atob("EBiDASSTJJISSSSZJJJCSSTJ///ISSZP///5CTJ/////ITJ/////ITJ/+B//ITJ/+B//ITJ//+P/ITJ/////ISZP///5CSRJ///ICSQJJJJACSYBJJIBCSYABgABCSYABgABCSYAJAABCSYANgABCSYBtgABCSYNtsABCSYBtgABCSYAMAABCSYAAAABCSZJJJJJCQ=="), this.x, this.y); } }; - // todo: all of these configurable through app settings menu. - const twelve_hour = true; - const swap_meridian = false; - const hour_attention_buzz_ms = 1000; - const hour_count_buzz_ms = 250; - const fraction_count_buzz_ms = 250; - const fractions_of_hour = 4; // 4 = 15min intervals, 6 = 10min intervals - const wait_ms = 500; - const meridian_buzz_ms = 50; - const meridian_buzz_wait_ms = 300; + // sensible defaults + let config = Object.assign({ + twelve_hour: true, + swap_meridian: false, + hour_attention_buzz_ms: 1000, + hour_count_buzz_ms: 250, + fraction_count_buzz_ms: 250, + fractions_of_hour: 4, // 4 = 15min intervals, 6 = 10min intervals + wait_ms: 500, + meridian_buzz_ms: 50, + meridian_buzz_wait_ms: 300 + }, require('Storage').readJSON("grandfatherclock.json", true) || {}); // or, load the app settings file. let date; - let fractionMs = 3600000 / fractions_of_hour; + let fractionMs = 3600000 / config.fractions_of_hour; let chime = function () { date = new Date(); - let hourFrac = Math.floor(date.getMinutes() / (60 / fractions_of_hour)); + let hourFrac = Math.floor(date.getMinutes() / (60 / config.fractions_of_hour)); if (hourFrac == 0) { // if it's an o'clock hour - let chimeHour = (twelve_hour ? date.getHours() % 12 : date.getHours()); - if (chimeHour == 0) (twelve_hour ? chimeHour += 12 : chimeHour += 24); + let chimeHour = (config.twelve_hour ? date.getHours() % 12 : date.getHours()); + if (chimeHour == 0) (config.twelve_hour ? chimeHour += 12 : chimeHour += 24); - Bangle.buzz(hour_attention_buzz_ms).then(() => { // initial buzz - setTimeout(hourChime, wait_ms, chimeHour); // wait a period before doing the first chime + Bangle.buzz(config.hour_attention_buzz_ms).then(() => { // initial buzz + setTimeout(hourChime, config.wait_ms, chimeHour); // wait a period before doing the first chime }); } else { // if it's a fraction of an hour fractionChime(hourFrac); @@ -42,27 +45,27 @@ let hourChime = function (hoursLeftToChime) { hoursLeftToChime--; - Bangle.buzz(hour_count_buzz_ms).then(() => { // recursive. buzz and wait to do the next buzz. + Bangle.buzz(config.hour_count_buzz_ms).then(() => { // recursive. buzz and wait to do the next buzz. if (hoursLeftToChime > 0) { - setTimeout(hourChime, wait_ms, hoursLeftToChime); - } else if (twelve_hour) { // once finished with the hour count - setTimeout(meridianChime, wait_ms, (date.getHours() >= 12)); // if in twelve hour mode, queue up the meridian chime. + setTimeout(hourChime, config.wait_ms, hoursLeftToChime); + } else if (config.twelve_hour) { // once finished with the hour count + setTimeout(meridianChime, config.wait_ms, (date.getHours() >= 12)); // if in twelve hour mode, queue up the meridian chime. } }); }; let fractionChime = function (fractionsLeftToChime) { fractionsLeftToChime--; - Bangle.buzz(fraction_count_buzz_ms).then(() => { // recursive. buzz and wait to do the next buzz. - if (fractionsLeftToChime > 0) setTimeout(fractionChime, wait_ms, fractionsLeftToChime); + Bangle.buzz(config.fraction_count_buzz_ms).then(() => { // recursive. buzz and wait to do the next buzz. + if (fractionsLeftToChime > 0) setTimeout(fractionChime, config.wait_ms, fractionsLeftToChime); }); }; let meridianChime = function (meridian) { - if ((swap_meridian ? !meridian : meridian)) { // default: if PM - Bangle.buzz(meridian_buzz_ms).then(setTimeout(Bangle.buzz, meridian_buzz_wait_ms, meridian_buzz_ms)); // buzz once, wait, buzz again. + if ((config.swap_meridian ? !meridian : meridian)) { // default: if PM + Bangle.buzz(config.meridian_buzz_ms).then(setTimeout(Bangle.buzz, config.meridian_buzz_wait_ms, config.meridian_buzz_ms)); // buzz once, wait, buzz again. } else { // default: if AM - Bangle.buzz(meridian_buzz_ms); // buzz once. + Bangle.buzz(config.meridian_buzz_ms); // buzz once. } }; From 1b5b5392b6d0d55959c4acf37e9ac48cd8536575 Mon Sep 17 00:00:00 2001 From: June Bennison Date: Mon, 10 Feb 2025 00:52:36 +1100 Subject: [PATCH 15/20] grandfatherclock: update metadata for settings --- apps/grandfatherclock/metadata.json | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/apps/grandfatherclock/metadata.json b/apps/grandfatherclock/metadata.json index 4d388d0b7..bd1166b3d 100644 --- a/apps/grandfatherclock/metadata.json +++ b/apps/grandfatherclock/metadata.json @@ -9,6 +9,10 @@ "supports" : ["BANGLEJS2"], "readme": "README.md", "storage": [ - {"name":"grandfatherclock.wid.js","url":"widget.js"} + {"name":"grandfatherclock.wid.js","url":"widget.js"}, + {"name":"grandfatherclock.settings.js","url":"settings.js"} + ], + "data": [ + {"name":"grandfatherclock.json"} ] } From 0e06e82a25d60adb8c2b8aaea52127d1a010d480 Mon Sep 17 00:00:00 2001 From: June Bennison Date: Mon, 10 Feb 2025 01:00:05 +1100 Subject: [PATCH 16/20] grandfatherclock: clean settings --- apps/grandfatherclock/settings.js | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/apps/grandfatherclock/settings.js b/apps/grandfatherclock/settings.js index 6ab3b43b3..e59e969bf 100644 --- a/apps/grandfatherclock/settings.js +++ b/apps/grandfatherclock/settings.js @@ -21,16 +21,14 @@ E.showMenu({ "": {"title" : "Grandfather Clock"}, "< Back": () => back(), - "12 / 24 hour": { + "12 hour": { value: config.twelve_hour, - format: v => v ? "12" : "24", onchange: v => { config.twelve_hour = v; writeConfig(); } },"Swap meridian": { value: config.swap_meridian, - format: v => v ? "Yes" : "No", onchange: v => { config.swap_meridian = v; writeConfig(); From 24d4a9284dc963b6809a60ec6cad2b68f37ad347 Mon Sep 17 00:00:00 2001 From: June Bennison Date: Mon, 10 Feb 2025 01:06:21 +1100 Subject: [PATCH 17/20] grandfatherclock: draw widget option --- apps/grandfatherclock/settings.js | 8 ++++++++ apps/grandfatherclock/widget.js | 21 ++++++++++++--------- 2 files changed, 20 insertions(+), 9 deletions(-) diff --git a/apps/grandfatherclock/settings.js b/apps/grandfatherclock/settings.js index e59e969bf..6401dffa5 100644 --- a/apps/grandfatherclock/settings.js +++ b/apps/grandfatherclock/settings.js @@ -3,6 +3,7 @@ const configFile = "grandfatherclock.json"; let config = Object.assign({ + draw_widget: true, twelve_hour: true, swap_meridian: false, hour_attention_buzz_ms: 1000, @@ -21,6 +22,13 @@ E.showMenu({ "": {"title" : "Grandfather Clock"}, "< Back": () => back(), + "Draw widget": { + value: config.draw_widget, + onchange: v => { + config.draw_widget = v; + writeConfig(); + } + }, "12 hour": { value: config.twelve_hour, onchange: v => { diff --git a/apps/grandfatherclock/widget.js b/apps/grandfatherclock/widget.js index 32162186a..b7014d595 100644 --- a/apps/grandfatherclock/widget.js +++ b/apps/grandfatherclock/widget.js @@ -1,16 +1,8 @@ (() => { - WIDGETS["grandfatherclock"] = { - area: "tr", - width: 16, - draw: function() { - g.reset(); - g.drawImage(atob("EBiDASSTJJISSSSZJJJCSSTJ///ISSZP///5CTJ/////ITJ/////ITJ/+B//ITJ/+B//ITJ//+P/ITJ/////ISZP///5CSRJ///ICSQJJJJACSYBJJIBCSYABgABCSYABgABCSYAJAABCSYANgABCSYBtgABCSYNtsABCSYBtgABCSYAMAABCSYAAAABCSZJJJJJCQ=="), this.x, this.y); - } - }; - // sensible defaults let config = Object.assign({ + draw_widget: true, twelve_hour: true, swap_meridian: false, hour_attention_buzz_ms: 1000, @@ -22,6 +14,17 @@ meridian_buzz_wait_ms: 300 }, require('Storage').readJSON("grandfatherclock.json", true) || {}); // or, load the app settings file. + WIDGETS["grandfatherclock"] = { + area: "tr", + width: config.draw_widget ? 16, + draw: function() { + if (config.draw_widget) { + g.reset(); + g.drawImage(atob("EBiDASSTJJISSSSZJJJCSSTJ///ISSZP///5CTJ/////ITJ/////ITJ/+B//ITJ/+B//ITJ//+P/ITJ/////ISZP///5CSRJ///ICSQJJJJACSYBJJIBCSYABgABCSYABgABCSYAJAABCSYANgABCSYBtgABCSYNtsABCSYBtgABCSYAMAABCSYAAAABCSZJJJJJCQ=="), this.x, this.y); + } + } + }; + let date; let fractionMs = 3600000 / config.fractions_of_hour; From 4630ff1d855878fd5d602ce2e1a4c456b37b4242 Mon Sep 17 00:00:00 2001 From: June Bennison Date: Mon, 10 Feb 2025 01:11:07 +1100 Subject: [PATCH 18/20] grandfatherclock: undefine widget width & draw ifn't --- apps/grandfatherclock/widget.js | 12 +++++------- 1 file changed, 5 insertions(+), 7 deletions(-) diff --git a/apps/grandfatherclock/widget.js b/apps/grandfatherclock/widget.js index b7014d595..bb9d9406f 100644 --- a/apps/grandfatherclock/widget.js +++ b/apps/grandfatherclock/widget.js @@ -16,13 +16,11 @@ WIDGETS["grandfatherclock"] = { area: "tr", - width: config.draw_widget ? 16, - draw: function() { - if (config.draw_widget) { - g.reset(); - g.drawImage(atob("EBiDASSTJJISSSSZJJJCSSTJ///ISSZP///5CTJ/////ITJ/////ITJ/+B//ITJ/+B//ITJ//+P/ITJ/////ISZP///5CSRJ///ICSQJJJJACSYBJJIBCSYABgABCSYABgABCSYAJAABCSYANgABCSYBtgABCSYNtsABCSYBtgABCSYAMAABCSYAAAABCSZJJJJJCQ=="), this.x, this.y); - } - } + width: config.draw_widget ? 16 : undefined, + draw: config.draw_widget ? function() { + g.reset(); + g.drawImage(atob("EBiDASSTJJISSSSZJJJCSSTJ///ISSZP///5CTJ/////ITJ/////ITJ/+B//ITJ/+B//ITJ//+P/ITJ/////ISZP///5CSRJ///ICSQJJJJACSYBJJIBCSYABgABCSYABgABCSYAJAABCSYANgABCSYBtgABCSYNtsABCSYBtgABCSYAMAABCSYAAAABCSZJJJJJCQ=="), this.x, this.y); + } : undefined }; let date; From cf0c293e60fffcb28c3f7b5e6c026a70ecfa37bc Mon Sep 17 00:00:00 2001 From: June Bennison Date: Mon, 10 Feb 2025 01:59:42 +1100 Subject: [PATCH 19/20] grandfatherclock: metadata & changelog --- apps/grandfatherclock/ChangeLog | 1 + apps/grandfatherclock/README.md | 10 ++-------- apps/grandfatherclock/metadata.json | 2 +- 3 files changed, 4 insertions(+), 9 deletions(-) diff --git a/apps/grandfatherclock/ChangeLog b/apps/grandfatherclock/ChangeLog index 4c21f3ace..a21dc397d 100644 --- a/apps/grandfatherclock/ChangeLog +++ b/apps/grandfatherclock/ChangeLog @@ -1 +1,2 @@ 0.01: New Widget! +0.02: rename, new icon, settings menu! diff --git a/apps/grandfatherclock/README.md b/apps/grandfatherclock/README.md index fdf98dd86..b701164cc 100644 --- a/apps/grandfatherclock/README.md +++ b/apps/grandfatherclock/README.md @@ -1,10 +1,10 @@ # Grandfather Clock -A widget that runs in the background and chimes on every (configurable*) fraction of an hour, similar to Chimer, and counts out the fractions and the o'clock hour. +A widget that runs in the background and chimes on every (configurable) fraction of an hour, similar to Chimer, and counts out the fractions and the o'clock hour. ## Usage -Once installed, see the App Settings page for options. * +Once installed, see the App Settings page for options. Defaults: - Twelve hour mode is ENABLED. @@ -24,9 +24,3 @@ Drop me a message at @yogsoy on Discord if you need help / discover a bug that I ## Creator Written by June B (yogsoy), inspired by aaronrolls' Chimer. - -## Todo - -\* App settings are not implemented yet, sorry! Await v0.02. - -A better icon would be nice. A 1-bit simplified grandfather clock. diff --git a/apps/grandfatherclock/metadata.json b/apps/grandfatherclock/metadata.json index bd1166b3d..053e384d6 100644 --- a/apps/grandfatherclock/metadata.json +++ b/apps/grandfatherclock/metadata.json @@ -1,7 +1,7 @@ { "id": "grandfatherclock", "name": "Grandfather Clock Widget", "shortName":"Grandfather Clock", - "version":"0.01", + "version":"0.02", "description": "A widget that chimes every fraction of an hour (similar to Chimer), and counts out the fractions and the o'clock hour.", "icon": "icon.png", "type": "widget", From e4644727338441dc9d5697bbceea48907c83ab54 Mon Sep 17 00:00:00 2001 From: June Bennison Date: Wed, 12 Feb 2025 19:43:04 +1100 Subject: [PATCH 20/20] grandfatherclock: show/hide functionality change sets width to 0 and checks inside the draw function rather than leaving them undefined --- apps/grandfatherclock/widget.js | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/apps/grandfatherclock/widget.js b/apps/grandfatherclock/widget.js index bb9d9406f..96e121e63 100644 --- a/apps/grandfatherclock/widget.js +++ b/apps/grandfatherclock/widget.js @@ -16,11 +16,13 @@ WIDGETS["grandfatherclock"] = { area: "tr", - width: config.draw_widget ? 16 : undefined, - draw: config.draw_widget ? function() { - g.reset(); - g.drawImage(atob("EBiDASSTJJISSSSZJJJCSSTJ///ISSZP///5CTJ/////ITJ/////ITJ/+B//ITJ/+B//ITJ//+P/ITJ/////ISZP///5CSRJ///ICSQJJJJACSYBJJIBCSYABgABCSYABgABCSYAJAABCSYANgABCSYBtgABCSYNtsABCSYBtgABCSYAMAABCSYAAAABCSZJJJJJCQ=="), this.x, this.y); - } : undefined + width: config.draw_widget ? 16 : 0, + draw: function() { + if (config.draw_widget) { + g.reset(); + g.drawImage(atob("EBiDASSTJJISSSSZJJJCSSTJ///ISSZP///5CTJ/////ITJ/////ITJ/+B//ITJ/+B//ITJ//+P/ITJ/////ISZP///5CSRJ///ICSQJJJJACSYBJJIBCSYABgABCSYABgABCSYAJAABCSYANgABCSYBtgABCSYNtsABCSYBtgABCSYAMAABCSYAAAABCSZJJJJJCQ=="), this.x, this.y); + } + } }; let date;