More fix
This commit is contained in:
1 parent
d74385ca3c
commit
f041daeda3
2 files changed
+19
-13
No files matched your search
+13
-11
@@ -434,8 +434,12 @@ router.get('/api/bookmark', () => bookmarkFragment(''));
|
||||
// straight in and processes no out-of-band elements -- and
|
||||
// when a worker first appears under a page boot.html
|
||||
// composed.
|
||||
// chapter=ch3 the verses of that chapter, and land on the chapter.
|
||||
// verse=v3_16 the same verses, that one selected, and land on the verse.
|
||||
// at=ch3 the verses of that chapter, and land on the chapter.
|
||||
// at=v3_16 the same verses, that one selected, and land on the verse.
|
||||
//
|
||||
// One parameter for both selects: at is the id of the element to land on, and
|
||||
// ch3 and v3_16 are told apart by their shape. Which select it came from is
|
||||
// not a second fact.
|
||||
//
|
||||
// Neither the book nor the anchor is in the URL, deliberately. Both come from
|
||||
// HX-Current-URL, which htmx sets from location.href on every request it
|
||||
@@ -467,19 +471,17 @@ router.get('/api/bookmark', () => bookmarkFragment(''));
|
||||
router.get('/api/reference', async (call) => {
|
||||
const params = call.url.searchParams;
|
||||
const page = call.currentUrl();
|
||||
// Which select the reader moved, if either did -- by whether the parameter
|
||||
// is there, not by whether it says anything. A select posts an empty value
|
||||
// when it has no options, and reading that as "no select moved" answers it
|
||||
// with a whole picker: htmx swaps a <div> into a <select>, which renders as
|
||||
// nothing, and the select is then empty for good -- every change after that
|
||||
// posts the same empty value and gets the same answer.
|
||||
// Set when a select was moved -- by whether the parameter is there, not by
|
||||
// whether it says anything. A select posts an empty value when it has no
|
||||
// options, and reading that as "no select moved" answers it with a whole
|
||||
// picker: htmx swaps a <div> into a <select>, which renders as nothing, and
|
||||
// the select is then empty for good -- every change after that posts the
|
||||
// same empty value and gets the same answer.
|
||||
//
|
||||
// An empty value is still an answerable question. It names no chapter, so it
|
||||
// gets chapter 1, which is what everything here does with an anchor it
|
||||
// cannot read.
|
||||
const moved = params.has('verse') ? params.get('verse')
|
||||
: params.has('chapter') ? params.get('chapter')
|
||||
: null;
|
||||
const moved = params.has('at') ? params.get('at') : null;
|
||||
|
||||
// The address bar is the fallback, and only that: once a select has been
|
||||
// used it is the one saying where to go, and HX-Replace-Url has not caught
|
||||
|
||||
Reference in new issue
Block a user