From f8b3c9ff47688d253c18c656a90c656f78972f20 Mon Sep 17 00:00:00 2001 From: Jan200101 Date: Sat, 20 Jul 2024 20:19:02 +0200 Subject: show guide button for mods with non-default installation methods --- src/app/js/browser.js | 27 +++++++++++++++++++-------- 1 file changed, 19 insertions(+), 8 deletions(-) (limited to 'src/app/js') 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 = `
@@ -459,9 +472,7 @@ browser.mod_el = (properties) => {
` - entry.querySelector("button.install").addEventListener("click", () => { - browser.install(properties); - }) + entry.querySelector("button.install").addEventListener("click", installcallback) browserEntries.appendChild(entry); } -- cgit v1.2.3 From 960b6c96ca8a7d7d293f306240c7af4cbf52306b Mon Sep 17 00:00:00 2001 From: Jan200101 Date: Sun, 21 Jul 2024 18:19:36 +0200 Subject: open non-default installation guide externally --- src/app/js/browser.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'src/app/js') diff --git a/src/app/js/browser.js b/src/app/js/browser.js index f010038..3415ebf 100644 --- a/src/app/js/browser.js +++ b/src/app/js/browser.js @@ -1,5 +1,5 @@ const Fuse = require("fuse.js"); -const ipcRenderer = require("electron").ipcRenderer; +const { ipcRenderer, shell } = require("electron"); const lang = require("../../lang"); @@ -426,7 +426,7 @@ browser.mod_el = (properties) => { installstr = lang("gui.browser.guide"); installcallback = () => { - browser.preview.set(nondefault_install[normalized_title]) + shell.openExternal(nondefault_install[normalized_title]) } } else if (properties.pkg.local_version) { -- cgit v1.2.3