From 67314a8bc22ea198b8e3de788282a0ca0151cb1e Mon Sep 17 00:00:00 2001 From: Caleb Date: Sun, 4 Sep 2022 00:02:19 -0400 Subject: Several functions moved --- webAO/dom/updateBackgroundPreview.ts | 29 +++++++++++++++++++++++++++++ 1 file changed, 29 insertions(+) create mode 100644 webAO/dom/updateBackgroundPreview.ts (limited to 'webAO/dom/updateBackgroundPreview.ts') 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 = ( + document.getElementById("bg_select") + ); + const background_filename = ( + document.getElementById("bg_filename") + ); + const background_preview = ( + 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 -- cgit From 1e3fde25b9f6d8adbdf087a51a34dc35cc1907d8 Mon Sep 17 00:00:00 2001 From: stonedDiscord Date: Sun, 4 Sep 2022 22:30:31 +0200 Subject: undo dom stuff --- webAO/dom/updateBackgroundPreview.ts | 29 ----------------------------- 1 file changed, 29 deletions(-) delete mode 100644 webAO/dom/updateBackgroundPreview.ts (limited to 'webAO/dom/updateBackgroundPreview.ts') diff --git a/webAO/dom/updateBackgroundPreview.ts b/webAO/dom/updateBackgroundPreview.ts deleted file mode 100644 index e55bf60..0000000 --- a/webAO/dom/updateBackgroundPreview.ts +++ /dev/null @@ -1,29 +0,0 @@ -import { AO_HOST } from "../client"; - -/** - * Update background preview. - */ -export function updateBackgroundPreview() { - const background_select = ( - document.getElementById("bg_select") - ); - const background_filename = ( - document.getElementById("bg_filename") - ); - const background_preview = ( - 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 -- cgit From ccec95a9d3b68e25e24a9168400fc47099a85c81 Mon Sep 17 00:00:00 2001 From: Caleb Date: Tue, 6 Sep 2022 21:55:10 -0400 Subject: More window functions --- webAO/dom/updateBackgroundPreview.ts | 28 ++++++++++++++++++++++++++++ 1 file changed, 28 insertions(+) create mode 100644 webAO/dom/updateBackgroundPreview.ts (limited to 'webAO/dom/updateBackgroundPreview.ts') 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 = ( + document.getElementById("bg_select") + ); + const background_filename = ( + document.getElementById("bg_filename") + ); + const background_preview = ( + 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 -- cgit