Compare commits
14
Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
6f00218034 | ||
|
|
451dfb200d | ||
|
|
3e83969f3e | ||
|
|
0b8a5965d0 | ||
|
|
55e814fb72 | ||
|
|
ed36cd060e | ||
|
|
a5514cf2a7 | ||
|
|
c2e3a18975 | ||
|
|
73e7e07951 | ||
|
|
6198c85840 | ||
|
|
a28cb82988 | ||
|
|
644f6eee5f | ||
|
|
01975b7f3a | ||
|
|
01aee23ddc |
No files matched your search
@@ -2,3 +2,4 @@ config.js
|
|||||||
db.json
|
db.json
|
||||||
__pycache__/
|
__pycache__/
|
||||||
*.pyc
|
*.pyc
|
||||||
|
db_lite.json
|
||||||
@@ -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 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 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 liveDatabaseMode = true; // live database mode
|
||||||
|
|
||||||
var dbPageItems = (typeof CALC_CONFIG !== 'undefined' && CALC_CONFIG.resultsPerPage) ? CALC_CONFIG.resultsPerPage : 12;
|
var dbPageItems = (typeof CALC_CONFIG !== 'undefined' && CALC_CONFIG.resultsPerPage) ? CALC_CONFIG.resultsPerPage : 12;
|
||||||
@@ -103,6 +104,7 @@ var calcOptionsArr = [
|
|||||||
"optNewPhrasesGoFirst",
|
"optNewPhrasesGoFirst",
|
||||||
"optShowExtraCiphers",
|
"optShowExtraCiphers",
|
||||||
"optAllowPhraseComments",
|
"optAllowPhraseComments",
|
||||||
|
"optPrioritizeIngglish",
|
||||||
"liveDatabaseMode",
|
"liveDatabaseMode",
|
||||||
"optLetterWordCount",
|
"optLetterWordCount",
|
||||||
"optWordBreakdown",
|
"optWordBreakdown",
|
||||||
@@ -546,6 +548,8 @@ function createOptionsMenu() {
|
|||||||
|
|
||||||
if (optShowExtraCiphers) SECstate = "checked"; // Show Extra Ciphers
|
if (optShowExtraCiphers) SECstate = "checked"; // Show Extra Ciphers
|
||||||
if (optAllowPhraseComments) APCstate = "checked"; // Allow Phrase Comments
|
if (optAllowPhraseComments) APCstate = "checked"; // Allow Phrase Comments
|
||||||
|
var PIMstate = "";
|
||||||
|
if (optPrioritizeIngglish) PIMstate = "checked"; // Prioritize Ingglish [...]
|
||||||
if (liveDatabaseMode) LDMstate = "checked"; // Live Database Mode
|
if (liveDatabaseMode) LDMstate = "checked"; // Live Database Mode
|
||||||
|
|
||||||
if (optNewPhrasesGoFirst) NPGFstate = "checked"; // New Phrases Go First
|
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()" ' +
|
'<div class="optionElement"><label class="chkLabel ciphCheckboxLabel2">Ignore Comments [...]<input type="checkbox" id="chkbox_APC" onclick="conf_APC()" ' +
|
||||||
APCstate +
|
APCstate +
|
||||||
'><span class="custChkBox"></span></label></div>';
|
'><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 +=
|
o +=
|
||||||
'<div class="optionElement"><label class="chkLabel ciphCheckboxLabel2">Live Database Mode<input type="checkbox" id="chkbox_LDM" onclick="conf_LDM()" ' +
|
'<div class="optionElement"><label class="chkLabel ciphCheckboxLabel2">Live Database Mode<input type="checkbox" id="chkbox_LDM" onclick="conf_LDM()" ' +
|
||||||
LDMstate +
|
LDMstate +
|
||||||
@@ -709,6 +717,16 @@ function conf_APC() {
|
|||||||
updateTables();
|
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() {
|
function conf_LWC() {
|
||||||
// Letter/Word Count
|
// Letter/Word Count
|
||||||
optLetterWordCount = !optLetterWordCount;
|
optLetterWordCount = !optLetterWordCount;
|
||||||
|
|||||||
+34
-14
@@ -109,6 +109,31 @@ function clearDatabaseQueryTable() {
|
|||||||
queryResultInitial = [] // clear
|
queryResultInitial = [] // clear
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function isIngglishEntry(phr) {
|
||||||
|
return typeof phr === "string" && phr.indexOf("[Ingglish:") !== -1
|
||||||
|
}
|
||||||
|
|
||||||
|
function compareQueryMatches(a, b, searchPhrase) {
|
||||||
|
// 1. Exact phrase match (full string or stripped of [...] comment) always first
|
||||||
|
var aRaw = a[1].toLowerCase()
|
||||||
|
var bRaw = b[1].toLowerCase()
|
||||||
|
var aStripped = aRaw.replace(/\[.+\]/g, '').trim()
|
||||||
|
var bStripped = bRaw.replace(/\[.+\]/g, '').trim()
|
||||||
|
var aExact = (aRaw === searchPhrase || aStripped === searchPhrase) ? 1 : 0
|
||||||
|
var bExact = (bRaw === searchPhrase || bStripped === searchPhrase) ? 1 : 0
|
||||||
|
if (aExact !== bExact) return bExact - aExact
|
||||||
|
|
||||||
|
// 2. When optPrioritizeIngglish is enabled, sort [Ingglish: ...] matches above non-Ingglish matches
|
||||||
|
if (typeof optPrioritizeIngglish !== "undefined" && optPrioritizeIngglish) {
|
||||||
|
var aIng = isIngglishEntry(a[1]) ? 1 : 0
|
||||||
|
var bIng = isIngglishEntry(b[1]) ? 1 : 0
|
||||||
|
if (aIng !== bIng) return bIng - aIng
|
||||||
|
}
|
||||||
|
|
||||||
|
// 3. Then sort by match score descending
|
||||||
|
return b[0] - a[0]
|
||||||
|
}
|
||||||
|
|
||||||
function searchDBcrossCipher() { // populate "queryResult" array with matching phrases
|
function searchDBcrossCipher() { // populate "queryResult" array with matching phrases
|
||||||
var p, m, n
|
var p, m, n
|
||||||
queryResult = [] // reset matching phrases
|
queryResult = [] // reset matching phrases
|
||||||
@@ -145,14 +170,10 @@ function searchDBcrossCipher() { // populate "queryResult" array with matching p
|
|||||||
}
|
}
|
||||||
if (tmpArr[0] > 0) queryResult.push(tmpArr) // if total score is more than zero, add phrase to array
|
if (tmpArr[0] > 0) queryResult.push(tmpArr) // if total score is more than zero, add phrase to array
|
||||||
}
|
}
|
||||||
// Sort by score descending, but pin exact phrase match to top
|
// Sort by score descending, pinning exact match and (when enabled) [Ingglish: ...] matches to top
|
||||||
var searchPhrase = sVal().toLowerCase()
|
var searchPhrase = sVal().toLowerCase().trim()
|
||||||
queryResult.sort(function(a, b) {
|
queryResult.sort(function(a, b) {
|
||||||
// Exact phrase match always first
|
return compareQueryMatches(a, b, searchPhrase)
|
||||||
var aExact = a[1].toLowerCase() === searchPhrase ? 1 : 0
|
|
||||||
var bExact = b[1].toLowerCase() === searchPhrase ? 1 : 0
|
|
||||||
if (aExact !== bExact) return bExact - aExact
|
|
||||||
return b[0] - a[0]; // then by score descending
|
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -185,13 +206,10 @@ function searchDBsameCipher() { // populate "queryResult" array with matching ph
|
|||||||
}
|
}
|
||||||
if (tmpArr[0] > 0) queryResult.push(tmpArr) // if total score is more than zero, add phrase to array
|
if (tmpArr[0] > 0) queryResult.push(tmpArr) // if total score is more than zero, add phrase to array
|
||||||
}
|
}
|
||||||
// Sort by score descending, but pin exact phrase match to top
|
// Sort by score descending, pinning exact match and (when enabled) [Ingglish: ...] matches to top
|
||||||
var searchPhrase = sVal().toLowerCase()
|
var searchPhrase = sVal().toLowerCase().trim()
|
||||||
queryResult.sort(function(a, b) {
|
queryResult.sort(function(a, b) {
|
||||||
var aExact = a[1].toLowerCase() === searchPhrase ? 1 : 0
|
return compareQueryMatches(a, b, searchPhrase)
|
||||||
var bExact = b[1].toLowerCase() === searchPhrase ? 1 : 0
|
|
||||||
if (aExact !== bExact) return bExact - aExact
|
|
||||||
return b[0] - a[0];
|
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -267,9 +285,11 @@ function updateDatabaseQueryTable(stPos = 0, dItems, scrollBarEvent = false) { /
|
|||||||
|
|
||||||
if (firstPhrase) { // open row on the first phrase
|
if (firstPhrase) { // open row on the first phrase
|
||||||
firstPhrase = false
|
firstPhrase = false
|
||||||
|
var ingBtnClass = (typeof optPrioritizeIngglish !== "undefined" && optPrioritizeIngglish) ? "queryPageBtn ingPriorityBtn ingPriorityOn" : "queryPageBtn ingPriorityBtn"
|
||||||
ms += '<tr class="cH"><td class="mPQ">'
|
ms += '<tr class="cH"><td class="mPQ">'
|
||||||
ms += queryResult.length.toLocaleString('en')+' matches'
|
ms += queryResult.length.toLocaleString('en')+' matches'
|
||||||
ms += '<br><br>'
|
ms += '<br><input class="'+ingBtnClass+'" id="queryIngPriorityBtn" type="button" value="ING ↑" title="Toggle Ingglish [...] priority sort to top" onclick="event.stopPropagation();conf_PIM()">'
|
||||||
|
ms += '<br>'
|
||||||
ms += '<div style="display: inline-flex;">'
|
ms += '<div style="display: inline-flex;">'
|
||||||
ms += '<input class="queryPageBtn" id="queryPrevPageBtn" type="button" value="<" onclick="queryShowPrevPage()">'
|
ms += '<input class="queryPageBtn" id="queryPrevPageBtn" type="button" value="<" onclick="queryShowPrevPage()">'
|
||||||
ms += '<input id="queryPosInput" type="tel" autocomplete="off" value="'+curPos+'">'
|
ms += '<input id="queryPosInput" type="tel" autocomplete="off" value="'+curPos+'">'
|
||||||
|
|||||||
@@ -1636,6 +1636,23 @@ body {
|
|||||||
border: 1px solid var(--border-dark-accent);
|
border: 1px solid var(--border-dark-accent);
|
||||||
padding: 0em 0.35em;
|
padding: 0em 0.35em;
|
||||||
}
|
}
|
||||||
|
.ingPriorityBtn {
|
||||||
|
font-size: 82%;
|
||||||
|
margin: 0.25em 0;
|
||||||
|
padding: 0.1em 0.45em;
|
||||||
|
cursor: pointer;
|
||||||
|
opacity: 0.65;
|
||||||
|
transition: opacity 0.15s ease, border-color 0.15s ease, color 0.15s ease;
|
||||||
|
}
|
||||||
|
.ingPriorityBtn:hover {
|
||||||
|
opacity: 0.95;
|
||||||
|
}
|
||||||
|
.ingPriorityBtn.ingPriorityOn {
|
||||||
|
opacity: 1;
|
||||||
|
color: var(--border-accent);
|
||||||
|
border-color: var(--border-accent);
|
||||||
|
font-weight: 600;
|
||||||
|
}
|
||||||
#queryMinBtn {
|
#queryMinBtn {
|
||||||
position: absolute;
|
position: absolute;
|
||||||
width: 24px;
|
width: 24px;
|
||||||
|
|||||||
@@ -44,6 +44,7 @@ var CALC_CONFIG = {
|
|||||||
// --- Defaults ---
|
// --- Defaults ---
|
||||||
autoMatchDesktop: true,
|
autoMatchDesktop: true,
|
||||||
autoMatchMobile: false,
|
autoMatchMobile: false,
|
||||||
|
prioritizeIngglishMatches: false, // sort [Ingglish: ...] matches to top of query results
|
||||||
resultsPerPage: 12,
|
resultsPerPage: 12,
|
||||||
newPhrasesOnTop: true,
|
newPhrasesOnTop: true,
|
||||||
|
|
||||||
|
|||||||
@@ -143,6 +143,9 @@
|
|||||||
<div id="HistoryTableArea"></div>
|
<div id="HistoryTableArea"></div>
|
||||||
</center>
|
</center>
|
||||||
</div>
|
</div>
|
||||||
|
<footer id="hsGlobalFooter" style="text-align:center;padding:14px 8px;font-family:'Courier New',monospace;font-size:12px;color:#94a3b8;">
|
||||||
|
<span class="hs-lemur-credit">hyperstitionstud.io/calc v2.0.24 • Made with <span class="hs-heart" role="img" aria-label="love" style="color:#fb7185;display:inline-block;padding:0 2px;">♥</span> by Lemurs.</span>
|
||||||
|
</footer>
|
||||||
|
|
||||||
<span id="loadPanel"></span>
|
<span id="loadPanel"></span>
|
||||||
|
|
||||||
|
|||||||
Reference in new issue
Block a user