From 506d435b6f43c4942031d0f1c04b9c0cfce90430 Mon Sep 17 00:00:00 2001 From: "caleb.mabry.15@cnu.edu" Date: Mon, 14 Mar 2022 22:03:20 -0400 Subject: Final fix for overlapping chars --- public/client.html | 40 ++++++++-------------------------------- webAO/client/setEmote.js | 27 ++++++++++++--------------- 2 files changed, 20 insertions(+), 47 deletions(-) diff --git a/public/client.html b/public/client.html index dc924fb..e11d662 100644 --- a/public/client.html +++ b/public/client.html @@ -83,40 +83,22 @@
- - - - +
- - - - +
- - - - +
- - - - +
- - - - +
- - - - +
@@ -125,16 +107,10 @@
- - - - +
- - - - +
diff --git a/webAO/client/setEmote.js b/webAO/client/setEmote.js index 16c95be..862e81a 100644 --- a/webAO/client/setEmote.js +++ b/webAO/client/setEmote.js @@ -10,22 +10,19 @@ const setEmote = (AO_HOST, client, charactername, emotename, prefix, pair, side) const characterFolder = `${AO_HOST}characters/`; const acceptedPositions = ['def', 'pro', 'wit']; const position = acceptedPositions.includes(side) ? `${side}_` : ''; + const emoteSelector = document.getElementById(`client_${position}${pairID}_img`) + const extensionsMap = [ + '.gif', + '.png', + '.apng', + '.webp' + ]; + const transparentPNG = 'data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAEAAAABCAQAAAC1HAwCAAAAC0lEQVR42mNkYAAAAAYAAjCB0C8AAAAASUVORK5CYII='; - const gif_s = document.getElementById(`client_${position}${pairID}_gif`); - const png_s = document.getElementById(`client_${position}${pairID}_png`); - const apng_s = document.getElementById(`client_${position}${pairID}_apng`); - const webp_s = document.getElementById(`client_${position}${pairID}_webp`); - const extensionsMap = { - '.gif': gif_s, - '.png': png_s, - '.apng': apng_s, - '.webp': webp_s, - }; - - for (const [extension, htmlElement] of Object.entries(extensionsMap)) { + for (const extension of extensionsMap) { // Hides all sprites before creating a new sprite if (client.lastChar !== client.chatmsg.name) { - htmlElement.src = transparentPNG; + emoteSelector.src = transparentPNG; } let url; if (extension === '.png') { @@ -35,8 +32,8 @@ const setEmote = (AO_HOST, client, charactername, emotename, prefix, pair, side) } const exists = fileExistsSync(url); if (exists) { - htmlElement.src = url; - return; + emoteSelector.src = url; + break; } } }; -- cgit From 865d0a10c22b529f1eb125077bbdd8139dc2c214 Mon Sep 17 00:00:00 2001 From: "caleb.mabry.15@cnu.edu" Date: Mon, 14 Mar 2022 22:30:03 -0400 Subject: Fixing characters again --- public/client.html | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/public/client.html b/public/client.html index e11d662..07b1ea9 100644 --- a/public/client.html +++ b/public/client.html @@ -107,10 +107,10 @@
- +
- +
-- cgit From 61c765fcb42804aef73d31b5c9129f9aeb25f8da Mon Sep 17 00:00:00 2001 From: "caleb.mabry.15@cnu.edu" Date: Wed, 16 Mar 2022 20:08:32 -0400 Subject: Resolving first comment --- public/client.html | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/public/client.html b/public/client.html index 07b1ea9..7a563d2 100644 --- a/public/client.html +++ b/public/client.html @@ -83,7 +83,7 @@
- +
-- cgit From 9b926731bcf36b621a0e792e5777823afcf9282d Mon Sep 17 00:00:00 2001 From: "caleb.mabry.15@cnu.edu" Date: Wed, 16 Mar 2022 20:10:29 -0400 Subject: Adding transparentpng to constants --- webAO/client.js | 7 ++++--- webAO/client/setEmote.js | 4 ++-- webAO/constants/transparentPng.js | 1 + 3 files changed, 7 insertions(+), 5 deletions(-) create mode 100644 webAO/constants/transparentPng.js diff --git a/webAO/client.js b/webAO/client.js index 8bac1cc..34a1b4b 100644 --- a/webAO/client.js +++ b/webAO/client.js @@ -28,6 +28,7 @@ import fileExists from './utils/fileExists.js'; import queryParser from './utils/queryParser.js'; import getAnimLength from './utils/getAnimLength.js'; import getResources from './utils/getResources.js'; +import transparentPng from './constants/transparentPng'; const version = process.env.npm_package_version; @@ -44,7 +45,6 @@ const THEME = theme || 'default'; const UPDATE_INTERVAL = 60; -const transparentPNG = 'data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAEAAAABCAQAAAC1HAwCAAAAC0lEQVR42mNkYAAAAAYAAjCB0C8AAAAASUVORK5CYII='; /** * Toggles AO1-style loading using paginated music packets for mobile platforms. * The old loading uses more smaller packets instead of a single big one, @@ -2083,7 +2083,8 @@ class Viewport { const baseEffectUrl = `${AO_HOST}themes/default/effects/`; fg.src = `${baseEffectUrl}${encodeURI(this.chatmsg.effects[0].toLowerCase())}.webp`; } else { - fg.src = transparentPNG; + + fg.src = transparentPng; } const soundChecks = ['0', '1', '', undefined]; @@ -2599,7 +2600,7 @@ window.changeCharacter = changeCharacter; */ export function charError(image) { console.warn(`${image.src} is missing from webAO`); - image.src = transparentPNG; + image.src = transparentPng; return true; } window.charError = charError; diff --git a/webAO/client/setEmote.js b/webAO/client/setEmote.js index 862e81a..4bbaab7 100644 --- a/webAO/client/setEmote.js +++ b/webAO/client/setEmote.js @@ -1,3 +1,4 @@ +import transparentPng from '../constants/transparentPng'; import fileExistsSync from '../utils/fileExistsSync'; /** @@ -17,12 +18,11 @@ const setEmote = (AO_HOST, client, charactername, emotename, prefix, pair, side) '.apng', '.webp' ]; - const transparentPNG = 'data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAEAAAABCAQAAAC1HAwCAAAAC0lEQVR42mNkYAAAAAYAAjCB0C8AAAAASUVORK5CYII='; for (const extension of extensionsMap) { // Hides all sprites before creating a new sprite if (client.lastChar !== client.chatmsg.name) { - emoteSelector.src = transparentPNG; + emoteSelector.src = transparentPng; } let url; if (extension === '.png') { diff --git a/webAO/constants/transparentPng.js b/webAO/constants/transparentPng.js new file mode 100644 index 0000000..f78dae0 --- /dev/null +++ b/webAO/constants/transparentPng.js @@ -0,0 +1 @@ +export default 'data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAEAAAABCAQAAAC1HAwCAAAAC0lEQVR42mNkYAAAAAYAAjCB0C8AAAAASUVORK5CYII='; \ No newline at end of file -- cgit From ec459ba3f054be81e9c8cd4531789a19512415fa Mon Sep 17 00:00:00 2001 From: "caleb.mabry.15@cnu.edu" Date: Wed, 16 Mar 2022 21:40:11 -0400 Subject: Added 2 more I forgot --- public/client.html | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/public/client.html b/public/client.html index 7a563d2..6d3810a 100644 --- a/public/client.html +++ b/public/client.html @@ -89,13 +89,13 @@
- +
- +
-- cgit