0.4.1l 12-Feb-2021

Display static "Loading..." message the first time tab is shown
-> Want it with dynamic results and to not replace existing data

feat-browser.html, spell-browser.html
- Use items array on first load so that we pick up "Loading..." message
v0.3.1-spetzel2020 v0.4.1-s
opus1217 2021-02-12 12:14:37 -08:00
parent 86b15332fe
commit 0b9b72edff
3 changed files with 15 additions and 4 deletions

View File

@ -26,6 +26,8 @@
Rename itemType -> browserTab to differentiate candidate item's type from the tab it appears on (spell, feat/class, item, NPC)
Fixed: Was calling the wrong sort for feat and NPC
0.4.1k: Don't call loadItems() during initalize; getData() just displays static elements
0.4.1l: Display progress indicator for loading - for now just a static one
0.4.1m; PLANNED: Want loading message with dynamic results and to not replace existing data; need to localize as well
*/
const CMPBrowser = {
@ -136,9 +138,13 @@ class CompendiumBrowser extends Application {
//0.4.1 Filter as we load to support new way of filtering
//Previously loaded all data and filtered in place; now loads minimal (preload) amount, filtered as we go
//First time (when you press Compendium Browser button) is called with filters unset
const loadingItem = {
name: "Loading...",
img: "icons/sundries/books/book-open-turquoise.webp"
}
//0.4.1k: Don't do any item/npc loading until tab is visible
let data = {
items : {"Loading" : loadingItem},
spellFilters : this.spellFilters,
showSpellBrowser : (game.user.isGM || this.settings.allowSpellBrowser),
featFilters : this.featFilters,
@ -440,6 +446,11 @@ class CompendiumBrowser extends Application {
this.replaceList(html, browserTab);
});
//Just for the loading image
if (this.observer) {
html.find("img").each((i,img) => this.observer.observe(img));
}
}
async checkListsLoaded() {

View File

@ -16,7 +16,7 @@
{{> "modules/compendium-browser/template/filter-container.html" filters=featFilters}}
</div>
<ul id="CBFeats">
{{> "modules/compendium-browser/template/feat-browser-list.html" feats=feats}}
{{> "modules/compendium-browser/template/feat-browser-list.html" feats=items}}
</ul>
</div>

View File

@ -16,6 +16,6 @@
{{> "modules/compendium-browser/template/filter-container.html" filters=spellFilters}}
</div>
<ul id="CBSpells">
{{> "modules/compendium-browser/template/spell-browser-list.html" spells=spells}}
{{> "modules/compendium-browser/template/spell-browser-list.html" spells=items}}
</ul>
</div>