aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
author0neGal <mail@0negal.com>2022-02-05 18:47:46 +0100
committer0neGal <mail@0negal.com>2022-02-05 18:51:48 +0100
commit392a46168971eb3a4d578cec2b8ebea533e02747 (patch)
treea7768a5aba596cab07f252589776f262949e9967 /src
parent32f4e5e1436ef5ba0faa466b03fbde2bb870fdc5 (diff)
downloadViper-392a46168971eb3a4d578cec2b8ebea533e02747.tar.gz
Viper-392a46168971eb3a4d578cec2b8ebea533e02747.zip
implemented limit to loading packages
I have no clue if 50 packages is too small or too, big, we'll adjust this the more mods that arrive. I also made the browser auto scroll to the top when closed, it looks far better.
Diffstat (limited to 'src')
-rw-r--r--src/app/browser.js8
-rw-r--r--src/app/main.css7
-rw-r--r--src/lang/en.json1
3 files changed, 16 insertions, 0 deletions
diff --git a/src/app/browser.js b/src/app/browser.js
index 6d10bfb..c23f217 100644
--- a/src/app/browser.js
+++ b/src/app/browser.js
@@ -3,8 +3,10 @@ var fuse;
var packages = [];
var Browser = {
+ maxentries: 50,
toggle: (state) => {
if (state) {
+ browser.scrollTo(0, 0);
overlay.classList.add("shown")
browser.classList.add("shown")
return
@@ -16,6 +18,7 @@ var Browser = {
}
}
+ browser.scrollTo(0, 0);
overlay.classList.toggle("shown")
browser.classList.toggle("shown")
},
@@ -31,6 +34,7 @@ var Browser = {
}
for (let i in packages) {
+ if (i == Browser.maxentries) {Browser.endoflist();break}
new BrowserElFromObj(packages[i]);
}
},
@@ -43,6 +47,9 @@ var Browser = {
browserEntries.innerHTML = `<div class="loading">${lang('gui.browser.loading')}</div>`;
}
},
+ endoflist: () => {
+ browserEntries.innerHTML += `<div class="message">${lang('gui.browser.endoflist')}</div>`
+ },
search: (string) => {
Browser.loading();
let res = fuse.search(string);
@@ -53,6 +60,7 @@ var Browser = {
}
for (let i = 0; i < res.length; i++) {
+ if (i == Browser.maxentries) {Browser.endoflist();break}
new BrowserElFromObj(res[i].item);
}
},
diff --git a/src/app/main.css b/src/app/main.css
index e48625b..b6a07eb 100644
--- a/src/app/main.css
+++ b/src/app/main.css
@@ -177,6 +177,13 @@ button {
height: calc(100% - var(--mischeight) - var(--height));
}
+#browser .message {
+ color: white;
+ text-align: center;
+ margin: var(--padding);
+ width: calc(100% - var(--padding));
+}
+
#browser .el .image, #browser .el .image img {
width: var(--height);
height: var(--height);
diff --git a/src/lang/en.json b/src/lang/en.json
index 59af04b..6bef99f 100644
--- a/src/lang/en.json
+++ b/src/lang/en.json
@@ -65,6 +65,7 @@
"gui.browser.madeby": "by",
"gui.browser.update": "Update",
+ "gui.browser.endoflist": "Maximum packages has been loaded.<br>Use the search for finding other packages!",
"gui.browser.install": "Install",
"gui.browser.reinstall": "Re-Install",
"gui.browser.loading": "Loading mods...",