diff options
| author | Caleb <caleb.mabry.15@cnu.edu> | 2022-09-04 00:02:19 -0400 |
|---|---|---|
| committer | Caleb <caleb.mabry.15@cnu.edu> | 2022-09-04 00:02:19 -0400 |
| commit | 67314a8bc22ea198b8e3de788282a0ca0151cb1e (patch) | |
| tree | 92d827d3acd06bc1e33fc94c45a0be3613a95ae3 /webAO/dom/updateBackgroundPreview.ts | |
| parent | d20994bd7c244cc84ab138cec441b05c261a83e4 (diff) | |
Several functions moved
Diffstat (limited to 'webAO/dom/updateBackgroundPreview.ts')
| -rw-r--r-- | webAO/dom/updateBackgroundPreview.ts | 29 |
1 files changed, 29 insertions, 0 deletions
diff --git a/webAO/dom/updateBackgroundPreview.ts b/webAO/dom/updateBackgroundPreview.ts new file mode 100644 index 0000000..e55bf60 --- /dev/null +++ b/webAO/dom/updateBackgroundPreview.ts @@ -0,0 +1,29 @@ +import { AO_HOST } from "../client"; + +/** + * 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 |
