[OCaml] High Intensity Training Online
feat hide exercise-selector submit under JS
The client marks the document as script-enhanced on init, and CSS hides the exercise-selector submit button when that marker is set. The dropdown navigates on change under script, so the button is redundant; a no-JS visitor keeps it as the fallback.
Changed files
ENHANCEMENTS.org
@@ -70,5 +70,5 @@
70
70
Always label the logbook tab `Logbook`. Add a dedicated profile button for the user name in the mobile top navigation bar.
71
71
** DONE Use shared load and reps column headings
72
72
In exercise logging fieldsets, show Load and Reps as column headings instead of repeating them above every input in a multi-exercise group.
73
Removed:
** TODO Hide exercise-selector submit buttons in SPA mode
73
Added:
** DONE Hide exercise-selector submit buttons in SPA mode
74
74
When JavaScript progressive enhancement is active, do not show the submit button for exercise selection.
lib/web/assets/hito.css
@@ -427,6 +427,9 @@
427
427
margin: 0;
428
428
padding: 0.65rem 1.1rem;
429
429
}
430
Added:
/* With script active, the dropdown navigates on change, so the submit button is
431
Added:
redundant; hide it. Without script it stays as the fallback. */
432
Added:
[data-hito-js="on"] .exercise-select-go { display: none; }
430
433
431
434
/* The sticky workout timer bar. It pins to the top of the scroll area while a
432
435
workout is being logged and shows the elapsed time. The client ticks the
lib/web/workout_client.ml
@@ -323,4 +323,9 @@
323
323
(Dom_html.handler popstate)
324
324
Js._false
325
325
|> ignore;
326
Added:
(* Mark the document as script-enhanced so CSS can hide no-JS fallbacks such
327
Added:
as the exercise-selector submit button. Set only once the client runs, so
328
Added:
a no-JS visitor keeps every fallback. *)
329
Added:
document##.documentElement##setAttribute
330
Added:
(Js.string "data-hito-js") (Js.string "on");
326
331
start_timer ()