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:
malonehunterandClaude Opus 4.8 committed 2026-09-13 00:20:24 -04:00
1 parent 6848cff627
commit 8562ab8edd
5 files changed
+37 -4

No files matched your search

+1
View File
@@ -1743,6 +1743,7 @@ function updateTables(updColorLayout = true) {
autoHistoryTableLayout(); // use Compact History if necessary
updateHistoryTable(); // update history table
updateWordBreakdown(breakCipher, true); // update word breakdown and choose first enabled cipher
if (typeof refreshOpenQuery === "function") refreshOpenQuery(); // refresh an open matches box in place after a cipher-set change
}
function autoHistoryTableLayout() {
+24
View File
@@ -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
+1
View File
@@ -38,6 +38,7 @@ var numericalMode // boolean flag, match numbers instead of phrase gematria
var userDB = [] // imported database
var userDBlive = [] // imported live database (phrases only)
var queryResult = [] // matching phrases
var lastQueryPhrase = '' // the phrase that produced the OPEN matches box, so a cipher toggle can refresh it in place
var queryResultInitial = [] // matching phrases (used to reset search bar results)
var precalcDBLoaded = false // if precalculated database is loaded, disable cipher rearrangement
var searchBarValue = '' // search bar value
+7
View File
@@ -1018,9 +1018,16 @@ body {
}
#queryDBbtn {
background-color: var(--input-bg-accent);
/* center the "\1F52E Query" value both axes: border-box so the 1px border doesn't bias width,
symmetric zero padding, and an explicit line-height so the emoji's tall line box doesn't push
the baseline down (was reading as extra top/left padding). */
box-sizing: border-box;
padding: 0em;
margin: 0em 0.3em;
width: 75px;
text-align: center;
line-height: 1;
vertical-align: middle;
}
#enterPhraseBtn,
#autoMatchBtn {
+4 -4
View File
@@ -16,11 +16,11 @@
<!-- html2canvas v1.0.0-alpha.12 -->
<script src="calc/gematria.js?v=3"></script>
<script src="calc/calc.js?v=14"></script>
<script src="calc/init-variables.js?v=7"></script>
<script src="calc/calc.js?v=15"></script>
<script src="calc/init-variables.js?v=8"></script>
<script src="calc/ciphers.js?v=6"></script>
<link rel="stylesheet" type="text/css" href="calc/styles.css?v=9" />
<link rel="stylesheet" type="text/css" href="calc/styles.css?v=10" />
<script>
window.onpaint = function () {
@@ -154,7 +154,7 @@
<script src="calc/num-prop.js?v=2"></script>
<script src="calc/edit-ciphers.js?v=2"></script>
<script src="calc/date-calc.js?v=2"></script>
<script src="calc/database.js?v=6"></script>
<script src="calc/database.js?v=7"></script>
<script src="calc/quick-guide.js?v=2"></script>
<script src="calc/localstorage.js?v=3"></script>