diff options
author | Jan200101 <sentrycraft123@gmail.com> | 2024-07-20 20:19:02 +0200 |
---|---|---|
committer | Jan200101 <sentrycraft123@gmail.com> | 2024-07-20 20:19:02 +0200 |
commit | f8b3c9ff47688d253c18c656a90c656f78972f20 (patch) | |
tree | 1e7b8503d726b410978fe396d644bda04550e253 /src | |
parent | 6f600624ad818ca80a4c342ac0259f95c8b6934d (diff) | |
download | Viper-f8b3c9ff47688d253c18c656a90c656f78972f20.tar.gz Viper-f8b3c9ff47688d253c18c656a90c656f78972f20.zip |
show guide button for mods with non-default installation methods
Diffstat (limited to 'src')
-rw-r--r-- | src/app/js/browser.js | 27 | ||||
-rw-r--r-- | src/lang/de.json | 1 | ||||
-rw-r--r-- | src/lang/en.json | 1 |
3 files changed, 21 insertions, 8 deletions
diff --git a/src/app/js/browser.js b/src/app/js/browser.js index 7dc84d9..f010038 100644 --- a/src/app/js/browser.js +++ b/src/app/js/browser.js @@ -414,13 +414,22 @@ browser.mod_el = (properties) => { let installicon = "downloads"; let installstr = lang("gui.browser.install"); - let normalized_mods = []; + let installcallback = () => {}; + let normalized_title = mods.normalize(properties.title) - for (let i = 0; i < mods.list().all; i++) { - normalized_mods.push(mods.normalize(mods_list[i].name)); + let nondefault_install = { + "vanillaplus": "https://github.com/Zayveeo5e/NP.VanillaPlus/blob/main/README.md" } - if (properties.pkg.local_version) { + if (normalized_title in nondefault_install) { + installicon = "open"; + installstr = lang("gui.browser.guide"); + + installcallback = () => { + browser.preview.set(nondefault_install[normalized_title]) + } + } + else if (properties.pkg.local_version) { installicon = "redo"; installstr = lang("gui.browser.reinstall"); @@ -428,11 +437,15 @@ browser.mod_el = (properties) => { installicon = "downloads"; installstr = lang("gui.browser.update"); } + + installcallback = () => { + browser.install(properties); + } } let entry = document.createElement("div"); entry.classList.add("el"); - entry.id = `mod-${mods.normalize(properties.title)}`; + entry.id = `mod-${normalized_title}`; entry.innerHTML = ` <div class="image"> @@ -459,9 +472,7 @@ browser.mod_el = (properties) => { </div> ` - entry.querySelector("button.install").addEventListener("click", () => { - browser.install(properties); - }) + entry.querySelector("button.install").addEventListener("click", installcallback) browserEntries.appendChild(entry); } diff --git a/src/lang/de.json b/src/lang/de.json index 9e68986..0eb17dc 100644 --- a/src/lang/de.json +++ b/src/lang/de.json @@ -72,6 +72,7 @@ "server": "Server-seitig", "skins": "Skins" }, + "guide": "Anleitung", "info": "Info", "install": "Installieren", "load_more": "Lade mehr...", diff --git a/src/lang/en.json b/src/lang/en.json index c705517..f968f73 100644 --- a/src/lang/en.json +++ b/src/lang/en.json @@ -119,6 +119,7 @@ "load_more": "Load more...", "end_of_list": "All packages have been loaded.", "no_results": "No results...", + "guide": "Guide", "filter": { "mods": "Mods", |