This handles issue #32. This adds an event listener on the new-thread and the thread pages. Essentially what happens is, given they are on one of these two threads,
For each `textarea` element that is a child of a `form` element,
If the user presses either `meta` or `ctrl` and presses the `enter` key while that former key is still down,
Execute the `submit` method of the parent `form` element.
I used ctrl and meta to handle the major OS's (assuming Linux's main command key is one of those two).
Comments
I did a forEach on each textarea that existed in a form for each page just in case there was ever a page with multiple. If this is overkill, I can remove it.
I dislike putting these scripts in the same folder as the HTML templates. Was hoping I could put it in a subfolder of scripts, but didn't want to try and change much of the core functions to make that happen as that seemed like way too much of an edge case. Using the prefix of scripts. seemed like the best compromise, but a compromise nonetheless.
I don't know enough about the templating in Go, but it seemed like this was the best way to inject some JS into a page. If there is a way to inject a listener in directly to an element (like more advanced templating in HTMX, React, etc), let me know and I can make that happen.
I'm not precious about PR's. If you want to modify it, merge it, decline it, whatever, go for it. Thanks!
This handles issue #32. This adds an event listener on the
new-thread
and thethread
pages. Essentially what happens is, given they are on one of these two threads,I used
ctrl
andmeta
to handle the major OS's (assuming Linux's main command key is one of those two).Comments
forEach
on each textarea that existed in aform
for each page just in case there was ever a page with multiple. If this is overkill, I can remove it.scripts
, but didn't want to try and change much of the core functions to make that happen as that seemed like way too much of an edge case. Using the prefix ofscripts.
seemed like the best compromise, but a compromise nonetheless.I'm not precious about PR's. If you want to modify it, merge it, decline it, whatever, go for it. Thanks!