easter-egg-quest 1.0.5 → 1.0.7
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
|
@@ -949,7 +949,7 @@ class NarrativeRenderer {
|
|
|
949
949
|
this.currentLine = line;
|
|
950
950
|
this.clearTimer = setTimeout(() => {
|
|
951
951
|
this.clear();
|
|
952
|
-
},
|
|
952
|
+
}, 15e3);
|
|
953
953
|
}
|
|
954
954
|
/**
|
|
955
955
|
* Show a narrative line with a confirmation button.
|
|
@@ -3451,35 +3451,38 @@ const _ResultsRenderer = class _ResultsRenderer {
|
|
|
3451
3451
|
}
|
|
3452
3452
|
// ─── Combined copy & share ──────────────────────────────────────────
|
|
3453
3453
|
_copyShareImage(s) {
|
|
3454
|
+
var _a2;
|
|
3454
3455
|
const canvas = this._renderCard(s);
|
|
3455
|
-
canvas.
|
|
3456
|
-
|
|
3457
|
-
|
|
3458
|
-
|
|
3459
|
-
|
|
3460
|
-
|
|
3461
|
-
|
|
3462
|
-
|
|
3463
|
-
|
|
3464
|
-
|
|
3465
|
-
|
|
3466
|
-
|
|
3467
|
-
|
|
3468
|
-
|
|
3469
|
-
}
|
|
3470
|
-
}
|
|
3471
|
-
if (navigator.clipboard && typeof ClipboardItem !== "undefined") {
|
|
3472
|
-
navigator.clipboard.write([
|
|
3473
|
-
new ClipboardItem({ "image/png": blob })
|
|
3474
|
-
]).then(() => {
|
|
3475
|
-
this._flashButton(".eeq-btn-share", "copied!");
|
|
3456
|
+
const dataUrl = canvas.toDataURL("image/png");
|
|
3457
|
+
const byteString = atob(dataUrl.split(",")[1]);
|
|
3458
|
+
const ab = new ArrayBuffer(byteString.length);
|
|
3459
|
+
const ia = new Uint8Array(ab);
|
|
3460
|
+
for (let i = 0; i < byteString.length; i++) ia[i] = byteString.charCodeAt(i);
|
|
3461
|
+
const blob = new Blob([ab], { type: "image/png" });
|
|
3462
|
+
const isMobile = /Android|iPhone|iPad|iPod/i.test(navigator.userAgent) && window.innerWidth < 768;
|
|
3463
|
+
if (isMobile && navigator.share) {
|
|
3464
|
+
const file = new File([blob], "easter-egg-quest.png", { type: "image/png" });
|
|
3465
|
+
if ((_a2 = navigator.canShare) == null ? void 0 : _a2.call(navigator, { files: [file] })) {
|
|
3466
|
+
navigator.share({
|
|
3467
|
+
files: [file],
|
|
3468
|
+
title: "Easter Egg Quest",
|
|
3469
|
+
text: `«${s.behaviorProfile.title}»`
|
|
3476
3470
|
}).catch(() => {
|
|
3477
|
-
this._downloadBlob(blob);
|
|
3478
3471
|
});
|
|
3479
3472
|
return;
|
|
3480
3473
|
}
|
|
3481
|
-
|
|
3482
|
-
|
|
3474
|
+
}
|
|
3475
|
+
if (navigator.clipboard && typeof ClipboardItem !== "undefined") {
|
|
3476
|
+
navigator.clipboard.write([
|
|
3477
|
+
new ClipboardItem({ "image/png": blob })
|
|
3478
|
+
]).then(() => {
|
|
3479
|
+
this._flashButton(".eeq-btn-share", "copied!");
|
|
3480
|
+
}).catch(() => {
|
|
3481
|
+
this._downloadBlob(blob);
|
|
3482
|
+
});
|
|
3483
|
+
return;
|
|
3484
|
+
}
|
|
3485
|
+
this._downloadBlob(blob);
|
|
3483
3486
|
}
|
|
3484
3487
|
_downloadBlob(blob) {
|
|
3485
3488
|
const url = URL.createObjectURL(blob);
|
|
@@ -4944,7 +4947,7 @@ class GameController {
|
|
|
4944
4947
|
"all three — remarkable"
|
|
4945
4948
|
];
|
|
4946
4949
|
(_d = this.narrative) == null ? void 0 : _d.showCelebration(congrats[eggIndex] ?? "egg collected");
|
|
4947
|
-
await this._wait(
|
|
4950
|
+
await this._wait(3500);
|
|
4948
4951
|
(_e = this.narrative) == null ? void 0 : _e.clear();
|
|
4949
4952
|
await this._wait(400);
|
|
4950
4953
|
if (eggIndex < 2) {
|