diff options
author | 0neGal <mail@0negal.com> | 2022-02-05 18:47:46 +0100 |
---|---|---|
committer | 0neGal <mail@0negal.com> | 2022-02-05 18:51:48 +0100 |
commit | 392a46168971eb3a4d578cec2b8ebea533e02747 (patch) | |
tree | a7768a5aba596cab07f252589776f262949e9967 /src/app/browser.js | |
parent | 32f4e5e1436ef5ba0faa466b03fbde2bb870fdc5 (diff) | |
download | Viper-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/app/browser.js')
-rw-r--r-- | src/app/browser.js | 8 |
1 files changed, 8 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); } }, |