Skip to content

Commit 38e383e

Browse files
committed
pre-heat reveal effects first
1 parent c2a6d7d commit 38e383e

File tree

1 file changed

+29
-25
lines changed

1 file changed

+29
-25
lines changed

script.user.js

Lines changed: 29 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
// ==UserScript==
22
// @name JPDB Userscript (6a67)
33
// @namespace http://tampermonkey.net/
4-
// @version 0.1.175
4+
// @version 0.1.176
55
// @description Script for JPDB that adds some styling and functionality
66
// @match *://jpdb.io/*
77
// @grant GM_addStyle
@@ -1772,14 +1772,15 @@
17721772
// Create a new promise for this execution
17731773
STATE.warmingEffectsPromise = (async () => {
17741774
try {
1775-
if (!WARM['smallFireworkAnimation']) {
1776-
const smallFirework = CONFIG.lottieSmallFireworks[0];
1777-
const smallFireworkJson = await JSON.parse(
1775+
// Reveal effects
1776+
if (!WARM['explosionAnimation']) {
1777+
const explosion = CONFIG.lottieExplosions[0];
1778+
const explosionJson = await JSON.parse(
17781779
(
1779-
await httpRequest(smallFirework, 365 * 24 * 60 * 60, true, false, true)
1780+
await httpRequest(explosion, 365 * 24 * 60 * 60, true, false, true)
17801781
).responseText
17811782
);
1782-
WARM['smallFireworkAnimation'] = loadLottieAnimation(smallFireworkJson);
1783+
WARM['explosionAnimation'] = loadLottieAnimation(explosionJson);
17831784
}
17841785

17851786
if (!WARM['bigFireworkAnimation']) {
@@ -1791,26 +1792,29 @@
17911792
);
17921793
WARM['bigFireworkAnimation'] = loadLottieAnimation(bigFireworkJson);
17931794
}
1795+
//
1796+
1797+
void (async () => {
1798+
if (!WARM['smallFireworkAnimation']) {
1799+
const smallFirework = CONFIG.lottieSmallFireworks[0];
1800+
const smallFireworkJson = await JSON.parse(
1801+
(
1802+
await httpRequest(smallFirework, 365 * 24 * 60 * 60, true, false, true)
1803+
).responseText
1804+
);
1805+
WARM['smallFireworkAnimation'] = loadLottieAnimation(smallFireworkJson);
1806+
}
17941807

1795-
if (!WARM['sparkleAnimation']) {
1796-
const randomSparkle = CONFIG.lottieSparkles[0];
1797-
const sparkleJson = await JSON.parse(
1798-
(
1799-
await httpRequest(randomSparkle, 365 * 24 * 60 * 60, true, false, true)
1800-
).responseText
1801-
);
1802-
WARM['sparkleAnimation'] = loadLottieAnimation(sparkleJson);
1803-
}
1804-
1805-
if (!WARM['explosionAnimation']) {
1806-
const explosion = CONFIG.lottieExplosions[0];
1807-
const explosionJson = await JSON.parse(
1808-
(
1809-
await httpRequest(explosion, 365 * 24 * 60 * 60, true, false, true)
1810-
).responseText
1811-
);
1812-
WARM['explosionAnimation'] = loadLottieAnimation(explosionJson);
1813-
}
1808+
if (!WARM['sparkleAnimation']) {
1809+
const randomSparkle = CONFIG.lottieSparkles[0];
1810+
const sparkleJson = await JSON.parse(
1811+
(
1812+
await httpRequest(randomSparkle, 365 * 24 * 60 * 60, true, false, true)
1813+
).responseText
1814+
);
1815+
WARM['sparkleAnimation'] = loadLottieAnimation(sparkleJson);
1816+
}
1817+
})();
18141818
} finally {
18151819
// Reset the promise when done, allowing future calls to run
18161820
STATE.warmingEffectsPromise = null;

0 commit comments

Comments
 (0)