diff --git a/CHANGELOG.md b/CHANGELOG.md index 2f28106..79f5970 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -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 diff --git a/calc/calc.js b/calc/calc.js index 9dff163..7e49c0a 100644 --- a/calc/calc.js +++ b/calc/calc.js @@ -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 + diff --git a/calc/highlighter.js b/calc/highlighter.js index 8c9cc01..e9dc107 100644 --- a/calc/highlighter.js +++ b/calc/highlighter.js @@ -266,7 +266,7 @@ function updateHistoryTableSameCiphMatch() { if (highlt_num.indexOf(v_grid_col[n][m]) > -1) { // if value is in highlight box for (z = m+1; z < v_grid_col[n].length; z++) { // compare vs other values in same column // if value matches another value in the same column and is present in highlight box - if (v_grid_col[n][m] == v_grid_col[n][z]) { + if (v_grid_col[n][m] == v_grid_col[n][z]) { hltBoolArr[m][n] = true // mark both as values to be highlighted hltBoolArr[z][n] = true // [phrase][cipher] } @@ -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(); } }; \ No newline at end of file diff --git a/calc/init-variables.js b/calc/init-variables.js index 4b4934e..423624a 100644 --- a/calc/init-variables.js +++ b/calc/init-variables.js @@ -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 diff --git a/calc/styles.css b/calc/styles.css index a6190d6..ec05267 100644 --- a/calc/styles.css +++ b/calc/styles.css @@ -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); } diff --git a/index.html b/index.html index 21263c8..a20dc34 100644 --- a/index.html +++ b/index.html @@ -11,16 +11,16 @@ - + - - + + - + - + @@ -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.