v2.4: decouple highlight-mode toggle + settings persistence + Cmd+click on Mac

Squashed port of the v2.4.0..v2.4.6 iteration on hypercypher production. The history-table
highlight semantics no longer follow the Cross/Same query match mode — a new ▼ toggle next
to the highlight box (styled like the ⚡ auto-match button, dim/lit on/off) controls them
independently. Cross/Same checkboxes now affect only the query/modal + export (as the names
suggest). optHltSameCipher and autoMatchEnabled both round-trip through localStorage now via
calcOptionsArr. Cmd+click on macOS now works as Ctrl+click does on Win/Linux (toggle a
history value into the highlight box) — macOS routes Ctrl+click to contextmenu so the
existing gesture was unreachable for Mac.

Pure client-side; no db change (v2.3 db.json + db_lite.json Release assets still valid).
Files: calc/calc.js, calc/highlighter.js, calc/init-variables.js, calc/styles.css, index.html.
Cache-bust calc v13 / highlighter v3 / init-variables v7 / styles v9.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This commit is contained in:
malonehunterandClaude Opus 4.7 committed 2026-05-30 07:46:08 -04:00
1 parent 202fe8ed04
commit 4eb10f2bdb
6 files changed
+102 -13

No files matched your search

+31
View File
@@ -1,5 +1,36 @@
# Changelog
## v2.4 — Highlight-Mode Decouple Toggle & Settings Persistence
### Added
- **Highlight-mode toggle (▼)** next to the highlight box, styled like the ⚡ auto-match
button (dim/lit on/off). Decouples the history-table highlight semantics from the
Cross/Same query match mode:
- Dim (default) = "any matches" — light every cell whose value you typed (cross-style)
- Lit (toggled) = "same column matches only" — light only values that repeat within a
cipher column (same-cipher-pairing)
- The Cross/Same checkboxes in the options panel now affect only the query/modal +
export (as the names suggest); the history-table highlight has its own switch.
- **Settings persistence** for two opt flags that weren't round-tripping through
`localStorage`:
- `optHltSameCipher` (the new toggle) — added to `calcOptionsArr`
- `autoMatchEnabled` (the ⚡ button state) — was the lone outlier among the opt flags;
every other one persisted but this one re-read the device-aware default each page
load. Now persists; the device-aware default still applies for *first* visit per
device, then the user's choice sticks.
- **Cmd+click on macOS** for the "add value to highlight box" power-user gesture. macOS
hard-routes Ctrl+click to a `contextmenu` event (firing the right-click hideValue
toggle instead of the Ctrl+click branch), so the existing gesture was unreachable for
Mac users. The click handler now accepts `e.metaKey` alongside `ctrlIsPressed`.
### Notes
- Plain left-click on a history value still triggers the cross-table blink sweep
regardless of the new toggle — that's the quick "where else does this number appear?"
gesture and predates the match-mode flags. The new toggle governs persistent highlight
semantics (typing into the box, Cmd/Ctrl+click); the ephemeral blink stays mode-free.
- No database changes — the `db.json` / `db_lite.json` Release assets from v2.3 are still
valid; v2.4 ships no new assets.
## v2.3 — Proper-Case Normalization & +6,421 Common Words
### Changed
+36 -4
View File
@@ -53,6 +53,10 @@ var optGemMultCharPosReverse = false; // value of each character is multiplied b
var optFiltSameCipherMatch = true; // DEFAULT: only phrases matching in the SAME cipher (tighter, more meaningful results)
var optFiltCrossCipherMatch = false; // phrases sharing a value across ANY enabled cipher (broader, noisier)
// History-table highlight-box mode, DECOUPLED from the query match mode above.
// false = light EVERY cell whose value you typed (default); true = only same-cipher pairs
// (values repeating within a column). Toggled by the ▦/▥ button next to #highlightBox.
var optHltSameCipher = false;
var alphaHlt = 0.15; // opacity for values that do not match - change value here and in conf_SOM()
var optAllowPhraseComments = true; // allow phrase comments, text inside [...] is not evaluated
@@ -92,7 +96,9 @@ var calcOptionsArr = [
"'optNumCalcMethod'+' = '+optNumCalcMethod",
"'optFiltCrossCipherMatch'+' = '+optFiltCrossCipherMatch",
"'optFiltSameCipherMatch'+' = '+optFiltSameCipherMatch",
"'optHltSameCipher'+' = '+optHltSameCipher",
"'optShowOnlyMatching'+' = '+optShowOnlyMatching",
"'autoMatchEnabled'+' = '+autoMatchEnabled",
"'optNewPhrasesGoFirst'+' = '+optNewPhrasesGoFirst",
"'optShowExtraCiphers'+' = '+optShowExtraCiphers",
"'optAllowPhraseComments'+' = '+optAllowPhraseComments",
@@ -336,6 +342,32 @@ function toggleAutoMatch() {
document.getElementById("phraseBox").focus();
}
// History-table highlight mode toggle (▼ single-icon, ⚡-pattern dim/lit).
// Decoupled from the Cross/Same query match mode.
// Sync the hltModeBtn UI (class + title) to the current optHltSameCipher value.
// Called by toggleHltMode() and from _dbLoaded() after settings restore from localStorage.
function syncHltModeBtn() {
var btn = document.getElementById("hltModeBtn");
if (btn === null) return;
if (optHltSameCipher) {
btn.classList.remove("hltModeOff");
btn.title = "Highlight: same column matches only — click for any matches";
} else {
btn.classList.add("hltModeOff");
btn.title = "Highlight: any matches (every cell with the value) — click for same column matches";
}
}
function toggleHltMode() {
optHltSameCipher = !optHltSameCipher;
syncHltModeBtn();
// re-render with the current highlight-box content
if (document.getElementById("highlightBox").value.replace(/ +/g, " ").trim() !== "") {
if (!optHltSameCipher) { autoHistoryTableLayout(); updateHistoryTable(); }
else { updateHistoryTableSameCiphMatch(); }
}
document.getElementById("phraseBox").focus();
}
$(document).ready(function () {
// Global Escape key handler
$(document).on("keydown", function(e) {
@@ -663,9 +695,9 @@ function conf_SOM() {
} else {
alphaHlt = 0.15;
}
if (optFiltCrossCipherMatch) {
if (!optHltSameCipher) {
updateTables();
} else if (optFiltSameCipherMatch) {
} else {
updateHistoryTableSameCiphMatch();
}
}
@@ -2235,8 +2267,8 @@ function updateHistoryTable(hltBoolArr) {
// if highlight mode is on
if (hltMode) {
// if cross cipher match and highlight box doesn't include number
if (optFiltCrossCipherMatch && !highlt_num.includes(gemVal)) {
// "all matches" highlight mode: dim any cell whose value isn't in the box
if (!optHltSameCipher && !highlt_num.includes(gemVal)) {
col = optColoredCiphers
? "hsl(" +
curCiph.H +
+2 -2
View File
@@ -499,7 +499,7 @@ function tdToggleHighlight(val){ // click on value in history table to toggle hi
hlt_val = JSON.stringify(highlt_num).replace(/,/g, " ") // to string
hlt_val = hlt_val.substring(1, hlt_val.length-1) // remove brackets
document.getElementById("highlightBox").value = hlt_val // update values inside textbox
if (optFiltCrossCipherMatch) { updateHistoryTable(); } else { updateHistoryTableSameCiphMatch(); }
if (!optHltSameCipher) { updateHistoryTable(); } else { updateHistoryTableSameCiphMatch(); }
return
}
@@ -508,5 +508,5 @@ function tdToggleHighlight(val){ // click on value in history table to toggle hi
document.getElementById("highlightBox").value += " " // append space if necessary
}
document.getElementById("highlightBox").value += val // append clicked value to Highlight textbox
if (optFiltCrossCipherMatch) { updateHistoryTable(); } else { updateHistoryTableSameCiphMatch(); }
if (!optHltSameCipher) { updateHistoryTable(); } else { updateHistoryTableSameCiphMatch(); }
};
+2 -2
View File
@@ -494,7 +494,7 @@ $(document).ready(function(){
autoHistoryTableLayout();
updateHistoryTable();
}
} else if (optFiltCrossCipherMatch) { autoHistoryTableLayout(); updateHistoryTable(); } else { updateHistoryTableSameCiphMatch(); }
} else if (!optHltSameCipher) { autoHistoryTableLayout(); updateHistoryTable(); } else { updateHistoryTableSameCiphMatch(); }
});
$("body").on("click", "td.hC", function () { // Cipher Name in history table (normal mode)
@@ -568,7 +568,7 @@ $(document).ready(function(){
$("body").on("click", ".tC", function (e) { // tC - history table cell
//console.log($(this).find(".gV").html()); // inner html of .gV found in "this"
var val = $(this).find(".gV").html(); // get gematria value from element
if(ctrlIsPressed) { // Ctrl + Left Click - toggle value inside highlight box
if(ctrlIsPressed || e.metaKey) { // Ctrl+Click (Win/Linux) or Cmd+Click (Mac) - toggle value inside highlight box
tdToggleHighlight(parseInt(val.trim(), 10)); // remove spaces, parse as integer and add (remove) to highlight box
} else { // Left Click only - temporary blinking effect
$( "table.HistoryTable td.tC > span:contains('"+val+"')" ).toggleClass('highlightValueBlink'); // add blinking effect
+17
View File
@@ -1034,6 +1034,21 @@ body {
#autoMatchBtn.matchOff {
opacity: 0.35;
}
#hltModeBtn {
background-color: var(--input-bg-accent);
padding: 0em;
margin: 0em 0em 0em 0.3em;
min-width: 32px;
max-width: 32px;
color: hsl(148, 65%, 58%);
font-size: 110%;
line-height: 1;
text-align: center;
vertical-align: middle;
}
#hltModeBtn.hltModeOff {
opacity: 0.35;
}
#calcNotification {
position: absolute;
left: 50%;
@@ -1056,6 +1071,7 @@ body {
#queryDBbtn:hover,
#enterPhraseBtn:hover,
#autoMatchBtn:hover,
#hltModeBtn:hover,
.queryPageBtn:hover {
background-color: var(--btn-hover-accent);
}
@@ -1067,6 +1083,7 @@ body {
#queryDBbtn:active,
#enterPhraseBtn:active,
#autoMatchBtn:active,
#hltModeBtn:active,
.queryPageBtn:active {
background-color: var(--btn-active-accent);
}
+14 -5
View File
@@ -11,16 +11,16 @@
<!-- Android Web App - Add to Home Screen -->
<link rel="manifest" href="manifest.json" />
<script src="config.js?v=8"></script>
<script src="config.js?v=10"></script>
<script src="lib/jquery.min.js?v=2"></script>
<!-- html2canvas v1.0.0-alpha.12 -->
<script src="calc/gematria.js?v=2"></script>
<script src="calc/calc.js?v=6"></script>
<script src="calc/init-variables.js?v=5"></script>
<script src="calc/calc.js?v=13"></script>
<script src="calc/init-variables.js?v=7"></script>
<script src="calc/ciphers.js?v=5"></script>
<link rel="stylesheet" type="text/css" href="calc/styles.css?v=5" />
<link rel="stylesheet" type="text/css" href="calc/styles.css?v=9" />
<script>
window.onpaint = function () {
@@ -121,6 +121,13 @@
spellcheck="false"
autocomplete="off"
placeholder="highlight #s"
/><input
id="hltModeBtn"
class="hltModeOff"
type="button"
title="Highlight: any matches (every cell with the value) — click for same column matches"
value="▼"
onclick="toggleHltMode()"
/><span id="clearFilterButton"></span>
</div>
@@ -141,7 +148,7 @@
<script src="calc/breakdown.js?v=2"></script>
<script src="calc/highlighter.js?v=2"></script>
<script src="calc/highlighter.js?v=3"></script>
<script src="calc/export.js?v=2"></script>
<script src="calc/export-csv.js?v=2"></script>
<script src="calc/num-prop.js?v=2"></script>
@@ -183,6 +190,8 @@
var amb = document.getElementById("autoMatchBtn");
amb.classList.remove("hideValue");
if (!autoMatchEnabled) amb.classList.add("matchOff");
// Sync hltModeBtn to the (possibly restored from localStorage) optHltSameCipher value.
if (typeof syncHltModeBtn === "function") syncHltModeBtn();
}
// Background: fetch the full 69-cipher set, then swap it in for the lite set.