From 89b1df73acb037626263053b865aea5eba48635e Mon Sep 17 00:00:00 2001 From: Remixer Dec <6587642+remixer-dec@users.noreply.github.com> Date: Mon, 17 Jun 2024 00:26:47 +0400 Subject: [PATCH] Background data loading & search icon fixes --- src/components/css/search.css | 4 ++-- src/components/html/quicksearch.html | 5 ++++- src/datasource.js | 13 ++++++++++++- src/entry.js | 3 +-- src/router.js | 4 +--- 5 files changed, 20 insertions(+), 9 deletions(-) diff --git a/src/components/css/search.css b/src/components/css/search.css index aba4e267..7d6dc6b5 100644 --- a/src/components/css/search.css +++ b/src/components/css/search.css @@ -32,8 +32,8 @@ div#searchbar { } #quickresults .mdl-list__item-icon { position: absolute; - left: 0; - transform: scale(0.8); + left: -2px; + transform: scale(0.8) translateY(-4px); height: 20px; width: 20px; margin-left: 2px; diff --git a/src/components/html/quicksearch.html b/src/components/html/quicksearch.html index be36fa7a..6b880c56 100644 --- a/src/components/html/quicksearch.html +++ b/src/components/html/quicksearch.html @@ -7,7 +7,10 @@
- {{result.text}}
+ + + {{result.text}}
+
{{locale.search.notfound}} {{locale.search.full}} {{locale.search.found}} {{total}} diff --git a/src/datasource.js b/src/datasource.js index f5c91fe2..405ee8de 100644 --- a/src/datasource.js +++ b/src/datasource.js @@ -50,9 +50,20 @@ class DataSourceManager { this.screenshots = new SelectedScreenshotLoader() } + autoloadMetadata() { + this.loadMetadata(app.selectedDir).then(() => { + app.loading = false + for (const d of app.datasource.ds.contentDirs) { + if (d !== app.selectedDir) { + this.loadMetadata(d) + } + } + }) + } + async loadMetadata(dir) { if (this.ds.contentDirs.indexOf(dir) === -1) return - app.loading = true + if (dir === app.selectedDir) app.loading = true app.metaLoadingStarted = true const meta = await this.ds.getMetadata(dir) const all = this.combineAllCategories(dir, meta) diff --git a/src/entry.js b/src/entry.js index c678133d..05635f6f 100644 --- a/src/entry.js +++ b/src/entry.js @@ -81,8 +81,7 @@ initialize().then(() => { D_MODES }).mount() if (!app.metaLoadingStarted) { - app.datasource.loadMetadata(app.selectedDir) - .then(() => { app.loading = false }) + app.datasource.autoloadMetadata() } document.getElementsByClassName('container')[0].style.display = 'block' // hide splashscreen after loading diff --git a/src/router.js b/src/router.js index 6b653b51..97146ebf 100644 --- a/src/router.js +++ b/src/router.js @@ -25,9 +25,7 @@ export default class Router { app.selectedDir = dir app.ui = '' if (app.datasource && !app.meta[app.selectedDir]) { - app.datasource.loadMetadata(app.selectedDir).then(() => { - app.loading = false - }) + app.datasource.autoloadMetadata() } } else { app.ui = id