update app and index.html

This commit is contained in:
2026-06-01 13:15:12 -07:00
parent 254f488eca
commit e0d0f15731
9 changed files with 754 additions and 38 deletions
+203 -6
View File
@@ -10,6 +10,91 @@
dhal: "Dhal", dad: "Dad", dha: "Dha", ghayn: "Ghayn"
};
const GREEK_NATIVE_NAMES = {
alpha: { classical: "ἄλφα", koine: "άλφα" },
beta: { classical: "βῆτα", koine: "βήτα" },
gamma: { classical: "γάμμα", koine: "γάμμα" },
delta: { classical: "δέλτα", koine: "δέλτα" },
epsilon: { classical: "ἒ ψιλόν", koine: "έψιλον" },
zeta: { classical: "ζῆτα", koine: "ζήτα" },
eta: { classical: "ἦτα", koine: "ήτα" },
theta: { classical: "θῆτα", koine: "θήτα" },
iota: { classical: "ἰῶτα", koine: "ιώτα" },
kappa: { classical: "κάππα", koine: "κάππα" },
lambda: { classical: "λάμβδα", koine: "λάμδα" },
mu: { classical: "μῦ", koine: "μι" },
nu: { classical: "νῦ", koine: "νι" },
xi: { classical: "ξῖ", koine: "ξι" },
omicron: { classical: "ὂ μικρόν", koine: "όμικρον" },
pi: { classical: "πῖ", koine: "πι" },
rho: { classical: "ῥῶ", koine: "ρω" },
sigma: { classical: "σῖγμα", koine: "σίγμα" },
tau: { classical: "ταῦ", koine: "ταυ" },
upsilon: { classical: "ὖ ψιλόν", koine: "ύψιλον" },
phi: { classical: "φῖ", koine: "φι" },
chi: { classical: "χῖ", koine: "χι" },
psi: { classical: "ψῖ", koine: "ψι" },
omega: { classical: "ὦ μέγα", koine: "ωμέγα" },
digamma: { classical: "δίγαμμα", koine: "δίγαμμα" },
qoppa: { classical: "κόππα", koine: "κόππα" },
sampi: { classical: "σαμπί", koine: "σαμπί" }
};
const GREEK_TRANSLITERATIONS = {
alpha: { classical: "A", koine: "A" },
beta: { classical: "B", koine: "V" },
gamma: { classical: "G", koine: "G" },
delta: { classical: "D", koine: "Th" },
epsilon: { classical: "E", koine: "E" },
zeta: { classical: "Z", koine: "Z" },
eta: { classical: "E", koine: "I" },
theta: { classical: "Th", koine: "Th" },
iota: { classical: "I", koine: "I" },
kappa: { classical: "K", koine: "K" },
lambda: { classical: "L", koine: "L" },
mu: { classical: "M", koine: "M" },
nu: { classical: "N", koine: "N" },
xi: { classical: "X", koine: "X" },
omicron: { classical: "O", koine: "O" },
pi: { classical: "P", koine: "P" },
rho: { classical: "R", koine: "R" },
sigma: { classical: "S", koine: "S" },
tau: { classical: "T", koine: "T" },
upsilon: { classical: "U/Y", koine: "I" },
phi: { classical: "Ph", koine: "F" },
chi: { classical: "Kh/Ch", koine: "Ch" },
psi: { classical: "Ps", koine: "Ps" },
omega: { classical: "O", koine: "O" },
digamma: { classical: "W", koine: "V" },
qoppa: { classical: "Q", koine: "Q" },
sampi: { classical: "Ss/Ts", koine: "Ss/Ts" }
};
const HEBREW_NATIVE_NAMES = {
alef: "אלף",
bet: "בית",
gimel: "גימל",
dalet: "דלת",
he: "הא",
vav: "וו",
zayin: "זין",
het: "חית",
tet: "טית",
yod: "יוד",
kaf: "כף",
lamed: "למד",
mem: "מם",
nun: "נון",
samekh: "סמך",
ayin: "עין",
pe: "פה",
tsadi: "צדי",
qof: "קוף",
resh: "ריש",
shin: "שין",
tav: "תו"
};
function createAlphabetBrowser(dependencies) {
const {
state,
@@ -22,15 +107,109 @@
return value ? value.charAt(0).toUpperCase() + value.slice(1) : "";
}
function alphabetDisplayLabel(alphabet) {
if (alphabet === "greek") return "Greek (Classical/Koine)";
if (alphabet === "greekArchaic") return "Greek (Archaic)";
return capitalize(alphabet);
}
function arabicDisplayName(letter) {
return ARABIC_DISPLAY_NAMES[letter && letter.name]
|| (String(letter && letter.name || "").charAt(0).toUpperCase() + String(letter && letter.name || "").slice(1));
}
function greekNativeNames(letter) {
const key = String(letter?.name || "").trim().toLowerCase();
const names = GREEK_NATIVE_NAMES[key];
if (!names) {
return { classical: "", koine: "" };
}
return {
classical: String(names.classical || "").trim(),
koine: String(names.koine || "").trim()
};
}
function toGreekUppercase(value) {
return String(value || "")
.normalize("NFD")
.replace(/[\u0300-\u036f]/g, "")
.toUpperCase();
}
function formatGreekNativeNames(letter, options = {}) {
const useUppercase = options?.uppercase === true;
const names = greekNativeNames(letter);
const classicalName = useUppercase ? toGreekUppercase(names.classical) : names.classical;
const koineName = useUppercase ? toGreekUppercase(names.koine) : names.koine;
if (classicalName && koineName && classicalName !== koineName) {
return `${classicalName} / ${koineName}`;
}
return classicalName || koineName || "";
}
function hebrewNativeName(letter) {
const key = String(letter?.hebrewLetterId || "").trim().toLowerCase();
return HEBREW_NATIVE_NAMES[key] || "";
}
function greekTransliterationVariants(letter) {
const key = String(letter?.name || "").trim().toLowerCase();
const variants = GREEK_TRANSLITERATIONS[key];
if (!variants) {
const fallback = String(letter?.transliteration || "").trim();
return {
classical: fallback,
koine: fallback
};
}
return {
classical: String(variants.classical || "").trim(),
koine: String(variants.koine || "").trim()
};
}
function formatGreekTransliteration(letter) {
const variants = greekTransliterationVariants(letter);
if (variants.classical && variants.koine && variants.classical !== variants.koine) {
return `${variants.classical} / ${variants.koine}`;
}
return variants.classical || variants.koine || String(letter?.transliteration || "").trim();
}
function greekPlaceValueByIndex(index, alphabet) {
const value = Number(index);
if (!Number.isFinite(value)) {
return null;
}
const position = Math.trunc(value);
if (position <= 0) {
return null;
}
if (alphabet === "greekArchaic") {
return null;
}
if (position <= 9) {
return position;
}
if (position <= 18) {
return (position - 9) * 10;
}
return (position - 18) * 100;
}
function getLetters() {
if (!state.alphabets) return [];
if (state.activeAlphabet === "all") {
const alphabetOrder = ["hebrew", "greek", "english", "arabic", "enochian"];
const alphabetOrder = ["hebrew", "greek", "greekArchaic", "english", "arabic", "enochian"];
return alphabetOrder.flatMap((alphabet) => {
const rows = Array.isArray(state.alphabets?.[alphabet]) ? state.alphabets[alphabet] : [];
return rows.map((row) => ({ ...row, __alphabet: alphabet }));
@@ -49,6 +228,7 @@
function letterKeyByAlphabet(alphabet, letter) {
if (alphabet === "hebrew") return letter.hebrewLetterId;
if (alphabet === "greek") return letter.name;
if (alphabet === "greekArchaic") return letter.name;
if (alphabet === "english") return letter.letter;
if (alphabet === "arabic") return letter.name;
if (alphabet === "enochian") return letter.id;
@@ -68,6 +248,7 @@
const alphabet = alphabetForLetter(letter);
if (alphabet === "hebrew") return letter.char;
if (alphabet === "greek") return letter.char;
if (alphabet === "greekArchaic") return letter.char;
if (alphabet === "english") return letter.letter;
if (alphabet === "arabic") return letter.char;
if (alphabet === "enochian") return letter.char;
@@ -78,6 +259,7 @@
const alphabet = alphabetForLetter(letter);
if (alphabet === "hebrew") return letter.name;
if (alphabet === "greek") return letter.displayName;
if (alphabet === "greekArchaic") return letter.displayName;
if (alphabet === "english") return letter.letter;
if (alphabet === "arabic") return arabicDisplayName(letter);
if (alphabet === "enochian") return letter.title;
@@ -86,8 +268,23 @@
function displaySub(letter) {
const alphabet = alphabetForLetter(letter);
if (alphabet === "hebrew") return `${letter.transliteration} · ${letter.letterType} · ${letter.numerology}`;
if (alphabet === "greek") return `${letter.transliteration} · isopsephy ${letter.numerology}${letter.archaic ? " · archaic" : ""}`;
if (alphabet === "hebrew") {
const nativeName = hebrewNativeName(letter);
return `${nativeName ? `${nativeName} · ` : ""}${letter.transliteration} · ${letter.letterType} · ${letter.numerology}`;
}
if (alphabet === "greek") {
const nativeName = formatGreekNativeNames(letter, { uppercase: true });
const transliteration = formatGreekTransliteration(letter);
const orderlyValue = Number.isFinite(Number(letter?.numerology)) ? Math.trunc(Number(letter.numerology)) : "—";
const placeValue = greekPlaceValueByIndex(letter?.index, alphabet);
return `${nativeName ? `${nativeName} · ` : ""}${transliteration} · isopsephy orderly ${orderlyValue}${Number.isFinite(placeValue) ? ` · 1-10-100 ${placeValue}` : ""}${letter.archaic ? " · archaic" : ""}`;
}
if (alphabet === "greekArchaic") {
const nativeName = formatGreekNativeNames(letter, { uppercase: true });
const transliteration = formatGreekTransliteration(letter);
const orderlyValue = Number.isFinite(Number(letter?.numerology)) ? Math.trunc(Number(letter.numerology)) : "—";
return `${nativeName ? `${nativeName} · ` : ""}${transliteration} · isopsephy orderly ${orderlyValue} · 1-10-100 ${orderlyValue} · archaic`;
}
if (alphabet === "english") return `Pythagorean ${letter.pythagorean}`;
if (alphabet === "arabic") return `${letter.transliteration} · abjad ${letter.abjad} · ${letter.nameArabic}`;
if (alphabet === "enochian") return `${letter.transliteration} · ${Array.isArray(letter.englishLetters) ? letter.englishLetters.join("/") : ""} · value ${letter.numerology}`;
@@ -315,7 +512,7 @@
const meta = document.createElement("span");
meta.className = "alpha-list-meta";
const alphaLabel = alphabet ? `${capitalize(alphabet)} · ` : "";
const alphaLabel = alphabet ? `${alphabetDisplayLabel(alphabet)} · ` : "";
meta.innerHTML = `<strong>${alphaLabel}${displayLabel(letter)}</strong><br><span class="alpha-list-sub">${displaySub(letter)}</span>`;
item.appendChild(glyph);
@@ -346,8 +543,8 @@
}
function updateTabs() {
const { tabAll, tabHebrew, tabGreek, tabEnglish, tabArabic, tabEnochian } = getDomRefs();
[tabAll, tabHebrew, tabGreek, tabEnglish, tabArabic, tabEnochian].forEach((btn) => {
const { tabAll, tabHebrew, tabGreek, tabGreekArchaic, tabEnglish, tabArabic, tabEnochian } = getDomRefs();
[tabAll, tabHebrew, tabGreek, tabGreekArchaic, tabEnglish, tabArabic, tabEnochian].forEach((btn) => {
if (!btn) return;
btn.classList.toggle("alpha-tab-active", btn.dataset.alpha === state.activeAlphabet);
});