feat(calc): add toggle to prioritize Ingglish matches to top of query results

- 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.
This commit is contained in:
Hermes Agent committed 2026-11-03 08:32:29 +00:00
1 parent bae8a992dc
commit 72c696420f
5 files changed
+71 -14

No files matched your search

+18
View File
@@ -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() {
'<div class="optionElement"><label class="chkLabel ciphCheckboxLabel2">Ignore Comments [...]<input type="checkbox" id="chkbox_APC" onclick="conf_APC()" ' +
APCstate +
'><span class="custChkBox"></span></label></div>';
o +=
'<div class="optionElement"><label class="chkLabel ciphCheckboxLabel2">Prioritize Ingglish [...]<input type="checkbox" id="chkbox_PIM" onclick="conf_PIM()" ' +
PIMstate +
'><span class="custChkBox"></span></label></div>';
o +=
'<div class="optionElement"><label class="chkLabel ciphCheckboxLabel2">Live Database Mode<input type="checkbox" id="chkbox_LDM" onclick="conf_LDM()" ' +
LDMstate +
@@ -709,6 +717,16 @@ function conf_APC() {
updateTables();
}
function conf_PIM() {
// Prioritize Ingglish [...] Matches
optPrioritizeIngglish = !optPrioritizeIngglish;
var chk = document.getElementById("chkbox_PIM");
if (chk !== null) chk.checked = optPrioritizeIngglish;
var btn = document.getElementById("queryIngPriorityBtn");
if (btn !== null) btn.classList.toggle("ingPriorityOn", optPrioritizeIngglish);
refreshOpenQuery();
}
function conf_LWC() {
// Letter/Word Count
optLetterWordCount = !optLetterWordCount;