Compare commits
No files matched your search
+143
@@ -1,5 +1,148 @@
|
|||||||
# Changelog
|
# Changelog
|
||||||
|
|
||||||
|
## v2.6.0
|
||||||
|
|
||||||
|
### Security
|
||||||
|
- **Import no longer uses `eval()`.** Imported cipher files and the localStorage settings copy are
|
||||||
|
parsed and shape-checked (`parseCipherArgs` / `cipherFromExport`); option names are whitelisted and
|
||||||
|
values must be JSON scalars. Previously a crafted cipher/settings file could execute arbitrary code
|
||||||
|
on import. Export format is unchanged for booleans/numbers.
|
||||||
|
- **All user-supplied text is escaped at render (`escHtml`).** Typed phrases, `[...]` comments,
|
||||||
|
imported history/matches/date file content, and cipher names now render as literal text instead of
|
||||||
|
HTML, across the history and matches tables, the character breakdown and chart, the cipher menu and
|
||||||
|
value tables, and the encoding menu. Prevents cross-site scripting from a crafted phrase, a shared
|
||||||
|
import file, or a cipher named with markup. (The cipher-*file* export keeps the raw name so the
|
||||||
|
export/import round-trip is unaffected.)
|
||||||
|
- Added `SECURITY.md` (how to report issues privately).
|
||||||
|
|
||||||
|
### Added
|
||||||
|
- **Based Atlanteanism** and **Based Atlanteanism Denovated** (Alphanumeric category), from NetVoid's
|
||||||
|
cyphers.news: Standard − Alphanumeric Qabbala with digits counting 0, and the same divided by 9.
|
||||||
|
Values verified against the derivation. Disabled by default; db.json gains two columns.
|
||||||
|
- **Refresh matches on cipher toggle** — enabling/disabling a cipher while the matches box is open
|
||||||
|
updates it in place, no re-submit.
|
||||||
|
|
||||||
|
### Fixed
|
||||||
|
- `manifest.json` icons pointed at a non-existent `calc-logo-36.png`; now 32/48.
|
||||||
|
- Query button centering.
|
||||||
|
|
||||||
|
> Upgrading: `databaseVersion` is bumped so browsers refetch the wider `db.json`. The trim-Phase-A
|
||||||
|
> database (234,751 entries) is a separate future release; this one keeps the v2.5 database content.
|
||||||
|
|
||||||
|
## v2.5 — NetVoid 2026 Manual Review Merge & Calibrated Junk Filter
|
||||||
|
|
||||||
|
### Added
|
||||||
|
- **+13,855 entries from NetVoid's 2026 manual curation pass** — modern political/conspiracy
|
||||||
|
phrases, historical event references, pop culture, esoteric concepts, tech/AI. Sourced from
|
||||||
|
`CYPHERS_CLEANED_DDB_2026.txt` which she's manually reviewing (A–R complete, S–Z in
|
||||||
|
progress). These are her truly-new additions since her 2023 starting db (14,520 total),
|
||||||
|
filtered through our calibrated junk rubric.
|
||||||
|
- **`tools/classify_candidates.py`** — new calibrated junk-rubric tool. Permissive on modern
|
||||||
|
proper nouns, brand names, acronyms (NASA/MAGA/COVID/AI/...), historical-event references,
|
||||||
|
and event-phrases with digits (`BLM 2020`, `COVID-19 Policy`, `Election Trump 2024`). Drops
|
||||||
|
only shared-consensus junk: pure foreign-script, single-letter pairs, keyboard-mash
|
||||||
|
patterns, bare spelled-numbers (no `[N]` annotation), repeated-word patterns, pure-date
|
||||||
|
constructions with year, long sentences with very low dictionary density. Drop rate on
|
||||||
|
NetVoid's 13,861 truly-new additions: 0.04% (6 entries). Reusable — takes any wordlist,
|
||||||
|
emits keep/drop decisions to JSONL or a plain keep-list. Designed for ecosystem reciprocity
|
||||||
|
so any merge in either direction stays clean.
|
||||||
|
|
||||||
|
### Fixed
|
||||||
|
- **`tools/normalize_caps.py` no longer mangles modern acronyms via dict-fallthrough.** The
|
||||||
|
old all-caps-multi-letter rule fell through to Title Case when the lowercase form was in
|
||||||
|
`/usr/share/dict/words` (web2 / Webster's 2nd, 1934), but web2 includes obscure
|
||||||
|
historical/Latin/scientific terms that overlap with modern acronyms: `maga`, `covid`, `la`,
|
||||||
|
`ai`, `id`, `us`, `it`, `ice` were all silently in the dict and being treated as "shouted
|
||||||
|
dict words" to title-case. Rule simplified to: all-caps multi-letter token → **always
|
||||||
|
preserve**. Trust the input. 462 acronyms preserved correctly in the NetVoid merge. The
|
||||||
|
trade-off — genuinely shouted normal words like `A BIG WIN FOR US` stay all-caps instead of
|
||||||
|
becoming Title Case — is rare in curated db entries and clearly the lesser evil.
|
||||||
|
|
||||||
|
### Changed
|
||||||
|
- Database: **216,088 → 229,943 entries** (+6.4%). `db.json` ~74.8 MB raw / ~32.0 MB gz.
|
||||||
|
`db_lite.json` ~18.4 MB raw / ~7.4 MB gz. Lite paint still ~2s. `databaseVersion` 3 → 4.
|
||||||
|
|
||||||
|
## v2.4 — Highlight-Mode Decouple Toggle & Settings Persistence
|
||||||
|
|
||||||
|
### Added
|
||||||
|
- **Highlight-mode toggle (▼)** next to the highlight box, styled like the ⚡ auto-match
|
||||||
|
button (dim/lit on/off). Decouples the history-table highlight semantics from the
|
||||||
|
Cross/Same query match mode:
|
||||||
|
- Dim (default) = "any matches" — light every cell whose value you typed (cross-style)
|
||||||
|
- Lit (toggled) = "same column matches only" — light only values that repeat within a
|
||||||
|
cipher column (same-cipher-pairing)
|
||||||
|
- The Cross/Same checkboxes in the options panel now affect only the query/modal +
|
||||||
|
export (as the names suggest); the history-table highlight has its own switch.
|
||||||
|
- **Settings persistence** for two opt flags that weren't round-tripping through
|
||||||
|
`localStorage`:
|
||||||
|
- `optHltSameCipher` (the new toggle) — added to `calcOptionsArr`
|
||||||
|
- `autoMatchEnabled` (the ⚡ button state) — was the lone outlier among the opt flags;
|
||||||
|
every other one persisted but this one re-read the device-aware default each page
|
||||||
|
load. Now persists; the device-aware default still applies for *first* visit per
|
||||||
|
device, then the user's choice sticks.
|
||||||
|
- **Cmd+click on macOS** for the "add value to highlight box" power-user gesture. macOS
|
||||||
|
hard-routes Ctrl+click to a `contextmenu` event (firing the right-click hideValue
|
||||||
|
toggle instead of the Ctrl+click branch), so the existing gesture was unreachable for
|
||||||
|
Mac users. The click handler now accepts `e.metaKey` alongside `ctrlIsPressed`.
|
||||||
|
|
||||||
|
### Notes
|
||||||
|
- Plain left-click on a history value still triggers the cross-table blink sweep
|
||||||
|
regardless of the new toggle — that's the quick "where else does this number appear?"
|
||||||
|
gesture and predates the match-mode flags. The new toggle governs persistent highlight
|
||||||
|
semantics (typing into the box, Cmd/Ctrl+click); the ephemeral blink stays mode-free.
|
||||||
|
- No database changes — the `db.json` / `db_lite.json` Release assets from v2.3 are still
|
||||||
|
valid; v2.4 ships no new assets.
|
||||||
|
|
||||||
|
## v2.3 — Proper-Case Normalization & +6,421 Common Words
|
||||||
|
|
||||||
|
### Changed
|
||||||
|
- **Database normalized to Proper Case** — every word's first letter capitalized, while
|
||||||
|
preserving acronyms (NASA), Roman numerals (XXXIII), and mixed-case brands (iPhone).
|
||||||
|
~60% of entries re-cased for consistent skimming. Only the 5 **case-sensitive** ciphers
|
||||||
|
(Alphanumeric Case Sensitive, Capitals Added/Mixed, Reverse Caps Added/Mixed) change value;
|
||||||
|
every other cipher lowercases input first, so their values are unaffected.
|
||||||
|
|
||||||
|
### Added
|
||||||
|
- **+6,421 common English words** filled in from the original Gematro 20K wordlist (short /
|
||||||
|
no-vowel fragments dropped). **209,667 → 216,088 entries.**
|
||||||
|
|
||||||
|
### Tools
|
||||||
|
- `tools/normalize_caps.py` — the smart Proper-Case pass: dictionary-aware acronym detection,
|
||||||
|
strict Roman-numeral + mixed-case preservation, digit/`[bracket]` passthrough. Reusable on
|
||||||
|
any Gematro `db.txt`.
|
||||||
|
|
||||||
|
## 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
|
## v2.1 — Database Restoration & Bug Fixes
|
||||||
|
|
||||||
### Added
|
### Added
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
# Cypher Calculator
|
# Cypher Calculator
|
||||||
|
|
||||||
A gematria cypher calculator with pre-computed instant matching, 145k+ curated word database, and full whitelabel support via `config.js`.
|
A gematria cypher calculator with pre-computed instant matching, 209k+ curated word database, and full whitelabel support via `config.js`.
|
||||||
|
|
||||||
**[Try it live →](https://cypher.hyperdope.com)**
|
**[Try it live →](https://cypher.hyperdope.com)**
|
||||||
|
|
||||||
@@ -41,7 +41,7 @@ var CALC_CONFIG = {
|
|||||||
],
|
],
|
||||||
// Custom cipher category groupings
|
// Custom cipher category groupings
|
||||||
customCategories: [
|
customCategories: [
|
||||||
{ name: "CCRU", ciphers: ["Alphanumeric Qabbala", "Synx", "Keypad"] },
|
{ name: "Favorites", ciphers: ["Ordinal", "Reduction", "Alphanumeric Qabbala"] },
|
||||||
],
|
],
|
||||||
// See config.default.js for all options
|
// See config.default.js for all options
|
||||||
};
|
};
|
||||||
@@ -59,14 +59,22 @@ git pull origin master
|
|||||||
|
|
||||||
## Database
|
## Database
|
||||||
|
|
||||||
**145,821 curated entries** — cleaned and enriched from the original 153k user-search database.
|
**229,943 curated entries** (Proper-Case normalized) — cleaned, enriched, restored from the original user-search database, and extended with NetVoid's 2026 manual review additions.
|
||||||
|
|
||||||
- **Removed:** 13,317 junk entries (spam, gibberish, personal rants, serial spammers)
|
- Proper-Case normalization with acronym / Roman-numeral / mixed-case protection (see `tools/normalize_caps.py`), plus +6,421 common words from the original 20K wordlist (v2.3)
|
||||||
- **Added:** 8,536 terms across 17 research categories (occult, theology, 9/11, gematria, psyop, cosmology, bitcoin, AI, coronavirus, world affairs, economics, health, intelligence, history, politics, civil liberties, free speech)
|
- Specialty sets (Liber AL, Latin, Roman numerals, spelled-out numbers, Illuminati/esoteric terms)
|
||||||
|
- Restoration of ~20k entries an earlier over-aggressive cleanup had removed (concentrated at the alphabet "ends" — A/B/C/X/Y/Z)
|
||||||
|
- ~7.7k recovered Thelemic/Hermetic terms (CCRU/Numogram, Crowley, Rosicrucian)
|
||||||
|
- See [CHANGELOG.md](CHANGELOG.md) for the full v2.1 breakdown
|
||||||
|
|
||||||
### Pre-computed Mode
|
### Pre-computed Mode (instant matching + progressive loading)
|
||||||
|
|
||||||
For instant matching (~100ms vs 2-5s), generate `db.json` with all 69 cipher values pre-calculated per entry. The calculator tries `db.json` first, falls back to `db.txt`. Set `databaseMode` in config.js.
|
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` and `db_lite.json`** from the [latest release](https://github.com/malonehunter/hyperdope-gematria/releases/latest) (both files are attached to every tagged release, even when the database itself didn't change) 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`).
|
||||||
|
|
||||||
|
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
|
### Adding Entries
|
||||||
|
|
||||||
@@ -74,8 +82,10 @@ Append phrases as new lines to `db.txt`. File must start with `CREATE_GEMATRO_DB
|
|||||||
|
|
||||||
## Features
|
## Features
|
||||||
|
|
||||||
- 85 ciphers (69 English + Hebrew, Greek, Arabic, Russian)
|
- 95 ciphers (80 English-applicable + Hebrew, Greek, Arabic, Russian)
|
||||||
- Pre-computed instant matching via db.json
|
- 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)
|
- Auto-match on Enter (configurable toggle)
|
||||||
- Escape closes modal / clears filter
|
- Escape closes modal / clears filter
|
||||||
- Mobile optimized (keyboard dismisses, touch minimize)
|
- Mobile optimized (keyboard dismisses, touch minimize)
|
||||||
@@ -112,4 +122,6 @@ Append phrases as new lines to `db.txt`. File must start with `CREATE_GEMATRO_DB
|
|||||||
|
|
||||||
## License
|
## License
|
||||||
|
|
||||||
MIT
|
This project is licensed under the **GNU General Public License v2.0** — see [`LICENSE`](LICENSE).
|
||||||
|
|
||||||
|
It builds on the original Gematro project (open-source; the original repository has since been deleted, so the exact upstream license isn't independently verifiable — this fork adopted **GPLv2** when first enhanced and published). It also incorporates 11 ciphers ported from [Alektryon's fork](https://github.com/Alektryon/gematria), released under the **GNU Affero General Public License v3.0 (AGPLv3)** and attributed in `CHANGELOG.md` and `calc/ciphers.js`. Because it incorporates AGPL (copyleft) code, the combined work is distributed under copyleft terms and is **not** MIT-licensed.
|
||||||
+37
@@ -0,0 +1,37 @@
|
|||||||
|
# Security Policy
|
||||||
|
|
||||||
|
## Reporting a vulnerability
|
||||||
|
|
||||||
|
Please report security issues **privately**, not as a public issue or pull request.
|
||||||
|
|
||||||
|
- Preferred: open a private [GitHub Security Advisory](../../security/advisories/new) on this repo.
|
||||||
|
- Or email **hyperdopeofficial@protonmail.com** with the details and, if possible, a minimal
|
||||||
|
reproduction.
|
||||||
|
|
||||||
|
We aim to acknowledge reports within a few days. This is a small, volunteer-maintained project, so
|
||||||
|
please allow reasonable time for a fix before any public disclosure. Fixes ship in the next release;
|
||||||
|
we'll credit reporters who want it.
|
||||||
|
|
||||||
|
## Scope
|
||||||
|
|
||||||
|
This is a **client-side** calculator: static HTML, CSS, and JavaScript with no backend and no
|
||||||
|
accounts. It runs entirely in the visitor's browser. The most relevant issue class is therefore
|
||||||
|
**cross-site scripting (XSS)** — untrusted text (a typed phrase, an imported cipher/settings/history
|
||||||
|
file, or a custom cipher name) reaching the DOM as markup. All user-supplied text is escaped at
|
||||||
|
render (`escHtml`) and cipher/settings imports are parsed as data, never `eval`'d.
|
||||||
|
|
||||||
|
In scope: XSS and injection in the calculator code; unsafe handling of imported files; anything that
|
||||||
|
lets one file or link run code in a user's browser at this origin.
|
||||||
|
|
||||||
|
Out of scope: how a given operator deploys or hosts a copy (serve only the built page, not the repo
|
||||||
|
`.git`/tooling); third-party CDNs; issues requiring a already-compromised browser or machine.
|
||||||
|
|
||||||
|
## Deploying safely
|
||||||
|
|
||||||
|
If you self-host, serve the **page files only** behind a static web server, ideally with a
|
||||||
|
Content-Security-Policy. Do not expose the repository's `.git` directory or tooling from your web
|
||||||
|
root.
|
||||||
|
|
||||||
|
## Supported versions
|
||||||
|
|
||||||
|
Security fixes are made against the latest release on `master`.
|
||||||
+8
-8
@@ -81,8 +81,8 @@ function updateWordBreakdown(impName = breakCipher, impBool = false, chartUpd =
|
|||||||
simplePhr = sVal() // display full phrase
|
simplePhr = sVal() // display full phrase
|
||||||
}
|
}
|
||||||
oStart += '<div id="SimpleBreak">'
|
oStart += '<div id="SimpleBreak">'
|
||||||
oStart += '<span class="breakPhrase">' + simplePhr + '</span><span class="breakPhrase"> = </span><span class="breakSum">' + curCipher.sumArr.reduce(getSum) + ' </span>' // add all values in array
|
oStart += '<span class="breakPhrase">' + escHtml(simplePhr) + '</span><span class="breakPhrase"> = </span><span class="breakSum">' + curCipher.sumArr.reduce(getSum) + ' </span>' // add all values in array
|
||||||
oStart += '<span class="breakCipher"><font style="'+curCiphCol+'"> (' + curCipher.cipherName + gemCalcModeLabel(curCipher) + ')</font></span>'
|
oStart += '<span class="breakCipher"><font style="'+curCiphCol+'"> (' + escHtml(curCipher.cipherName) + gemCalcModeLabel(curCipher) + ')</font></span>'
|
||||||
}
|
}
|
||||||
|
|
||||||
if (optWordBreakdown == true && curCipher.cp.length <= chLimit ) { // character limit, calculated even if out of screen bounds
|
if (optWordBreakdown == true && curCipher.cp.length <= chLimit ) { // character limit, calculated even if out of screen bounds
|
||||||
@@ -141,7 +141,7 @@ function updateWordBreakdown(impName = breakCipher, impBool = false, chartUpd =
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
ciphEndClass = (leftToRightBreak) ? "CipherEnd" : "CipherEndRTL"
|
ciphEndClass = (leftToRightBreak) ? "CipherEnd" : "CipherEndRTL"
|
||||||
if (optCompactBreakdown == true) o += '</tr><tr><td colspan=' + tdCount + ' class="'+ciphEndClass+'"><font style="'+curCiphCol+'">' + curCipher.cipherName + gemCalcModeLabel(curCipher) + '</font></td></tr></table></div>'
|
if (optCompactBreakdown == true) o += '</tr><tr><td colspan=' + tdCount + ' class="'+ciphEndClass+'"><font style="'+curCiphCol+'">' + escHtml(curCipher.cipherName) + gemCalcModeLabel(curCipher) + '</font></td></tr></table></div>'
|
||||||
else o += '</tr></tbody></table></div>'
|
else o += '</tr></tbody></table></div>'
|
||||||
|
|
||||||
o = oStart + o // prepend phrase, word/letter count
|
o = oStart + o // prepend phrase, word/letter count
|
||||||
@@ -227,7 +227,7 @@ function updateWordBreakdown(impName = breakCipher, impBool = false, chartUpd =
|
|||||||
o = oStart + o // prepend phrase, word/letter count
|
o = oStart + o // prepend phrase, word/letter count
|
||||||
if (optCompactBreakdown == true) {
|
if (optCompactBreakdown == true) {
|
||||||
o += '<div id="BreakSumLong"><span class="breakSumDark">' + curCipher.sumArr.reduce(getSum) + ' </span>'
|
o += '<div id="BreakSumLong"><span class="breakSumDark">' + curCipher.sumArr.reduce(getSum) + ' </span>'
|
||||||
o += '<span class="breakCipher" style="'+curCiphCol+'">' + curCipher.cipherName + gemCalcModeLabel(curCipher) + '</span></div></div>'
|
o += '<span class="breakCipher" style="'+curCiphCol+'">' + escHtml(curCipher.cipherName) + gemCalcModeLabel(curCipher) + '</span></div></div>'
|
||||||
} else {
|
} else {
|
||||||
o += '<div style="padding: 0.5em"></div>'
|
o += '<div style="padding: 0.5em"></div>'
|
||||||
}
|
}
|
||||||
@@ -248,8 +248,8 @@ function updateWordBreakdown(impName = breakCipher, impBool = false, chartUpd =
|
|||||||
var chartClass = 'SimpleBreakChart'
|
var chartClass = 'SimpleBreakChart'
|
||||||
if (curCipher.cp.length > chLimit) chartClass = 'SimpleBreakChartLong'
|
if (curCipher.cp.length > chLimit) chartClass = 'SimpleBreakChartLong'
|
||||||
o = '<tr><td colspan=' + tdCount + '>'
|
o = '<tr><td colspan=' + tdCount + '>'
|
||||||
o += '<div class="'+chartClass+'"><span class="breakPhraseChart">' + simplePhr + ' = ' + curCipher.sumArr.reduce(getSum) + ' </span>' // add all values in array
|
o += '<div class="'+chartClass+'"><span class="breakPhraseChart">' + escHtml(simplePhr) + ' = ' + curCipher.sumArr.reduce(getSum) + ' </span>' // add all values in array
|
||||||
o += '<span class="breakPhraseChartCiphName" style="'+curCiphCol+'">(' + curCipher.cipherName + gemCalcModeLabel(curCipher) + ')</span></div></td></tr>'
|
o += '<span class="breakPhraseChartCiphName" style="'+curCiphCol+'">(' + escHtml(curCipher.cipherName) + gemCalcModeLabel(curCipher) + ')</span></div></td></tr>'
|
||||||
$('#BreakTableContainer').prepend(o) // insert in the beginning of the table
|
$('#BreakTableContainer').prepend(o) // insert in the beginning of the table
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -322,7 +322,7 @@ function updateCipherChart(curCipher) {
|
|||||||
o += '<tr>'
|
o += '<tr>'
|
||||||
o += '<td id="spaceChartBtn" style="font-size: 150%; font-weight: 500; '+curCiphFaintCol+'">-</td>' // Space
|
o += '<td id="spaceChartBtn" style="font-size: 150%; font-weight: 500; '+curCiphFaintCol+'">-</td>' // Space
|
||||||
o += '<td id="capsNameChartBtn" colspan="' + (Math.ceil(curCipher.cArr.length / 2) - 2) + '">'
|
o += '<td id="capsNameChartBtn" colspan="' + (Math.ceil(curCipher.cArr.length / 2) - 2) + '">'
|
||||||
o += '<font style="font-size: 150%; font-weight: 500; '+curCiphCol+'">' + curCipher.cipherName + '</font>'
|
o += '<font style="font-size: 150%; font-weight: 500; '+curCiphCol+'">' + escHtml(curCipher.cipherName) + '</font>'
|
||||||
o += '</td>'
|
o += '</td>'
|
||||||
o += '<td id="backspaceChartBtn" style="font-size: 150%; font-weight: 500; '+curCiphFaintCol+'">←</td>' // Backspace
|
o += '<td id="backspaceChartBtn" style="font-size: 150%; font-weight: 500; '+curCiphFaintCol+'">←</td>' // Backspace
|
||||||
o += '</tr><tr>'
|
o += '</tr><tr>'
|
||||||
@@ -376,7 +376,7 @@ function updateCipherChartGemCard(impName = breakCipher) {
|
|||||||
o += '<tbody><tr>'
|
o += '<tbody><tr>'
|
||||||
|
|
||||||
o += '<td colspan="' + curCipher.cArr.length + '">'
|
o += '<td colspan="' + curCipher.cArr.length + '">'
|
||||||
o += '<font style="font-size: 150%; font-weight: 500; '+curCiphCol+'">' + curCipher.cipherName + '</font>'
|
o += '<font style="font-size: 150%; font-weight: 500; '+curCiphCol+'">' + escHtml(curCipher.cipherName) + '</font>'
|
||||||
o += '</td></tr><tr>'
|
o += '</td></tr><tr>'
|
||||||
|
|
||||||
var halfL = curCipher.cArr.length / 2
|
var halfL = curCipher.cArr.length / 2
|
||||||
|
|||||||
+160
-59
@@ -51,8 +51,12 @@ var optGemSubstitutionMode = true; // simple substitution of characters with cor
|
|||||||
var optGemMultCharPos = false; // value of each character is multiplied by character index
|
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 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 optFiltSameCipherMatch = true; // DEFAULT: only phrases matching in the SAME cipher (tighter, more meaningful results)
|
||||||
var optFiltCrossCipherMatch = true; // filter shows only ciphers that have matching values
|
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 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
|
||||||
@@ -88,43 +92,46 @@ var coderainLitDefault = 0.19;
|
|||||||
var optImageScale = 1.0; // image scaling factor for screenshots
|
var optImageScale = 1.0; // image scaling factor for screenshots
|
||||||
|
|
||||||
var calcOptionsArr = [
|
var calcOptionsArr = [
|
||||||
// used to export/import settings
|
// used to export/import settings — the NAMES of the option globals; exportCalcOptions() reads
|
||||||
"'optNumCalcMethod'+' = '+optNumCalcMethod",
|
// window[name], importCalcOptions() accepts only these names (no eval on either side)
|
||||||
"'optFiltCrossCipherMatch'+' = '+optFiltCrossCipherMatch",
|
"optNumCalcMethod",
|
||||||
"'optFiltSameCipherMatch'+' = '+optFiltSameCipherMatch",
|
"optFiltCrossCipherMatch",
|
||||||
"'optShowOnlyMatching'+' = '+optShowOnlyMatching",
|
"optFiltSameCipherMatch",
|
||||||
"'optNewPhrasesGoFirst'+' = '+optNewPhrasesGoFirst",
|
"optHltSameCipher",
|
||||||
"'optShowExtraCiphers'+' = '+optShowExtraCiphers",
|
"optShowOnlyMatching",
|
||||||
"'optAllowPhraseComments'+' = '+optAllowPhraseComments",
|
"autoMatchEnabled",
|
||||||
"'liveDatabaseMode'+' = '+liveDatabaseMode",
|
"optNewPhrasesGoFirst",
|
||||||
"'optLetterWordCount'+' = '+optLetterWordCount",
|
"optShowExtraCiphers",
|
||||||
"'optWordBreakdown'+' = '+optWordBreakdown",
|
"optAllowPhraseComments",
|
||||||
"'optCompactBreakdown'+' = '+optCompactBreakdown",
|
"liveDatabaseMode",
|
||||||
"'optShowCipherChart'+' = '+optShowCipherChart",
|
"optLetterWordCount",
|
||||||
"'optGradientCharts'+' = '+optGradientCharts",
|
"optWordBreakdown",
|
||||||
"'optLoadUserHistCiphers'+' = '+optLoadUserHistCiphers",
|
"optCompactBreakdown",
|
||||||
"'optMatrixCodeRain'+' = '+optMatrixCodeRain",
|
"optShowCipherChart",
|
||||||
"'interfaceHue'+' = '+interfaceHue",
|
"optGradientCharts",
|
||||||
"'interfaceSat'+' = '+interfaceSat",
|
"optLoadUserHistCiphers",
|
||||||
"'interfaceLit'+' = '+interfaceLit",
|
"optMatrixCodeRain",
|
||||||
"'fontHue'+' = '+fontHue",
|
"interfaceHue",
|
||||||
"'fontSat'+' = '+fontSat",
|
"interfaceSat",
|
||||||
"'fontLit'+' = '+fontLit",
|
"interfaceLit",
|
||||||
"'coderainHue'+' = '+coderainHue",
|
"fontHue",
|
||||||
"'coderainSat'+' = '+coderainSat",
|
"fontSat",
|
||||||
"'coderainLit'+' = '+coderainLit",
|
"fontLit",
|
||||||
"'optPhraseLimit'+' = '+optPhraseLimit",
|
"coderainHue",
|
||||||
"'dbPageItems'+' = '+dbPageItems",
|
"coderainSat",
|
||||||
"'dbScrollItems'+' = '+dbScrollItems",
|
"coderainLit",
|
||||||
"'optForceTwoColumnLayout'+' = '+optForceTwoColumnLayout",
|
"optPhraseLimit",
|
||||||
"'optColoredCiphers'+' = '+optColoredCiphers",
|
"dbPageItems",
|
||||||
"'optGemSubstitutionMode'+' = '+optGemSubstitutionMode",
|
"dbScrollItems",
|
||||||
"'optGemMultCharPos'+' = '+optGemMultCharPos",
|
"optForceTwoColumnLayout",
|
||||||
"'optGemMultCharPosReverse'+' = '+optGemMultCharPosReverse",
|
"optColoredCiphers",
|
||||||
|
"optGemSubstitutionMode",
|
||||||
|
"optGemMultCharPos",
|
||||||
|
"optGemMultCharPosReverse",
|
||||||
'"encDefAlphArr"+" = \x27"+String(encPrevAlphStr).replace(/,/g,"")+"\x27"',
|
'"encDefAlphArr"+" = \x27"+String(encPrevAlphStr).replace(/,/g,"")+"\x27"',
|
||||||
'"encDefVowArr"+" = \x27"+String(encPrevVowStr).replace(/,/g,"")+"\x27"',
|
'"encDefVowArr"+" = \x27"+String(encPrevVowStr).replace(/,/g,"")+"\x27"',
|
||||||
'"encDefExcLetArr"+" = \x27"+String(encPrevExcLetStr).replace(/,/g,"")+"\x27"',
|
'"encDefExcLetArr"+" = \x27"+String(encPrevExcLetStr).replace(/,/g,"")+"\x27"',
|
||||||
"'optImageScale'+' = '+optImageScale",
|
"optImageScale",
|
||||||
];
|
];
|
||||||
|
|
||||||
var runOnceRestoreCalcSet = true;
|
var runOnceRestoreCalcSet = true;
|
||||||
@@ -259,18 +266,21 @@ function createCiphersMenu() {
|
|||||||
|
|
||||||
o += '<div class="dropdown">';
|
o += '<div class="dropdown">';
|
||||||
o += '<button class="dropbtn">Cyphers</button>';
|
o += '<button class="dropbtn">Cyphers</button>';
|
||||||
o += '<div class="dropdown-content" style="width: 380px;">';
|
o += '<div class="dropdown-content" style="width: 410px;">';
|
||||||
|
|
||||||
o += "<div><center>";
|
o += '<div class="ciphPresetRow">';
|
||||||
o +=
|
o +=
|
||||||
'<input class="intBtn3" type="button" value="Empty" onclick="disableAllCiphers()">';
|
'<input class="intBtn3 ciphPresetBtn" type="button" value="Empty" onclick="disableAllCiphers()">';
|
||||||
o +=
|
o +=
|
||||||
'<input class="intBtn3" type="button" value="Default" onclick="enableDefaultCiphers()">';
|
'<input class="intBtn3 ciphPresetBtn" type="button" value="Base" onclick="enableBaseCiphers()">';
|
||||||
|
if (typeof CALC_CONFIG !== 'undefined' && Array.isArray(CALC_CONFIG.recommendedCiphers) && CALC_CONFIG.recommendedCiphers.length > 0)
|
||||||
|
o +=
|
||||||
|
'<input class="intBtn3 ciphPresetBtn" type="button" value="Curated" onclick="enableRecommendedCiphers()">';
|
||||||
o +=
|
o +=
|
||||||
'<input class="intBtn3" type="button" value="All (EN)" onclick="enableAllEnglishCiphers()">';
|
'<input class="intBtn3 ciphPresetBtn" type="button" value="All (EN)" onclick="enableAllEnglishCiphers()">';
|
||||||
o +=
|
o +=
|
||||||
'<input class="intBtn3" type="button" value="All" onclick="enableAllCiphers()">';
|
'<input class="intBtn3 ciphPresetBtn" type="button" value="All" onclick="enableAllCiphers()">';
|
||||||
o += "</center></div>";
|
o += "</div>";
|
||||||
|
|
||||||
o +=
|
o +=
|
||||||
'<hr style="background-color: var(--separator-accent2); height: 1px; border: none; margin: 0.4em;">';
|
'<hr style="background-color: var(--separator-accent2); height: 1px; border: none; margin: 0.4em;">';
|
||||||
@@ -333,6 +343,32 @@ function toggleAutoMatch() {
|
|||||||
document.getElementById("phraseBox").focus();
|
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 () {
|
$(document).ready(function () {
|
||||||
// Global Escape key handler
|
// Global Escape key handler
|
||||||
$(document).on("keydown", function(e) {
|
$(document).on("keydown", function(e) {
|
||||||
@@ -407,7 +443,7 @@ function displayCipherCatDetailed(curCat) {
|
|||||||
} // checkbox state
|
} // checkbox state
|
||||||
o +=
|
o +=
|
||||||
'<tr><td><label class="chkLabel ciphCheckboxLabel2">' +
|
'<tr><td><label class="chkLabel ciphCheckboxLabel2">' +
|
||||||
cipherList[i].cipherName +
|
escHtml(cipherList[i].cipherName) +
|
||||||
'<input type="checkbox" id="cipher_chkbox' +
|
'<input type="checkbox" id="cipher_chkbox' +
|
||||||
i +
|
i +
|
||||||
'" onclick="toggleCipher(' +
|
'" onclick="toggleCipher(' +
|
||||||
@@ -646,9 +682,9 @@ function conf_SCM() {
|
|||||||
chkCCM = document.getElementById("chkbox_CCM");
|
chkCCM = document.getElementById("chkbox_CCM");
|
||||||
if (chkCCM !== null) chkCCM.checked = false;
|
if (chkCCM !== null) chkCCM.checked = false;
|
||||||
} else if (!optFiltCrossCipherMatch && !optFiltSameCipherMatch) {
|
} else if (!optFiltCrossCipherMatch && !optFiltSameCipherMatch) {
|
||||||
optFiltCrossCipherMatch = true; // can't disable both, revert to cross match as default
|
optFiltSameCipherMatch = true; // can't disable both — keep same match (the default)
|
||||||
chkCCM = document.getElementById("chkbox_CCM");
|
chkSCM = document.getElementById("chkbox_SCM");
|
||||||
if (chkCCM !== null) chkCCM.checked = true;
|
if (chkSCM !== null) chkSCM.checked = true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -660,9 +696,9 @@ function conf_SOM() {
|
|||||||
} else {
|
} else {
|
||||||
alphaHlt = 0.15;
|
alphaHlt = 0.15;
|
||||||
}
|
}
|
||||||
if (optFiltCrossCipherMatch) {
|
if (!optHltSameCipher) {
|
||||||
updateTables();
|
updateTables();
|
||||||
} else if (optFiltSameCipherMatch) {
|
} else {
|
||||||
updateHistoryTableSameCiphMatch();
|
updateHistoryTableSameCiphMatch();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -1041,7 +1077,7 @@ function toggleColorControlsMenu(redraw = false) {
|
|||||||
if (cipherList[i].enabled) {
|
if (cipherList[i].enabled) {
|
||||||
o +=
|
o +=
|
||||||
'<td><span class="ciphCheckboxLabel">' +
|
'<td><span class="ciphCheckboxLabel">' +
|
||||||
cipherList[i].cipherName +
|
escHtml(cipherList[i].cipherName) +
|
||||||
"</span></td>";
|
"</span></td>";
|
||||||
o +=
|
o +=
|
||||||
'<td><input type="number" step="2" min="-360" max="360" value="' +
|
'<td><input type="number" step="2" min="-360" max="360" value="' +
|
||||||
@@ -1509,6 +1545,26 @@ function initCiphers(updDefCiph = true) {
|
|||||||
if (cCat.indexOf(catName) == -1) cCat.push(catName);
|
if (cCat.indexOf(catName) == -1) cCat.push(catName);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
// Config-driven default-enabled set (fork branding). If CALC_CONFIG.defaultEnabledCiphers
|
||||||
|
// is a non-empty array, it REPLACES the ciphers.js enabled:true defaults — so this fork can
|
||||||
|
// open with a curated loadout while the open-source default stays the bare 4. Unknown names
|
||||||
|
// are skipped with a warning. Becomes the "reset to defaults" baseline (defaultCipherArraySaved).
|
||||||
|
// Gated on runOnceRestoreCalcSet: this is the fresh-new-user setup path ONLY. When restoring
|
||||||
|
// SAVED user settings, runOnceRestoreCalcSet is already false, so we DON'T override (and thus
|
||||||
|
// don't stomp the user's saved cipher selection).
|
||||||
|
if (runOnceRestoreCalcSet && updDefCiph && typeof CALC_CONFIG !== 'undefined' && Array.isArray(CALC_CONFIG.defaultEnabledCiphers) && CALC_CONFIG.defaultEnabledCiphers.length > 0) {
|
||||||
|
var _validNames = cipherList.map(function (c) { return c.cipherName; });
|
||||||
|
var _cfgDefaults = [];
|
||||||
|
for (var dc = 0; dc < CALC_CONFIG.defaultEnabledCiphers.length; dc++) {
|
||||||
|
var _nm = CALC_CONFIG.defaultEnabledCiphers[dc];
|
||||||
|
if (_validNames.indexOf(_nm) > -1) {
|
||||||
|
if (_cfgDefaults.indexOf(_nm) === -1) _cfgDefaults.push(_nm);
|
||||||
|
} else {
|
||||||
|
console.warn("defaultEnabledCiphers: unknown cipher '" + _nm + "' (skipped)");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (_cfgDefaults.length > 0) defaultCipherArray = _cfgDefaults;
|
||||||
|
}
|
||||||
if (defaultCipherArraySaved.length == 0)
|
if (defaultCipherArraySaved.length == 0)
|
||||||
defaultCipherArraySaved = [...defaultCipherArray]; // copy of initial default ciphers
|
defaultCipherArraySaved = [...defaultCipherArray]; // copy of initial default ciphers
|
||||||
initColorArrays();
|
initColorArrays();
|
||||||
@@ -1585,6 +1641,37 @@ function disableAllCiphers() {
|
|||||||
updateTables(); // update
|
updateTables(); // update
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// "Base" preset: the universal classic-4 gematria set. Independent of config and
|
||||||
|
// saved settings, so it always selects exactly these 4 — a one-click return to the
|
||||||
|
// base view (vs "Default", which is the fork's full default loadout).
|
||||||
|
function enableBaseCiphers() {
|
||||||
|
prevCiphIndex = -1; // reset cipher selection
|
||||||
|
var base = ["Ordinal", "Reduction", "Reverse Ordinal", "Reverse Reduction"];
|
||||||
|
var cur_chkbox;
|
||||||
|
for (i = 0; i < cipherList.length; i++) {
|
||||||
|
var on = base.indexOf(cipherList[i].cipherName) > -1;
|
||||||
|
cipherList[i].enabled = on;
|
||||||
|
cur_chkbox = document.getElementById("cipher_chkbox" + i);
|
||||||
|
if (cur_chkbox !== null) cur_chkbox.checked = on;
|
||||||
|
}
|
||||||
|
updateTables(); // update
|
||||||
|
}
|
||||||
|
|
||||||
|
// "Curated" preset: the fork's recommended extended loadout (CALC_CONFIG.recommendedCiphers,
|
||||||
|
// = the lite-db set, so all match instantly). Button only renders when that list is non-empty.
|
||||||
|
function enableRecommendedCiphers() {
|
||||||
|
prevCiphIndex = -1; // reset cipher selection
|
||||||
|
var rec = (typeof CALC_CONFIG !== 'undefined' && Array.isArray(CALC_CONFIG.recommendedCiphers)) ? CALC_CONFIG.recommendedCiphers : [];
|
||||||
|
var cur_chkbox;
|
||||||
|
for (i = 0; i < cipherList.length; i++) {
|
||||||
|
var on = rec.indexOf(cipherList[i].cipherName) > -1;
|
||||||
|
cipherList[i].enabled = on;
|
||||||
|
cur_chkbox = document.getElementById("cipher_chkbox" + i);
|
||||||
|
if (cur_chkbox !== null) cur_chkbox.checked = on;
|
||||||
|
}
|
||||||
|
updateTables(); // update
|
||||||
|
}
|
||||||
|
|
||||||
function toggleCipherCategory(ciph_cat) {
|
function toggleCipherCategory(ciph_cat) {
|
||||||
prevCiphIndex = -1; // reset cipher selection
|
prevCiphIndex = -1; // reset cipher selection
|
||||||
// Check if custom config category
|
// Check if custom config category
|
||||||
@@ -1656,6 +1743,7 @@ function updateTables(updColorLayout = true) {
|
|||||||
autoHistoryTableLayout(); // use Compact History if necessary
|
autoHistoryTableLayout(); // use Compact History if necessary
|
||||||
updateHistoryTable(); // update history table
|
updateHistoryTable(); // update history table
|
||||||
updateWordBreakdown(breakCipher, true); // update word breakdown and choose first enabled cipher
|
updateWordBreakdown(breakCipher, true); // update word breakdown and choose first enabled cipher
|
||||||
|
if (typeof refreshOpenQuery === "function") refreshOpenQuery(); // refresh an open matches box in place after a cipher-set change
|
||||||
}
|
}
|
||||||
|
|
||||||
function autoHistoryTableLayout() {
|
function autoHistoryTableLayout() {
|
||||||
@@ -1675,6 +1763,19 @@ function updateEnabledCipherCount() {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Entity-escape user-supplied text before it enters an innerHTML string — for the HTML body AND
|
||||||
|
// for values inside double-quoted attributes (escapes & < > " '). Store phrases RAW; escape only
|
||||||
|
// here at render. Added 2026-09-13 (the calc had no escaping; phrases reached the DOM raw). Keep
|
||||||
|
// every user-text sink routed through this.
|
||||||
|
function escHtml(s) {
|
||||||
|
return String(s)
|
||||||
|
.replace(/&/g, "&")
|
||||||
|
.replace(/</g, "<")
|
||||||
|
.replace(/>/g, ">")
|
||||||
|
.replace(/"/g, """)
|
||||||
|
.replace(/'/g, "'");
|
||||||
|
}
|
||||||
|
|
||||||
function sVal() {
|
function sVal() {
|
||||||
return document.getElementById("phraseBox").value.trim(); // get value, remove spaces from both sides
|
return document.getElementById("phraseBox").value.trim(); // get value, remove spaces from both sides
|
||||||
}
|
}
|
||||||
@@ -1864,7 +1965,7 @@ function updateEnabledCipherTable() {
|
|||||||
'<td class="phraseGemCiphName" style="' +
|
'<td class="phraseGemCiphName" style="' +
|
||||||
cur_col +
|
cur_col +
|
||||||
'">' +
|
'">' +
|
||||||
cipherList[i].cipherName +
|
escHtml(cipherList[i].cipherName) +
|
||||||
"</td>";
|
"</td>";
|
||||||
// o += '<td class="phraseGemValueOdd" style="'+cur_col+'">'+cipherList[i].calcGematria(phr)+'</td>'
|
// o += '<td class="phraseGemValueOdd" style="'+cur_col+'">'+cipherList[i].calcGematria(phr)+'</td>'
|
||||||
o +=
|
o +=
|
||||||
@@ -1889,7 +1990,7 @@ function updateEnabledCipherTable() {
|
|||||||
'<td class="phraseGemCiphName" style="' +
|
'<td class="phraseGemCiphName" style="' +
|
||||||
cur_col +
|
cur_col +
|
||||||
'">' +
|
'">' +
|
||||||
cipherList[i].cipherName +
|
escHtml(cipherList[i].cipherName) +
|
||||||
"</td>";
|
"</td>";
|
||||||
ciph_in_row++;
|
ciph_in_row++;
|
||||||
odd_col = true;
|
odd_col = true;
|
||||||
@@ -2130,7 +2231,7 @@ function updateHistoryTable(hltBoolArr) {
|
|||||||
'px;"><span class="hCV2" style="' +
|
'px;"><span class="hCV2" style="' +
|
||||||
curCiphCol +
|
curCiphCol +
|
||||||
'">' +
|
'">' +
|
||||||
cipherList[z].cipherName +
|
escHtml(cipherList[z].cipherName) +
|
||||||
"</span></td>"; // color of cipher displayed in the table
|
"</span></td>"; // color of cipher displayed in the table
|
||||||
} else {
|
} else {
|
||||||
ms +=
|
ms +=
|
||||||
@@ -2141,7 +2242,7 @@ function updateHistoryTable(hltBoolArr) {
|
|||||||
"px; min-width: " +
|
"px; min-width: " +
|
||||||
calcCipherNameWidthPx(cipherList[z].cipherName) +
|
calcCipherNameWidthPx(cipherList[z].cipherName) +
|
||||||
'px;">' +
|
'px;">' +
|
||||||
cipherList[z].cipherName +
|
escHtml(cipherList[z].cipherName) +
|
||||||
"</td>"; // color of cipher displayed in the table
|
"</td>"; // color of cipher displayed in the table
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -2160,11 +2261,11 @@ function updateHistoryTable(hltBoolArr) {
|
|||||||
// comment first, phrase without comment and leading/trailing spaces
|
// comment first, phrase without comment and leading/trailing spaces
|
||||||
dispPhrase =
|
dispPhrase =
|
||||||
'<span class="pCHT">' +
|
'<span class="pCHT">' +
|
||||||
tmpComment +
|
escHtml(tmpComment) +
|
||||||
"</span>" +
|
"</span>" +
|
||||||
sHistory[x].replace(/\[.+\]/g, "").trim();
|
escHtml(sHistory[x].replace(/\[.+\]/g, "").trim());
|
||||||
} else {
|
} else {
|
||||||
dispPhrase = sHistory[x];
|
dispPhrase = escHtml(sHistory[x]);
|
||||||
}
|
}
|
||||||
ms += '<tr><td class="hP" data-ind="' + x + '">' + dispPhrase + "</td>"; // hP - history phrase, add data index
|
ms += '<tr><td class="hP" data-ind="' + x + '">' + dispPhrase + "</td>"; // hP - history phrase, add data index
|
||||||
var col = ""; // value color
|
var col = ""; // value color
|
||||||
@@ -2181,8 +2282,8 @@ function updateHistoryTable(hltBoolArr) {
|
|||||||
|
|
||||||
// if highlight mode is on
|
// if highlight mode is on
|
||||||
if (hltMode) {
|
if (hltMode) {
|
||||||
// if cross cipher match and highlight box doesn't include number
|
// "all matches" highlight mode: dim any cell whose value isn't in the box
|
||||||
if (optFiltCrossCipherMatch && !highlt_num.includes(gemVal)) {
|
if (!optHltSameCipher && !highlt_num.includes(gemVal)) {
|
||||||
col = optColoredCiphers
|
col = optColoredCiphers
|
||||||
? "hsl(" +
|
? "hsl(" +
|
||||||
curCiph.H +
|
curCiph.H +
|
||||||
|
|||||||
+370
-258
@@ -14,24 +14,6 @@ new cipher(
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
cipherList = [
|
cipherList = [
|
||||||
new cipher(
|
|
||||||
"Standard",
|
|
||||||
"English",
|
|
||||||
50,
|
|
||||||
78,
|
|
||||||
63,
|
|
||||||
[
|
|
||||||
97, 98, 99, 100, 101, 102, 103, 104, 105, 106, 107, 108, 109, 110, 111,
|
|
||||||
112, 113, 114, 115, 116, 117, 118, 119, 120, 121, 122,
|
|
||||||
],
|
|
||||||
[
|
|
||||||
1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 20, 30, 40, 50, 60, 70, 80, 90, 100, 200,
|
|
||||||
300, 400, 500, 600, 700, 800,
|
|
||||||
],
|
|
||||||
true,
|
|
||||||
false,
|
|
||||||
false
|
|
||||||
),
|
|
||||||
new cipher(
|
new cipher(
|
||||||
"Ordinal",
|
"Ordinal",
|
||||||
"English",
|
"English",
|
||||||
@@ -68,6 +50,264 @@ cipherList = [
|
|||||||
true,
|
true,
|
||||||
false
|
false
|
||||||
),
|
),
|
||||||
|
new cipher(
|
||||||
|
"Reverse Ordinal",
|
||||||
|
"Reverse",
|
||||||
|
146,
|
||||||
|
74,
|
||||||
|
50,
|
||||||
|
[
|
||||||
|
97, 98, 99, 100, 101, 102, 103, 104, 105, 106, 107, 108, 109, 110, 111,
|
||||||
|
112, 113, 114, 115, 116, 117, 118, 119, 120, 121, 122,
|
||||||
|
],
|
||||||
|
[
|
||||||
|
26, 25, 24, 23, 22, 21, 20, 19, 18, 17, 16, 15, 14, 13, 12, 11, 10, 9, 8,
|
||||||
|
7, 6, 5, 4, 3, 2, 1,
|
||||||
|
],
|
||||||
|
true,
|
||||||
|
true,
|
||||||
|
false
|
||||||
|
),
|
||||||
|
new cipher(
|
||||||
|
"Reverse Reduction",
|
||||||
|
"Reverse",
|
||||||
|
180,
|
||||||
|
60,
|
||||||
|
69,
|
||||||
|
[
|
||||||
|
97, 98, 99, 100, 101, 102, 103, 104, 105, 106, 107, 108, 109, 110, 111,
|
||||||
|
112, 113, 114, 115, 116, 117, 118, 119, 120, 121, 122,
|
||||||
|
],
|
||||||
|
[
|
||||||
|
8, 7, 6, 5, 4, 3, 2, 1, 9, 8, 7, 6, 5, 4, 3, 2, 1, 9, 8, 7, 6, 5, 4, 3, 2,
|
||||||
|
1,
|
||||||
|
],
|
||||||
|
true,
|
||||||
|
true,
|
||||||
|
false
|
||||||
|
),
|
||||||
|
new cipher(
|
||||||
|
"Standard",
|
||||||
|
"English",
|
||||||
|
50,
|
||||||
|
78,
|
||||||
|
63,
|
||||||
|
[
|
||||||
|
97, 98, 99, 100, 101, 102, 103, 104, 105, 106, 107, 108, 109, 110, 111,
|
||||||
|
112, 113, 114, 115, 116, 117, 118, 119, 120, 121, 122,
|
||||||
|
],
|
||||||
|
[
|
||||||
|
1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 20, 30, 40, 50, 60, 70, 80, 90, 100, 200,
|
||||||
|
300, 400, 500, 600, 700, 800,
|
||||||
|
],
|
||||||
|
true,
|
||||||
|
false,
|
||||||
|
false
|
||||||
|
),
|
||||||
|
new cipher(
|
||||||
|
"Latin (Jewish)",
|
||||||
|
"Latin",
|
||||||
|
260,
|
||||||
|
100,
|
||||||
|
70,
|
||||||
|
[
|
||||||
|
97, 98, 99, 100, 101, 102, 103, 104, 105, 107, 108, 109, 110, 111, 112,
|
||||||
|
113, 114, 115, 116, 117, 120, 121, 122, 106, 118, 119,
|
||||||
|
],
|
||||||
|
[
|
||||||
|
1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 20, 30, 40, 50, 60, 70, 80, 90, 100, 200,
|
||||||
|
300, 400, 500, 600, 700, 900,
|
||||||
|
],
|
||||||
|
true,
|
||||||
|
false,
|
||||||
|
false
|
||||||
|
),
|
||||||
|
new cipher(
|
||||||
|
"English Sumerian",
|
||||||
|
"Mathematic",
|
||||||
|
95,
|
||||||
|
41,
|
||||||
|
69,
|
||||||
|
[
|
||||||
|
97, 98, 99, 100, 101, 102, 103, 104, 105, 106, 107, 108, 109, 110, 111,
|
||||||
|
112, 113, 114, 115, 116, 117, 118, 119, 120, 121, 122,
|
||||||
|
],
|
||||||
|
[
|
||||||
|
6, 12, 18, 24, 30, 36, 42, 48, 54, 60, 66, 72, 78, 84, 90, 96, 102, 108,
|
||||||
|
114, 120, 126, 132, 138, 144, 150, 156,
|
||||||
|
],
|
||||||
|
true,
|
||||||
|
false,
|
||||||
|
false
|
||||||
|
),
|
||||||
|
new cipher(
|
||||||
|
"Satanic Gematria",
|
||||||
|
"English",
|
||||||
|
350,
|
||||||
|
55,
|
||||||
|
61,
|
||||||
|
[
|
||||||
|
97, 98, 99, 100, 101, 102, 103, 104, 105, 106, 107, 108, 109, 110, 111,
|
||||||
|
112, 113, 114, 115, 116, 117, 118, 119, 120, 121, 122,
|
||||||
|
],
|
||||||
|
[
|
||||||
|
36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53,
|
||||||
|
54, 55, 56, 57, 58, 59, 60, 61,
|
||||||
|
],
|
||||||
|
true,
|
||||||
|
false,
|
||||||
|
false
|
||||||
|
),
|
||||||
|
new cipher(
|
||||||
|
"Bacon Simple",
|
||||||
|
"Baconian",
|
||||||
|
120,
|
||||||
|
65,
|
||||||
|
62,
|
||||||
|
[
|
||||||
|
97, 98, 99, 100, 101, 102, 103, 104, 105, 106, 107, 108, 109, 110, 111,
|
||||||
|
112, 113, 114, 115, 116, 117, 118, 119, 120, 121, 122,
|
||||||
|
],
|
||||||
|
[
|
||||||
|
1, 2, 3, 4, 5, 6, 7, 8, 9, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20,
|
||||||
|
20, 21, 22, 23, 24,
|
||||||
|
],
|
||||||
|
true,
|
||||||
|
false,
|
||||||
|
false
|
||||||
|
),
|
||||||
|
new cipher(
|
||||||
|
"Septenary",
|
||||||
|
"Other",
|
||||||
|
37,
|
||||||
|
54,
|
||||||
|
55,
|
||||||
|
[
|
||||||
|
97, 98, 99, 100, 101, 102, 103, 104, 105, 106, 107, 108, 109, 110, 111,
|
||||||
|
112, 113, 114, 115, 116, 117, 118, 119, 120, 121, 122,
|
||||||
|
],
|
||||||
|
[
|
||||||
|
1, 2, 3, 4, 5, 6, 7, 6, 5, 4, 3, 2, 1, 1, 2, 3, 4, 5, 6, 7, 6, 5, 4, 3, 2,
|
||||||
|
1,
|
||||||
|
],
|
||||||
|
true,
|
||||||
|
false,
|
||||||
|
false
|
||||||
|
),
|
||||||
|
new cipher(
|
||||||
|
"Chaldean (Cheiro)",
|
||||||
|
"Extra",
|
||||||
|
99,
|
||||||
|
36,
|
||||||
|
54,
|
||||||
|
[
|
||||||
|
97, 98, 99, 100, 101, 102, 103, 104, 105, 106, 107, 108, 109, 110, 111,
|
||||||
|
112, 113, 114, 115, 116, 117, 118, 119, 120, 121, 122,
|
||||||
|
],
|
||||||
|
[
|
||||||
|
1, 2, 3, 4, 5, 8, 3, 5, 1, 1, 2, 3, 4, 5, 7, 8, 1, 2, 3, 4, 6, 6, 6, 5, 1,
|
||||||
|
7,
|
||||||
|
],
|
||||||
|
true,
|
||||||
|
false,
|
||||||
|
false
|
||||||
|
),
|
||||||
|
new cipher(
|
||||||
|
"Primes",
|
||||||
|
"Mathematic",
|
||||||
|
44,
|
||||||
|
56,
|
||||||
|
62,
|
||||||
|
[
|
||||||
|
97, 98, 99, 100, 101, 102, 103, 104, 105, 106, 107, 108, 109, 110, 111,
|
||||||
|
112, 113, 114, 115, 116, 117, 118, 119, 120, 121, 122,
|
||||||
|
],
|
||||||
|
[
|
||||||
|
2, 3, 5, 7, 11, 13, 17, 19, 23, 29, 31, 37, 41, 43, 47, 53, 59, 61, 67,
|
||||||
|
71, 73, 79, 83, 89, 97, 101,
|
||||||
|
],
|
||||||
|
true,
|
||||||
|
false,
|
||||||
|
false
|
||||||
|
),
|
||||||
|
new cipher(
|
||||||
|
"Alphanumeric Qabbala",
|
||||||
|
"Alphanumeric",
|
||||||
|
60,
|
||||||
|
33,
|
||||||
|
62,
|
||||||
|
[
|
||||||
|
48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 97, 98, 99, 100, 101, 102, 103,
|
||||||
|
104, 105, 106, 107, 108, 109, 110, 111, 112, 113, 114, 115, 116, 117, 118,
|
||||||
|
119, 120, 121, 122,
|
||||||
|
],
|
||||||
|
[
|
||||||
|
0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20,
|
||||||
|
21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35,
|
||||||
|
],
|
||||||
|
true,
|
||||||
|
false,
|
||||||
|
false
|
||||||
|
),
|
||||||
|
new cipher(
|
||||||
|
"Synx",
|
||||||
|
"Alphanumeric",
|
||||||
|
180,
|
||||||
|
44,
|
||||||
|
66,
|
||||||
|
[
|
||||||
|
48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 97, 98, 99, 100, 101, 102, 103,
|
||||||
|
104, 105, 106, 107, 108, 109, 110, 111, 112, 113, 114, 115, 116, 117, 118,
|
||||||
|
119, 120, 121, 122,
|
||||||
|
],
|
||||||
|
[
|
||||||
|
1, 2, 3, 4, 5, 6, 7, 9, 10, 12, 14, 15, 18, 20, 21, 28, 30, 35, 36, 42,
|
||||||
|
45, 60, 63, 70, 84, 90, 105, 126, 140, 180, 210, 252, 315, 420, 630, 1260,
|
||||||
|
],
|
||||||
|
true,
|
||||||
|
false,
|
||||||
|
false
|
||||||
|
),
|
||||||
|
new cipher(
|
||||||
|
"Alphanumeric Case Sensitive",
|
||||||
|
"Alphanumeric",
|
||||||
|
32,
|
||||||
|
68,
|
||||||
|
62,
|
||||||
|
[
|
||||||
|
48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 97, 98, 99, 100, 101, 102, 103,
|
||||||
|
104, 105, 106, 107, 108, 109, 110, 111, 112, 113, 114, 115, 116, 117, 118,
|
||||||
|
119, 120, 121, 122, 65, 66, 67, 68, 69, 70, 71, 72, 73, 74, 75, 76, 77,
|
||||||
|
78, 79, 80, 81, 82, 83, 84, 85, 86, 87, 88, 89, 90,
|
||||||
|
],
|
||||||
|
[
|
||||||
|
0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20,
|
||||||
|
21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38,
|
||||||
|
39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, 56,
|
||||||
|
57, 58, 59, 60, 61,
|
||||||
|
],
|
||||||
|
true,
|
||||||
|
false,
|
||||||
|
true
|
||||||
|
),
|
||||||
|
new cipher(
|
||||||
|
"English Qaballa",
|
||||||
|
"Thelemic",
|
||||||
|
13,
|
||||||
|
68,
|
||||||
|
64,
|
||||||
|
[
|
||||||
|
97, 108, 119, 104, 115, 100, 111, 122, 107, 118, 103, 114, 99, 110, 121,
|
||||||
|
106, 117, 102, 113, 98, 109, 120, 105, 116, 101, 112,
|
||||||
|
],
|
||||||
|
[
|
||||||
|
1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21,
|
||||||
|
22, 23, 24, 25, 26,
|
||||||
|
],
|
||||||
|
true,
|
||||||
|
false,
|
||||||
|
false
|
||||||
|
),
|
||||||
new cipher(
|
new cipher(
|
||||||
"Single Reduction",
|
"Single Reduction",
|
||||||
"English",
|
"English",
|
||||||
@@ -164,24 +404,6 @@ cipherList = [
|
|||||||
false,
|
false,
|
||||||
true
|
true
|
||||||
),
|
),
|
||||||
new cipher(
|
|
||||||
"Satanic Gematria",
|
|
||||||
"English",
|
|
||||||
350,
|
|
||||||
55,
|
|
||||||
61,
|
|
||||||
[
|
|
||||||
97, 98, 99, 100, 101, 102, 103, 104, 105, 106, 107, 108, 109, 110, 111,
|
|
||||||
112, 113, 114, 115, 116, 117, 118, 119, 120, 121, 122,
|
|
||||||
],
|
|
||||||
[
|
|
||||||
36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53,
|
|
||||||
54, 55, 56, 57, 58, 59, 60, 61,
|
|
||||||
],
|
|
||||||
true,
|
|
||||||
false,
|
|
||||||
false
|
|
||||||
),
|
|
||||||
new cipher(
|
new cipher(
|
||||||
"Reverse Standard",
|
"Reverse Standard",
|
||||||
"Reverse",
|
"Reverse",
|
||||||
@@ -200,42 +422,6 @@ cipherList = [
|
|||||||
false,
|
false,
|
||||||
false
|
false
|
||||||
),
|
),
|
||||||
new cipher(
|
|
||||||
"Reverse Ordinal",
|
|
||||||
"Reverse",
|
|
||||||
146,
|
|
||||||
74,
|
|
||||||
50,
|
|
||||||
[
|
|
||||||
97, 98, 99, 100, 101, 102, 103, 104, 105, 106, 107, 108, 109, 110, 111,
|
|
||||||
112, 113, 114, 115, 116, 117, 118, 119, 120, 121, 122,
|
|
||||||
],
|
|
||||||
[
|
|
||||||
26, 25, 24, 23, 22, 21, 20, 19, 18, 17, 16, 15, 14, 13, 12, 11, 10, 9, 8,
|
|
||||||
7, 6, 5, 4, 3, 2, 1,
|
|
||||||
],
|
|
||||||
true,
|
|
||||||
true,
|
|
||||||
false
|
|
||||||
),
|
|
||||||
new cipher(
|
|
||||||
"Reverse Reduction",
|
|
||||||
"Reverse",
|
|
||||||
180,
|
|
||||||
60,
|
|
||||||
69,
|
|
||||||
[
|
|
||||||
97, 98, 99, 100, 101, 102, 103, 104, 105, 106, 107, 108, 109, 110, 111,
|
|
||||||
112, 113, 114, 115, 116, 117, 118, 119, 120, 121, 122,
|
|
||||||
],
|
|
||||||
[
|
|
||||||
8, 7, 6, 5, 4, 3, 2, 1, 9, 8, 7, 6, 5, 4, 3, 2, 1, 9, 8, 7, 6, 5, 4, 3, 2,
|
|
||||||
1,
|
|
||||||
],
|
|
||||||
true,
|
|
||||||
true,
|
|
||||||
false
|
|
||||||
),
|
|
||||||
new cipher(
|
new cipher(
|
||||||
"Reverse Single Reduction",
|
"Reverse Single Reduction",
|
||||||
"Reverse",
|
"Reverse",
|
||||||
@@ -350,24 +536,6 @@ cipherList = [
|
|||||||
false,
|
false,
|
||||||
false
|
false
|
||||||
),
|
),
|
||||||
new cipher(
|
|
||||||
"Bacon Simple",
|
|
||||||
"Baconian",
|
|
||||||
120,
|
|
||||||
65,
|
|
||||||
62,
|
|
||||||
[
|
|
||||||
97, 98, 99, 100, 101, 102, 103, 104, 105, 106, 107, 108, 109, 110, 111,
|
|
||||||
112, 113, 114, 115, 116, 117, 118, 119, 120, 121, 122,
|
|
||||||
],
|
|
||||||
[
|
|
||||||
1, 2, 3, 4, 5, 6, 7, 8, 9, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20,
|
|
||||||
20, 21, 22, 23, 24,
|
|
||||||
],
|
|
||||||
true,
|
|
||||||
false,
|
|
||||||
false
|
|
||||||
),
|
|
||||||
new cipher(
|
new cipher(
|
||||||
"Bacon Reverse",
|
"Bacon Reverse",
|
||||||
"Baconian",
|
"Baconian",
|
||||||
@@ -494,24 +662,6 @@ cipherList = [
|
|||||||
false,
|
false,
|
||||||
false
|
false
|
||||||
),
|
),
|
||||||
new cipher(
|
|
||||||
"Latin (Jewish)",
|
|
||||||
"Latin",
|
|
||||||
260,
|
|
||||||
100,
|
|
||||||
70,
|
|
||||||
[
|
|
||||||
97, 98, 99, 100, 101, 102, 103, 104, 105, 107, 108, 109, 110, 111, 112,
|
|
||||||
113, 114, 115, 116, 117, 120, 121, 122, 106, 118, 119,
|
|
||||||
],
|
|
||||||
[
|
|
||||||
1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 20, 30, 40, 50, 60, 70, 80, 90, 100, 200,
|
|
||||||
300, 400, 500, 600, 700, 900,
|
|
||||||
],
|
|
||||||
true,
|
|
||||||
false,
|
|
||||||
false
|
|
||||||
),
|
|
||||||
new cipher(
|
new cipher(
|
||||||
"Latin Ordinal (Jewish Ord.)",
|
"Latin Ordinal (Jewish Ord.)",
|
||||||
"Latin",
|
"Latin",
|
||||||
@@ -602,24 +752,6 @@ cipherList = [
|
|||||||
false,
|
false,
|
||||||
false
|
false
|
||||||
),
|
),
|
||||||
new cipher(
|
|
||||||
"English Qaballa",
|
|
||||||
"Thelemic",
|
|
||||||
13,
|
|
||||||
68,
|
|
||||||
64,
|
|
||||||
[
|
|
||||||
97, 108, 119, 104, 115, 100, 111, 122, 107, 118, 103, 114, 99, 110, 121,
|
|
||||||
106, 117, 102, 113, 98, 109, 120, 105, 116, 101, 112,
|
|
||||||
],
|
|
||||||
[
|
|
||||||
1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21,
|
|
||||||
22, 23, 24, 25, 26,
|
|
||||||
],
|
|
||||||
true,
|
|
||||||
false,
|
|
||||||
false
|
|
||||||
),
|
|
||||||
new cipher(
|
new cipher(
|
||||||
"Cipher X",
|
"Cipher X",
|
||||||
"Thelemic",
|
"Thelemic",
|
||||||
@@ -656,24 +788,6 @@ cipherList = [
|
|||||||
false,
|
false,
|
||||||
false
|
false
|
||||||
),
|
),
|
||||||
new cipher(
|
|
||||||
"English Sumerian",
|
|
||||||
"Mathematic",
|
|
||||||
95,
|
|
||||||
41,
|
|
||||||
69,
|
|
||||||
[
|
|
||||||
97, 98, 99, 100, 101, 102, 103, 104, 105, 106, 107, 108, 109, 110, 111,
|
|
||||||
112, 113, 114, 115, 116, 117, 118, 119, 120, 121, 122,
|
|
||||||
],
|
|
||||||
[
|
|
||||||
6, 12, 18, 24, 30, 36, 42, 48, 54, 60, 66, 72, 78, 84, 90, 96, 102, 108,
|
|
||||||
114, 120, 126, 132, 138, 144, 150, 156,
|
|
||||||
],
|
|
||||||
true,
|
|
||||||
false,
|
|
||||||
false
|
|
||||||
),
|
|
||||||
new cipher(
|
new cipher(
|
||||||
"Reverse Sumerian",
|
"Reverse Sumerian",
|
||||||
"Mathematic",
|
"Mathematic",
|
||||||
@@ -692,24 +806,6 @@ cipherList = [
|
|||||||
false,
|
false,
|
||||||
false
|
false
|
||||||
),
|
),
|
||||||
new cipher(
|
|
||||||
"Primes",
|
|
||||||
"Mathematic",
|
|
||||||
44,
|
|
||||||
56,
|
|
||||||
62,
|
|
||||||
[
|
|
||||||
97, 98, 99, 100, 101, 102, 103, 104, 105, 106, 107, 108, 109, 110, 111,
|
|
||||||
112, 113, 114, 115, 116, 117, 118, 119, 120, 121, 122,
|
|
||||||
],
|
|
||||||
[
|
|
||||||
2, 3, 5, 7, 11, 13, 17, 19, 23, 29, 31, 37, 41, 43, 47, 53, 59, 61, 67,
|
|
||||||
71, 73, 79, 83, 89, 97, 101,
|
|
||||||
],
|
|
||||||
true,
|
|
||||||
false,
|
|
||||||
false
|
|
||||||
),
|
|
||||||
new cipher(
|
new cipher(
|
||||||
"Reverse Primes",
|
"Reverse Primes",
|
||||||
"Mathematic",
|
"Mathematic",
|
||||||
@@ -800,24 +896,6 @@ cipherList = [
|
|||||||
false,
|
false,
|
||||||
false
|
false
|
||||||
),
|
),
|
||||||
new cipher(
|
|
||||||
"Septenary",
|
|
||||||
"Other",
|
|
||||||
37,
|
|
||||||
54,
|
|
||||||
55,
|
|
||||||
[
|
|
||||||
97, 98, 99, 100, 101, 102, 103, 104, 105, 106, 107, 108, 109, 110, 111,
|
|
||||||
112, 113, 114, 115, 116, 117, 118, 119, 120, 121, 122,
|
|
||||||
],
|
|
||||||
[
|
|
||||||
1, 2, 3, 4, 5, 6, 7, 6, 5, 4, 3, 2, 1, 1, 2, 3, 4, 5, 6, 7, 6, 5, 4, 3, 2,
|
|
||||||
1,
|
|
||||||
],
|
|
||||||
true,
|
|
||||||
false,
|
|
||||||
false
|
|
||||||
),
|
|
||||||
new cipher(
|
new cipher(
|
||||||
"Cheiro Numerology",
|
"Cheiro Numerology",
|
||||||
"Other",
|
"Other",
|
||||||
@@ -872,47 +950,6 @@ cipherList = [
|
|||||||
false,
|
false,
|
||||||
false
|
false
|
||||||
),
|
),
|
||||||
new cipher(
|
|
||||||
"Alphanumeric Qabbala",
|
|
||||||
"Other",
|
|
||||||
60,
|
|
||||||
33,
|
|
||||||
62,
|
|
||||||
[
|
|
||||||
48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 97, 98, 99, 100, 101, 102, 103,
|
|
||||||
104, 105, 106, 107, 108, 109, 110, 111, 112, 113, 114, 115, 116, 117, 118,
|
|
||||||
119, 120, 121, 122,
|
|
||||||
],
|
|
||||||
[
|
|
||||||
0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20,
|
|
||||||
21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35,
|
|
||||||
],
|
|
||||||
true,
|
|
||||||
false,
|
|
||||||
false
|
|
||||||
),
|
|
||||||
new cipher(
|
|
||||||
"Alphanumeric Case Sensitive",
|
|
||||||
"Other",
|
|
||||||
32,
|
|
||||||
68,
|
|
||||||
62,
|
|
||||||
[
|
|
||||||
48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 97, 98, 99, 100, 101, 102, 103,
|
|
||||||
104, 105, 106, 107, 108, 109, 110, 111, 112, 113, 114, 115, 116, 117, 118,
|
|
||||||
119, 120, 121, 122, 65, 66, 67, 68, 69, 70, 71, 72, 73, 74, 75, 76, 77,
|
|
||||||
78, 79, 80, 81, 82, 83, 84, 85, 86, 87, 88, 89, 90,
|
|
||||||
],
|
|
||||||
[
|
|
||||||
0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20,
|
|
||||||
21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38,
|
|
||||||
39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, 56,
|
|
||||||
57, 58, 59, 60, 61,
|
|
||||||
],
|
|
||||||
true,
|
|
||||||
false,
|
|
||||||
true
|
|
||||||
),
|
|
||||||
new cipher(
|
new cipher(
|
||||||
"Zeroing Key",
|
"Zeroing Key",
|
||||||
"Zeroing",
|
"Zeroing",
|
||||||
@@ -951,7 +988,7 @@ cipherList = [
|
|||||||
),
|
),
|
||||||
new cipher(
|
new cipher(
|
||||||
"Alphanumeric Halves",
|
"Alphanumeric Halves",
|
||||||
"Zeroing",
|
"Alphanumeric",
|
||||||
59,
|
59,
|
||||||
21,
|
21,
|
||||||
57,
|
57,
|
||||||
@@ -1396,7 +1433,7 @@ cipherList = [
|
|||||||
),
|
),
|
||||||
new cipher(
|
new cipher(
|
||||||
"Alphanumeric Primes",
|
"Alphanumeric Primes",
|
||||||
"Extra",
|
"Alphanumeric",
|
||||||
34,
|
34,
|
||||||
53,
|
53,
|
||||||
73,
|
73,
|
||||||
@@ -1415,7 +1452,7 @@ cipherList = [
|
|||||||
),
|
),
|
||||||
new cipher(
|
new cipher(
|
||||||
"Alphanumeric Trigonal",
|
"Alphanumeric Trigonal",
|
||||||
"Extra",
|
"Alphanumeric",
|
||||||
101,
|
101,
|
||||||
22,
|
22,
|
||||||
64,
|
64,
|
||||||
@@ -1435,7 +1472,7 @@ cipherList = [
|
|||||||
),
|
),
|
||||||
new cipher(
|
new cipher(
|
||||||
"Alphanumeric Squares",
|
"Alphanumeric Squares",
|
||||||
"Extra",
|
"Alphanumeric",
|
||||||
175,
|
175,
|
||||||
19,
|
19,
|
||||||
61,
|
61,
|
||||||
@@ -1453,42 +1490,25 @@ cipherList = [
|
|||||||
false,
|
false,
|
||||||
false
|
false
|
||||||
),
|
),
|
||||||
|
// --- from NetVoid (cyphers.news, 2026-09) — her "CCRU" group = our Alphanumeric family ------------
|
||||||
|
// Based Atlanteanism = Standard − Alphanumeric Qabbala, digits count 0 (her derivation descriptor
|
||||||
|
// {from:"Standard", minus:"Alphanumeric Qabbala"}); values as published, verified against the identity.
|
||||||
new cipher(
|
new cipher(
|
||||||
"Synx",
|
"Based Atlanteanism",
|
||||||
"Extra",
|
"Alphanumeric",
|
||||||
180,
|
156, 80, 62,
|
||||||
44,
|
[48,49,50,51,52,53,54,55,56,57,97,98,99,100,101,102,103,104,105,106,107,108,109,110,111,112,113,114,115,116,117,118,119,120,121,122],
|
||||||
66,
|
[0,0,0,0,0,0,0,0,0,0,-9,-9,-9,-9,-9,-9,-9,-9,-9,-9,0,9,18,27,36,45,54,63,72,171,270,369,468,567,666,765],
|
||||||
[
|
true, false, false
|
||||||
48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 97, 98, 99, 100, 101, 102, 103,
|
|
||||||
104, 105, 106, 107, 108, 109, 110, 111, 112, 113, 114, 115, 116, 117, 118,
|
|
||||||
119, 120, 121, 122,
|
|
||||||
],
|
|
||||||
[
|
|
||||||
1, 2, 3, 4, 5, 6, 7, 9, 10, 12, 14, 15, 18, 20, 21, 28, 30, 35, 36, 42,
|
|
||||||
45, 60, 63, 70, 84, 90, 105, 126, 140, 180, 210, 252, 315, 420, 630, 1260,
|
|
||||||
],
|
|
||||||
true,
|
|
||||||
false,
|
|
||||||
false
|
|
||||||
),
|
),
|
||||||
|
// Based Atlanteanism Denovated = (Standard − Alphanumeric Qabbala) / 9 (her {…, over: 9}).
|
||||||
new cipher(
|
new cipher(
|
||||||
"Chaldean (Cheiro)",
|
"Based Atlanteanism Denovated",
|
||||||
"Extra",
|
"Alphanumeric",
|
||||||
99,
|
172, 100, 62,
|
||||||
36,
|
[48,49,50,51,52,53,54,55,56,57,97,98,99,100,101,102,103,104,105,106,107,108,109,110,111,112,113,114,115,116,117,118,119,120,121,122],
|
||||||
54,
|
[0,0,0,0,0,0,0,0,0,0,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,0,1,2,3,4,5,6,7,8,19,30,41,52,63,74,85],
|
||||||
[
|
true, false, false
|
||||||
97, 98, 99, 100, 101, 102, 103, 104, 105, 106, 107, 108, 109, 110, 111,
|
|
||||||
112, 113, 114, 115, 116, 117, 118, 119, 120, 121, 122,
|
|
||||||
],
|
|
||||||
[
|
|
||||||
1, 2, 3, 4, 5, 8, 3, 5, 1, 1, 2, 3, 4, 5, 7, 8, 1, 2, 3, 4, 6, 6, 6, 5, 1,
|
|
||||||
7,
|
|
||||||
],
|
|
||||||
true,
|
|
||||||
false,
|
|
||||||
false
|
|
||||||
),
|
),
|
||||||
new cipher(
|
new cipher(
|
||||||
"Kabbalistic (Sepharial)",
|
"Kabbalistic (Sepharial)",
|
||||||
@@ -1562,4 +1582,96 @@ cipherList = [
|
|||||||
false,
|
false,
|
||||||
false
|
false
|
||||||
),
|
),
|
||||||
|
|
||||||
|
// ---- New ciphers ported from Alektryon's fork (github.com/Alektryon/gematria), AGPLv3 ----
|
||||||
|
// Polygonal family + English Qabalah 31 / Mars Kamea / Angelic + Bacon Standard / R Standard
|
||||||
|
// (= his Elizabethan Standard / R Standard). All disabled by default.
|
||||||
|
new cipher(
|
||||||
|
"Pentagonal",
|
||||||
|
"Mathematic",
|
||||||
|
50, 59, 56,
|
||||||
|
[97,98,99,100,101,102,103,104,105,106,107,108,109,110,111,112,113,114,115,116,117,118,119,120,121,122],
|
||||||
|
[1,5,12,22,35,51,70,92,117,145,176,210,247,287,330,376,425,477,532,590,651,715,782,852,925,1001],
|
||||||
|
true, false, false
|
||||||
|
),
|
||||||
|
new cipher(
|
||||||
|
"Hexagonal",
|
||||||
|
"Mathematic",
|
||||||
|
52, 60, 54,
|
||||||
|
[97,98,99,100,101,102,103,104,105,106,107,108,109,110,111,112,113,114,115,116,117,118,119,120,121,122],
|
||||||
|
[1,6,15,28,45,66,91,120,153,190,231,276,325,378,435,496,561,630,703,780,861,946,1035,1128,1225,1326],
|
||||||
|
true, false, false
|
||||||
|
),
|
||||||
|
new cipher(
|
||||||
|
"Heptagonal",
|
||||||
|
"Mathematic",
|
||||||
|
54, 61, 52,
|
||||||
|
[97,98,99,100,101,102,103,104,105,106,107,108,109,110,111,112,113,114,115,116,117,118,119,120,121,122],
|
||||||
|
[1,7,18,34,55,81,112,148,189,235,286,342,403,469,540,616,697,783,874,970,1071,1177,1288,1404,1525,1651],
|
||||||
|
true, false, false
|
||||||
|
),
|
||||||
|
new cipher(
|
||||||
|
"Octagonal",
|
||||||
|
"Mathematic",
|
||||||
|
56, 62, 50,
|
||||||
|
[97,98,99,100,101,102,103,104,105,106,107,108,109,110,111,112,113,114,115,116,117,118,119,120,121,122],
|
||||||
|
[1,8,21,40,65,96,133,176,225,280,341,408,481,560,645,736,833,936,1045,1160,1281,1408,1541,1680,1825,1976],
|
||||||
|
true, false, false
|
||||||
|
),
|
||||||
|
new cipher(
|
||||||
|
"Enneagonal",
|
||||||
|
"Mathematic",
|
||||||
|
58, 63, 48,
|
||||||
|
[97,98,99,100,101,102,103,104,105,106,107,108,109,110,111,112,113,114,115,116,117,118,119,120,121,122],
|
||||||
|
[1,9,24,46,75,111,154,204,261,325,396,474,559,651,750,856,969,1089,1216,1350,1491,1639,1794,1956,2125,2301],
|
||||||
|
true, false, false
|
||||||
|
),
|
||||||
|
new cipher(
|
||||||
|
"Decagonal",
|
||||||
|
"Mathematic",
|
||||||
|
60, 64, 46,
|
||||||
|
[97,98,99,100,101,102,103,104,105,106,107,108,109,110,111,112,113,114,115,116,117,118,119,120,121,122],
|
||||||
|
[1,10,27,52,85,126,175,232,297,370,451,540,637,742,855,976,1105,1242,1387,1540,1701,1870,2047,2232,2425,2626],
|
||||||
|
true, false, false
|
||||||
|
),
|
||||||
|
new cipher(
|
||||||
|
"English Qabalah 31",
|
||||||
|
"Thelemic",
|
||||||
|
52, 66, 70,
|
||||||
|
[97,102,107,112,117,122,101,106,111,116,121,100,105,110,115,120,99,104,109,114,119,98,103,108,113,118],
|
||||||
|
[1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26],
|
||||||
|
true, false, false
|
||||||
|
),
|
||||||
|
new cipher(
|
||||||
|
"Mars Kamea Gematria",
|
||||||
|
"Thelemic",
|
||||||
|
0, 70, 60,
|
||||||
|
[97,115,119,98,107,111,121,100,104,108,117,102,106,110,114,118,103,112,116,120,99,109,113,122,101,105],
|
||||||
|
[0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25],
|
||||||
|
true, false, false
|
||||||
|
),
|
||||||
|
new cipher(
|
||||||
|
"Angelic Gematria",
|
||||||
|
"Other",
|
||||||
|
276, 100, 85,
|
||||||
|
[97,98,99,100,101,102,103,104,105,106,107,108,109,110,111,112,113,114,115,116,117,118,119,120,121,122],
|
||||||
|
[5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30],
|
||||||
|
true, false, false
|
||||||
|
),
|
||||||
|
new cipher(
|
||||||
|
"Bacon Standard",
|
||||||
|
"Baconian",
|
||||||
|
48, 49, 72,
|
||||||
|
[97,98,99,100,101,102,103,104,105,106,107,108,109,110,111,112,113,114,115,116,117,118,119,120,121,122],
|
||||||
|
[1,2,3,4,5,6,7,8,9,9,10,20,30,40,50,60,70,80,90,100,200,200,300,400,500,600],
|
||||||
|
true, false, false
|
||||||
|
),
|
||||||
|
new cipher(
|
||||||
|
"Bacon R Standard",
|
||||||
|
"Baconian",
|
||||||
|
50, 78, 63,
|
||||||
|
[122,121,120,119,118,117,116,115,114,113,112,111,110,109,108,107,106,105,104,103,102,101,100,99,98,97],
|
||||||
|
[1,2,3,4,5,5,6,7,8,9,10,20,30,40,50,60,70,70,80,90,100,200,300,400,500,600],
|
||||||
|
true, false, false
|
||||||
|
),
|
||||||
];
|
];
|
||||||
+80
-15
@@ -3,13 +3,14 @@
|
|||||||
function queryDatabase() {
|
function queryDatabase() {
|
||||||
var cVal
|
var cVal
|
||||||
if(sVal() == "") return // empty input
|
if(sVal() == "") return // empty input
|
||||||
|
lastQueryPhrase = sVal() // remember what this box is showing, so a later cipher toggle can refresh it
|
||||||
|
|
||||||
if (liveDatabaseMode == true) calcLiveDatabase(userDBlive) // calculate gematria for live database for enabled ciphers
|
if (liveDatabaseMode == true) calcLiveDatabase(userDBlive) // calculate gematria for live database for enabled ciphers
|
||||||
|
|
||||||
$("#calcMain").addClass("splitInterface") // split screen
|
$("#calcMain").addClass("splitInterface") // split screen
|
||||||
|
|
||||||
if (document.getElementById("queryArea") == null) { // create div if it doesn't exist
|
if (document.getElementById("queryArea") == null) { // create div if it doesn't exist
|
||||||
var o = '<div id="queryArea"></div>'
|
var o = '<div id="queryArea" tabindex="-1"></div>'
|
||||||
$(o).appendTo('body');
|
$(o).appendTo('body');
|
||||||
}
|
}
|
||||||
// Position modal below the enabled cipher table (the Ordinal/Reduction values box)
|
// Position modal below the enabled cipher table (the Ordinal/Reduction values box)
|
||||||
@@ -67,6 +68,37 @@ function queryDatabase() {
|
|||||||
/*var o = 'min-width:'+tWidth+';width:'+tWidth+';'
|
/*var o = 'min-width:'+tWidth+';width:'+tWidth+';'
|
||||||
$("#queryArea").attr("style", o) // set minimal/initial width for the table*/
|
$("#queryArea").attr("style", o) // set minimal/initial width for the table*/
|
||||||
updateDatabaseQueryTable(0, dbPageItems)
|
updateDatabaseQueryTable(0, dbPageItems)
|
||||||
|
|
||||||
|
// Progressive loading: surface the spinner ONLY when this query is waiting on "…" cells
|
||||||
|
// (a non-lite cipher enabled before the full db finished streaming); hide it otherwise.
|
||||||
|
var _ind = document.getElementById("dbLoadIndicator")
|
||||||
|
if (_ind) {
|
||||||
|
if (!fullDBLoaded && queryHadUnloadedCipher) { _ind.title = "loading all cyphers…"; _ind.style.display = "inline" }
|
||||||
|
else { _ind.style.display = "none" }
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
var _refreshingQuery = false // reentrancy guard: updateTables -> refreshOpenQuery -> queryDatabase must not recurse
|
||||||
|
function refreshOpenQuery() {
|
||||||
|
// Called after any cipher-set change (updateTables). If a matches box is open and maximized,
|
||||||
|
// re-run the SAME query so a newly enabled cipher adds its column (and re-ranks) with no
|
||||||
|
// resubmit — and a newly disabled cipher drops its column. No-op when no box is open.
|
||||||
|
if (_refreshingQuery) return
|
||||||
|
var qa = document.getElementById("queryArea")
|
||||||
|
if (qa === null || $("#queryArea").hasClass("minimizeQuery")) return // only when open + not minimized
|
||||||
|
if (lastQueryPhrase === "") return
|
||||||
|
var box = document.getElementById("phraseBox")
|
||||||
|
var savedInput = box.value // preserve whatever the user may be typing now
|
||||||
|
var savedFilter = searchBarValue // preserve the find-in-results filter
|
||||||
|
_refreshingQuery = true
|
||||||
|
try {
|
||||||
|
box.value = lastQueryPhrase // queryDatabase reads sVal(); point it at the open box's phrase
|
||||||
|
queryDatabase() // rebuilds the table for the current enabled-cipher set
|
||||||
|
} finally {
|
||||||
|
box.value = savedInput // restore silently (direct assignment fires no input event)
|
||||||
|
_refreshingQuery = false
|
||||||
|
}
|
||||||
|
if (savedFilter) searchBarDBQuery(savedFilter) // re-apply the filter over the fresh matches
|
||||||
}
|
}
|
||||||
|
|
||||||
function clearDatabaseQueryTable() {
|
function clearDatabaseQueryTable() {
|
||||||
@@ -96,6 +128,7 @@ function searchDBcrossCipher() { // populate "queryResult" array with matching p
|
|||||||
for (p = 0; p < userDB.length; p++) { // for each phrase in database
|
for (p = 0; p < userDB.length; p++) { // for each phrase in database
|
||||||
tmpArr = [0, userDB[p][0]] // reset, set score[0], phrase[1]
|
tmpArr = [0, userDB[p][0]] // reset, set score[0], phrase[1]
|
||||||
for (m = 0; m < gemArrCiphUsed.length; m++) { // for each enabled cipher index
|
for (m = 0; m < gemArrCiphUsed.length; m++) { // for each enabled cipher index
|
||||||
|
if (gemArrCiphUsed[m] === -1) { tmpArr.push(null); continue } // cipher not in current db (not yet loaded) — show "—", no score
|
||||||
tmpVal = Number(userDB[p][gemArrCiphUsed[m]+1]) // value for that phrase (+1 because [0] contains phrase), string to number
|
tmpVal = Number(userDB[p][gemArrCiphUsed[m]+1]) // value for that phrase (+1 because [0] contains phrase), string to number
|
||||||
tmpArr.push(tmpVal) // first add values irrelevant of match validity
|
tmpArr.push(tmpVal) // first add values irrelevant of match validity
|
||||||
for (n = 0; n < gemArr.length; n++) { // for each gematria value (cross cipher)
|
for (n = 0; n < gemArr.length; n++) { // for each gematria value (cross cipher)
|
||||||
@@ -142,6 +175,7 @@ function searchDBsameCipher() { // populate "queryResult" array with matching ph
|
|||||||
for (p = 0; p < userDB.length; p++) { // for each phrase in database
|
for (p = 0; p < userDB.length; p++) { // for each phrase in database
|
||||||
tmpArr = [0, userDB[p][0]] // reset, set score[0], phrase[1]
|
tmpArr = [0, userDB[p][0]] // reset, set score[0], phrase[1]
|
||||||
for (m = 0; m < gemArrCiphUsed.length; m++) { // for each enabled cipher index
|
for (m = 0; m < gemArrCiphUsed.length; m++) { // for each enabled cipher index
|
||||||
|
if (gemArrCiphUsed[m] === -1) { tmpArr.push(null); continue } // cipher not in current db (not yet loaded) — show "—", no score
|
||||||
tmpVal = Number(userDB[p][gemArrCiphUsed[m]+1]) // value for that phrase (+1 because [0] contains phrase), string to number
|
tmpVal = Number(userDB[p][gemArrCiphUsed[m]+1]) // value for that phrase (+1 because [0] contains phrase), string to number
|
||||||
tmpArr.push(tmpVal) // first add values irrelevant of match validity
|
tmpArr.push(tmpVal) // first add values irrelevant of match validity
|
||||||
if (tmpVal == gemArr[m]) {
|
if (tmpVal == gemArr[m]) {
|
||||||
@@ -215,7 +249,7 @@ function updateDatabaseQueryTable(stPos = 0, dItems, scrollBarEvent = false) { /
|
|||||||
ms += '<div id="queryMinBtn">_</div>'
|
ms += '<div id="queryMinBtn">_</div>'
|
||||||
ms += '</div>'
|
ms += '</div>'
|
||||||
ms += '<input type="range" min="0" max="'+sliderMax+'" value="'+curSliderPos+'" class="qSlider" id="queryScrollbar">' // slider/scrollbar
|
ms += '<input type="range" min="0" max="'+sliderMax+'" value="'+curSliderPos+'" class="qSlider" id="queryScrollbar">' // slider/scrollbar
|
||||||
ms += '<input id="querySearchInput" type="text" spellcheck="false" autocomplete="off" value="'+searchBarValue+'" placeholder="Find...">' // search bar
|
ms += '<input id="querySearchInput" type="text" spellcheck="false" autocomplete="off" value="'+escHtml(searchBarValue)+'" placeholder="Find...">' // search bar
|
||||||
ms += '<table id="QueryTable" class="HistoryTable" data-startpos='+stPos+' data-dispitems='+dItems+'>'
|
ms += '<table id="QueryTable" class="HistoryTable" data-startpos='+stPos+' data-dispitems='+dItems+'>'
|
||||||
ms += '<tbody>'
|
ms += '<tbody>'
|
||||||
} else { // scrollbar used
|
} else { // scrollbar used
|
||||||
@@ -249,7 +283,7 @@ function updateDatabaseQueryTable(stPos = 0, dItems, scrollBarEvent = false) { /
|
|||||||
curCiphCol = (optColoredCiphers) ? 'hsl('+curCiph.H+' '+curCiph.S+'% '+curCiph.L+'% / 1)' : ''
|
curCiphCol = (optColoredCiphers) ? 'hsl('+curCiph.H+' '+curCiph.S+'% '+curCiph.L+'% / 1)' : ''
|
||||||
// ms += '<td class="hCVQ"><span class="hCV2" style="color: '+curCiphCol+'">'+curCiph.cipherName.replace(/ /g, "<br>")+'</span></td>' // color of cipher displayed in the table
|
// ms += '<td class="hCVQ"><span class="hCV2" style="color: '+curCiphCol+'">'+curCiph.cipherName.replace(/ /g, "<br>")+'</span></td>' // color of cipher displayed in the table
|
||||||
ms += '<td class="hCVQ" style="height: '+calcCipherNameHeightPx(curCiph.cipherName)+'px;"><span class="hCV2" style="color: '+curCiphCol+'">'
|
ms += '<td class="hCVQ" style="height: '+calcCipherNameHeightPx(curCiph.cipherName)+'px;"><span class="hCV2" style="color: '+curCiphCol+'">'
|
||||||
ms += curCiph.cipherName+'</span></td>' // color of cipher displayed in the table
|
ms += escHtml(curCiph.cipherName)+'</span></td>' // color of cipher displayed in the table
|
||||||
}
|
}
|
||||||
ms += "</tr>"
|
ms += "</tr>"
|
||||||
curPos += dbPageItems
|
curPos += dbPageItems
|
||||||
@@ -262,12 +296,12 @@ function updateDatabaseQueryTable(stPos = 0, dItems, scrollBarEvent = false) { /
|
|||||||
tmpComment = commentMatch[0]
|
tmpComment = commentMatch[0]
|
||||||
}
|
}
|
||||||
// comment first, phrase without comment and leading/trailing spaces
|
// comment first, phrase without comment and leading/trailing spaces
|
||||||
dispPhrase = (encodingMenuOpened) ? '<span class="pCHT">'+tmpComment+'</span>' + queryResult[x].replace(/\[.+\]/g, '').trim() : '<span class="pCHT">'+tmpComment+'</span>' + queryResult[x][1].replace(/\[.+\]/g, '').trim()
|
dispPhrase = (encodingMenuOpened) ? '<span class="pCHT">'+escHtml(tmpComment)+'</span>' + escHtml(queryResult[x].replace(/\[.+\]/g, '').trim()) : '<span class="pCHT">'+escHtml(tmpComment)+'</span>' + escHtml(queryResult[x][1].replace(/\[.+\]/g, '').trim())
|
||||||
} else {
|
} else {
|
||||||
dispPhrase = (encodingMenuOpened) ? queryResult[x] : queryResult[x][1]
|
dispPhrase = (encodingMenuOpened) ? escHtml(queryResult[x]) : escHtml(queryResult[x][1])
|
||||||
}
|
}
|
||||||
var fullPhrase = (encodingMenuOpened) ? queryResult[x] : queryResult[x][1]
|
var fullPhrase = (encodingMenuOpened) ? queryResult[x] : queryResult[x][1]
|
||||||
ms += '<tr><td class="hPQ" data-ind="'+x+'" title="'+fullPhrase.replace(/"/g, '"')+'">' + dispPhrase + '</td>' // phrase at index 1
|
ms += '<tr><td class="hPQ" data-ind="'+x+'" title="'+escHtml(fullPhrase)+'">' + dispPhrase + '</td>' // phrase at index 1 (title + body both escaped)
|
||||||
|
|
||||||
valPos = 2 // reset position for new phrase
|
valPos = 2 // reset position for new phrase
|
||||||
for (y = 0; y < gemArrCiph.length; y++) { // gemArrCiph contains indices of ciphers used for query
|
for (y = 0; y < gemArrCiph.length; y++) { // gemArrCiph contains indices of ciphers used for query
|
||||||
@@ -282,6 +316,11 @@ function updateDatabaseQueryTable(stPos = 0, dItems, scrollBarEvent = false) { /
|
|||||||
// if (gemVal == 0) gemVal = "-"
|
// if (gemVal == 0) gemVal = "-"
|
||||||
valPos++ // increment value position
|
valPos++ // increment value position
|
||||||
|
|
||||||
|
if (gemVal === null) { // cipher not in the current db yet (precompute still streaming) — placeholder
|
||||||
|
ms += '<td class="tCQ"><span class="gVQ" title="loading full cipher set…" style="color: hsl(0 0% 50% / '+alphaHlt+')"> … </span></td>'
|
||||||
|
continue
|
||||||
|
}
|
||||||
|
|
||||||
// mSame - same cipher match, mCross - cross cipher match
|
// 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 ( 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}
|
if (gemArr.indexOf(gemVal) > -1) {mCross = true} else {mCross = false}
|
||||||
@@ -305,9 +344,9 @@ function updateDatabaseQueryTable(stPos = 0, dItems, scrollBarEvent = false) { /
|
|||||||
} else {
|
} else {
|
||||||
document.getElementById("queryArea").innerHTML = ms
|
document.getElementById("queryArea").innerHTML = ms
|
||||||
}
|
}
|
||||||
if (navigator.maxTouchPoints <= 1 && !scrollBarEvent) { // ignore scrollbar event
|
if (navigator.maxTouchPoints <= 1 && !scrollBarEvent) { // desktop: focus the modal so arrow keys navigate it (B+); typing snaps back to the phrase box
|
||||||
// Return focus to main phrase box so user can immediately type next query
|
var _qa = document.getElementById("queryArea")
|
||||||
document.getElementById("phraseBox").focus()
|
if (_qa) _qa.focus()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -335,7 +374,7 @@ function queryShowPrevPage() {
|
|||||||
n = $("#QueryTable").data("dispitems")
|
n = $("#QueryTable").data("dispitems")
|
||||||
$("#queryArea").html() // clear previous table
|
$("#queryArea").html() // clear previous table
|
||||||
updateDatabaseQueryTable(st, n) // redraw table at new position
|
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() {
|
function queryShowNextPage() {
|
||||||
@@ -348,7 +387,7 @@ function queryShowNextPage() {
|
|||||||
n = $("#QueryTable").data("dispitems")
|
n = $("#QueryTable").data("dispitems")
|
||||||
$("#queryArea").html() // clear previous table
|
$("#queryArea").html() // clear previous table
|
||||||
updateDatabaseQueryTable(st, n) // redraw table at new position
|
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() {
|
function unloadDatabase() {
|
||||||
@@ -437,15 +476,41 @@ function loadPrecomputedDB(data) {
|
|||||||
displayCalcNotification(loadedMsg, 2500)
|
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() {
|
function getPrecomputedCipherPositions() {
|
||||||
// Map enabled cipher names to their column indices in db.json
|
// Map each ENABLED cipher (in cipherList order = gemArr order) to its column index
|
||||||
// Returns 0-based indices into cipher_order (NOT +1 adjusted)
|
// in the loaded db.json cipher_order. Returns -1 for a cipher not in the current db
|
||||||
// because searchDBcrossCipher/sameCipher already add +1 when accessing userDB
|
// (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 = []
|
var positions = []
|
||||||
|
queryHadUnloadedCipher = false
|
||||||
for (var i = 0; i < cipherList.length; i++) {
|
for (var i = 0; i < cipherList.length; i++) {
|
||||||
if (cipherList[i].enabled) {
|
if (cipherList[i].enabled) {
|
||||||
var pos = cipherOrder.indexOf(cipherList[i].cipherName)
|
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
|
return positions
|
||||||
|
|||||||
+1
-1
@@ -44,7 +44,7 @@ function toggleEncodingMenu(updateEncMenu = false, clearValues = false) {
|
|||||||
if (cipherList[i].enabled == true) { // for each enabled cipher
|
if (cipherList[i].enabled == true) { // for each enabled cipher
|
||||||
chkVal = (document.getElementById('encCiphVal'+i) !== null) ? document.getElementById('encCiphVal'+i).value : 0
|
chkVal = (document.getElementById('encCiphVal'+i) !== null) ? document.getElementById('encCiphVal'+i).value : 0
|
||||||
chkVal = (clearValues) ? 0 : chkVal // clear values
|
chkVal = (clearValues) ? 0 : chkVal // clear values
|
||||||
o += '<td><span class="ciphCheckboxLabel">'+cipherList[i].cipherName+'</span></td>'
|
o += '<td><span class="ciphCheckboxLabel">'+escHtml(cipherList[i].cipherName)+'</span></td>'
|
||||||
o += '<td><input type="text" value="'+chkVal+'" class="colSlider" id="encCiphVal'+i+'"></td>'
|
o += '<td><input type="text" value="'+chkVal+'" class="colSlider" id="encCiphVal'+i+'"></td>'
|
||||||
o += '<td style="min-width: 16px;"></td>'
|
o += '<td style="min-width: 16px;"></td>'
|
||||||
ciph_in_row++
|
ciph_in_row++
|
||||||
|
|||||||
+20
-6
@@ -98,10 +98,13 @@ function importFileAction(file, hasLocalFile) {
|
|||||||
file = ciph[0].replace(/(\t| +|\r|\n)/g, "").slice(10,-1) // remove tabs, consequtive spaces, line breaks - "new cipher" at start, last bracket
|
file = ciph[0].replace(/(\t| +|\r|\n)/g, "").slice(10,-1) // remove tabs, consequtive spaces, line breaks - "new cipher" at start, last bracket
|
||||||
ciph = file.split(",new cipher") // split string into array
|
ciph = file.split(",new cipher") // split string into array
|
||||||
|
|
||||||
cipherList = []; cCat = []; defaultCipherArray = [] // clear arrays with previously defined ciphers, categories, default ciphers
|
var imported = [] // parse every cipher first — one malformed entry aborts the import and keeps the current ciphers
|
||||||
for (n = 0; n < ciph.length; n++) {
|
for (n = 0; n < ciph.length; n++) {
|
||||||
cipherList.push(eval("new cipher("+ciph[n].slice(1,-1)+")")) // remove parethesis, evaluate string as javascript code
|
var c = cipherFromExport(ciph[n].slice(1,-1)) // remove parentheses; parsed as data, never eval'd
|
||||||
|
if (c === null) { displayCalcNotification("Cipher import failed: malformed cipher #"+(n+1), 3000); return }
|
||||||
|
imported.push(c)
|
||||||
}
|
}
|
||||||
|
cipherList = imported; cCat = []; defaultCipherArray = [] // replace previously defined ciphers, categories, default ciphers
|
||||||
document.getElementById("calcOptionsPanel").innerHTML = "" // clear menu panel
|
document.getElementById("calcOptionsPanel").innerHTML = "" // clear menu panel
|
||||||
|
|
||||||
initCalc() // reinit.
|
initCalc() // reinit.
|
||||||
@@ -148,10 +151,13 @@ function importFileAction(file, hasLocalFile) {
|
|||||||
file = ciph[0].replace(/(\t| +|\r|\n)/g, "").slice(10,-1) // remove tabs, consequtive spaces, line breaks - "new cipher" at start, last bracket
|
file = ciph[0].replace(/(\t| +|\r|\n)/g, "").slice(10,-1) // remove tabs, consequtive spaces, line breaks - "new cipher" at start, last bracket
|
||||||
ciph = file.split(",new cipher") // split string into array
|
ciph = file.split(",new cipher") // split string into array
|
||||||
|
|
||||||
cipherList = []; cCat = []; defaultCipherArray = [] // clear arrays with previously defined ciphers, categories, default ciphers
|
var imported = [] // parse every cipher first — one malformed entry aborts the import and keeps the current ciphers
|
||||||
for (n = 0; n < ciph.length; n++) {
|
for (n = 0; n < ciph.length; n++) {
|
||||||
cipherList.push(eval("new cipher("+ciph[n].slice(1,-1)+")")) // remove parethesis, evaluate string as javascript code
|
var c = cipherFromExport(ciph[n].slice(1,-1)) // remove parentheses; parsed as data, never eval'd
|
||||||
|
if (c === null) { displayCalcNotification("Cipher import failed: malformed cipher #"+(n+1), 3000); return }
|
||||||
|
imported.push(c)
|
||||||
}
|
}
|
||||||
|
cipherList = imported; cCat = []; defaultCipherArray = [] // replace previously defined ciphers, categories, default ciphers
|
||||||
document.getElementById("calcOptionsPanel").innerHTML = "" // clear menu panel
|
document.getElementById("calcOptionsPanel").innerHTML = "" // clear menu panel
|
||||||
initCalc() // reinit
|
initCalc() // reinit
|
||||||
updateTables() // update tables
|
updateTables() // update tables
|
||||||
@@ -240,9 +246,17 @@ function isJsonString(str) {
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
function importCalcOptions(calcOpt) { // load user options
|
function importCalcOptions(calcOpt) { // load user options: "name = value" strings; names must be in calcOptionsArr, values are JSON scalars — parsed, never eval'd
|
||||||
if (typeof calcOpt !== 'undefined' && calcOpt !== null) {
|
if (typeof calcOpt !== 'undefined' && calcOpt !== null) {
|
||||||
for (var i = 0; i < calcOpt.length; i++) eval(calcOpt[i])
|
for (var i = 0; i < calcOpt.length; i++) {
|
||||||
|
if (typeof calcOpt[i] !== "string") continue
|
||||||
|
var m = calcOpt[i].match(/^\s*([A-Za-z_][A-Za-z0-9_]*)\s*=\s*([\s\S]+?)\s*$/)
|
||||||
|
if (m === null || calcOptionsArr.indexOf(m[1]) === -1) continue // unknown option name → ignored
|
||||||
|
var v
|
||||||
|
try { v = JSON.parse(m[2]) } catch (e) { continue } // not a JSON scalar → ignored
|
||||||
|
if (typeof v !== "boolean" && typeof v !== "number" && typeof v !== "string") continue
|
||||||
|
window[m[1]] = v // the option globals are top-level `var`s, i.e. window properties
|
||||||
|
}
|
||||||
}
|
}
|
||||||
toggleCodeRain() // update coderain
|
toggleCodeRain() // update coderain
|
||||||
}
|
}
|
||||||
|
|||||||
+2
-2
@@ -241,10 +241,10 @@ function exportCiphersDB(expAllCiph = false) {
|
|||||||
return out
|
return out
|
||||||
}
|
}
|
||||||
|
|
||||||
function exportCalcOptions() {
|
function exportCalcOptions() { // one JSON string per option: "name = value" (same text as before for booleans/numbers); values read by name, never eval'd
|
||||||
var o = "calcOptions = [\n\t"
|
var o = "calcOptions = [\n\t"
|
||||||
for (var i = 0; i < calcOptionsArr.length; i++) {
|
for (var i = 0; i < calcOptionsArr.length; i++) {
|
||||||
o += "\x22"+eval(calcOptionsArr[i])+"\x22,\n\t" // quotes - \x22
|
o += JSON.stringify(calcOptionsArr[i]+" = "+JSON.stringify(window[calcOptionsArr[i]]))+",\n\t"
|
||||||
}
|
}
|
||||||
o = o.slice(0,-3) + "\n]\n" // remove comma, new line, tab; new line, close array, new line
|
o = o.slice(0,-3) + "\n]\n" // remove comma, new line, tab; new line, close array, new line
|
||||||
return o
|
return o
|
||||||
|
|||||||
+26
-1
@@ -216,4 +216,29 @@ class cipher { // cipher constructor class
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
// ================= Cipher import (parsed, never eval'd) =================
|
||||||
|
// Exported cipher files (exportCiphers / exportCiphersDB), the localStorage settings copy and
|
||||||
|
// pasted "// ciphers.js" files carry each cipher as `new cipher(<args>)`. The <args> text is
|
||||||
|
// JSON-compatible by construction of the exporter: "name","category",H,S,L,[charcodes],[values],
|
||||||
|
// diacriticsAsRegular,enabled,caseSensitive. It used to be eval()'d — imported files and the
|
||||||
|
// localStorage copy (which any XSS could have written) could execute code. Now it is parsed and
|
||||||
|
// shape-checked; anything that is not exactly a cipher argument list is rejected (null).
|
||||||
|
function parseCipherArgs(argStr) {
|
||||||
|
var args
|
||||||
|
try { args = JSON.parse("[" + argStr + "]") } catch (e) { return null }
|
||||||
|
if (!Array.isArray(args) || args.length < 7 || args.length > 10) return null
|
||||||
|
var isIntArr = function (a) { return Array.isArray(a) && a.every(function (x) { return Number.isInteger(x) }) }
|
||||||
|
var isBoolOrAbsent = function (b) { return b === undefined || typeof b === "boolean" }
|
||||||
|
if (typeof args[0] !== "string" || typeof args[1] !== "string") return null // name, category
|
||||||
|
if (![2, 3, 4].every(function (i) { return typeof args[i] === "number" && isFinite(args[i]) })) return null // H, S, L
|
||||||
|
if (!isIntArr(args[5]) || !isIntArr(args[6]) || args[5].length !== args[6].length) return null // charcodes, values
|
||||||
|
if (![7, 8, 9].every(function (i) { return isBoolOrAbsent(args[i]) })) return null // flags (constructor defaults apply when absent)
|
||||||
|
return args
|
||||||
|
}
|
||||||
|
|
||||||
|
function cipherFromExport(argStr) { // → a cipher, or null when the text is not a well-formed cipher argument list
|
||||||
|
var a = parseCipherArgs(argStr)
|
||||||
|
if (a === null) return null
|
||||||
|
return new cipher(a[0], a[1], a[2], a[3], a[4], a[5], a[6], a[7], a[8], a[9])
|
||||||
|
}
|
||||||
+3
-3
@@ -266,7 +266,7 @@ function updateHistoryTableSameCiphMatch() {
|
|||||||
if (highlt_num.indexOf(v_grid_col[n][m]) > -1) { // if value is in highlight box
|
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
|
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 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[m][n] = true // mark both as values to be highlighted
|
||||||
hltBoolArr[z][n] = true // [phrase][cipher]
|
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 = JSON.stringify(highlt_num).replace(/,/g, " ") // to string
|
||||||
hlt_val = hlt_val.substring(1, hlt_val.length-1) // remove brackets
|
hlt_val = hlt_val.substring(1, hlt_val.length-1) // remove brackets
|
||||||
document.getElementById("highlightBox").value = hlt_val // update values inside textbox
|
document.getElementById("highlightBox").value = hlt_val // update values inside textbox
|
||||||
if (optFiltCrossCipherMatch) { updateHistoryTable(); } else { updateHistoryTableSameCiphMatch(); }
|
if (!optHltSameCipher) { updateHistoryTable(); } else { updateHistoryTableSameCiphMatch(); }
|
||||||
return
|
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 += " " // append space if necessary
|
||||||
}
|
}
|
||||||
document.getElementById("highlightBox").value += val // append clicked value to Highlight textbox
|
document.getElementById("highlightBox").value += val // append clicked value to Highlight textbox
|
||||||
if (optFiltCrossCipherMatch) { updateHistoryTable(); } else { updateHistoryTableSameCiphMatch(); }
|
if (!optHltSameCipher) { updateHistoryTable(); } else { updateHistoryTableSameCiphMatch(); }
|
||||||
};
|
};
|
||||||
+21
-3
@@ -1,7 +1,7 @@
|
|||||||
// ==================================================================
|
// ==================================================================
|
||||||
// breakdown.js
|
// 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 bgCol = "var(--breakdown-bg-accent)" // breakdown table background color
|
||||||
var chLimit = 30 // character limit, used to switch to a long breakdown style
|
var chLimit = 30 // character limit, used to switch to a long breakdown style
|
||||||
var maxRowWidth = 36 // one row character limit (long breakdown)
|
var maxRowWidth = 36 // one row character limit (long breakdown)
|
||||||
@@ -38,6 +38,7 @@ var numericalMode // boolean flag, match numbers instead of phrase gematria
|
|||||||
var userDB = [] // imported database
|
var userDB = [] // imported database
|
||||||
var userDBlive = [] // imported live database (phrases only)
|
var userDBlive = [] // imported live database (phrases only)
|
||||||
var queryResult = [] // matching phrases
|
var queryResult = [] // matching phrases
|
||||||
|
var lastQueryPhrase = '' // the phrase that produced the OPEN matches box, so a cipher toggle can refresh it in place
|
||||||
var queryResultInitial = [] // matching phrases (used to reset search bar results)
|
var queryResultInitial = [] // matching phrases (used to reset search bar results)
|
||||||
var precalcDBLoaded = false // if precalculated database is loaded, disable cipher rearrangement
|
var precalcDBLoaded = false // if precalculated database is loaded, disable cipher rearrangement
|
||||||
var searchBarValue = '' // search bar value
|
var searchBarValue = '' // search bar value
|
||||||
@@ -134,6 +135,23 @@ $(document).ready(function(){
|
|||||||
$("body").on("click", "#queryArea.minimizeQuery", function (e) {
|
$("body").on("click", "#queryArea.minimizeQuery", function (e) {
|
||||||
toggleQueryMinimize();
|
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 })); }
|
||||||
|
}
|
||||||
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
// ==================================================================
|
// ==================================================================
|
||||||
@@ -477,7 +495,7 @@ $(document).ready(function(){
|
|||||||
autoHistoryTableLayout();
|
autoHistoryTableLayout();
|
||||||
updateHistoryTable();
|
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)
|
$("body").on("click", "td.hC", function () { // Cipher Name in history table (normal mode)
|
||||||
@@ -551,7 +569,7 @@ $(document).ready(function(){
|
|||||||
$("body").on("click", ".tC", function (e) { // tC - history table cell
|
$("body").on("click", ".tC", function (e) { // tC - history table cell
|
||||||
//console.log($(this).find(".gV").html()); // inner html of .gV found in "this"
|
//console.log($(this).find(".gV").html()); // inner html of .gV found in "this"
|
||||||
var val = $(this).find(".gV").html(); // get gematria value from element
|
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
|
tdToggleHighlight(parseInt(val.trim(), 10)); // remove spaces, parse as integer and add (remove) to highlight box
|
||||||
} else { // Left Click only - temporary blinking effect
|
} else { // Left Click only - temporary blinking effect
|
||||||
$( "table.HistoryTable td.tC > span:contains('"+val+"')" ).toggleClass('highlightValueBlink'); // add blinking effect
|
$( "table.HistoryTable td.tC > span:contains('"+val+"')" ).toggleClass('highlightValueBlink'); // add blinking effect
|
||||||
|
|||||||
@@ -32,10 +32,13 @@ function restoreCalcSettingsLocalStorage(silentMode = false) {
|
|||||||
file = ciph[0].replace(/(\t| +|\r|\n)/g, "").slice(10,-1) // remove tabs, consequtive spaces, line breaks - "new cipher" at start, last bracket
|
file = ciph[0].replace(/(\t| +|\r|\n)/g, "").slice(10,-1) // remove tabs, consequtive spaces, line breaks - "new cipher" at start, last bracket
|
||||||
ciph = file.split(",new cipher") // split string into array
|
ciph = file.split(",new cipher") // split string into array
|
||||||
|
|
||||||
cipherList = []; cCat = []; defaultCipherArray = [] // clear arrays with previously defined ciphers, categories, default ciphers
|
var imported = [] // parse every cipher first — one malformed entry aborts the import and keeps the current ciphers
|
||||||
for (n = 0; n < ciph.length; n++) {
|
for (n = 0; n < ciph.length; n++) {
|
||||||
cipherList.push(eval("new cipher("+ciph[n].slice(1,-1)+")")) // remove parethesis, evaluate string as javascript code
|
var c = cipherFromExport(ciph[n].slice(1,-1)) // remove parentheses; parsed as data, never eval'd
|
||||||
|
if (c === null) { displayCalcNotification("Cipher import failed: malformed cipher #"+(n+1), 3000); return }
|
||||||
|
imported.push(c)
|
||||||
}
|
}
|
||||||
|
cipherList = imported; cCat = []; defaultCipherArray = [] // replace previously defined ciphers, categories, default ciphers
|
||||||
document.getElementById("calcOptionsPanel").innerHTML = "" // clear menu panel
|
document.getElementById("calcOptionsPanel").innerHTML = "" // clear menu panel
|
||||||
initCalc() // reinit
|
initCalc() // reinit
|
||||||
updateTables() // update tables
|
updateTables() // update tables
|
||||||
|
|||||||
+45
-2
@@ -962,6 +962,24 @@ body {
|
|||||||
background-color: var(--btn-bg-accent);
|
background-color: var(--btn-bg-accent);
|
||||||
/*background-color: transparent;*/
|
/*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) {
|
@media (max-width: 911px) {
|
||||||
/* mobile */
|
/* mobile */
|
||||||
#queryDBbtn {
|
#queryDBbtn {
|
||||||
@@ -1000,9 +1018,16 @@ body {
|
|||||||
}
|
}
|
||||||
#queryDBbtn {
|
#queryDBbtn {
|
||||||
background-color: var(--input-bg-accent);
|
background-color: var(--input-bg-accent);
|
||||||
padding: 0em;
|
/* "\1F52E Query" was left-biased: the value is ~70px in a fixed 75px button, so text-align:center
|
||||||
|
left a right-hand gap that read as extra left padding. Hug the content with symmetric horizontal
|
||||||
|
padding (width:auto) so the orb and label sit centered with equal space either side. Verified
|
||||||
|
headless (q2-D). box-sizing keeps the 1px border out of the width math. */
|
||||||
|
box-sizing: border-box;
|
||||||
|
width: auto;
|
||||||
|
min-width: 75px;
|
||||||
|
padding: 0 0.6em;
|
||||||
margin: 0em 0.3em;
|
margin: 0em 0.3em;
|
||||||
width: 75px;
|
text-align: center;
|
||||||
}
|
}
|
||||||
#enterPhraseBtn,
|
#enterPhraseBtn,
|
||||||
#autoMatchBtn {
|
#autoMatchBtn {
|
||||||
@@ -1016,6 +1041,21 @@ body {
|
|||||||
#autoMatchBtn.matchOff {
|
#autoMatchBtn.matchOff {
|
||||||
opacity: 0.35;
|
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 {
|
#calcNotification {
|
||||||
position: absolute;
|
position: absolute;
|
||||||
left: 50%;
|
left: 50%;
|
||||||
@@ -1038,6 +1078,7 @@ body {
|
|||||||
#queryDBbtn:hover,
|
#queryDBbtn:hover,
|
||||||
#enterPhraseBtn:hover,
|
#enterPhraseBtn:hover,
|
||||||
#autoMatchBtn:hover,
|
#autoMatchBtn:hover,
|
||||||
|
#hltModeBtn:hover,
|
||||||
.queryPageBtn:hover {
|
.queryPageBtn:hover {
|
||||||
background-color: var(--btn-hover-accent);
|
background-color: var(--btn-hover-accent);
|
||||||
}
|
}
|
||||||
@@ -1049,6 +1090,7 @@ body {
|
|||||||
#queryDBbtn:active,
|
#queryDBbtn:active,
|
||||||
#enterPhraseBtn:active,
|
#enterPhraseBtn:active,
|
||||||
#autoMatchBtn:active,
|
#autoMatchBtn:active,
|
||||||
|
#hltModeBtn:active,
|
||||||
.queryPageBtn:active {
|
.queryPageBtn:active {
|
||||||
background-color: var(--btn-active-accent);
|
background-color: var(--btn-active-accent);
|
||||||
}
|
}
|
||||||
@@ -1574,6 +1616,7 @@ body {
|
|||||||
resize: horizontal;
|
resize: horizontal;
|
||||||
z-index: 100;
|
z-index: 100;
|
||||||
}
|
}
|
||||||
|
#queryArea:focus { outline: none; } /* focused for arrow-key nav (B+) — hide the focus ring */
|
||||||
@media (max-width: 911px) {
|
@media (max-width: 911px) {
|
||||||
/* mobile — center the modal */
|
/* mobile — center the modal */
|
||||||
#queryArea {
|
#queryArea {
|
||||||
|
|||||||
+14
-1
@@ -36,8 +36,10 @@ var CALC_CONFIG = {
|
|||||||
|
|
||||||
// --- Database ---
|
// --- Database ---
|
||||||
databaseMode: "auto", // "auto" tries db.json then db.txt | "json" | "txt"
|
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",
|
databaseTxtUrl: "db.txt",
|
||||||
|
databaseVersion: 2, // bump on each db.json regen -> cache-busts the db fetch (?v=N)
|
||||||
|
|
||||||
// --- Defaults ---
|
// --- Defaults ---
|
||||||
autoMatchDesktop: true,
|
autoMatchDesktop: true,
|
||||||
@@ -45,6 +47,17 @@ var CALC_CONFIG = {
|
|||||||
resultsPerPage: 12,
|
resultsPerPage: 12,
|
||||||
newPhrasesOnTop: true,
|
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: [],
|
||||||
|
|
||||||
|
// Optional "Curated" preset button — a one-click extended loadout. Empty/omitted => no
|
||||||
|
// button shown. Keep in sync with the lite db.json (tools/generate_db_json.py LITE_CIPHERS).
|
||||||
|
// Example: recommendedCiphers: ["Ordinal", "Reduction", "Alphanumeric Qabbala", ...],
|
||||||
|
recommendedCiphers: [],
|
||||||
|
|
||||||
// --- Custom Cipher Categories ---
|
// --- Custom Cipher Categories ---
|
||||||
// Group ciphers into custom menu sections. Ciphers are referenced by
|
// Group ciphers into custom menu sections. Ciphers are referenced by
|
||||||
// their exact name from ciphers.js. They still appear in their original
|
// their exact name from ciphers.js. They still appear in their original
|
||||||
|
|||||||
+47
-24
@@ -11,16 +11,16 @@
|
|||||||
<!-- Android Web App - Add to Home Screen -->
|
<!-- Android Web App - Add to Home Screen -->
|
||||||
<link rel="manifest" href="manifest.json" />
|
<link rel="manifest" href="manifest.json" />
|
||||||
|
|
||||||
<script src="config.js?v=3"></script>
|
<script src="config.js?v=11"></script>
|
||||||
<script src="lib/jquery.min.js?v=2"></script>
|
<script src="lib/jquery.min.js?v=2"></script>
|
||||||
<!-- html2canvas v1.0.0-alpha.12 -->
|
<!-- html2canvas v1.0.0-alpha.12 -->
|
||||||
|
|
||||||
<script src="calc/gematria.js?v=2"></script>
|
<script src="calc/gematria.js?v=3"></script>
|
||||||
<script src="calc/calc.js?v=2"></script>
|
<script src="calc/calc.js?v=17"></script>
|
||||||
<script src="calc/init-variables.js?v=3"></script>
|
<script src="calc/init-variables.js?v=8"></script>
|
||||||
<script src="calc/ciphers.js?v=3"></script>
|
<script src="calc/ciphers.js?v=6"></script>
|
||||||
|
|
||||||
<link rel="stylesheet" type="text/css" href="calc/styles.css?v=2" />
|
<link rel="stylesheet" type="text/css" href="calc/styles.css?v=10" />
|
||||||
|
|
||||||
<script>
|
<script>
|
||||||
window.onpaint = function () {
|
window.onpaint = function () {
|
||||||
@@ -121,6 +121,13 @@
|
|||||||
spellcheck="false"
|
spellcheck="false"
|
||||||
autocomplete="off"
|
autocomplete="off"
|
||||||
placeholder="highlight #s"
|
placeholder="highlight #s"
|
||||||
|
/><input
|
||||||
|
id="hltModeBtn"
|
||||||
|
class="hltModeOff"
|
||||||
|
type="button"
|
||||||
|
title="Highlight: any matches (every cell with the value) — click for same column matches"
|
||||||
|
value="▼"
|
||||||
|
onclick="toggleHltMode()"
|
||||||
/><span id="clearFilterButton"></span>
|
/><span id="clearFilterButton"></span>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
@@ -139,19 +146,19 @@
|
|||||||
|
|
||||||
<span id="loadPanel"></span>
|
<span id="loadPanel"></span>
|
||||||
|
|
||||||
<script src="calc/breakdown.js?v=2"></script>
|
<script src="calc/breakdown.js?v=4"></script>
|
||||||
|
|
||||||
<script src="calc/highlighter.js?v=2"></script>
|
<script src="calc/highlighter.js?v=3"></script>
|
||||||
<script src="calc/export.js?v=2"></script>
|
<script src="calc/export.js?v=3"></script>
|
||||||
<script src="calc/export-csv.js?v=2"></script>
|
<script src="calc/export-csv.js?v=3"></script>
|
||||||
<script src="calc/num-prop.js?v=2"></script>
|
<script src="calc/num-prop.js?v=2"></script>
|
||||||
<script src="calc/edit-ciphers.js?v=2"></script>
|
<script src="calc/edit-ciphers.js?v=2"></script>
|
||||||
<script src="calc/date-calc.js?v=2"></script>
|
<script src="calc/date-calc.js?v=2"></script>
|
||||||
<script src="calc/database.js?v=2"></script>
|
<script src="calc/database.js?v=9"></script>
|
||||||
<script src="calc/quick-guide.js?v=2"></script>
|
<script src="calc/quick-guide.js?v=2"></script>
|
||||||
|
|
||||||
<script src="calc/localstorage.js?v=2"></script>
|
<script src="calc/localstorage.js?v=3"></script>
|
||||||
<script src="calc/encoding.js?v=2"></script>
|
<script src="calc/encoding.js?v=3"></script>
|
||||||
<script src="calc/encoding-ciphers.js?v=2"></script>
|
<script src="calc/encoding-ciphers.js?v=2"></script>
|
||||||
|
|
||||||
<script src="calc/coderain.js?v=2"></script>
|
<script src="calc/coderain.js?v=2"></script>
|
||||||
@@ -175,12 +182,24 @@
|
|||||||
var _jsonUrl = _c.databaseJsonUrl || "db.json";
|
var _jsonUrl = _c.databaseJsonUrl || "db.json";
|
||||||
var _txtUrl = _c.databaseTxtUrl || "db.txt";
|
var _txtUrl = _c.databaseTxtUrl || "db.txt";
|
||||||
var _mode = _c.databaseMode || "auto";
|
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() {
|
function _dbLoaded() {
|
||||||
document.getElementById("dbLoadIndicator").style.display = "none";
|
document.getElementById("dbLoadIndicator").style.display = "none";
|
||||||
var amb = document.getElementById("autoMatchBtn");
|
var amb = document.getElementById("autoMatchBtn");
|
||||||
amb.classList.remove("hideValue");
|
amb.classList.remove("hideValue");
|
||||||
if (!autoMatchEnabled) amb.classList.add("matchOff");
|
if (!autoMatchEnabled) amb.classList.add("matchOff");
|
||||||
|
// Sync hltModeBtn to the (possibly restored from localStorage) optHltSameCipher value.
|
||||||
|
if (typeof syncHltModeBtn === "function") syncHltModeBtn();
|
||||||
|
}
|
||||||
|
|
||||||
|
// 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") {
|
if (_mode === "txt") {
|
||||||
@@ -188,17 +207,21 @@
|
|||||||
importFileAction(database, true);
|
importFileAction(database, true);
|
||||||
_dbLoaded();
|
_dbLoaded();
|
||||||
} else {
|
} else {
|
||||||
fetch(_jsonUrl)
|
// Progressive: lite first (fast first paint), then full in the background.
|
||||||
.then(function(r) {
|
fetch(_liteUrl + _dbVer)
|
||||||
if (!r.ok) throw new Error("db.json not found (" + r.status + ")");
|
.then(function(r) { if (!r.ok) throw new Error("lite " + r.status); return r.json(); })
|
||||||
return r.json();
|
.then(function(data) { loadPrecomputedDB(data); _dbLoaded(); _fetchFull(); })
|
||||||
})
|
.catch(function(liteErr) {
|
||||||
.then(function(data) { loadPrecomputedDB(data); _dbLoaded(); })
|
console.log("Lite DB unavailable, loading full directly:", liteErr.message);
|
||||||
.catch(function(err) {
|
fetch(_jsonUrl + _dbVer)
|
||||||
console.log("Pre-computed DB not available, using live mode:", err.message);
|
.then(function(r) { if (!r.ok) throw new Error("db.json not found (" + r.status + ")"); return r.json(); })
|
||||||
var database = loadFile(_txtUrl);
|
.then(function(data) { loadPrecomputedDB(data); _dbLoaded(); })
|
||||||
importFileAction(database, true);
|
.catch(function(err) {
|
||||||
_dbLoaded();
|
console.log("Pre-computed DB not available, using live mode:", err.message);
|
||||||
|
var database = loadFile(_txtUrl);
|
||||||
|
importFileAction(database, true);
|
||||||
|
_dbLoaded();
|
||||||
|
});
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
</script>
|
</script>
|
||||||
|
|||||||
+4
-4
@@ -4,13 +4,13 @@
|
|||||||
"background_color": "#202631",
|
"background_color": "#202631",
|
||||||
"icons": [
|
"icons": [
|
||||||
{
|
{
|
||||||
"src": "res/calc-logo-36.png",
|
"src": "res/calc-logo-32.png",
|
||||||
"sizes": "36x36",
|
"sizes": "32x32",
|
||||||
"type": "image/png",
|
"type": "image/png",
|
||||||
"density": 0.75
|
"density": 0.75
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"src": "res/calc-logo-36.png",
|
"src": "res/calc-logo-48.png",
|
||||||
"sizes": "48x48",
|
"sizes": "48x48",
|
||||||
"type": "image/png",
|
"type": "image/png",
|
||||||
"density": 1.0
|
"density": 1.0
|
||||||
@@ -42,4 +42,4 @@
|
|||||||
],
|
],
|
||||||
"start_url": "index.html",
|
"start_url": "index.html",
|
||||||
"display": "fullscreen"
|
"display": "fullscreen"
|
||||||
}
|
}
|
||||||
+2
-1
@@ -9,7 +9,8 @@ query), it can instead load a precomputed `db.json` containing all 69 cipher val
|
|||||||
`db.json` is a build artifact derived from `db.txt` + `calc/ciphers.js`. It is not committed
|
`db.json` is a build artifact derived from `db.txt` + `calc/ciphers.js`. It is not committed
|
||||||
to the repo (it's large). Two ways to get it:
|
to the repo (it's large). Two ways to get it:
|
||||||
|
|
||||||
1. **Download** the prebuilt `db.json` from the latest [GitHub Release](../../releases).
|
1. **Download** the prebuilt `db.json` from the latest
|
||||||
|
[GitHub Release](https://github.com/malonehunter/hyperdope-gematria/releases/latest).
|
||||||
Place it next to `index.html`.
|
Place it next to `index.html`.
|
||||||
2. **Regenerate** it yourself:
|
2. **Regenerate** it yourself:
|
||||||
|
|
||||||
|
|||||||
@@ -0,0 +1,324 @@
|
|||||||
|
#!/usr/bin/env python3
|
||||||
|
"""Classify gematria-db candidate entries: keep vs drop, with bucket + reason.
|
||||||
|
|
||||||
|
Calibrated against the NetVoid 2026 manual-curation cross-check, which exposed the
|
||||||
|
older dict-ratio / has-digit / camel-mash rules over-flagging modern proper nouns,
|
||||||
|
brands, acronyms, and event phrases like 'COVID-19 Policy' or 'Donald Trump 2024'.
|
||||||
|
|
||||||
|
This filter is intentionally permissive on real-world entries (anything with a
|
||||||
|
proper-noun signal, any dict word, any digit, OR reasonable structure) and only
|
||||||
|
hard-drops the patterns both independent curation passes (ours + NetVoid's) agreed
|
||||||
|
were junk.
|
||||||
|
|
||||||
|
Usage:
|
||||||
|
python3 classify_candidates.py <input.txt> [--out <decisions.jsonl>] [--keep-list <keeps.txt>]
|
||||||
|
|
||||||
|
Input: one entry per line. Header line is auto-detected and skipped if it starts
|
||||||
|
with "CREATE_GEMATRO" or "GEMATRO_DB;" (Derek CSV — first column taken).
|
||||||
|
|
||||||
|
Output: prints bucket summary to stdout. Optional --out emits one JSON per line.
|
||||||
|
Optional --keep-list emits just the kept entries (one per line, no header).
|
||||||
|
"""
|
||||||
|
from __future__ import annotations
|
||||||
|
|
||||||
|
import json
|
||||||
|
import re
|
||||||
|
import sys
|
||||||
|
from pathlib import Path
|
||||||
|
|
||||||
|
|
||||||
|
def load_dict() -> set[str]:
|
||||||
|
for p in ("/usr/share/dict/words", "/etc/dictionaries-common/words"):
|
||||||
|
try:
|
||||||
|
with open(p, encoding="utf-8", errors="ignore") as f:
|
||||||
|
return {w.strip().lower() for w in f if w.strip()}
|
||||||
|
except FileNotFoundError:
|
||||||
|
continue
|
||||||
|
return set()
|
||||||
|
|
||||||
|
|
||||||
|
DICT = load_dict()
|
||||||
|
|
||||||
|
# ---- patterns ----
|
||||||
|
NON_ASCII = re.compile(r"[^\x00-\x7f]")
|
||||||
|
# True non-English-script (no ASCII letters at all)
|
||||||
|
ASCII_LETTERS_RE = re.compile(r"[A-Za-z]")
|
||||||
|
MONTH = r"(?:january|february|march|april|may|june|july|august|september|october|november|december|jan|feb|mar|apr|jun|jul|aug|sep|sept|oct|nov|dec)"
|
||||||
|
ORDINAL = r"(?:first|second|third|fourth|fifth|sixth|seventh|eighth|ninth|tenth|eleventh|twelfth|thirteenth|fourteenth|fifteenth|sixteenth|seventeenth|eighteenth|nineteenth|twentieth)"
|
||||||
|
NUMBER_WORD = r"(?:zero|one|two|three|four|five|six|seven|eight|nine|ten|eleven|twelve|thirteen|fourteen|fifteen|sixteen|seventeen|eighteen|nineteen|twenty|thirty|forty|fifty|sixty|seventy|eighty|ninety|hundred|thousand|million|billion|and)"
|
||||||
|
|
||||||
|
# A "pure date" — calendar wording + REQUIRES a 4-digit year (so 'January 6' / 'April 1st'
|
||||||
|
# keep their cultural-reference meaning; 'June 28 1969' / 'February twenty eighth 1975' drop).
|
||||||
|
PURE_DATE_RE = re.compile(
|
||||||
|
rf"^\s*(?:{MONTH})(?:\s+(?:\d{{1,2}}|{ORDINAL}|{NUMBER_WORD}))*(?:\s*(?:st|nd|rd|th))?\s+\d{{4}}\s*$",
|
||||||
|
re.I,
|
||||||
|
)
|
||||||
|
|
||||||
|
# Pure spelled number (no other content). Optional [N] annotation kept = our convention.
|
||||||
|
SPELLED_NUMBER_RE = re.compile(
|
||||||
|
rf"^\s*(?:{NUMBER_WORD}\s*)+(?:\[\d+\])?\s*$",
|
||||||
|
re.I,
|
||||||
|
)
|
||||||
|
|
||||||
|
# Pure numeric (year, code, etc.) — usually meaningful in gematria context
|
||||||
|
PURE_NUMERIC_RE = re.compile(r"^\s*[\d\s/.\-:]+\s*(?:\[\d+\])?\s*$")
|
||||||
|
|
||||||
|
# All-caps short fragment — specifically the "A Z" / "B P" / "F O Y" single-letter-and-space pattern.
|
||||||
|
# Tightened: must be SINGLE letters separated by spaces. 'KSI', 'LMK', 'AC DC' all survive.
|
||||||
|
ALLCAPS_TINY_RE = re.compile(r"^[A-Z](?:\s+[A-Z])+$")
|
||||||
|
|
||||||
|
# Long consonant run within a SINGLE word (10+ consecutive consonants) = keyboard mash.
|
||||||
|
# Per-word check below avoids false positives like 'Music Industry Symbolism'.
|
||||||
|
LONG_CONSONANT_RE = re.compile(r"[bcdfghjklmnpqrstvwxyz]{10,}", re.I)
|
||||||
|
|
||||||
|
VOWELS = set("aeiouy")
|
||||||
|
|
||||||
|
|
||||||
|
def letters_only(s: str) -> str:
|
||||||
|
return re.sub(r"[^A-Za-z]", "", s)
|
||||||
|
|
||||||
|
|
||||||
|
def has_proper_noun_signal(words: list[str]) -> bool:
|
||||||
|
"""At least one capitalized, 3+ letter word with a vowel (e.g., 'Palantir', 'Netanyahu')."""
|
||||||
|
for w in words:
|
||||||
|
a = letters_only(w)
|
||||||
|
if len(a) >= 3 and a[0].isupper() and any(c.lower() in VOWELS for c in a):
|
||||||
|
return True
|
||||||
|
return False
|
||||||
|
|
||||||
|
|
||||||
|
def has_dict_word(words: list[str], min_len: int = 2) -> bool:
|
||||||
|
"""Has at least one English dictionary word. min_len=2 keeps 'is', 'an', 'to', 'by' as signals.
|
||||||
|
Single-character words ('a', 'i') still excluded.
|
||||||
|
"""
|
||||||
|
for w in words:
|
||||||
|
a = letters_only(w).lower()
|
||||||
|
if len(a) >= min_len and a in DICT:
|
||||||
|
return True
|
||||||
|
return False
|
||||||
|
|
||||||
|
|
||||||
|
def classify(entry: str) -> dict:
|
||||||
|
"""Return {classification, keep, reason}. Pure function, deterministic."""
|
||||||
|
raw = entry.rstrip()
|
||||||
|
if not raw.strip():
|
||||||
|
return {"classification": "empty", "keep": False, "reason": "empty"}
|
||||||
|
|
||||||
|
# 1. PURELY non-ASCII (zero ASCII letters) = wrong db for English ciphers.
|
||||||
|
# Entries with diacritics (Beyoncé, Oñaz, Æ) survive because they have ASCII letters too.
|
||||||
|
if NON_ASCII.search(raw) and not ASCII_LETTERS_RE.search(raw):
|
||||||
|
return {
|
||||||
|
"classification": "non-ascii-only",
|
||||||
|
"keep": False,
|
||||||
|
"reason": "entry has no ASCII letters (foreign script only)",
|
||||||
|
}
|
||||||
|
|
||||||
|
words = raw.split()
|
||||||
|
nw = len(words)
|
||||||
|
letters = letters_only(raw)
|
||||||
|
|
||||||
|
# 2. tiny fragment: ≤2 letters AND all-lowercase AND no digits.
|
||||||
|
# Catches 'aa', 'bb', 'cd' (mash); preserves 'YO', 'IQ', 'TF' (uppercase = intent),
|
||||||
|
# '4G', 'WW3', '3/11' (digits = intent), 'Yu' (mixed-case = name).
|
||||||
|
if (len(letters) <= 2
|
||||||
|
and raw == raw.lower()
|
||||||
|
and not any(c.isdigit() for c in raw)):
|
||||||
|
return {
|
||||||
|
"classification": "tiny-fragment",
|
||||||
|
"keep": False,
|
||||||
|
"reason": f"all-lowercase ≤2 letters, no digits — likely fragment",
|
||||||
|
}
|
||||||
|
|
||||||
|
# 3. all-caps single-letter pair pattern ('A Z', 'B P', 'F O Y') — not 3-letter acronyms
|
||||||
|
if ALLCAPS_TINY_RE.match(raw):
|
||||||
|
return {
|
||||||
|
"classification": "allcaps-tiny",
|
||||||
|
"keep": False,
|
||||||
|
"reason": "single-letter-spaces pattern (e.g. 'A Z', 'B P')",
|
||||||
|
}
|
||||||
|
|
||||||
|
# 4. short + no vowels + ALL-LOWERCASE + no digits = real keyboard mash.
|
||||||
|
# ('scr', 'wkqz' drop; 'LMK', 'xQc', 'WW3', '4G' survive because case/digits signal intent.)
|
||||||
|
if (len(letters) <= 5
|
||||||
|
and letters
|
||||||
|
and not any(c.lower() in VOWELS for c in letters)
|
||||||
|
and raw == raw.lower()
|
||||||
|
and not any(c.isdigit() for c in raw)):
|
||||||
|
return {
|
||||||
|
"classification": "no-vowel-mash",
|
||||||
|
"keep": False,
|
||||||
|
"reason": "all-lowercase ≤5 letters with no vowels (keyboard mash)",
|
||||||
|
}
|
||||||
|
|
||||||
|
# 5. long consonant run WITHIN A SINGLE WORD (10+ consecutive) = keyboard mash.
|
||||||
|
# Per-word check avoids cross-word false-positives like 'Music Industry Symbolism'.
|
||||||
|
for w in words:
|
||||||
|
if LONG_CONSONANT_RE.search(letters_only(w)):
|
||||||
|
return {
|
||||||
|
"classification": "consonant-run",
|
||||||
|
"keep": False,
|
||||||
|
"reason": f"single word with 10+ consonants ({w!r})",
|
||||||
|
}
|
||||||
|
|
||||||
|
# 6. same word repeated 3+ times ("Jew Jew Jew Jew Jew")
|
||||||
|
if nw >= 3 and len({w.lower() for w in words}) == 1:
|
||||||
|
return {
|
||||||
|
"classification": "repeated-word",
|
||||||
|
"keep": False,
|
||||||
|
"reason": f"same word x{nw}",
|
||||||
|
}
|
||||||
|
|
||||||
|
# 7. pure-date constructions (whole entry is just a calendar date)
|
||||||
|
if PURE_DATE_RE.match(raw):
|
||||||
|
return {
|
||||||
|
"classification": "pure-date",
|
||||||
|
"keep": False,
|
||||||
|
"reason": "entry is only a calendar date",
|
||||||
|
}
|
||||||
|
|
||||||
|
# 8. pure spelled-number entries — keep if [N] annotated (our convention), drop bare
|
||||||
|
if SPELLED_NUMBER_RE.match(raw):
|
||||||
|
if "[" in raw and "]" in raw:
|
||||||
|
return {
|
||||||
|
"classification": "spelled-number-annotated",
|
||||||
|
"keep": True,
|
||||||
|
"reason": "spelled number with [N] annotation (our convention)",
|
||||||
|
}
|
||||||
|
return {
|
||||||
|
"classification": "spelled-number-bare",
|
||||||
|
"keep": False,
|
||||||
|
"reason": "bare spelled number with no [N] annotation or context",
|
||||||
|
}
|
||||||
|
|
||||||
|
# 9. pure numeric (year/code) — almost always meaningful in gematria
|
||||||
|
if PURE_NUMERIC_RE.match(raw):
|
||||||
|
return {
|
||||||
|
"classification": "numeric",
|
||||||
|
"keep": True,
|
||||||
|
"reason": "pure numeric (year, code, date — usually meaningful)",
|
||||||
|
}
|
||||||
|
|
||||||
|
# 10. long scraped sentence (≥15 words AND low real-word density)
|
||||||
|
if nw >= 15:
|
||||||
|
dict_hits = sum(
|
||||||
|
1 for w in words if (a := letters_only(w).lower()) and len(a) >= 3 and a in DICT
|
||||||
|
)
|
||||||
|
if dict_hits < nw * 0.4:
|
||||||
|
return {
|
||||||
|
"classification": "long-scraped",
|
||||||
|
"keep": False,
|
||||||
|
"reason": f"long sentence (nw={nw}) with low dict density ({dict_hits} dict words)",
|
||||||
|
}
|
||||||
|
return {
|
||||||
|
"classification": "long-content",
|
||||||
|
"keep": True,
|
||||||
|
"reason": f"long sentence (nw={nw}) with real content",
|
||||||
|
}
|
||||||
|
|
||||||
|
# 11. final signal test: any of {dict word, proper-noun pattern, digit, uppercase letter}.
|
||||||
|
# An uppercase letter = intentional capitalization = signal of intent.
|
||||||
|
# ('AC DC' = band, 'KSI' = name, 'IOU' = abbr — all have uppercase so all survive.)
|
||||||
|
has_d = has_dict_word(words)
|
||||||
|
has_p = has_proper_noun_signal(words)
|
||||||
|
has_n = any(c.isdigit() for c in raw)
|
||||||
|
has_u = any(c.isupper() for c in raw)
|
||||||
|
|
||||||
|
if not (has_d or has_p or has_n or has_u):
|
||||||
|
return {
|
||||||
|
"classification": "no-signal",
|
||||||
|
"keep": False,
|
||||||
|
"reason": "no dict words, no proper-noun, no digits, no uppercase — likely junk",
|
||||||
|
}
|
||||||
|
|
||||||
|
# default: keep
|
||||||
|
return {
|
||||||
|
"classification": "keep",
|
||||||
|
"keep": True,
|
||||||
|
"reason": "passes filter",
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
def load_entries(path: Path) -> list[str]:
|
||||||
|
"""Auto-detect Gematro header + CSV format; return list of phrase strings."""
|
||||||
|
out: list[str] = []
|
||||||
|
with open(path, encoding="utf-8", errors="replace") as f:
|
||||||
|
first: str | None = None
|
||||||
|
for i, line in enumerate(f):
|
||||||
|
line = line.rstrip("\r\n")
|
||||||
|
if i == 0:
|
||||||
|
first = line
|
||||||
|
if line.upper().startswith("CREATE_GEMATRO") or line.startswith("GEMATRO_DB;"):
|
||||||
|
continue # header, skip
|
||||||
|
if line.strip():
|
||||||
|
out.append(line)
|
||||||
|
else:
|
||||||
|
if line.strip():
|
||||||
|
if first and first.startswith("GEMATRO_DB;"):
|
||||||
|
out.append(line.split(";")[0])
|
||||||
|
else:
|
||||||
|
out.append(line)
|
||||||
|
return out
|
||||||
|
|
||||||
|
|
||||||
|
def main(argv: list[str]) -> int:
|
||||||
|
if not argv or argv[0] in ("-h", "--help"):
|
||||||
|
print(__doc__)
|
||||||
|
return 0
|
||||||
|
|
||||||
|
inp = Path(argv[0])
|
||||||
|
out_path: Path | None = None
|
||||||
|
keep_path: Path | None = None
|
||||||
|
|
||||||
|
i = 1
|
||||||
|
while i < len(argv):
|
||||||
|
if argv[i] == "--out" and i + 1 < len(argv):
|
||||||
|
out_path = Path(argv[i + 1])
|
||||||
|
i += 2
|
||||||
|
elif argv[i] == "--keep-list" and i + 1 < len(argv):
|
||||||
|
keep_path = Path(argv[i + 1])
|
||||||
|
i += 2
|
||||||
|
else:
|
||||||
|
i += 1
|
||||||
|
|
||||||
|
entries = load_entries(inp)
|
||||||
|
decisions: list[dict] = []
|
||||||
|
keeps: list[str] = []
|
||||||
|
buckets: dict[str, int] = {}
|
||||||
|
|
||||||
|
for e in entries:
|
||||||
|
d = classify(e)
|
||||||
|
d["entry"] = e
|
||||||
|
decisions.append(d)
|
||||||
|
buckets[d["classification"]] = buckets.get(d["classification"], 0) + 1
|
||||||
|
if d["keep"]:
|
||||||
|
keeps.append(e)
|
||||||
|
|
||||||
|
if out_path:
|
||||||
|
with open(out_path, "w", encoding="utf-8") as f:
|
||||||
|
for d in decisions:
|
||||||
|
f.write(json.dumps(d, ensure_ascii=False) + "\n")
|
||||||
|
if keep_path:
|
||||||
|
with open(keep_path, "w", encoding="utf-8") as f:
|
||||||
|
f.write("\n".join(keeps) + "\n")
|
||||||
|
|
||||||
|
n = len(entries) or 1
|
||||||
|
kept = len(keeps)
|
||||||
|
dropped = n - kept
|
||||||
|
print(f"input: {len(entries):,} keep: {kept:,} ({kept/n*100:.1f}%) drop: {dropped:,} ({dropped/n*100:.1f}%)")
|
||||||
|
print("by classification:")
|
||||||
|
for b, c in sorted(buckets.items(), key=lambda x: -x[1]):
|
||||||
|
marker = "+" if classify_returns_keep_for_bucket(b, decisions) else "-"
|
||||||
|
print(f" {marker} {c:>7,} {b}")
|
||||||
|
return 0
|
||||||
|
|
||||||
|
|
||||||
|
def classify_returns_keep_for_bucket(bucket: str, decisions: list[dict]) -> bool:
|
||||||
|
"""Whether this bucket recommends keep (for stdout summary marker)."""
|
||||||
|
for d in decisions:
|
||||||
|
if d["classification"] == bucket:
|
||||||
|
return d["keep"]
|
||||||
|
return False
|
||||||
|
|
||||||
|
|
||||||
|
if __name__ == "__main__":
|
||||||
|
sys.exit(main(sys.argv[1:]))
|
||||||
@@ -18,6 +18,15 @@ from pathlib import Path
|
|||||||
|
|
||||||
from all_ciphers import get_ciphers, compute_value
|
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 `recommendedCiphers` (the 16-cipher "Curated" set).
|
||||||
|
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():
|
def main():
|
||||||
in_path = Path(sys.argv[1] if len(sys.argv) > 1 else "db_track_a.txt")
|
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
|
size_mb = out_path.stat().st_size / 1024 / 1024
|
||||||
print(f"Done. {n} entries, {size_mb:.1f} MB, {time.time()-t0:.0f}s total")
|
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__":
|
if __name__ == "__main__":
|
||||||
main()
|
main()
|
||||||
@@ -0,0 +1,117 @@
|
|||||||
|
#!/usr/bin/env python3
|
||||||
|
"""Normalize a Gematro db.txt to Proper Case.
|
||||||
|
|
||||||
|
Rule (NetVoid's "capitalise first letter of every word, keep 3-letter agencies",
|
||||||
|
done smartly): capitalize the first letter of every word and lowercase the rest,
|
||||||
|
BUT preserve:
|
||||||
|
- acronyms e.g. NASA, FBI, BMX (all-caps tokens that aren't dictionary words)
|
||||||
|
- Roman numerals e.g. XXXIII, II, and lowercase mmxlvi -> MMXLVI
|
||||||
|
- mixed-case e.g. iPhone, eBay, McDonald (internal capitals)
|
||||||
|
- digits / [bracket] annotations -> left untouched
|
||||||
|
|
||||||
|
Only the 5 case-sensitive ciphers (Alphanumeric Case Sensitive, Capitals Added/Mixed,
|
||||||
|
Reverse Caps Added/Mixed) change value; every other cipher lowercases first.
|
||||||
|
|
||||||
|
Usage: python3 normalize_caps.py <in.txt> <out.txt> [--report]
|
||||||
|
Output is deduped (case-insensitive) and re-sorted (case-insensitive), matching the
|
||||||
|
db.txt invariants.
|
||||||
|
"""
|
||||||
|
import re
|
||||||
|
import sys
|
||||||
|
from pathlib import Path
|
||||||
|
|
||||||
|
|
||||||
|
def load_dict():
|
||||||
|
try:
|
||||||
|
return {w.strip().lower() for w in open("/usr/share/dict/words", errors="ignore") if w.strip()}
|
||||||
|
except FileNotFoundError:
|
||||||
|
return set()
|
||||||
|
|
||||||
|
|
||||||
|
DICT = load_dict()
|
||||||
|
ROMAN = re.compile(r"M{0,4}(CM|CD|D?C{0,3})(XC|XL|L?X{0,3})(IX|IV|V?I{0,3})", re.I)
|
||||||
|
|
||||||
|
|
||||||
|
def is_roman(s):
|
||||||
|
return bool(s) and ROMAN.fullmatch(s) is not None
|
||||||
|
|
||||||
|
|
||||||
|
def xform_word(w):
|
||||||
|
# digits / brackets: leave entirely alone (numbers, [N] annotations)
|
||||||
|
if any(c.isdigit() for c in w) or "[" in w or "]" in w:
|
||||||
|
return w
|
||||||
|
letters = re.sub(r"[^A-Za-z]", "", w)
|
||||||
|
if not letters:
|
||||||
|
return w
|
||||||
|
# mixed-case (an uppercase letter past the first, but NOT all-caps): preserve iPhone / eBay / McDonald
|
||||||
|
if w != w.lower() and w != w.upper() and not (w[0].isupper() and w[1:] == w[1:].lower()):
|
||||||
|
return w
|
||||||
|
# all-caps multi-letter token: preserve as-is. This single rule covers acronyms
|
||||||
|
# (NASA, FBI, MAGA, COVID), Roman numerals (XXXIII), modern shortforms (AI, LA, ID,
|
||||||
|
# KSI), and brand/band names (AC DC). We used to fall through to Title Case when the
|
||||||
|
# lowercased token was in /usr/share/dict/words, but that dict knows 'maga', 'covid',
|
||||||
|
# 'la', 'ai', 'id', 'us', 'it', 'ice' as words and was mangling 462 modern acronyms
|
||||||
|
# in NetVoid's 2026 additions. Trust the input: if it's typed all-caps, keep it.
|
||||||
|
# Cost: 'A BIG WIN FOR US' stays loud instead of becoming 'A Big Win For Us' — rare
|
||||||
|
# in curated db entries and clearly the lesser evil.
|
||||||
|
if w == w.upper() and len(letters) >= 2:
|
||||||
|
return w
|
||||||
|
# lowercase/mixed Roman numeral that isn't a real word: uppercase it (mmxlvi -> MMXLVI)
|
||||||
|
if len(letters) >= 2 and is_roman(letters) and letters.lower() not in DICT:
|
||||||
|
return w.upper()
|
||||||
|
# normal word: Title Case
|
||||||
|
return w[:1].upper() + w[1:].lower()
|
||||||
|
|
||||||
|
|
||||||
|
def xform(line):
|
||||||
|
return " ".join(xform_word(w) for w in line.split())
|
||||||
|
|
||||||
|
|
||||||
|
def main():
|
||||||
|
inp, outp = Path(sys.argv[1]), Path(sys.argv[2])
|
||||||
|
report = "--report" in sys.argv[3:]
|
||||||
|
lines = [l.rstrip("\r\n") for l in open(inp, encoding="utf-8")]
|
||||||
|
header = lines[0] if lines and "GEMATRO" in lines[0].upper() else None
|
||||||
|
body = [l for l in (lines[1:] if header else lines) if l.strip()]
|
||||||
|
|
||||||
|
out = [xform(l) for l in body]
|
||||||
|
changed = [(a, b) for a, b in zip(body, out) if a != b]
|
||||||
|
|
||||||
|
# case-insensitive dedup (collapses any case-variants merged by the transform) + re-sort
|
||||||
|
seen = {}
|
||||||
|
for o in out:
|
||||||
|
seen.setdefault(o.lower(), o)
|
||||||
|
dedup = sorted(seen.values(), key=lambda s: s.lower())
|
||||||
|
removed = len(out) - len(dedup)
|
||||||
|
|
||||||
|
with open(outp, "w", encoding="utf-8") as f:
|
||||||
|
if header:
|
||||||
|
f.write(header + "\n")
|
||||||
|
f.write("\n".join(dedup) + "\n")
|
||||||
|
|
||||||
|
print(f"dict words: {len(DICT):,}")
|
||||||
|
print(f"in={len(body):,} changed={len(changed):,} ({len(changed)/len(body)*100:.0f}%) "
|
||||||
|
f"case-dups removed={removed:,} out={len(dedup):,}")
|
||||||
|
|
||||||
|
if report:
|
||||||
|
import random
|
||||||
|
print("\n--- rule demo (hardcoded) ---")
|
||||||
|
for s in ["NASA conspiracy", "World War II", "xxxiii", "mmxlvi", "iPhone",
|
||||||
|
"the FBI and CIA", "a BIG WIN for US", "a bmx god", "eBay", "apple"]:
|
||||||
|
print(f" {s!r:22} -> {xform(s)!r}")
|
||||||
|
print("\n--- 18 real before -> after (changed entries) ---")
|
||||||
|
random.seed(5)
|
||||||
|
for a, b in random.sample(changed, 18):
|
||||||
|
print(f" {a!r}\n -> {b!r}")
|
||||||
|
# protection counts
|
||||||
|
kept_acro = sum(1 for l in dedup for w in l.split()
|
||||||
|
if w == w.upper() and len(re.sub(r"[^A-Za-z]", "", w)) >= 2
|
||||||
|
and not is_roman(re.sub(r"[^A-Za-z]", "", w)))
|
||||||
|
kept_roman = sum(1 for l in dedup for w in l.split()
|
||||||
|
if w == w.upper() and is_roman(re.sub(r"[^A-Za-z]", "", w)) and len(w) >= 2)
|
||||||
|
print(f"\n all-caps acronym tokens preserved: {kept_acro:,}")
|
||||||
|
print(f" all-caps Roman-numeral tokens: {kept_roman:,}")
|
||||||
|
|
||||||
|
|
||||||
|
if __name__ == "__main__":
|
||||||
|
main()
|
||||||
Reference in new issue
Block a user