aboutsummaryrefslogtreecommitdiff
path: root/src/app
diff options
context:
space:
mode:
author0neGal <mail@0negal.com>2022-05-30 21:53:41 +0200
committer0neGal <mail@0negal.com>2022-05-30 21:53:41 +0200
commit7ddfd200abad2de370d49f6a58862a71c148111d (patch)
tree39cdb07eaf4badc7f5391b55a55cfac6500e57b2 /src/app
parent992f747c5cd93b4fd8c5e27c3bd24766c5875a5c (diff)
downloadViper-7ddfd200abad2de370d49f6a58862a71c148111d.tar.gz
Viper-7ddfd200abad2de370d49f6a58862a71c148111d.zip
fixed missing commas and various syntax stuff
I know, commas aren't needed, however, going in and out of using commas and not using them also looks bad, so generally I try to always use them, with exceptions.
Diffstat (limited to 'src/app')
-rw-r--r--src/app/browser.js35
-rw-r--r--src/app/lang.js2
-rw-r--r--src/app/launcher.js9
-rw-r--r--src/app/main.js29
-rw-r--r--src/app/settings.js12
5 files changed, 46 insertions, 41 deletions
diff --git a/src/app/browser.js b/src/app/browser.js
index a292cf6..72ab24e 100644
--- a/src/app/browser.js
+++ b/src/app/browser.js
@@ -18,7 +18,6 @@ var Browser = {
}
}
- console.log(other)
return pkgs;
},
get: () => {
@@ -88,8 +87,8 @@ var Browser = {
toggle: (state) => {
if (state) {
browser.scrollTo(0, 0);
- overlay.classList.add("shown")
- browser.classList.add("shown")
+ overlay.classList.add("shown");
+ browser.classList.add("shown");
if (browserEntries.querySelectorAll(".el").length == 0) {
Browser.loadfront();
@@ -98,16 +97,16 @@ var Browser = {
} else if (! state) {
if (state != undefined) {
Browser.filters.toggle(false);
- overlay.classList.remove("shown")
- browser.classList.remove("shown")
- preview.classList.remove("shown")
+ overlay.classList.remove("shown");
+ browser.classList.remove("shown");
+ preview.classList.remove("shown");
return
}
}
browser.scrollTo(0, 0);
- overlay.classList.toggle("shown")
- browser.classList.toggle("shown")
+ overlay.classList.toggle("shown");
+ browser.classList.toggle("shown");
},
loadfront: async () => {
Browser.loading();
@@ -162,11 +161,11 @@ var Browser = {
}
if (pkgs.length == 0 || isEnd) {
- Browser.msg(`${lang('gui.browser.endoflist')}`)
+ Browser.msg(`${lang('gui.browser.endoflist')}`);
return
}
- Browser.msg(`<button id="loadmore">${lang("gui.browser.loadmore")}</button>`)
+ Browser.msg(`<button id="loadmore">${lang("gui.browser.loadmore")}</button>`);
loadmore.addEventListener("click", () => {
Browser.loadpkgs(pkgs);
Browser.endoflist(pkgs);
@@ -177,7 +176,7 @@ var Browser = {
let res = fuse.search(string);
if (res.length < 1) {
- Browser.loading(lang("gui.browser.noresults"))
+ Browser.loading(lang("gui.browser.noresults"));
return
}
@@ -244,12 +243,11 @@ var Browser = {
}
Browser.endoflist();
- console.log(pkgs)
break
}
try {
- new BrowserElFromObj(pkgs[i])
+ new BrowserElFromObj(pkgs[i]);
}catch(e) {}
count++;
@@ -420,10 +418,12 @@ ipcRenderer.on("installedmod", (event, mod) => {
function normalize(items) {
let main = (string) => {
- return string.replaceAll(" ", "").replaceAll(".", "").replaceAll("-", "").replaceAll("_", "").toLowerCase()
+ return string.replaceAll(" ", "")
+ .replaceAll(".", "").replaceAll("-", "")
+ .replaceAll("_", "").toLowerCase();
}
if (typeof items == "string") {
- return main(items)
+ return main(items);
} else {
let newArray = [];
for (let i = 0; i < items.length; i++) {
@@ -462,7 +462,6 @@ events.forEach((event) => {
let mouseAt = document.elementsFromPoint(mouseX, mouseY);
if (! mouseAt.includes(document.querySelector("#filter"))
&& ! mouseAt.includes(document.querySelector(".overlay"))) {
- console.log(mouseAt)
Browser.filters.toggle(false);
}
})
@@ -498,5 +497,7 @@ browser.addEventListener("mousemove", (event) => {
let checks = document.querySelectorAll(".check");
for (let i = 0; i < checks.length; i++) {
- checks[i].setAttribute("onclick", "this.classList.toggle('checked');Browser.loadfront();search.value = ''")
+ checks[i].setAttribute("onclick",
+ "this.classList.toggle('checked');Browser.loadfront();search.value = ''"
+ )
}
diff --git a/src/app/lang.js b/src/app/lang.js
index 6fdcd8d..f1c31d3 100644
--- a/src/app/lang.js
+++ b/src/app/lang.js
@@ -10,7 +10,7 @@ function setlang() {
if (html[i][0] != " " &&
html[i][html[i].length - 1] != " ") {
// Replaces it with it's string
- html[i] = lang(html[i])
+ html[i] = lang(html[i]);
}
}
diff --git a/src/app/launcher.js b/src/app/launcher.js
index 51d3a63..e0b56db 100644
--- a/src/app/launcher.js
+++ b/src/app/launcher.js
@@ -3,8 +3,8 @@ const markdown = require("marked").parse;
// Changes the main page
// This is the tabs in the sidebar
function page(page) {
- let pages = document.querySelectorAll(".mainContainer .contentContainer")
- let btns = document.querySelectorAll(".gamesContainer button")
+ let btns = document.querySelectorAll(".gamesContainer button");
+ let pages = document.querySelectorAll(".mainContainer .contentContainer");
for (let i = 0; i < pages.length; i++) {
pages[i].classList.add("hidden");
@@ -82,7 +82,10 @@ function showVpSection(section) {
}
function showNsSection(section) {
- if (!["main", "release", "mods"].includes(section)) throw new Error("unknown ns section");
+ if (!["main", "release", "mods"].includes(section)) {
+ throw new Error("unknown ns section");
+ }
+
nsMainBtn.removeAttribute("active");
nsModsBtn.removeAttribute("active");
nsReleaseBtn.removeAttribute("active");
diff --git a/src/app/main.js b/src/app/main.js
index 362450a..d132c35 100644
--- a/src/app/main.js
+++ b/src/app/main.js
@@ -36,9 +36,9 @@ if (fs.existsSync("viper.json")) {
}catch (e) {
let reset = confirm(lang("general.invalidconfig", navigator.language) + e);
if (! reset) {
- ipcRenderer.send("exit")
+ ipcRenderer.send("exit");
} else {
- fs.writeFileSync("viper.json", "{}")
+ fs.writeFileSync("viper.json", "{}");
ipcRenderer.send("relaunch");
}
@@ -100,12 +100,15 @@ function setButtons(state) {
}
}
- disablearray(document.querySelectorAll(".playBtnContainer .playBtn"))
- disablearray(document.querySelectorAll("#nsMods .buttons.modbtns button"))
- disablearray(document.querySelectorAll("#browser #browserEntries .text button"))
+ disablearray(document.querySelectorAll(".playBtnContainer .playBtn"));
+ disablearray(document.querySelectorAll("#nsMods .buttons.modbtns button"));
+ disablearray(document.querySelectorAll("#browser #browserEntries .text button"));
}
-ipcRenderer.on("setbuttons", (event, state) => {setButtons(state)})
+ipcRenderer.on("setbuttons", (event, state) => {
+ setButtons(state);
+})
+
ipcRenderer.on("gamepathlost", (event, state) => {
page(0);
setButtons(false);
@@ -172,7 +175,7 @@ function selected(all) {
}
}
- ipcRenderer.send("removemod", selected)
+ ipcRenderer.send("removemod", selected);
},
toggle: () => {
if (selected.match(/^Northstar\./)) {
@@ -185,7 +188,7 @@ function selected(all) {
}
}
- ipcRenderer.send("togglemod", selected)
+ ipcRenderer.send("togglemod", selected);
}
}
}
@@ -195,19 +198,18 @@ let installqueue = [];
// Tells the main process to install a mod through the file selector
function installmod() {
setButtons(false);
- ipcRenderer.send("installmod")
+ ipcRenderer.send("installmod");
}
// Tells the main process to directly install a mod from this path
function installFromPath(path) {
setButtons(false);
- ipcRenderer.send("installfrompath", path)
+ ipcRenderer.send("installfrompath", path);
}
// Tells the main process to install a mod from a URL
function installFromURL(url, dependencies, clearqueue) {
if (clearqueue) {installqueue = []};
- console.log(installqueue)
let prettydepends = [];
@@ -215,7 +217,6 @@ function installFromURL(url, dependencies, clearqueue) {
let newdepends = [];
for (let i = 0; i < dependencies.length; i++) {
let depend = dependencies[i].toLowerCase();
- console.log(depend)
if (! depend.match(/northstar-northstar-.*/)) {
depend = dependencies[i].replaceAll("-", "/");
let pkg = depend.split("/");
@@ -237,7 +238,7 @@ function installFromURL(url, dependencies, clearqueue) {
}
setButtons(false);
- ipcRenderer.send("installfromurl", url, dependencies)
+ ipcRenderer.send("installfromurl", url, dependencies);
if (dependencies) {
installqueue = dependencies;
@@ -355,7 +356,7 @@ document.addEventListener("drop", (e) => {
event.stopPropagation();
dragUI.classList.remove("shown");
- installFromPath(event.dataTransfer.files[0].path)
+ installFromPath(event.dataTransfer.files[0].path);
});
document.body.addEventListener("keyup", (e) => {
diff --git a/src/app/settings.js b/src/app/settings.js
index 23b38c9..051d6a1 100644
--- a/src/app/settings.js
+++ b/src/app/settings.js
@@ -3,22 +3,22 @@ var Settings = {
if (state) {
Settings.load();
options.scrollTo(0, 0);
- overlay.classList.add("shown")
- options.classList.add("shown")
+ overlay.classList.add("shown");
+ options.classList.add("shown");
return
} else if (! state) {
if (state != undefined) {
- overlay.classList.remove("shown")
- options.classList.remove("shown")
+ overlay.classList.remove("shown");
+ options.classList.remove("shown");
return
}
}
Settings.load();
options.scrollTo(0, 0);
- overlay.classList.toggle("shown")
- options.classList.toggle("shown")
+ overlay.classList.toggle("shown");
+ options.classList.toggle("shown");
},
apply: () => {
settings = {...settings, ...Settings.get()};