added thumbs generation for performation and also added a new deck format for registration
This commit is contained in:
@@ -3,7 +3,7 @@
|
||||
"use strict";
|
||||
|
||||
const { DAY_IN_MS, getMoonPhaseName, getDecanForDate } = window.TarotCalc || {};
|
||||
const { resolveTarotCardImage, getTarotCardDisplayName } = window.TarotCardImages || {};
|
||||
const { resolveTarotCardImage, resolveTarotCardThumbnail, getTarotCardDisplayName } = window.TarotCardImages || {};
|
||||
|
||||
let nowLightboxOverlayEl = null;
|
||||
let nowLightboxImageEl = null;
|
||||
@@ -207,7 +207,7 @@
|
||||
imageEl.style.cursor = "zoom-in";
|
||||
imageEl.title = "Click to enlarge";
|
||||
imageEl.addEventListener("click", () => {
|
||||
const src = imageEl.getAttribute("src");
|
||||
const src = imageEl.dataset.fullSrc || imageEl.getAttribute("src");
|
||||
if (!src || imageEl.style.display === "none") {
|
||||
return;
|
||||
}
|
||||
@@ -489,23 +489,32 @@
|
||||
|
||||
bindNowCardLightbox(imageEl);
|
||||
|
||||
if (!cardName || typeof resolveTarotCardImage !== "function") {
|
||||
if (!cardName || (typeof resolveTarotCardThumbnail !== "function" && typeof resolveTarotCardImage !== "function")) {
|
||||
imageEl.style.display = "none";
|
||||
imageEl.removeAttribute("src");
|
||||
delete imageEl.dataset.fullSrc;
|
||||
return;
|
||||
}
|
||||
|
||||
const src = resolveTarotCardImage(cardName);
|
||||
if (!src) {
|
||||
const fullSrc = typeof resolveTarotCardImage === "function"
|
||||
? resolveTarotCardImage(cardName)
|
||||
: null;
|
||||
const thumbnailSrc = typeof resolveTarotCardThumbnail === "function"
|
||||
? (resolveTarotCardThumbnail(cardName) || fullSrc)
|
||||
: fullSrc;
|
||||
if (!thumbnailSrc) {
|
||||
imageEl.style.display = "none";
|
||||
imageEl.removeAttribute("src");
|
||||
delete imageEl.dataset.fullSrc;
|
||||
return;
|
||||
}
|
||||
|
||||
imageEl.src = src;
|
||||
imageEl.src = thumbnailSrc;
|
||||
imageEl.dataset.fullSrc = fullSrc || thumbnailSrc;
|
||||
const displayName = getDisplayTarotName(cardName, trumpNumber);
|
||||
imageEl.alt = `${fallbackLabel}: ${displayName}`;
|
||||
imageEl.style.display = "block";
|
||||
imageEl.decoding = "async";
|
||||
}
|
||||
|
||||
window.NowUiHelpers = {
|
||||
|
||||
Reference in New Issue
Block a user