From 779f897027acab151e26315381982450dd79f448 Mon Sep 17 00:00:00 2001 From: Redume Date: Fri, 16 Dec 2022 09:29:07 +0300 Subject: [PATCH] Fixed a bug where re-hiding the description did not work correctly --- web/static/scripts/gallery.js | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/web/static/scripts/gallery.js b/web/static/scripts/gallery.js index c2d809e..371fc77 100644 --- a/web/static/scripts/gallery.js +++ b/web/static/scripts/gallery.js @@ -109,7 +109,8 @@ function wallpaperLoad(data) { ids[id]['copyright'] = ids[id]['copyright'] === undefined ? "NASA" : ids[id]['copyright']; - let explanation = ids[id]['explanation'].length > 200 ? ids[id]['explanation'].slice(0, 200) + "..." : ids[id]['explanation']; + const explanation = ids[id]['explanation'].length > 200 ? ids[id]['explanation'].slice(0, 200) + "..." : ids[id]['explanation']; + console.log(explanation); if (ids[id]['media_type'] === "image") { title.innerHTML = ``; img.innerHTML = ` @@ -192,7 +193,7 @@ function wallpaperLoad(data) { explanation.innerHTML = `Explanation: ${ids[id]['explanation']}`; showMore.innerHTML = "Show less"; } else { - explanation.innerHTML = explanation.innerHTML.slice(0, 200) + "..."; + explanation.innerHTML = `Explanation: ${ids[id]['explanation'].length > 200 ? ids[id]['explanation'].slice(0, 200) + "..." : ids[id]['explanation']}`; showMore.innerHTML = "Show more"; } });