From 4e414f4d262bc9792b8431940bb7a7549b346916 Mon Sep 17 00:00:00 2001 From: octospacc Date: Sat, 6 Jan 2024 00:23:21 +0100 Subject: [PATCH] Hotfix MatrixStickerHelper --- public/MatrixStickerHelper/index.html | 15 +++++++++------ 1 file changed, 9 insertions(+), 6 deletions(-) diff --git a/public/MatrixStickerHelper/index.html b/public/MatrixStickerHelper/index.html index dd9ecbc..60c443b 100644 --- a/public/MatrixStickerHelper/index.html +++ b/public/MatrixStickerHelper/index.html @@ -161,7 +161,7 @@ TODO:

[2024-01-05]

  • Uploading stickers from (multiple) local image files
  • -
  • Deleting individual stickers from packs
  • +
  • Deleting individual stickers from packs (+ bug hotfix)
  • Various bugfixes and UX improvements
  • @@ -470,11 +470,13 @@ TODO: } function ShowStickerPack (event, packObject) { - const thisElem = (event.target.tagName.toLowerCase() === 'button' ? event.target : event.target.parentElement); - for (const elem of thisElem.parentElement.querySelectorAll('button')) { - elem.disabled = false; + if (event) { + const thisElem = (event.target.tagName.toLowerCase() === 'button' ? event.target : event.target.parentElement); + for (const elem of thisElem.parentElement.querySelectorAll('button')) { + elem.disabled = false; + } + thisElem.disabled = true; } - thisElem.disabled = true; $`#LayoutPackActions input[name="packName"]`.value = packObject.data.title; $`#LayoutPackActions button[name="packDelete"]`.onclick = () => { // TODO: this makes the commit button go usable even if the pack was just created and had no stickers... not important but would be a small UI improvement @@ -561,9 +563,10 @@ TODO: }, }; //stickerData[Defaults.appIdentity] = {}; + const globalStickerIndex = (packObject.data.stickers.length + newPackStickers.length); const stickerElem = $().createElement('button'); stickerElem.innerHTML = ``; - stickerElem.onclick = () => OnClickStickerButton(event, packObject, stickerData, newPackStickers.length); + stickerElem.onclick = () => OnClickStickerButton(null, packObject, stickerData, globalStickerIndex); $`#LayoutPackGrid`.insertBefore(stickerElem, event.target.parentElement); newPackStickers.push(stickerData); } else {