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:
1 parent
202fe8ed04
commit
4eb10f2bdb
6 files changed
+103
-14
No files matched your search
+36
-4
@@ -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 +
|
||||
|
||||
+3
-3
@@ -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(); }
|
||||
};
|
||||
@@ -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
|
||||
|
||||
@@ -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);
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user