Spaces:
Running
Running
Ron Au
commited on
Commit
·
8cf142f
1
Parent(s):
75e2e80
fix(name): Fix name width not adjusting on new card
Browse files- static/js/index.js +8 -2
static/js/index.js
CHANGED
@@ -38,7 +38,8 @@ const generate = async () => {
|
|
38 |
await new Promise((resolve) => setTimeout(resolve, 2_000));
|
39 |
|
40 |
pulls += 1;
|
41 |
-
const resolvedCardUrl = new URL(`new_card?pull=${pulls}`, document.location.origin + document.location.pathname)
|
|
|
42 |
const cardResponse = await fetch(resolvedCardUrl);
|
43 |
const card = await cardResponse.json();
|
44 |
|
@@ -53,12 +54,17 @@ const generate = async () => {
|
|
53 |
);
|
54 |
|
55 |
cardSlot.innerHTML = cardHTML(card.details);
|
56 |
-
updateCardName(trainerName, pokeName, useTrainerName);
|
57 |
document.querySelector('img.picture').src = card.image;
|
58 |
|
59 |
mousemoveHandlerForPreviousCard = initialiseCardRotation(scene);
|
60 |
|
61 |
setOutput('card', 'completed');
|
|
|
|
|
|
|
|
|
|
|
|
|
62 |
} catch (err) {
|
63 |
generating = false;
|
64 |
setOutput('booster', 'failed');
|
|
|
38 |
await new Promise((resolve) => setTimeout(resolve, 2_000));
|
39 |
|
40 |
pulls += 1;
|
41 |
+
const resolvedCardUrl = new URL(`new_card?pull=${pulls}`, document.location.origin + document.location.pathname)
|
42 |
+
.href;
|
43 |
const cardResponse = await fetch(resolvedCardUrl);
|
44 |
const card = await cardResponse.json();
|
45 |
|
|
|
54 |
);
|
55 |
|
56 |
cardSlot.innerHTML = cardHTML(card.details);
|
|
|
57 |
document.querySelector('img.picture').src = card.image;
|
58 |
|
59 |
mousemoveHandlerForPreviousCard = initialiseCardRotation(scene);
|
60 |
|
61 |
setOutput('card', 'completed');
|
62 |
+
|
63 |
+
const updateNameDuringAnimation = setInterval(() => updateCardName(trainerName, pokeName, useTrainerName), 100);
|
64 |
+
|
65 |
+
setTimeout(() => {
|
66 |
+
clearInterval(updateNameDuringAnimation);
|
67 |
+
}, 500);
|
68 |
} catch (err) {
|
69 |
generating = false;
|
70 |
setOutput('booster', 'failed');
|