diff options
| author | Caleb <caleb.mabry.15@cnu.edu> | 2022-09-06 21:55:10 -0400 |
|---|---|---|
| committer | Caleb <caleb.mabry.15@cnu.edu> | 2022-09-06 21:55:10 -0400 |
| commit | ccec95a9d3b68e25e24a9168400fc47099a85c81 (patch) | |
| tree | 4228d606b206aa9f7f9438a5e69e3e721bc02643 /webAO/dom/updateBackgroundPreview.ts | |
| parent | 84184b35c8564a1c51cc67d9781d2463fd159527 (diff) | |
More window functions
Diffstat (limited to 'webAO/dom/updateBackgroundPreview.ts')
| -rw-r--r-- | webAO/dom/updateBackgroundPreview.ts | 28 |
1 files changed, 28 insertions, 0 deletions
diff --git a/webAO/dom/updateBackgroundPreview.ts b/webAO/dom/updateBackgroundPreview.ts new file mode 100644 index 0000000..b41ee8f --- /dev/null +++ b/webAO/dom/updateBackgroundPreview.ts @@ -0,0 +1,28 @@ +import { AO_HOST } from '../client/aoHost' +/** + * Update background preview. + */ +export function updateBackgroundPreview() { + const background_select = <HTMLSelectElement>( + document.getElementById("bg_select") + ); + const background_filename = <HTMLInputElement>( + document.getElementById("bg_filename") + ); + const background_preview = <HTMLImageElement>( + document.getElementById("bg_preview") + ); + + 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`; + } +} +window.updateBackgroundPreview = updateBackgroundPreview;
\ No newline at end of file |
