diff options
Diffstat (limited to 'webAO/dom/updateBackgroundPreview.ts')
| -rw-r--r-- | webAO/dom/updateBackgroundPreview.ts | 17 |
1 files changed, 9 insertions, 8 deletions
diff --git a/webAO/dom/updateBackgroundPreview.ts b/webAO/dom/updateBackgroundPreview.ts index b41ee8f..01b5c44 100644 --- a/webAO/dom/updateBackgroundPreview.ts +++ b/webAO/dom/updateBackgroundPreview.ts @@ -1,4 +1,6 @@ -import { AO_HOST } from '../client/aoHost' +import { AO_HOST } from '../client/aoHost'; +import tryUrls from "../utils/tryUrls"; + /** * Update background preview. */ @@ -15,14 +17,13 @@ export function updateBackgroundPreview() { if (background_select.selectedIndex === 0) { background_filename.style.display = "initial"; - background_preview.src = `${AO_HOST}background/${encodeURI( - background_filename.value.toLowerCase() - )}/defenseempty.png`; } else { background_filename.style.display = "none"; - background_preview.src = `${AO_HOST}background/${encodeURI( - background_select.value.toLowerCase() - )}/defenseempty.png`; } + tryUrls(`${AO_HOST}background/${encodeURI( + background_select.value.toLowerCase() + )}/defenseempty`).then((resp) => { + background_preview.src = resp; + }); } -window.updateBackgroundPreview = updateBackgroundPreview;
\ No newline at end of file +window.updateBackgroundPreview = updateBackgroundPreview; |
