aboutsummaryrefslogtreecommitdiff
path: root/src/app/js/mods.js
diff options
context:
space:
mode:
author0neGal <mail@0negal.com>2023-02-07 21:44:21 +0100
committer0neGal <mail@0negal.com>2023-02-07 22:09:12 +0100
commit416679e95792872b8f1e994aee4ea708ce4a1293 (patch)
tree4e9fb28a8add888e93968369e89f02558df8a693 /src/app/js/mods.js
parent26175fe28f1c28ace34618e3eac2a7b1a88f4b0a (diff)
downloadViper-416679e95792872b8f1e994aee4ea708ce4a1293.tar.gz
Viper-416679e95792872b8f1e994aee4ea708ce4a1293.zip
added icons to modlist
Diffstat (limited to 'src/app/js/mods.js')
-rw-r--r--src/app/js/mods.js27
1 files changed, 20 insertions, 7 deletions
diff --git a/src/app/js/mods.js b/src/app/js/mods.js
index fd900a2..19c5bda 100644
--- a/src/app/js/mods.js
+++ b/src/app/js/mods.js
@@ -6,7 +6,6 @@ mods.load = (mods_obj) => {
let normalized_names = [];
let set_mod = (mod) => {
- let image_url = "";
let normalized_name = "mod-list-" + normalize(mod.Name);
normalized_names.push(normalized_name);
@@ -28,8 +27,8 @@ mods.load = (mods_obj) => {
div.innerHTML += `
<div class="image">
- <img src="${image_url}">
- <img class="blur" src="${image_url}">
+ <img src="">
+ <img class="blur" src="">
</div>
<div class="text">
<div class="title">${mod.Name}</div>
@@ -42,7 +41,7 @@ mods.load = (mods_obj) => {
${lang("gui.mods.remove")}
</button>
- <button class="visual">${mod.Version}</button>
+ <button class="visual">${version.format(mod.Version)}</button>
<button class="visual">
${lang("gui.browser.madeby")}
${mod.Author || lang("gui.mods.unknown_author")}
@@ -58,9 +57,7 @@ mods.load = (mods_obj) => {
mods.toggle(mod.Name);
})
- if (! image_url) {
- div.querySelector(".image").remove();
- }
+ div.querySelector(".image").style.display = "none";
modsdiv.append(div);
}
@@ -90,6 +87,22 @@ mods.load = (mods_obj) => {
return;
}
+ if (mod_versions[mod]) {
+ let image_url = mod_versions[mod].package.versions[0].icon;
+
+ let image_container = mod_els[i].querySelector(".image");
+ let image_el = image_container.querySelector("img")
+ let image_blur_el = image_container.querySelector("img.blur")
+
+ if (image_url && ! image_el.getAttribute("src")) {
+ image_container.style.display = null;
+ image_el.src = image_url;
+ image_blur_el.src = image_url;
+
+ image_container.parentElement.classList.add("has-icon");
+ }
+ }
+
if (mod_versions[mod]
&& mod_versions[mod].has_update) {