diff --git a/CHANGELOG.md b/CHANGELOG.md
index 8dd6292..58bd049 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -1,5 +1,37 @@
# Changelog
+## v2.2 — Progressive Loading, Curated Default Loadout & 11 New Ciphers
+
+### Added
+- **Progressive database loading**: a small `db_lite.json` (the default cipher set) loads
+ first for a ~2s first paint with immediate matching, then the full `db.json` streams in and
+ swaps in the background — the full cipher set no longer gates first-paint time.
+- **11 new ciphers** ported from Alektryon's fork (AGPLv3, attributed): the polygonal family
+ (Pentagonal, Hexagonal, Heptagonal, Octagonal, Enneagonal, Decagonal), English Qabalah 31,
+ Mars Kamea Gematria, Angelic Gematria, and Bacon Standard / Bacon R Standard — **now 95
+ ciphers (80 English-applicable)**.
+- **Configurable default loadout** — `config.js` `defaultEnabledCiphers` sets which ciphers
+ are on at first load (and on "reset to defaults"); empty/omitted = the classic 4.
+- **Built-in "Alphanumeric" category** grouping the alphanumeric family (Alphanumeric Qabbala,
+ Synx, Alphanumeric Case Sensitive, Alphanumeric Primes/Trigonal/Squares/Halves).
+- **"Base" preset** button (the classic 4) in the Cyphers menu.
+- **Keyboard navigation** for the results modal (desktop): ↑/↓ page, ←/→ minimize/restore;
+ typing snaps focus back to the phrase box.
+- **db cache-busting** — `config.js` `databaseVersion` appends `?v=N` to the db fetch so an
+ updated database isn't served stale from browser cache.
+
+### Changed
+- **Default match mode is now "Same Cipher Match"** (was "Cross Cipher Match") — tighter, more
+ relevant results, especially with a larger default loadout.
+- Cipher menu/grid order: the base four lead.
+
+### Fixed
+- Breakdown viewer defaulted to the stale name "English Ordinal" (renamed in v2.1) and opened
+ on the wrong cipher — now defaults to "Ordinal".
+
+### Tools
+- `tools/generate_db_json.py` emits `db_lite.json` (the lite subset) alongside `db.json`.
+
## v2.1 — Database Restoration & Bug Fixes
### Added
diff --git a/README.md b/README.md
index 9924e73..180bbe2 100644
--- a/README.md
+++ b/README.md
@@ -41,7 +41,7 @@ var CALC_CONFIG = {
],
// Custom cipher category groupings
customCategories: [
- { name: "CCRU", ciphers: ["Alphanumeric Qabbala", "Synx", "Keypad"] },
+ { name: "Favorites", ciphers: ["Ordinal", "Reduction", "Alphanumeric Qabbala"] },
],
// See config.default.js for all options
};
@@ -66,14 +66,14 @@ git pull origin master
- ~7.7k recovered Thelemic/Hermetic terms (CCRU/Numogram, Crowley, Rosicrucian)
- See [CHANGELOG.md](CHANGELOG.md) for the full v2.1 breakdown
-### Pre-computed Mode (instant matching)
+### Pre-computed Mode (instant matching + progressive loading)
-Out of the box the calculator runs in **live mode** — it loads `db.txt` and computes cipher values on the fly (works immediately, ~2-5s per query). For **instant matching** (~100ms), use the pre-computed `db.json`:
+Out of the box the calculator runs in **live mode** — it loads `db.txt` and computes cipher values on the fly (works immediately, ~2-5s per query). For **instant matching** (~100ms), use the pre-computed JSON:
-- **Download** the prebuilt `db.json` from the [latest release](https://github.com/malonehunter/hyperdope-gematria/releases/latest) and drop it next to `index.html`, **or**
-- **Rebuild** it from `db.txt`: `python3 tools/generate_db_json.py db.txt db.json`
+- **Download** the prebuilt **`db.json` and `db_lite.json`** from the [latest release](https://github.com/malonehunter/hyperdope-gematria/releases/latest) and drop them next to `index.html`, **or**
+- **Rebuild** both from `db.txt`: `python3 tools/generate_db_json.py db.txt db.json` (emits `db.json` + `db_lite.json`).
-The calculator auto-detects `db.json` (tries it first, falls back to `db.txt`) — see `databaseMode` in `config.js` (default `"auto"`). No code changes needed.
+With both present, the calculator **loads progressively**: `db_lite.json` (the default ciphers) paints in ~2s with immediate matching, then the full `db.json` streams in and swaps in the background. It auto-detects them (see `databaseMode` / `databaseLiteJsonUrl` in `config.js`). Bump `databaseVersion` in `config.js` whenever you update the databases to cache-bust browsers.
### Adding Entries
@@ -81,8 +81,10 @@ Append phrases as new lines to `db.txt`. File must start with `CREATE_GEMATRO_DB
## Features
-- 85 ciphers (69 English + Hebrew, Greek, Arabic, Russian)
-- Pre-computed instant matching via db.json
+- 95 ciphers (80 English-applicable + Hebrew, Greek, Arabic, Russian)
+- Progressive pre-computed matching (fast lite first paint, full set in the background)
+- Configurable default cipher loadout + Base/Default/All presets
+- Desktop keyboard nav for the results modal (arrows page / minimize)
- Auto-match on Enter (configurable toggle)
- Escape closes modal / clears filter
- Mobile optimized (keyboard dismisses, touch minimize)
diff --git a/calc/calc.js b/calc/calc.js
index 5f65cde..56726ac 100644
--- a/calc/calc.js
+++ b/calc/calc.js
@@ -51,8 +51,8 @@ var optGemSubstitutionMode = true; // simple substitution of characters with cor
var optGemMultCharPos = false; // value of each character is multiplied by character index
var optGemMultCharPosReverse = false; // value of each character is multiplied by character index in reverse order
-var optFiltSameCipherMatch = false; // filter shows only phrases that match in the same cipher
-var optFiltCrossCipherMatch = true; // filter shows only ciphers that have matching values
+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)
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
@@ -259,18 +259,20 @@ function createCiphersMenu() {
o += '
';
o += '';
- o += '
';
+ o += '
';
- o += "
";
+ o += '
';
o +=
- '';
+ '';
o +=
- '';
+ '';
o +=
- '';
+ '';
o +=
- '';
- o += "
'
+ continue
+ }
+
// mSame - same cipher match, mCross - cross cipher match
if ( gemVal == gemArr[y] ) {mSame = true} else {mSame = false} // if value is at the same index (meaning same cipher)
if (gemArr.indexOf(gemVal) > -1) {mCross = true} else {mCross = false}
@@ -305,9 +320,9 @@ function updateDatabaseQueryTable(stPos = 0, dItems, scrollBarEvent = false) { /
} else {
document.getElementById("queryArea").innerHTML = ms
}
- if (navigator.maxTouchPoints <= 1 && !scrollBarEvent) { // ignore scrollbar event
- // Return focus to main phrase box so user can immediately type next query
- document.getElementById("phraseBox").focus()
+ if (navigator.maxTouchPoints <= 1 && !scrollBarEvent) { // desktop: focus the modal so arrow keys navigate it (B+); typing snaps back to the phrase box
+ var _qa = document.getElementById("queryArea")
+ if (_qa) _qa.focus()
}
}
@@ -335,7 +350,7 @@ function queryShowPrevPage() {
n = $("#QueryTable").data("dispitems")
$("#queryArea").html() // clear previous table
updateDatabaseQueryTable(st, n) // redraw table at new position
- if (navigator.maxTouchPoints <= 1) document.getElementById("queryPosInput").focus() // restore focus on desktop devices
+ if (navigator.maxTouchPoints <= 1) document.getElementById("queryArea").focus() // keep the modal focused for arrow-key nav (B+)
}
function queryShowNextPage() {
@@ -348,7 +363,7 @@ function queryShowNextPage() {
n = $("#QueryTable").data("dispitems")
$("#queryArea").html() // clear previous table
updateDatabaseQueryTable(st, n) // redraw table at new position
- if (navigator.maxTouchPoints <= 1) document.getElementById("queryPosInput").focus() // restore focus on desktop devices
+ if (navigator.maxTouchPoints <= 1) document.getElementById("queryArea").focus() // keep the modal focused for arrow-key nav (B+)
}
function unloadDatabase() {
@@ -437,15 +452,41 @@ function loadPrecomputedDB(data) {
displayCalcNotification(loadedMsg, 2500)
}
+var fullDBLoaded = false
+function swapToFullDB(fullData) { // progressive loading: replace the lite db with the full set
+ if (!fullData || !fullData.cipher_order || !fullData.data) return
+ cipherOrder = fullData.cipher_order
+ userDB = fullData.data
+ fullDBLoaded = true
+ var _ind = document.getElementById("dbLoadIndicator"); if (_ind) _ind.style.display = "none" // background full done — hide the spinner
+ console.log("Full precomputed DB swapped in (" + cipherOrder.length + " ciphers, " + userDB.length + " entries).")
+ // If a results modal is open AND the last query used a cipher not in the lite db
+ // (a "—" column), re-run it IN PLACE so those columns fill + matches/ranking update.
+ // Single-threaded JS means this can't interrupt a running query — it runs between events.
+ // Only surface the swap if the user was waiting on "…" cells (queried a not-yet-loaded
+ // cipher early). Otherwise swap SILENTLY — the next query just uses the full set.
+ if (document.getElementById("queryArea") !== null && queryHadUnloadedCipher) {
+ var prevFilter = searchBarValue
+ queryDatabase() // re-run in place to fill the "…" cells
+ if (prevFilter) searchBarDBQuery(prevFilter) // restore the search-bar filter
+ displayCalcNotification("all " + cipherOrder.length + " cyphers ready", 2000)
+ }
+}
+
+var queryHadUnloadedCipher = false // true if the last query used a cipher not in the loaded db (progressive loading)
+
function getPrecomputedCipherPositions() {
- // Map enabled cipher names to their column indices in db.json
- // Returns 0-based indices into cipher_order (NOT +1 adjusted)
- // because searchDBcrossCipher/sameCipher already add +1 when accessing userDB
+ // Map each ENABLED cipher (in cipherList order = gemArr order) to its column index
+ // in the loaded db.json cipher_order. Returns -1 for a cipher not in the current db
+ // (e.g. a non-lite cipher enabled before the full set has streamed in) so the array
+ // stays 1:1 aligned with gemArr/gemArrCiph. Callers treat -1 as "show —, don't score".
var positions = []
+ queryHadUnloadedCipher = false
for (var i = 0; i < cipherList.length; i++) {
if (cipherList[i].enabled) {
var pos = cipherOrder.indexOf(cipherList[i].cipherName)
- if (pos > -1) positions.push(pos) // 0-based; search functions add +1
+ positions.push(pos) // 0-based column, or -1 if not in current db
+ if (pos === -1) queryHadUnloadedCipher = true
}
}
return positions
diff --git a/calc/init-variables.js b/calc/init-variables.js
index ae46f8e..4b4934e 100644
--- a/calc/init-variables.js
+++ b/calc/init-variables.js
@@ -1,7 +1,7 @@
// ==================================================================
// breakdown.js
-var breakCipher = "English Ordinal" // current cipher for breakdown
+var breakCipher = "Ordinal" // current cipher for breakdown (must match a real cipher name)
var bgCol = "var(--breakdown-bg-accent)" // breakdown table background color
var chLimit = 30 // character limit, used to switch to a long breakdown style
var maxRowWidth = 36 // one row character limit (long breakdown)
@@ -134,6 +134,23 @@ $(document).ready(function(){
$("body").on("click", "#queryArea.minimizeQuery", function (e) {
toggleQueryMinimize();
});
+
+ // Arrow-key navigation when the results modal itself is focused (desktop, B+):
+ // up/down = page, left/right = minimize/restore; typing a printable char snaps focus
+ // back to the phrase box (quick re-query). Guarded to e.target===queryArea so the
+ // slider / position box / search field keep their own key behavior.
+ $("body").on("keydown", "#queryArea", function (e) {
+ if (e.target.id !== "queryArea") return;
+ var minimized = $("#queryArea").hasClass("minimizeQuery");
+ if (e.which === 38) { if (!minimized) { queryShowPrevPage(); e.preventDefault(); } }
+ else if (e.which === 40) { if (!minimized) { queryShowNextPage(); e.preventDefault(); } }
+ else if (e.which === 37) { if (!minimized) { toggleQueryMinimize(); document.getElementById("queryArea").focus(); e.preventDefault(); } }
+ else if (e.which === 39) { if (minimized) { toggleQueryMinimize(); document.getElementById("queryArea").focus(); e.preventDefault(); } }
+ else if (e.key && e.key.length === 1 && !e.ctrlKey && !e.metaKey && !e.altKey) {
+ var pb = document.getElementById("phraseBox"); // snap back to the phrase box + route the char
+ if (pb) { e.preventDefault(); pb.focus(); pb.value += e.key; pb.dispatchEvent(new Event("input", { bubbles: true })); }
+ }
+ });
});
// ==================================================================
diff --git a/calc/styles.css b/calc/styles.css
index f608c69..a6190d6 100644
--- a/calc/styles.css
+++ b/calc/styles.css
@@ -962,6 +962,24 @@ body {
background-color: var(--btn-bg-accent);
/*background-color: transparent;*/
}
+/* 5-button cipher-preset row (Empty/Base/Default/All(EN)/All) in the Cyphers dropdown
+ ONLY. Flex row distributes the buttons evenly edge-to-edge (no centered dead-space),
+ each sized to width/5. Scoped via .ciphPresetRow so it can't touch any other modal,
+ the shared .intBtn3 (Query/Enter) buttons, or the .intBtn (Export/Save) buttons. */
+.ciphPresetRow {
+ display: flex;
+ gap: 0.3em;
+ margin: 0 0 0.5em 0;
+}
+.ciphPresetRow .ciphPresetBtn {
+ flex: 1 1 0;
+ width: auto; /* override .intBtn3's fixed 85px */
+ min-width: 0; /* allow even distribution */
+ padding: 0.2em 0.1em;
+ margin: 0; /* gap handles spacing */
+ font-size: 95%;
+ white-space: nowrap;
+}
@media (max-width: 911px) {
/* mobile */
#queryDBbtn {
@@ -1574,6 +1592,7 @@ body {
resize: horizontal;
z-index: 100;
}
+#queryArea:focus { outline: none; } /* focused for arrow-key nav (B+) — hide the focus ring */
@media (max-width: 911px) {
/* mobile — center the modal */
#queryArea {
diff --git a/config.default.js b/config.default.js
index 98b452e..31acfdc 100644
--- a/config.default.js
+++ b/config.default.js
@@ -36,8 +36,10 @@ var CALC_CONFIG = {
// --- Database ---
databaseMode: "auto", // "auto" tries db.json then db.txt | "json" | "txt"
- databaseJsonUrl: "db.json",
+ databaseJsonUrl: "db.json", // full set — loaded in background
+ databaseLiteJsonUrl: "db_lite.json", // lite set (common ciphers) — loaded first for fast paint
databaseTxtUrl: "db.txt",
+ databaseVersion: 1, // bump on each db.json regen -> cache-busts the db fetch (?v=N)
// --- Defaults ---
autoMatchDesktop: true,
@@ -45,6 +47,12 @@ var CALC_CONFIG = {
resultsPerPage: 12,
newPhrasesOnTop: true,
+ // Ciphers enabled by default on first load + "reset to defaults". Overrides the
+ // enabled:true flags in ciphers.js. Empty => use ciphers.js defaults (classic 4).
+ // Names must match ciphers.js exactly. Example:
+ // defaultEnabledCiphers: ["Ordinal", "Reduction", "Reverse Ordinal", "Reverse Reduction"],
+ defaultEnabledCiphers: [],
+
// --- Custom Cipher Categories ---
// Group ciphers into custom menu sections. Ciphers are referenced by
// their exact name from ciphers.js. They still appear in their original
diff --git a/index.html b/index.html
index 6f9307b..21263c8 100644
--- a/index.html
+++ b/index.html
@@ -11,16 +11,16 @@
-
+
-
-
-
+
+
+
-
+
-
+
@@ -175,6 +175,8 @@
var _jsonUrl = _c.databaseJsonUrl || "db.json";
var _txtUrl = _c.databaseTxtUrl || "db.txt";
var _mode = _c.databaseMode || "auto";
+ var _liteUrl = _c.databaseLiteJsonUrl || "db_lite.json";
+ var _dbVer = _c.databaseVersion ? ("?v=" + _c.databaseVersion) : ""; // cache-bust db.json/db_lite.json on each regen
function _dbLoaded() {
document.getElementById("dbLoadIndicator").style.display = "none";
@@ -183,22 +185,34 @@
if (!autoMatchEnabled) amb.classList.add("matchOff");
}
+ // Background: fetch the full 69-cipher set, then swap it in for the lite set.
+ function _fetchFull() {
+ fetch(_jsonUrl + _dbVer)
+ .then(function(r) { if (!r.ok) throw new Error("full db.json " + r.status); return r.json(); })
+ .then(function(data) { swapToFullDB(data); })
+ .catch(function(err) { console.log("Full DB unavailable (keeping lite):", err.message); });
+ }
+
if (_mode === "txt") {
var database = loadFile(_txtUrl);
importFileAction(database, true);
_dbLoaded();
} else {
- fetch(_jsonUrl)
- .then(function(r) {
- if (!r.ok) throw new Error("db.json not found (" + r.status + ")");
- return r.json();
- })
- .then(function(data) { loadPrecomputedDB(data); _dbLoaded(); })
- .catch(function(err) {
- console.log("Pre-computed DB not available, using live mode:", err.message);
- var database = loadFile(_txtUrl);
- importFileAction(database, true);
- _dbLoaded();
+ // Progressive: lite first (fast first paint), then full in the background.
+ fetch(_liteUrl + _dbVer)
+ .then(function(r) { if (!r.ok) throw new Error("lite " + r.status); return r.json(); })
+ .then(function(data) { loadPrecomputedDB(data); _dbLoaded(); _fetchFull(); })
+ .catch(function(liteErr) {
+ console.log("Lite DB unavailable, loading full directly:", liteErr.message);
+ fetch(_jsonUrl + _dbVer)
+ .then(function(r) { if (!r.ok) throw new Error("db.json not found (" + r.status + ")"); return r.json(); })
+ .then(function(data) { loadPrecomputedDB(data); _dbLoaded(); })
+ .catch(function(err) {
+ console.log("Pre-computed DB not available, using live mode:", err.message);
+ var database = loadFile(_txtUrl);
+ importFileAction(database, true);
+ _dbLoaded();
+ });
});
}
diff --git a/tools/generate_db_json.py b/tools/generate_db_json.py
index 28b212d..35d5da7 100644
--- a/tools/generate_db_json.py
+++ b/tools/generate_db_json.py
@@ -18,6 +18,15 @@ from pathlib import Path
from all_ciphers import get_ciphers, compute_value
+# Lite db.json cipher subset for progressive first-paint. MUST stay in sync with
+# production config.js `defaultEnabledCiphers` (the default 16-cipher loadout).
+LITE_CIPHERS = [
+ "Ordinal", "Reduction", "Reverse Ordinal", "Reverse Reduction",
+ "Standard", "Latin (Jewish)", "English Sumerian", "Satanic Gematria",
+ "Bacon Simple", "Septenary", "Chaldean (Cheiro)", "Primes",
+ "Alphanumeric Qabbala", "Synx", "Alphanumeric Case Sensitive", "English Qaballa",
+]
+
def main():
in_path = Path(sys.argv[1] if len(sys.argv) > 1 else "db_track_a.txt")
@@ -74,6 +83,28 @@ def main():
size_mb = out_path.stat().st_size / 1024 / 1024
print(f"Done. {n} entries, {size_mb:.1f} MB, {time.time()-t0:.0f}s total")
+ # --- lite db.json: only LITE_CIPHERS columns, for progressive first-paint ---
+ missing = [c for c in LITE_CIPHERS if c not in cipher_order]
+ if missing:
+ print(f"WARNING: LITE_CIPHERS not in cipher_order (skipped): {missing}")
+ lite_idx = [cipher_order.index(c) for c in LITE_CIPHERS if c in cipher_order]
+ lite_order = [cipher_order[i] for i in lite_idx]
+ lite_data = [[row[0]] + [row[i + 1] for i in lite_idx] for row in data]
+ lite_out = {
+ "version": 2,
+ "format": "HYPER_CYPHERS",
+ "tier": "lite",
+ "generated": date.today().isoformat(),
+ "entries": n,
+ "cipher_order": lite_order,
+ "data": lite_data,
+ }
+ lite_path = out_path.with_name(out_path.stem + "_lite" + out_path.suffix)
+ with open(lite_path, "w", encoding="utf-8") as f:
+ json.dump(lite_out, f, separators=(",", ":"))
+ lite_mb = lite_path.stat().st_size / 1024 / 1024
+ print(f"Lite: {len(lite_order)} ciphers -> {lite_path.name}, {lite_mb:.1f} MB")
+
if __name__ == "__main__":
main()