From 25fe710c3b36b097502a5f3e0afb024312cbf7b9 Mon Sep 17 00:00:00 2001 From: Caleb Mabry <36182383+caleb-mabry@users.noreply.github.com> Date: Sun, 17 Jul 2022 00:56:15 -0400 Subject: Moved viewport out of client --- webAO/client/setEmote.js | 40 ---------------------------------------- 1 file changed, 40 deletions(-) delete mode 100644 webAO/client/setEmote.js (limited to 'webAO/client/setEmote.js') diff --git a/webAO/client/setEmote.js b/webAO/client/setEmote.js deleted file mode 100644 index f682fe5..0000000 --- a/webAO/client/setEmote.js +++ /dev/null @@ -1,40 +0,0 @@ -import transparentPng from '../constants/transparentPng'; -import fileExists from '../utils/fileExists'; - -/** - * Sets all the img tags to the right sources - * @param {*} chatmsg - */ - -const setEmote = async (AO_HOST, client, charactername, emotename, prefix, pair, side) => { - const pairID = pair ? 'pair' : 'char'; - 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' - ]; - - for (const extension of extensionsMap) { - // Hides all sprites before creating a new sprite - if (client.lastChar !== client.chatmsg.name) { - emoteSelector.src = transparentPng; - } - let url; - if (extension === '.png') { - url = `${characterFolder}${encodeURI(charactername)}/${encodeURI(emotename)}${extension}`; - } else { - url = `${characterFolder}${encodeURI(charactername)}/${encodeURI(prefix)}${encodeURI(emotename)}${extension}`; - } - const exists = await fileExists(url); - if (exists) { - emoteSelector.src = url; - break; - } - } -}; -export default setEmote; -- cgit