From 72c696420ffe0e321e2f2acc6e8901aa243418f0 Mon Sep 17 00:00:00 2001 From: Hermes Agent Date: Tue, 3 Nov 2026 04:06:05 +0000 Subject: [PATCH] feat(calc): add toggle to prioritize Ingglish matches to top of query results MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - Add optPrioritizeIngglish option (configurable via prioritizeIngglishMatches in config.default.js and persisted in localStorage via calcOptionsArr). - Add 'Prioritize Ingglish [...]' checkbox (chkbox_PIM / conf_PIM()) to the Options Menu and a one-click 'ING ↑' toggle button (queryIngPriorityBtn) inside the Match Results table header that re-sorts open query modals in place via refreshOpenQuery(). - Unify match sorting in calc/database.js under compareQueryMatches(a, b, searchPhrase): pins exact full or comment-stripped phrase matches first, sorts [Ingglish: ...] rows above standard entries when optPrioritizeIngglish is enabled, and preserves score ordering within each group. --- .gitignore | 1 + calc/calc.js | 18 ++++++++++++++++++ calc/database.js | 48 +++++++++++++++++++++++++++++++++-------------- calc/styles.css | 17 +++++++++++++++++ config.default.js | 1 + 5 files changed, 71 insertions(+), 14 deletions(-) diff --git a/.gitignore b/.gitignore index ba87b49..67e81a8 100644 --- a/.gitignore +++ b/.gitignore @@ -2,3 +2,4 @@ config.js db.json __pycache__/ *.pyc +db_lite.json diff --git a/calc/calc.js b/calc/calc.js index f58e9e8..37c1a2c 100644 --- a/calc/calc.js +++ b/calc/calc.js @@ -60,6 +60,7 @@ 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 +var optPrioritizeIngglish = (typeof CALC_CONFIG !== 'undefined' && CALC_CONFIG.prioritizeIngglishMatches) ? true : false; // sort [Ingglish: ...] matches to top of query results var liveDatabaseMode = true; // live database mode var dbPageItems = (typeof CALC_CONFIG !== 'undefined' && CALC_CONFIG.resultsPerPage) ? CALC_CONFIG.resultsPerPage : 12; @@ -103,6 +104,7 @@ var calcOptionsArr = [ "optNewPhrasesGoFirst", "optShowExtraCiphers", "optAllowPhraseComments", + "optPrioritizeIngglish", "liveDatabaseMode", "optLetterWordCount", "optWordBreakdown", @@ -546,6 +548,8 @@ function createOptionsMenu() { if (optShowExtraCiphers) SECstate = "checked"; // Show Extra Ciphers if (optAllowPhraseComments) APCstate = "checked"; // Allow Phrase Comments + var PIMstate = ""; + if (optPrioritizeIngglish) PIMstate = "checked"; // Prioritize Ingglish [...] if (liveDatabaseMode) LDMstate = "checked"; // Live Database Mode if (optNewPhrasesGoFirst) NPGFstate = "checked"; // New Phrases Go First @@ -586,6 +590,10 @@ function createOptionsMenu() { '
'; + o += + '
'; o += '