Skip to content

Commit

Permalink
use ? image rather than invalid URL
Browse files Browse the repository at this point in the history
  • Loading branch information
bbrk24 committed Mar 19, 2024
1 parent 27a2909 commit 5f23dce
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 8 deletions.
Binary file added img/unknown.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
16 changes: 8 additions & 8 deletions src/index.civet
Original file line number Diff line number Diff line change
Expand Up @@ -142,7 +142,7 @@ updatePreview := :void =>
||> .src = `./img/${rival}.png`
|> rivalImgContainer.appendChild
catch
characterImg.src = ''
characterImg.src = './img/unknown.png'

character := try data.characters[+characterDropdown.value]
kart := try data.karts[+kartDropdown.value]
Expand All @@ -153,17 +153,17 @@ updatePreview := :void =>
try
kartImg.src = `./img/${Array::find.call(kartDropdown.options, .selected).text.replaceAll ' ', ''}.png`
catch
kartImg.src = ''
kartImg.src = './img/unknown.png'
imgError = true
try
wheelImg.src = `./img/${Array::find.call(wheelDropdown.options, .selected).text.replaceAll ' ', ''}.png`
catch
wheelImg.src = ''
wheelImg.src = './img/unknown.png'
imgError = true
try
gliderImg.src = `./img/${Array::find.call(gliderDropdown.options, .selected).text.replaceAll ' ', ''}.png`
catch
gliderImg.src = ''
gliderImg.src = './img/unknown.png'
imgError = true

unless character? and kart? and wheel? and glider? and not imgError
Expand Down Expand Up @@ -198,10 +198,10 @@ updatePreview()
[characterDropdown, kartDropdown, wheelDropdown, gliderDropdown].forEach .addEventListener 'change', updatePreview, { +passive }

function setPreviewedKart(character: string, kart: string, wheels: string, glider: string)
characterDropdown.selectedIndex = Array::findIndex.call characterDropdown.options, &.text.replaceAll(' ', '') is character
kartDropdown.selectedIndex = Array::findIndex.call kartDropdown.options, &.text.replaceAll(' ', '') is kart
wheelDropdown.selectedIndex = Array::findIndex.call wheelDropdown.options, &.text.replaceAll(' ', '') is wheels
gliderDropdown.selectedIndex = Array::findIndex.call gliderDropdown.options, &.text.replaceAll(' ', '') is glider
characterDropdown.selectedIndex = Array::findIndex.call characterDropdown.options, .text.replaceAll(' ', '') is character
kartDropdown.selectedIndex = Array::findIndex.call kartDropdown.options, .text.replaceAll(' ', '') is kart
wheelDropdown.selectedIndex = Array::findIndex.call wheelDropdown.options, .text.replaceAll(' ', '') is wheels
gliderDropdown.selectedIndex = Array::findIndex.call gliderDropdown.options, .text.replaceAll(' ', '') is glider
updatePreview()

menu := document.querySelector('menu')!
Expand Down

0 comments on commit 5f23dce

Please sign in to comment.