Skip to content

Commit

Permalink
preload images
Browse files Browse the repository at this point in the history
  • Loading branch information
GitPaulo committed Aug 12, 2024
1 parent ad9351a commit e03b9d1
Show file tree
Hide file tree
Showing 14 changed files with 12 additions and 14 deletions.
18 changes: 11 additions & 7 deletions src/app.html
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,14 @@
<meta charset="utf-8" />
<link rel="icon" href="%sveltekit.assets%/favicon.png" />
<meta name="viewport" content="width=device-width, initial-scale=1" />
<!-- Preload backgrounds -->
<link rel="preload" href="background_arealmreborn.webp" as="image" />
<link rel="preload" href="background_heavensward.webp" as="image" />
<link rel="preload" href="background_stormblood.webp" as="image" />
<link rel="preload" href="background_shadowbringers.webp" as="image" />
<link rel="preload" href="background_endwalker.webp" as="image" />
<link rel="preload" href="background_dawntrail.webp" as="image" />
<!-- Head -->
%sveltekit.head%
</head>
<body class="flex flex-col mt-8" data-sveltekit-preload-data="hover">
Expand All @@ -13,12 +21,8 @@
<div class="content-container">%sveltekit.body%</div>
</div>
</body>
<div
id="footer"
class="text-sm mt-1 md:mt-4 text-gray-400"
style="display: block"
>
<div id="foot-text" class="hidden md:block">
<div id="footer" class="text-sm mt-1 md:mt-4 text-gray-400">
<div id="copyright" class="hidden md:block">
FINAL FANTASY is a registered trademark of Square Enix Holdings Co., Ltd.
<br />
FINAL FANTASY XIV © SQUARE ENIX CO., LTD.
Expand All @@ -29,7 +33,7 @@
target="_blank"
rel="noopener noreferrer"
title="GitHub.com/GitPaulo/FFXIV-Journey"
class="text-sm text-gray-500 flex items-center space-x-2 mt-2 flex items-center justify-center"
class="text-sm text-gray-500 flex items-center space-x-2 mt-2 justify-center"
>
<svg
viewBox="0 0 98 96"
Expand Down
8 changes: 1 addition & 7 deletions src/routes/+page.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,7 @@
// Update the background image based on the current expansion
function updateBackground() {
const bgImage = $currentExpansion
? `${base}/background_${$currentExpansion.replace(/\s/g, "").toLowerCase()}.jpg`
? `${base}/background_${$currentExpansion.replace(/\s/g, "").toLowerCase()}.webp`
: ""; // No background is default
const bgElement = document.getElementById("background");
Expand Down Expand Up @@ -137,7 +137,6 @@
searchInput?.focus();
}
};
window.addEventListener("keydown", handleKeydown);
// Initialize the quests data and state
Expand All @@ -151,11 +150,6 @@
updateCurrentExpansion();
updateBackground();
setTimeout(() => loading.set(false), 350);
const footer = document.getElementById("footer");
if (footer) {
footer.style.display = "block";
}
});
}
Expand Down
Binary file removed static/background_arealmreborn.jpg
Binary file not shown.
Binary file added static/background_arealmreborn.webp
Binary file not shown.
Binary file removed static/background_dawntrail.jpg
Binary file not shown.
Binary file added static/background_dawntrail.webp
Binary file not shown.
Binary file removed static/background_endwalker.jpg
Binary file not shown.
Binary file added static/background_endwalker.webp
Binary file not shown.
Binary file removed static/background_heavensward.jpg
Binary file not shown.
Binary file added static/background_heavensward.webp
Binary file not shown.
Binary file removed static/background_shadowbringers.jpg
Binary file not shown.
Binary file added static/background_shadowbringers.webp
Binary file not shown.
Binary file removed static/background_stormblood.jpg
Binary file not shown.
Binary file added static/background_stormblood.webp
Binary file not shown.

0 comments on commit e03b9d1

Please sign in to comment.