Skip to content

Commit

Permalink
Re-encode images as webp to take up way less space
Browse files Browse the repository at this point in the history
  • Loading branch information
bbrk24 committed Oct 27, 2024
1 parent b9f19b1 commit 38d57cc
Show file tree
Hide file tree
Showing 266 changed files with 18 additions and 15 deletions.
Binary file removed img/300SLRoadster.png
Binary file not shown.
Binary file added img/300SLRoadster.webp
Binary file not shown.
Binary file removed img/AncientTires.png
Binary file not shown.
Binary file added img/AncientTires.webp
Binary file not shown.
Binary file removed img/AzureRoller.png
Binary file not shown.
Binary file added img/AzureRoller.webp
Binary file not shown.
Binary file removed img/BDasher.png
Binary file not shown.
Binary file added img/BDasher.webp
Binary file not shown.
Binary file removed img/BabyDaisy.png
Binary file not shown.
Binary file added img/BabyDaisy.webp
Binary file not shown.
Binary file removed img/BabyLuigi.png
Binary file not shown.
Binary file added img/BabyLuigi.webp
Binary file not shown.
Binary file removed img/BabyMario.png
Binary file not shown.
Binary file added img/BabyMario.webp
Binary file not shown.
Binary file removed img/BabyPeach.png
Binary file not shown.
Binary file added img/BabyPeach.webp
Binary file not shown.
Binary file removed img/BabyRosalina.png
Binary file not shown.
Binary file added img/BabyRosalina.webp
Binary file not shown.
Binary file removed img/Badwagon.png
Binary file not shown.
Binary file added img/Badwagon.webp
Binary file not shown.
Binary file removed img/Biddybuggy.png
Binary file not shown.
Binary file added img/Biddybuggy.webp
Binary file not shown.
Binary file removed img/Birdo.png
Binary file not shown.
Binary file added img/Birdo.webp
Binary file not shown.
Binary file removed img/BlueFalcon.png
Binary file not shown.
Binary file added img/BlueFalcon.webp
Binary file not shown.
Binary file removed img/BlueStandard.png
Binary file not shown.
Binary file added img/BlueStandard.webp
Binary file not shown.
Binary file removed img/BoneRattler.png
Binary file not shown.
Binary file added img/BoneRattler.webp
Binary file not shown.
Binary file removed img/Bowser.png
Binary file not shown.
Binary file added img/Bowser.webp
Binary file not shown.
Binary file removed img/BowserJr.png
Binary file not shown.
Binary file added img/BowserJr.webp
Binary file not shown.
Binary file removed img/BowserKite.png
Binary file not shown.
Binary file added img/BowserKite.webp
Binary file not shown.
Binary file removed img/Button.png
Binary file not shown.
Binary file added img/Button.webp
Binary file not shown.
Binary file removed img/CatCruiser.png
Binary file not shown.
Binary file added img/CatCruiser.webp
Binary file not shown.
Binary file removed img/CatPeach.png
Binary file not shown.
Binary file added img/CatPeach.webp
Binary file not shown.
Binary file removed img/CircuitSpecial.png
Binary file not shown.
Binary file added img/CircuitSpecial.webp
Binary file not shown.
Binary file removed img/CityTripper.png
Binary file not shown.
Binary file added img/CityTripper.webp
Binary file not shown.
Binary file removed img/CloudGlider.png
Binary file not shown.
Binary file added img/CloudGlider.webp
Binary file not shown.
Binary file removed img/Comet.png
Binary file not shown.
Binary file added img/Comet.webp
Binary file not shown.
Binary file removed img/CrimsonSlim.png
Diff not rendered.
Binary file added img/CrimsonSlim.webp
Binary file not shown.
Binary file removed img/Cushion.png
Diff not rendered.
Binary file added img/Cushion.webp
Binary file not shown.
Binary file removed img/CyberSlick.png
Diff not rendered.
Binary file added img/CyberSlick.webp
Binary file not shown.
Binary file removed img/Daisy.png
Diff not rendered.
Binary file added img/Daisy.webp
Binary file not shown.
Binary file removed img/DiddyKong.png
Diff not rendered.
Binary file added img/DiddyKong.webp
Binary file not shown.
Binary file removed img/DonkeyKong.png
Diff not rendered.
Binary file added img/DonkeyKong.webp
Binary file not shown.
Binary file removed img/DryBones.png
Diff not rendered.
Binary file added img/DryBones.webp
Binary file not shown.
Binary file removed img/DryBowser.png
Diff not rendered.
Binary file added img/DryBowser.webp
Binary file not shown.
Binary file removed img/FlameRider.png
Diff not rendered.
Binary file added img/FlameRider.webp
Binary file not shown.
Binary file removed img/FlowerGlider.png
Diff not rendered.
Binary file added img/FlowerGlider.webp
Binary file not shown.
Binary file removed img/FunkyKong.png
Diff not rendered.
Binary file added img/FunkyKong.webp
Binary file not shown.
Binary file removed img/GLA.png
Diff not rendered.
Binary file added img/GLA.webp
Binary file not shown.
Binary file removed img/GLATires.png
Diff not rendered.
Binary file added img/GLATires.webp
Binary file not shown.
Binary file removed img/GoldGlider.png
Diff not rendered.
Binary file added img/GoldGlider.webp
Binary file not shown.
Binary file removed img/GoldStandard.png
Diff not rendered.
Binary file added img/GoldStandard.webp
Binary file not shown.
Binary file removed img/GoldTires.png
Diff not rendered.
Binary file added img/GoldTires.webp
Binary file not shown.
Binary file removed img/HeavyMii.png
Diff not rendered.
Binary file added img/HeavyMii.webp
Binary file not shown.
Binary file removed img/HotMonster.png
Diff not rendered.
Binary file added img/HotMonster.webp
Binary file not shown.
Binary file removed img/HylianKite.png
Diff not rendered.
Binary file added img/HylianKite.webp
Binary file not shown.
Binary file removed img/Iggy.png
Diff not rendered.
Binary file added img/Iggy.webp
Binary file not shown.
Binary file removed img/InklingBoy.png
Diff not rendered.
Binary file added img/InklingBoy.webp
Binary file not shown.
Binary file removed img/InklingGirl.png
Diff not rendered.
Binary file added img/InklingGirl.webp
Binary file not shown.
Binary file removed img/Inkstriker.png
Diff not rendered.
Binary file added img/Inkstriker.webp
Binary file not shown.
Binary file removed img/Isabelle.png
Diff not rendered.
Binary file added img/Isabelle.webp
Binary file not shown.
Binary file removed img/JetBike.png
Diff not rendered.
Binary file added img/JetBike.webp
Binary file not shown.
Binary file removed img/Kamek.png
Diff not rendered.
Binary file added img/Kamek.webp
Binary file not shown.
Binary file removed img/KingBoo.png
Diff not rendered.
Binary file added img/KingBoo.webp
Binary file not shown.
Binary file removed img/KoopaClown.png
Diff not rendered.
Binary file added img/KoopaClown.webp
Binary file not shown.
Binary file removed img/KoopaTroopa.png
Diff not rendered.
Binary file added img/KoopaTroopa.webp
Binary file not shown.
Binary file removed img/Lakitu.png
Diff not rendered.
Binary file added img/Lakitu.webp
Binary file not shown.
Binary file removed img/Landship.png
Diff not rendered.
Binary file added img/Landship.webp
Binary file not shown.
Binary file removed img/Larry.png
Diff not rendered.
Binary file added img/Larry.webp
Binary file not shown.
Binary file removed img/LeafTires.png
Diff not rendered.
Binary file added img/LeafTires.webp
Binary file not shown.
Binary file removed img/Lemmy.png
Diff not rendered.
Binary file added img/Lemmy.webp
Binary file not shown.
Binary file removed img/LightMii.png
Diff not rendered.
Binary file added img/LightMii.webp
Binary file not shown.
Binary file removed img/Link.png
Diff not rendered.
Binary file added img/Link.webp
Binary file not shown.
Binary file removed img/Ludwig.png
Diff not rendered.
Binary file added img/Ludwig.webp
Binary file not shown.
Binary file removed img/Luigi.png
Diff not rendered.
Binary file added img/Luigi.webp
Binary file not shown.
Binary file removed img/MKTVParafoil.png
Diff not rendered.
Binary file added img/MKTVParafoil.webp
Binary file not shown.
Binary file removed img/Mach8.png
Diff not rendered.
Binary file added img/Mach8.webp
Binary file not shown.
Binary file removed img/Mario.png
Diff not rendered.
Binary file added img/Mario.webp
Binary file not shown.
Binary file removed img/MasterCycle.png
Diff not rendered.
Binary file added img/MasterCycle.webp
Binary file not shown.
Binary file removed img/MasterCycleZero.png
Diff not rendered.
Binary file added img/MasterCycleZero.webp
Binary file not shown.
Binary file removed img/MediumMii.png
Diff not rendered.
Binary file added img/MediumMii.webp
Binary file not shown.
Binary file removed img/Metal.png
Diff not rendered.
Binary file added img/Metal.webp
Binary file not shown.
Binary file removed img/MetalMario.png
Diff not rendered.
Binary file added img/MetalMario.webp
Binary file not shown.
Binary file removed img/Monster.png
Diff not rendered.
Binary file added img/Monster.webp
Binary file not shown.
Binary file removed img/Morton.png
Diff not rendered.
Binary file added img/Morton.webp
Binary file not shown.
Binary file removed img/MrScooty.png
Diff not rendered.
Binary file added img/MrScooty.webp
Binary file not shown.
Binary file removed img/OffRoad.png
Diff not rendered.
Binary file added img/OffRoad.webp
Binary file not shown.
Binary file removed img/PWing.png
Diff not rendered.
Binary file added img/PWing.webp
Binary file not shown.
Binary file removed img/PaperGlider.png
Diff not rendered.
Binary file added img/PaperGlider.webp
Binary file not shown.
Binary file removed img/Parachute.png
Diff not rendered.
Binary file added img/Parachute.webp
Binary file not shown.
Binary file removed img/Parafoil.png
Diff not rendered.
Binary file added img/Parafoil.webp
Binary file not shown.
Binary file removed img/Paraglider.png
Diff not rendered.
Binary file added img/Paraglider.webp
Binary file not shown.
Binary file removed img/Pauline.png
Diff not rendered.
Binary file added img/Pauline.webp
Binary file not shown.
Binary file removed img/Peach.png
Diff not rendered.
Binary file added img/Peach.webp
Binary file not shown.
Binary file removed img/PeachParasol.png
Diff not rendered.
Binary file added img/PeachParasol.webp
Binary file not shown.
Binary file removed img/Peachette.png
Diff not rendered.
Binary file added img/Peachette.webp
Binary file not shown.
Binary file removed img/PeteyPiranha.png
Diff not rendered.
Binary file added img/PeteyPiranha.webp
Binary file not shown.
Binary file removed img/PinkGoldPeach.png
Diff not rendered.
Binary file added img/PinkGoldPeach.webp
Binary file not shown.
Binary file removed img/PipeFrame.png
Diff not rendered.
Binary file added img/PipeFrame.webp
Binary file not shown.
Binary file removed img/PlaneGlider.png
Diff not rendered.
Binary file added img/PlaneGlider.webp
Binary file not shown.
Binary file removed img/Prancer.png
Diff not rendered.
Binary file added img/Prancer.webp
Binary file not shown.
Binary file removed img/RetroOffRoad.png
Diff not rendered.
Binary file added img/RetroOffRoad.webp
Binary file not shown.
Binary file removed img/Roller.png
Diff not rendered.
Binary file added img/Roller.webp
Binary file not shown.
Binary file removed img/Rosalina.png
Diff not rendered.
Binary file added img/Rosalina.webp
Binary file not shown.
Binary file removed img/Roy.png
Diff not rendered.
Binary file added img/Roy.webp
Binary file not shown.
Binary file removed img/ShyGuy.png
Diff not rendered.
Binary file added img/ShyGuy.webp
Binary file not shown.
Binary file removed img/Slick.png
Diff not rendered.
Binary file added img/Slick.webp
Binary file not shown.
Binary file removed img/Slim.png
Diff not rendered.
Binary file added img/Slim.webp
Binary file not shown.
Binary file removed img/Sneeker.png
Diff not rendered.
Binary file added img/Sneeker.webp
Binary file not shown.
Binary file removed img/SplatBuggy.png
Diff not rendered.
Binary file added img/SplatBuggy.webp
Binary file not shown.
Binary file removed img/Sponge.png
Diff not rendered.
Binary file added img/Sponge.webp
Binary file not shown.
Binary file removed img/SportBike.png
Diff not rendered.
Binary file added img/SportBike.webp
Binary file not shown.
Binary file removed img/SportsCoupe.png
Diff not rendered.
Binary file added img/SportsCoupe.webp
Binary file not shown.
Binary file removed img/Standard.png
Diff not rendered.
Binary file added img/Standard.webp
Binary file not shown.
Binary file removed img/StandardATV.png
Diff not rendered.
Binary file added img/StandardATV.webp
Binary file not shown.
Binary file removed img/StandardBike.png
Diff not rendered.
Binary file added img/StandardBike.webp
Binary file not shown.
Binary file removed img/StandardKart.png
Diff not rendered.
Binary file added img/StandardKart.webp
Binary file not shown.
Binary file removed img/SteelDriver.png
Diff not rendered.
Binary file added img/SteelDriver.webp
Binary file not shown.
Binary file removed img/Streetle.png
Diff not rendered.
Binary file added img/Streetle.webp
Binary file not shown.
Binary file removed img/SuperGlider.png
Diff not rendered.
Binary file added img/SuperGlider.webp
Binary file not shown.
Binary file removed img/TanookiKart.png
Diff not rendered.
Binary file added img/TanookiKart.webp
Binary file not shown.
Binary file removed img/TanookiMario.png
Diff not rendered.
Binary file added img/TanookiMario.webp
Binary file not shown.
Binary file removed img/TeddyBuggy.png
Diff not rendered.
Binary file added img/TeddyBuggy.webp
Binary file not shown.
Binary file removed img/TheDuke.png
Diff not rendered.
Binary file added img/TheDuke.webp
Binary file not shown.
Binary file removed img/Toad.png
Diff not rendered.
Binary file added img/Toad.webp
Binary file not shown.
Binary file removed img/Toadette.png
Diff not rendered.
Binary file added img/Toadette.webp
Binary file not shown.
Binary file removed img/TriSpeeder.png
Diff not rendered.
Binary file added img/TriSpeeder.webp
Binary file not shown.
Binary file removed img/TriforceTires.png
Diff not rendered.
Binary file added img/TriforceTires.webp
Binary file not shown.
Binary file removed img/Varmint.png
Diff not rendered.
Binary file added img/Varmint.webp
Binary file not shown.
Binary file removed img/VillagerBoy.png
Diff not rendered.
Binary file added img/VillagerBoy.webp
Binary file not shown.
Binary file removed img/VillagerGirl.png
Diff not rendered.
Binary file added img/VillagerGirl.webp
Binary file not shown.
Binary file removed img/W25SilverArrow.png
Diff not rendered.
Binary file added img/W25SilverArrow.webp
Binary file not shown.
Binary file removed img/WaddleWing.png
Diff not rendered.
Binary file added img/WaddleWing.webp
Binary file not shown.
Binary file removed img/Waluigi.png
Diff not rendered.
Binary file added img/Waluigi.webp
Binary file not shown.
Binary file removed img/Wario.png
Diff not rendered.
Binary file added img/Wario.webp
Binary file not shown.
Binary file removed img/WarioWing.png
Diff not rendered.
Binary file added img/WarioWing.webp
Binary file not shown.
Binary file removed img/Wendy.png
Diff not rendered.
Binary file added img/Wendy.webp
Binary file not shown.
Binary file removed img/Wiggler.png
Diff not rendered.
Binary file added img/Wiggler.webp
Binary file not shown.
Binary file removed img/WildWiggler.png
Diff not rendered.
Binary file added img/WildWiggler.webp
Binary file not shown.
Binary file removed img/Wood.png
Diff not rendered.
Binary file added img/Wood.webp
Binary file not shown.
Binary file removed img/Yoshi.png
Diff not rendered.
Binary file added img/Yoshi.webp
Binary file not shown.
Binary file removed img/YoshiBike.png
Diff not rendered.
Binary file added img/YoshiBike.webp
Binary file not shown.
Binary file removed img/unknown.png
Diff not rendered.
Binary file added img/unknown.webp
Binary file not shown.
8 changes: 4 additions & 4 deletions index.html
Original file line number Diff line number Diff line change
Expand Up @@ -350,10 +350,10 @@
</thead>
<tbody id="output">
<tr>
<td><img src="./img/Mario.png" alt="Mario" title="Mario" /><img src="./img/Ludwig.png" alt="Ludwig" title="Ludwig" /><img src="./img/MediumMii.png" alt="MediumMii" title="Medium Mii" /></td>
<td><img src="./img/StandardKart.png" alt="StandardKart" title="Standard Kart" /><img src="./img/TheDuke.png" alt="TheDuke" title="The Duke" /></td>
<td><img src="./img/Standard.png" alt="Standard" title="Standard" /><img src="./img/BlueStandard.png" alt="BlueStandard" title="Blue Standard" /></td>
<td><img src="./img/SuperGlider.png" alt="SuperGlider" title="Super Glider" /><img src="./img/WaddleWing.png" alt="WaddleWing" title="Waddle Wing" /><img src="./img/HylianKite.png" alt="HylianKite" title="Hylian Kite" /></td>
<td><img src="./img/Mario.webp" alt="Mario" title="Mario" /><img src="./img/Ludwig.webp" alt="Ludwig" title="Ludwig" /><img src="./img/MediumMii.webp" alt="MediumMii" title="Medium Mii" /></td>
<td><img src="./img/StandardKart.webp" alt="StandardKart" title="Standard Kart" /><img src="./img/TheDuke.webp" alt="TheDuke" title="The Duke" /></td>
<td><img src="./img/Standard.webp" alt="Standard" title="Standard" /><img src="./img/BlueStandard.webp" alt="BlueStandard" title="Blue Standard" /></td>
<td><img src="./img/SuperGlider.webp" alt="SuperGlider" title="Super Glider" /><img src="./img/WaddleWing.webp" alt="WaddleWing" title="Waddle Wing" /><img src="./img/HylianKite.webp" alt="HylianKite" title="Hylian Kite" /></td>
</tr>
</tbody>
</table>
Expand Down
3 changes: 3 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -12,5 +12,8 @@
},
"devDependencies": {
"express": "^5.0.1"
},
"engines": {
"node": "^18.18.0 || >=19.0.0"
}
}
6 changes: 3 additions & 3 deletions src/imageCache.civet
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
class ImageCache
#map: Map<string, HTMLImageElement>
#map: Map string, HTMLImageElement

@()
#map = new Map
Expand All @@ -9,9 +9,9 @@ class ImageCache
#map.get(name)!.cloneNode() as HTMLImageElement
else
document.createElement 'img'
||> .src = `./img/${name}.png`
||> .src = `./img/${name}.webp`
||> .alt = name
||> .title = name.replace /(?<=[^A-Z])[A-Z]|(?!^)[A-Z][a-z]|(?<=\D)\d/g, ' $&'
||> #map@set name
||> #map.set name, .

export default cache := new ImageCache
16 changes: 8 additions & 8 deletions src/index.civet
Original file line number Diff line number Diff line change
Expand Up @@ -164,27 +164,27 @@ updatePreview := :void =>
imgError .= false

if characterName? := characterDropdown.selectedOptions.0?.dataset.name
characterImg.src = `./img/${characterName}.png`
characterImg.src = `./img/${characterName}.webp`
for rival of currData.rivals[characterName] ?? []
rival |> cache.getImage |> rivalImgContainer.appendChild
else
characterImg.src = './img/unknown.png'
characterImg.src = './img/unknown.webp'
imgError = true

if kartName? := kartDropdown.selectedOptions.0?.dataset.name
kartImg.src = `./img/${kartName}.png`
kartImg.src = `./img/${kartName}.webp`
else
kartImg.src = './img/unknown.png'
kartImg.src = './img/unknown.webp'
imgError = true
if wheelName? := wheelDropdown.selectedOptions.0?.dataset.name
wheelImg.src = `./img/${wheelName}.png`
wheelImg.src = `./img/${wheelName}.webp`
else
wheelImg.src = './img/unknown.png'
wheelImg.src = './img/unknown.webp'
imgError = true
if gliderName? := gliderDropdown.selectedOptions.0?.dataset.name
gliderImg.src = `./img/${gliderName}.png`
gliderImg.src = `./img/${gliderName}.webp`
else
gliderImg.src = './img/unknown.png'
gliderImg.src = './img/unknown.webp'
imgError = true

unless character? and kart? and wheel? and glider? and not imgError
Expand Down

0 comments on commit 38d57cc

Please sign in to comment.