diff options
Diffstat (limited to 'webAO/dom')
| -rw-r--r-- | webAO/dom/resizeChatbox.ts | 11 | ||||
| -rw-r--r-- | webAO/dom/updateBackgroundPreview.ts | 17 |
2 files changed, 17 insertions, 11 deletions
diff --git a/webAO/dom/resizeChatbox.ts b/webAO/dom/resizeChatbox.ts index 887877d..0fb737d 100644 --- a/webAO/dom/resizeChatbox.ts +++ b/webAO/dom/resizeChatbox.ts @@ -3,13 +3,18 @@ import { CHATBOX } from "../client"; * Set the font size for the chatbox */ export function resizeChatbox() { - const chatContainerBox = document.getElementById("client_chatcontainer")!; + const chatContainerBox = document.getElementById("client_chatcontainer"); + const clockBox = document.getElementById("client_clock"); + const trackstatusBox = document.getElementById("client_trackstatus"); + const gameHeight = document.getElementById("client_background")!.offsetHeight; chatContainerBox.style.fontSize = `${(gameHeight * 0.0521).toFixed(1)}px`; + clockBox.style.fontSize = `${(gameHeight * 0.0521).toFixed(1)}px`; + trackstatusBox.style.fontSize = `${(gameHeight * 0.0521).toFixed(1)}px`; const trackstatus = <HTMLMarqueeElement>(document.getElementById("client_trackstatustext")); - trackstatus.width = (trackstatus.offsetWidth - 1) + "px"; + trackstatus.style.width = (trackstatus.offsetWidth - 1) + "px"; //clock @@ -25,7 +30,7 @@ export function resizeChatbox() { } else if (CHATBOX == "key") { weekday = ["Sun.", "Mon.", "Tue.", "Wed.", "Thu.", "Fri.", "Sat."]; document.getElementById("client_clock_weekday")!.innerText = weekday[now.getDay()]; - document.getElementById("client_clock_date")!.innerText = String(now.getDay()); + document.getElementById("client_clock_date")!.innerText = String(now.getDate()); } } 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; |
