Files
xovi-qmd-extensions/3.26.0.68/quickSettingsTimer.qmd

364 lines
20 KiB
Plaintext

; Quick Settings Timer/Chrono
; Adds a countdown timer and stopwatch to the quick settings panel
; Timer state lives in Values.timerManager so it persists across menu opens/closes
AFFECT [[1658694193319203921]]
TRAVERSE [[6502786168]]
LOCATE AFTER ALL
INSERT {
property ~&214620122227&~ timerManager: _timerManager
~&6502786168&~ {
~&5972374&~: _timerManager
property ~&6503679477&~ timerMode: ~&6504329801&~
property ~&197088788&~ totalMs: 0
property ~&197088788&~ remainMs: 0
property ~&6503679477&~ isRunning: ~&214625660372&~
property ~&7083178290016&~ ~&478322454160073828&~: "00:00"
property ~&6503679477&~ ~&16765420033347753489&~: ~&214625660372&~
property ~&197088788&~ presetMs: 60000
property ~&6503679477&~ addMode: ~&6504329801&~
function fmt(ms) {
~&197102514&~ ~&180970&~ = ~&6502909715&~.~&197079679&~(ms);
~&197102514&~ ~&180977&~ = ~&6502909715&~.~&214626058827&~(~&180970&~ / 3600000);
~&197102514&~ ~&180982&~ = ~&6502909715&~.~&214626058827&~((~&180970&~ % 3600000) / 60000);
~&197102514&~ ~&180988&~ = ~&6502909715&~.~&214626058827&~((~&180970&~ % 60000) / 1000);
~&197102514&~ mm = ~&180982&~.~&7713616118928163&~().~&7713428190834284&~(2, ~&'180921&~);
~&197102514&~ ss = ~&180988&~.~&7713616118928163&~().~&7713428190834284&~(2, ~&'180921&~);
~&5972376&~ (~&180977&~ > 0) {
~&7083121450889&~ ~&180977&~.~&7713616118928163&~().~&7713428190834284&~(2, ~&'180921&~) + ~&"180931&~ + mm + ~&"180931&~ + ss;
}
~&7083121450889&~ mm + ~&"180931&~ + ss;
}
function refresh() {
~&5972376&~ (timerMode) {
~&478322454160073828&~ = fmt(remainMs > 0 ? remainMs : 0);
} ~&6503784146&~ {
~&478322454160073828&~ = fmt(totalMs);
}
}
function go() {
~&5972376&~ (timerMode) {
~&5972376&~ (remainMs <= 0) ~&7083121450889&~;
}
~&16765420033347753489&~ = ~&214625660372&~;
isRunning = ~&6504329801&~;
_tick.~&214641748151&~();
}
function ~&6504295855&~() {
isRunning = ~&214625660372&~;
_tick.~&6504295855&~();
}
function doReset() {
~&6504295855&~();
~&16765420033347753489&~ = ~&214625660372&~;
~&5972376&~ (timerMode) {
remainMs = totalMs;
} ~&6503784146&~ {
totalMs = 0;
}
refresh();
}
~&214604601930&~ {
~&5972374&~: _tick
~&7713147298280334&~: 100
~&7083121289162&~: ~&6504329801&~
~&495358363329399331&~: {
~&5972376&~ (_timerManager.timerMode) {
_timerManager.remainMs -= 100;
~&5972376&~ (_timerManager.remainMs <= 0) {
_timerManager.remainMs = 0;
_timerManager.~&6504295855&~();
_timerManager.~&16765420033347753489&~ = ~&6504329801&~;
}
} ~&6503784146&~ {
_timerManager.totalMs += 100;
}
_timerManager.refresh();
}
}
}
}
END TRAVERSE
END AFFECT
AFFECT [[12542166428983872557]]
TRAVERSE [[7711468349764991]] > [[6502786168]] > [[8397788359424131273]] > [[14125623155555875541]]#[[233718721544006]]
LOCATE AFTER [[254501558939456351]]#[[8399137618543699982]]
INSERT {
~&425121728314878811&~.~&15740235808997988493&~ {
~&7081629735527&~.~&254529418434902000&~: ~&6504329801&~
~&7081629735527&~.~&254549367831075482&~: ~&254477762679831355&~.~&214603824602&~.~&7713684474795983&~.~&7713442318223278&~.~&233744706647566&~.~&214641496386&~
}
~&14125623155555875541&~ {
~&5972374&~: _timerUI
~&7081629735527&~.~&254529418434902000&~: ~&6504329801&~
~&7081629735527&~.~&8399743405844438450&~: ~&254477762679831355&~.~&214603824602&~.~&7713684474795983&~.~&7713442318223278&~.~&233740248806464&~.~&214641496386&~
~&7081629735527&~.~&499747351624466981&~: ~&254477762679831355&~.~&214603824602&~.~&7713684474795983&~.~&7713442318223278&~.~&233740248806464&~.~&214641496386&~
~&7081629735527&~.~&254549367831075482&~: ~&254477762679831355&~.~&214603824602&~.~&7713684474795983&~.~&7713442318223278&~.~&233744706647566&~.~&214641496386&~
~&233744706647566&~: ~&254477762679831355&~.~&214603824602&~.~&7713684474795983&~.~&7713442318223278&~.~&233744706647566&~.~&7082925185962&~
/* Mode selector tabs */
~&254501558939456351&~ {
~&7081629735527&~.~&254529418434902000&~: ~&6504329801&~
~&233744706647566&~: 0
~&7712155293725601&~ {
~&214634455770&~: [
{ ~&197101097&~: ~&"214604601930&~, isTimer: ~&6504329801&~ },
{ ~&197101097&~: "Chrono", isTimer: ~&214625660372&~ }
]
~&7712922269353028&~: ~&6502786168&~ {
~&7081629735527&~.~&254529418434902000&~: ~&6504329801&~
~&7081629735527&~.~&17520348323745447649&~: 68
readonly property ~&6503679477&~ ~&7082453764421&~: ~&7082020628281&~.timerManager.timerMode === ~&254539508423767444&~.isTimer
~&6503165774&~ {
~&233721384511543&~.~&7712879746914881&~: ~&7083038346995&~
~&6504315758&~: ~&254539508423767444&~.~&197101097&~
~&6503823200&~.~&254543497768871654&~: 24
~&6503823200&~.~&6503679370&~: ~&7082453764421&~
~&214622605608&~: ~&7082453764421&~ ? ~&7082020628281&~.~&8399340017235344933&~ : "#888888"
}
~&254494525842443467&~ {
~&233721384511543&~.~&6503816592&~: ~&7083038346995&~
~&254542236275632405&~: {
~&7082020628281&~.timerManager.~&6504295855&~();
~&7082020628281&~.timerManager.timerMode = ~&254539508423767444&~.isTimer;
~&5972376&~ (!~&254539508423767444&~.isTimer) {
~&7082020628281&~.timerManager.totalMs = 0;
}
~&7082020628281&~.timerManager.refresh();
}
}
~&254501108490678590&~ {
~&233721384511543&~.~&7082507142622&~: ~&7083038346995&~.~&7082507142622&~
~&233721384511543&~.~&6504027668&~: ~&7083038346995&~.~&6504027668&~
~&233721384511543&~.~&214640173127&~: ~&7083038346995&~.~&214640173127&~
~&7082729686082&~: 3
~&214622605608&~: ~&7082453764421&~ ? ~&7082020628281&~.~&8399340017235344933&~ : ~&"503220030291830651&~
}
}
}
}
/* Time display (fixed width to avoid resizing) */
~&6502786168&~ {
~&7081629735527&~.~&254522510204479688&~: ~&5971598&~.~&14019785274593562237&~
~&7081629735527&~.~&7797818826744279624&~: 300
~&7081629735527&~.~&17520348323745447649&~: _display.~&2122835675838176157&~
~&6503165774&~ {
~&5972374&~: _display
~&233721384511543&~.~&7712879746914881&~: ~&7083038346995&~
~&6504315758&~: ~&7082020628281&~.timerManager.~&478322454160073828&~
~&6503823200&~.~&254543497768871654&~: 56
~&6503823200&~.~&7083316716977&~: ~&6502673216&~.ExtraLight
~&214622605608&~: ~&7082020628281&~.~&8399340017235344933&~
~&15450610953915458578&~: ~&6503165774&~.~&14019785274593562237&~
}
}
/* Preset buttons (timer mode only) */
~&254501558939456351&~ {
~&7081629735527&~.~&254529418434902000&~: ~&6504329801&~
~&233744706647566&~: ~&254477762679831355&~.~&214603824602&~.~&7713684474795983&~.~&7713442318223278&~.~&233744706647566&~.~&214641496386&~
~&233748328658231&~: ~&7082020628281&~.timerManager.timerMode
~&7712155293725601&~ {
~&214634455770&~: [
{ ~&197101097&~: "1 m", ~&197102508&~: 60000 },
{ ~&197101097&~: "5 m", ~&197102508&~: 300000 },
{ ~&197101097&~: "10 m", ~&197102508&~: 600000 },
{ ~&197101097&~: "30 m", ~&197102508&~: 1800000 },
{ ~&197101097&~: "1 h", ~&197102508&~: 3600000 }
]
~&7712922269353028&~: ~&6502786168&~ {
~&7081629735527&~.~&254529418434902000&~: ~&6504329801&~
~&7081629735527&~.~&17520348323745447649&~: 50
~&254501108490678590&~ {
~&233721384511543&~.~&6503816592&~: ~&7083038346995&~
~&7083116119249&~: 8
~&214622605608&~: "#EEEEEE"
}
~&6503165774&~ {
~&233721384511543&~.~&7712879746914881&~: ~&7083038346995&~
~&6504315758&~: ~&254539508423767444&~.~&197101097&~
~&6503823200&~.~&254543497768871654&~: 20
~&6503823200&~.~&6503679370&~: ~&6504329801&~
~&214622605608&~: ~&7082020628281&~.~&8399340017235344933&~
}
~&254494525842443467&~ {
~&233721384511543&~.~&6503816592&~: ~&7083038346995&~
~&254542236275632405&~: {
~&7082020628281&~.timerManager.~&6504295855&~();
~&7082020628281&~.timerManager.presetMs = ~&254539508423767444&~.~&197102508&~;
~&5972376&~ (~&7082020628281&~.timerManager.addMode) {
~&7082020628281&~.timerManager.totalMs += ~&254539508423767444&~.~&197102508&~;
~&7082020628281&~.timerManager.remainMs += ~&254539508423767444&~.~&197102508&~;
} ~&6503784146&~ {
~&7082020628281&~.timerManager.totalMs = ~&254539508423767444&~.~&197102508&~;
~&7082020628281&~.timerManager.remainMs = ~&254539508423767444&~.~&197102508&~;
}
~&7082020628281&~.timerManager.refresh();
}
}
}
}
}
/* Control buttons */
~&254501558939456351&~ {
~&7081629735527&~.~&254529418434902000&~: ~&6504329801&~
~&233744706647566&~: ~&254477762679831355&~.~&214603824602&~.~&7713684474795983&~.~&7713442318223278&~.~&233744706647566&~.~&214641496386&~
/* Add/Set toggle (timer only) */
~&6502786168&~ {
~&7081629735527&~.~&254529418434902000&~: ~&6504329801&~
~&7081629735527&~.~&17520348323745447649&~: 70
~&233748328658231&~: ~&7082020628281&~.timerManager.timerMode
~&254501108490678590&~ {
~&233721384511543&~.~&6503816592&~: ~&7083038346995&~
~&7083116119249&~: 8
~&7082507052999&~.~&214622605608&~: "#888888"
~&7082507052999&~.~&214646099849&~: 1
~&214622605608&~: ~&"503220030291830651&~
}
~&425121728314878811&~.~&6502767986&~ {
~&233721384511543&~.~&7712879746914881&~: ~&7083038346995&~
~&6504284228&~: ~&425121728314878811&~.~&7082020628281&~.~&7713132906001613&~.~&214641496386&~
~&7083172477658&~: ~&7082020628281&~.timerManager.addMode ? ~&"15094524446772001204&~ : ~&"5724976033632521381&~
}
~&254494525842443467&~ {
~&233721384511543&~.~&6503816592&~: ~&7083038346995&~
~&254542236275632405&~: {
~&7082020628281&~.timerManager.addMode = !~&7082020628281&~.timerManager.addMode;
}
}
}
/* Reset */
~&6502786168&~ {
~&7081629735527&~.~&254529418434902000&~: ~&6504329801&~
~&7081629735527&~.~&17520348323745447649&~: 70
~&254501108490678590&~ {
~&233721384511543&~.~&6503816592&~: ~&7083038346995&~
~&7083116119249&~: 8
~&7082507052999&~.~&214622605608&~: "#888888"
~&7082507052999&~.~&214646099849&~: 1
~&214622605608&~: ~&"503220030291830651&~
}
~&425121728314878811&~.~&6502767986&~ {
~&233721384511543&~.~&7712879746914881&~: ~&7083038346995&~
~&6504284228&~: ~&425121728314878811&~.~&7082020628281&~.~&7713132906001613&~.~&214641496386&~
~&7083172477658&~: ~&"6968812144639225076&~
}
~&254494525842443467&~ {
~&233721384511543&~.~&6503816592&~: ~&7083038346995&~
~&254542236275632405&~: ~&7082020628281&~.timerManager.doReset()
}
}
/* Start / Stop */
~&6502786168&~ {
~&7081629735527&~.~&254529418434902000&~: ~&6504329801&~
~&7081629735527&~.~&17520348323745447649&~: 70
~&254501108490678590&~ {
~&233721384511543&~.~&6503816592&~: ~&7083038346995&~
~&7083116119249&~: 8
~&214622605608&~: ~&7082020628281&~.timerManager.isRunning ? "#EEEEEE" : ~&7082020628281&~.~&8399340017235344933&~
}
~&6503165774&~ {
~&233721384511543&~.~&7712879746914881&~: ~&7083038346995&~
~&6504315758&~: ~&7082020628281&~.timerManager.isRunning ? "Stop" : "Start"
~&6503823200&~.~&254543497768871654&~: 20
~&6503823200&~.~&6503679370&~: ~&6504329801&~
~&214622605608&~: ~&7082020628281&~.timerManager.isRunning ? ~&7082020628281&~.~&8399340017235344933&~ : ~&7082020628281&~.~&8399340017260114793&~
}
~&254494525842443467&~ {
~&233721384511543&~.~&6503816592&~: ~&7083038346995&~
~&254542236275632405&~: {
~&7082020628281&~.timerManager.isRunning ? ~&7082020628281&~.timerManager.~&6504295855&~() : ~&7082020628281&~.timerManager.go();
}
}
}
}
}
}
END TRAVERSE
END AFFECT
; Notification bar when timer finishes - visible in all modes
AFFECT [[2328484894988065446]]
IMPORT [[233700934949963.233693781272506]] [[180922.180921]]
TRAVERSE [[8397788359424131273]]#[[6504254477]] > [[8397993708429497603]]#[[7713531976371484]]
LOCATE AFTER ALL
INSERT {
~&425121728314878811&~.~&11119534664549952261&~ {
~&233721384511543&~.~&6504027668&~: ~&7083038346995&~.~&6504027668&~
~&233721384511543&~.~&214640173127&~: ~&7083038346995&~.~&214640173127&~
~&233721384511543&~.~&7082507142622&~: ~&7083038346995&~.~&7082507142622&~
~&233748328658231&~: ~&7082020628281&~.timerManager.~&16765420033347753489&~
~&6504337259&~: ~&254477762679831355&~.~&11119534664549952261&~.~&233740920352621&~
~&425121728314878811&~.~&11119534664549952261&~.~&233695222288046&~ {
~&6504315758&~: "Time's up! (" + ~&7082020628281&~.timerManager.fmt(~&7082020628281&~.timerManager.totalMs) + ~&"180914&~
~&7081629735527&~.~&254529418434902000&~: ~&6504329801&~
~&7081629735527&~.~&8399743405844438450&~: ~&425121728314878811&~.~&7082020628281&~.~&233740248806464&~.~&214641496386&~
~&7081629735527&~.~&499747351624466981&~: ~&425121728314878811&~.~&7082020628281&~.~&233740248806464&~.~&214641496386&~
}
~&425121728314878811&~.~&11119534664549952261&~.~&7081261925573&~ {
~&6504315758&~: ~&"233701679664206&~
~&254542236275632405&~: {
~&7082020628281&~.timerManager.doReset();
~&7082020628281&~.timerManager.go();
}
}
~&425121728314878811&~.~&11119534664549952261&~.~&233683758819504&~ { }
~&425121728314878811&~.~&11119534664549952261&~.~&7081261925573&~ {
~&6504315758&~: "+1min"
~&254542236275632405&~: {
~&7082020628281&~.timerManager.totalMs += 60000;
~&7082020628281&~.timerManager.remainMs += 60000;
~&7082020628281&~.timerManager.~&16765420033347753489&~ = ~&214625660372&~;
~&7082020628281&~.timerManager.go();
}
}
~&425121728314878811&~.~&11119534664549952261&~.~&233683758819504&~ { }
~&425121728314878811&~.~&11119534664549952261&~.~&7081261925573&~ {
~&6504315758&~: "+5min"
~&254542236275632405&~: {
~&7082020628281&~.timerManager.totalMs += 300000;
~&7082020628281&~.timerManager.remainMs += 300000;
~&7082020628281&~.timerManager.~&16765420033347753489&~ = ~&214625660372&~;
~&7082020628281&~.timerManager.go();
}
}
~&425121728314878811&~.~&11119534664549952261&~.~&233683758819504&~ { }
~&425121728314878811&~.~&11119534664549952261&~.~&7081261925573&~ {
~&6504315758&~: ~&"214584551711&~
~&254542236275632405&~: {
~&7082020628281&~.timerManager.~&16765420033347753489&~ = ~&214625660372&~;
}
}
}
}
END TRAVERSE
END AFFECT