calc: refresh matches box in place on cipher toggle (no resubmit) + Query-button centering (parity with production)
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01LmGTn96JVn6xPNNTTW77g1
This commit is contained in:
1 parent
6848cff627
commit
8562ab8edd
5 files changed
+37
-4
No files matched your search
@@ -3,6 +3,7 @@
|
||||
function queryDatabase() {
|
||||
var cVal
|
||||
if(sVal() == "") return // empty input
|
||||
lastQueryPhrase = sVal() // remember what this box is showing, so a later cipher toggle can refresh it
|
||||
|
||||
if (liveDatabaseMode == true) calcLiveDatabase(userDBlive) // calculate gematria for live database for enabled ciphers
|
||||
|
||||
@@ -77,6 +78,29 @@ function queryDatabase() {
|
||||
}
|
||||
}
|
||||
|
||||
var _refreshingQuery = false // reentrancy guard: updateTables -> refreshOpenQuery -> queryDatabase must not recurse
|
||||
function refreshOpenQuery() {
|
||||
// Called after any cipher-set change (updateTables). If a matches box is open and maximized,
|
||||
// re-run the SAME query so a newly enabled cipher adds its column (and re-ranks) with no
|
||||
// resubmit — and a newly disabled cipher drops its column. No-op when no box is open.
|
||||
if (_refreshingQuery) return
|
||||
var qa = document.getElementById("queryArea")
|
||||
if (qa === null || $("#queryArea").hasClass("minimizeQuery")) return // only when open + not minimized
|
||||
if (lastQueryPhrase === "") return
|
||||
var box = document.getElementById("phraseBox")
|
||||
var savedInput = box.value // preserve whatever the user may be typing now
|
||||
var savedFilter = searchBarValue // preserve the find-in-results filter
|
||||
_refreshingQuery = true
|
||||
try {
|
||||
box.value = lastQueryPhrase // queryDatabase reads sVal(); point it at the open box's phrase
|
||||
queryDatabase() // rebuilds the table for the current enabled-cipher set
|
||||
} finally {
|
||||
box.value = savedInput // restore silently (direct assignment fires no input event)
|
||||
_refreshingQuery = false
|
||||
}
|
||||
if (savedFilter) searchBarDBQuery(savedFilter) // re-apply the filter over the fresh matches
|
||||
}
|
||||
|
||||
function clearDatabaseQueryTable() {
|
||||
$("#calcMain").removeClass("splitInterface")
|
||||
$("#queryArea").remove() // remove element from page
|
||||
|
||||
Reference in new issue
Block a user