Merge pull request #12 from League-of-Foundry-Developers/v0.3.1-spetzel2020

V0.3.1 spetzel2020
features_update
Spetzel 2021-03-12 14:06:39 -08:00 committed by GitHub
commit 280c0bcb44
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
15 changed files with 1153 additions and 752 deletions

View File

@ -1,24 +1,30 @@
# Compendium Browser
> This version only works for Foundry v0.4.4 and up. To use the previous version please visit https://github.com/syl3r86/compendium-browser/tree/pre-0.4.4
Tired of scrolling compendia? Easily brows and filter for spells, feats, items, and NPCs using Compendium Browser.
A module to easily browse and filter spells as well as npcs loaded from compendie.
**NEW** Compendium Browser is faster and better-behaved; **it no longer loads all the compendia into memory on start-up** (which sometimes hung servers because of memory or CPU requirements). Instead, it filters and loads on-demand, as well as giving you a Module Setting to control how many rows are loaded at a time.
## Summary
* **Authors**: Discord: Spetzel#0103; Felix (felix.mueller.86@web.de)
* **Version**: 0.4.2
* **Foundry VTT Compatibility**: 0.7.2-0.7.9
* **System Compatibility (If applicable)**: dnd5e
* **Translation Support**: en
## Installation
1. Copy this link and use it in Foundrys Module Manager to install the Module
1. Go to the Add-on Modules tab in Foundry Setup
2. Click Install Module and search for **Compendium Browser** OR paste this link: `https://github.com/League-of-Foundry-Developers/compendium-browser/releases/download/latest/module.json`
3. Open your world and go to Settings>Manage Modules and enable Compendium Browser
> https://raw.githubusercontent.com/syl3r86/compendium-browser/master/module.json
2. Enable the Module in your Worlds Module Settings
![example](preview.jpg)
## Details
Only the Gamemaster has access to the Settings, where they can enable or disable player access to the spell or npc-browser. It is **highly** recommended to disable any compendie that do not contain spell or should not be used in the NPC Browser. This reduces the initial loading time, that happens after a client connects to foundry, immensly.
Only the Gamemaster has access to the Settings, where they can enable or disable player access to the spell or npc-browser. It is **highly** recommended to disable any compendia that do not contain spell or should not be used in the NPC Browser. .
This application enables anyone to add their own custom spell or npc filters via the api. After initialization the app can be found under game.compendiumBrowser where either addSpellFilter or addNpcFilter can be used to add a filter. This does support any data that the spell or npc has, including flags.
All filters featured in the app are included in this manor and can be found in the compendium-browser.js at around line 726.
All filters featured in the app are included in this manner and can be found in the compendium-browser.js at around line 726.
## Contribution
If you feel like supporting my work, feel free to leave a tip at my paypal felix.mueller.86@web.de

View File

@ -53,12 +53,22 @@
position: sticky;
display: block;
min-width: 250px;
max-width: 400px;
width: 300px;
max-width: 45%;
width: 350px;
height: 100%;
padding-right: 5px;
overflow: scroll;
}
.compendium-browser .list-area {
position: sticky;
display: flex;
min-width: 250px;
max-width: 55%;
width: 400px;
height: 100%;
padding-right: 5px;
overflow-y: scroll;
}
.compendium-browser .control-area button {
background: rgba(0, 0, 0, 0.05);
border: 1px solid #bbb;
@ -129,7 +139,6 @@
float: right;
display: block;
min-width: 335px;
width: 785px;
margin: 0;
height: 100%;
overflow: auto;

File diff suppressed because it is too large Load Diff

View File

@ -55,8 +55,15 @@
"CMPBrowser.dmgInteraction": "Damage Interaction",
"CMPBrowser.dmgDealt": "Damage Dealt",
"CMPBrowser.size": "Size",
"CMPBrowser.spellBrowser":"Spell Browser",
"CMPBrowser.npcBrowser":"NPC Browser",
"CMPBrowser.settings":"Settings"
"CMPBrowser.Tab.SpellBrowser":"Spell Browser",
"CMPBrowser.Tab.FeatBrowser": "Feat Browser",
"CMPBrowser.Tab.ItemBrowser": "Item Browser",
"CMPBrowser.Tab.NPCBrowser":"NPC Browser",
"CMPBrowser.Tab.Settings":"Settings",
"CMPBrowser.SETTING.Maxload.NAME" : "Maximum load",
"CMPBrowser.SETTING.Maxload.HINT" : "Maximum number of spells, feats, items, or NPCs to display; to see more use the filters. This setting is to allow manageing memory and server load.",
"CMPBrowser.LOADING.Message" : "Loaded...{numLoaded} {itemType}s",
"CMPBrowser.LOADING.MaxLoaded" : "(maximum displayed; to see more, use the filters)",
"CMPBrowser.Filters.ResetFilters" : "Reset Filters"
}

View File

@ -1,9 +1,18 @@
{
"name": "compendium-browser",
"title": "Compendium Browser",
"description": "A module to easily browse and filter spells as well as npcs loaded from compendie.",
"version": "0.3.1",
"description": "<p>Easily browse and filter spells, feats, items, and npcs loaded from compendia!</p><strong>NEW! Compendium Browser is faster and better-behaved;</strong> it no longer loads all the compendia into memory on start-up (which sometimes hung servers because of memory or CPU requirements). Instead, it filters and loads on-demand, as well as giving you a Module Setting to control how many rows are loaded at a time.<br>Changes in v0.4.3:<ul><li>Fixed: Error on dragging item from Compendium Browser (<a href='https://github.com/League-of-Foundry-Developers/compendium-browser/issues/9'>Issue #9</a>)</li><li>Fixed: Reset Filters doesn't clear the onscreen filters (<a href='https://github.com/League-of-Foundry-Developers/compendium-browser/issues/4'>Issue #4</a>)</li></ul>",
"version": "0.4.3",
"author": "Felix#6196",
"authors": [
{
"name": "Spetzel#0103",
"url": "https://github.com/spetzel2020"
},
{
"name": "Felix#6196"
}
],
"systems": ["dnd5e"],
"scripts": ["./compendium-browser.js"],
"styles": ["./compendium-browser.css"],
@ -30,9 +39,13 @@
"path": "lang/pt-BR.json"
}
],
"url": "https://github.com/syl3r86/compendium-browser",
"manifest": "https://raw.githubusercontent.com/syl3r86/compendium-browser/master/module.json",
"download": "https://github.com/syl3r86/compendium-browser/archive/master.zip",
"url": "https://github.com/League-of-Foundry-Developers/compendium-browser",
"manifest": "https://github.com/League-of-Foundry-Developers/compendium-browser/releases/download/latest/module.json",
"download": "https://github.com/League-of-Foundry-Developers/compendium-browser/releases/download/latest/compendium-browser.zip",
"minimumCoreVersion": "0.6.2",
"compatibleCoreVersion": "0.6.2"
"compatibleCoreVersion": "0.7.9",
"allowBugReporter": true,
"bugs": "https://github.com/League-of-Foundry-Developers/compendium-browser/issues",
"readme": "https://github.com/League-of-Foundry-Developers/compendium-browser/blob/master/README.md",
"changelog": "https://github.com/League-of-Foundry-Developers/compendium-browser/blob/master/CHANGELOG.md"
}

View File

@ -0,0 +1,17 @@
{{#each listItems as |feat id|}}
<li class="feat flexrow draggable" data-entry-compendium="{{feat.compendium}}" data-entry-id="{{id}}">
<div class="item-image">
<img class="" data-src="{{feat.img}}" title="{{feat.name}}" width="32" height="32" />
</div>
<div class="item-name">
<span class="item-edit"><a>{{feat.name}}</a></span>
</div>
<div class="feat-tags">
<span title="Class Requirement">{{feat.classRequirementString}}</span>
</div>
<div class="filter-tags">
<input type="hidden" name="class" value="{{feat.classRequirementString}}">
</div>
</li>
{{/each}}

View File

@ -8,31 +8,18 @@
<dt>{{localize "CMPBrowser.sortBy"}}:</dt>
<dd><select class="null" name="sortorder">
<option value="true" selected>{{localize "Name"}}</option>
<option value="false">Class</option>
<option value="false">{{localize "DND5E.ItemTypeClass"}}</option>
</select></dd>
</dl>
<button id="reset-feat-filter">Reset Filters</button>
<button id="reset-feat-filter">{{localize "CMPBrowser.Filters.ResetFilters"}}</button>
</div>
{{> "modules/compendium-browser/template/filter-container.html" filters=featFilters}}
</div>
<ul>
{{#each feats as |feat id|}}
<li class="feat flexrow draggable" data-entry-compendium="{{feat.compendium}}" data-entry-id="{{feat._id}}">
<div class="item-image">
<img class="" data-src="{{feat.img}}" title="{{feat.name}}" width="32" height="32"/>
</div>
<div class="item-name">
<span class="item-edit" ><a>{{feat.name}}</a></span>
</div>
<div class="feat-tags">
<span title="Class Requirement">{{feat.classRequirementString}}</span>
</div>
<div class="filter-tags">
<input type="hidden" name="class" value="{{feat.classRequirementString}}">
</div>
</li>
{{/each}}
<div class="list-area flexcol">
<span id="CBFeatsMessage" style="flex:0"></span>
<ul id="CBFeats">
{{> "modules/compendium-browser/template/feat-browser-list.html" feats=items}}
</ul>
</div>
</div>

View File

@ -0,0 +1,16 @@
{{#each listItems as |item id|}}
<li class="item flexrow draggable" data-entry-compendium="{{item.compendium}}" data-entry-id="{{id}}">
<div class="item-image">
<img class="" data-src="{{item.img}}" title="{{item.name}}" width="32" height="32" />
</div>
<div class="item-name">
<span class="item-edit"><a>{{item.name}}</a></span>
</div>
<div class="item-tags">
<span title="Item Type">{{item.type}}</span>
</div>
<div class="filter-tags">
<input type="hidden" name="type" value="{{item.type}}">
</div>
</li>
{{/each}}

View File

@ -8,30 +8,17 @@
<dt>{{localize "CMPBrowser.sortBy"}}:</dt>
<dd><select class="null" name="sortorder">
<option value="true" selected>{{localize "Name"}}</option>
<option value="false">Item Type</option>
<option value="false">{{localize "DND5E.Type"}}</option>
</select></dd>
</dl>
<button id="reset-item-filter">Reset Filters</button>
<button id="reset-item-filter">{{localize "CMPBrowser.Filters.ResetFilters"}}</button>
</div>
{{> "modules/compendium-browser/template/filter-container.html" filters=itemFilters}}
</div>
<ul>
{{#each items as |item id|}}
<li class="item flexrow draggable" data-entry-compendium="{{item.compendium}}" data-entry-id="{{item._id}}">
<div class="item-image">
<img class="" data-src="{{item.img}}" title="{{item.name}}" width="32" height="32"/>
</div>
<div class="item-name">
<span class="item-edit" ><a>{{item.name}}</a></span>
</div>
<div class="item-tags">
<span title="Item Type">{{item.type}}</span>
</div>
<div class="filter-tags">
<input type="hidden" name="type" value="{{item.type}}">
</div>
</li>
{{/each}}
<div class="list-area flexcol">
<span id="CBItemsMessage" style="flex:0"></span>
<ul id="CBItems">
{{> "modules/compendium-browser/template/item-browser-list.html" items=items}}
</ul>
</div>
</div>

View File

@ -0,0 +1,6 @@
<img class="" src="icons/sundries/books/book-open-turquoise.webp" title="Loading book" width="32" height="32"/>
<span class="item-edit" >
{{localize "CMPBrowser.LOADING.Message" numLoaded=numLoaded itemType=itemType}}
{{#if maxLoaded}}{{localize "CMPBrowser.LOADING.MaxLoaded"}}{{/if}}
</span>

View File

@ -0,0 +1,21 @@
{{#each listItems as |npc id|}}
<li class="npc flexrow draggable" data-entry-compendium="{{npc.compendium}}" data-entry-id="{{id}}">
<div class="npc-image">
<img class="" data-src="{{npc.img}}" title="{{npc.name}}" width="32" height="32" />
</div>
<div class="npc-line">
<div class="npc-name">
<span class="item-edit"><a>{{npc.name}}</a></span>
</div>
<div class="npc-tags">
<span class="cr" title="Challange Rating">CR {{npc.displayCR}}</span>
<span class="size">{{npc.displaySize}}</span>
<span class="type">{{npc.displayType}}</span>
</div>
<div class="filter-tags">
<input type="hidden" name="order.cr" value="{{npc.orderCR}}">
<input type="hidden" name="order.size" value="{{npc.orderSize}}">
</div>
</div>
</li>
{{/each}}

View File

@ -12,32 +12,14 @@
<option value="size">{{localize "DND5E.Size"}}</option>
</select></dd>
</dl>
<button id="reset-npc-filter">Reset NPC Filters</button>
<button id="reset-npc-filter">{{localize "CMPBrowser.Filters.ResetFilters"}}</button>
</div>
{{> "modules/compendium-browser/template/filter-container.html" filters=npcFilters}}
</div>
<ul>
{{#each npcs as |npc id|}}
<li class="npc flexrow draggable" data-entry-compendium="{{npc.compendium}}" data-entry-id="{{npc._id}}">
<div class="npc-image">
<img class="" data-src="{{npc.img}}" title="{{npc.name}}" width="32" height="32" />
</div>
<div class="npc-line">
<div class="npc-name">
<span class="item-edit"><a>{{npc.name}}</a></span>
</div>
<div class="npc-tags">
<span class="cr-display" title="Challange Rating">CR {{npc.displayCR}}</span>
<span class="size-display">{{npc.displaySize}}</span>
<span class="type">{{npc.data.details.type.value}}</span>
</div>
<div class="filter-tags">
<input type="hidden" name="order.cr" value="{{npc.data.details.cr}}">
<input type="hidden" name="order.size" value="{{npc.filterSize}}">
</div>
</div>
</li>
{{/each}}
<div class="list-area flexcol">
<span id="CBNpcsMessage" style="flex:0"></span>
<ul id="CBNPCs">
{{> "modules/compendium-browser/template/npc-browser-list.html" npcs=npcs}}
</ul>
</div>
</div>

View File

@ -0,0 +1,25 @@
{{#each listItems as |spell id|}}
<li class="spell flexrow draggable" data-entry-compendium="{{spell.compendium}}" data-entry-id="{{id}}">
<div class="item-image">
<img class="" data-src="{{spell.img}}" title="{{spell.name}}" width="32" height="32"/>
</div>
<div class="item-name">
<span class="item-edit" ><a>{{spell.name}}</a></span>
</div>
<div class="spell-tags">
<span title="Spell level">{{#if spell.data.level}}{{spell.data.level}}{{else}}C{{/if}}</span>
<div class="spacer-large"></div>
<span {{#unless spell.data.components.ritual}}style="color:#bbb;" title="{{localize "No"}} {{localize "CMPBrowser.ritual"}}"{{else}} title="{{localize "CMPBrowser.ritual"}}"{{/unless}}>R</span>
<span {{#unless spell.data.components.concentration}}style="color:#bbb;" title="{{localize "No"}} {{localize "CMPBrowser.concentration"}}"{{else}} title="{{localize "CMPBrowser.concentration"}}"{{/unless}}>C</span>
<div class="spacer"></div>
<span {{#unless spell.data.components.vocal}}style="color:#bbb;" title="{{localize "No"}} {{localize "CMPBrowser.verbal"}}"{{else}} title="{{localize "CMPBrowser.verbal"}}"{{/unless}}>V</span>
<span {{#unless spell.data.components.somatic}}style="color:#bbb;" title="{{localize "No"}} {{localize "CMPBrowser.somatic"}}"{{else}} title="{{localize "CMPBrowser.somatic"}}"{{/unless}}>S</span>
<span {{#unless spell.data.components.material}}style="color:#bbb;" title="no{{localize "No"}} {{localize "CMPBrowser.material"}}"{{else}} title="{{localize "CMPBrowser.material"}}"{{/unless}}>M</span>
</div>
<div class="filter-tags">
<input type="hidden" name="level" value="{{spell.data.level}}">
</div>
</li>
{{/each}}

View File

@ -11,34 +11,14 @@
<option value="false">{{localize "CMPBrowser.lvl"}}</option>
</select></dd>
</dl>
<button id="reset-spell-filter">Reset Spell Filters</button>
<button id="reset-spell-filter">{{localize "CMPBrowser.Filters.ResetFilters"}}</button>
</div>
{{> "modules/compendium-browser/template/filter-container.html" filters=spellFilters}}
</div>
<ul>
{{#each spells as |spell id|}}
<li class="spell flexrow draggable" data-entry-compendium="{{spell.compendium}}" data-entry-id="{{spell._id}}">
<div class="item-image">
<img class="" data-src="{{spell.img}}" title="{{spell.name}}" width="32" height="32"/>
</div>
<div class="item-name">
<span class="item-edit" ><a>{{spell.name}}</a></span>
</div>
<div class="spell-tags">
<span title="Spell level">{{#if spell.data.level}}{{spell.data.level}}{{else}}C{{/if}}</span>
<div class="spacer-large"></div>
<span {{#unless spell.data.components.ritual}}style="color:#bbb;" title="{{localize "No"}} {{localize "CMPBrowser.ritual"}}"{{else}} title="{{localize "CMPBrowser.ritual"}}"{{/unless}}>R</span>
<span {{#unless spell.data.components.concentration}}style="color:#bbb;" title="{{localize "No"}} {{localize "CMPBrowser.concentration"}}"{{else}} title="{{localize "CMPBrowser.concentration"}}"{{/unless}}>C</span>
<div class="spacer"></div>
<span {{#unless spell.data.components.vocal}}style="color:#bbb;" title="{{localize "No"}} {{localize "CMPBrowser.verbal"}}"{{else}} title="{{localize "CMPBrowser.verbal"}}"{{/unless}}>V</span>
<span {{#unless spell.data.components.somatic}}style="color:#bbb;" title="{{localize "No"}} {{localize "CMPBrowser.somatic"}}"{{else}} title="{{localize "CMPBrowser.somatic"}}"{{/unless}}>S</span>
<span {{#unless spell.data.components.material}}style="color:#bbb;" title="no{{localize "No"}} {{localize "CMPBrowser.material"}}"{{else}} title="{{localize "CMPBrowser.material"}}"{{/unless}}>M</span>
</div>
<div class="filter-tags">
<input type="hidden" name="level" value="{{spell.data.level}}">
</div>
</li>
{{/each}}
<div class="list-area flexcol">
<span id="CBSpellsMessage" style="flex:0"></span>
<ul id="CBSpells">
{{> "modules/compendium-browser/template/spell-browser-list.html" spells=items}}
</ul>
</div>
</div>

View File

@ -1,16 +1,16 @@
<div class="parent">
<div class="tabs">
{{#if showSpellBrowser}}<a class="item" data-tab="spell">{{localize "CMPBrowser.spellBrowser"}}</a>{{/if}}
{{#if showFeatBrowser}}<a class="item" data-tab="feat">Feat Browser</a>{{/if}}
{{#if showItemBrowser}}<a class="item" data-tab="item">Item Browser</a>{{/if}}
{{#if showNpcBrowser}}<a class="item" data-tab="npc">{{localize "CMPBrowser.npcBrowser"}}</a>{{/if}}
{{#if isGM}}<a class="item" data-tab="setting">{{localize "CMPBrowser.settings"}}</a>{{/if}}
{{#if showSpellBrowser}}<a class="item" data-tab="spell">{{localize "CMPBrowser.Tab.SpellBrowser"}}</a>{{/if}}
{{#if showFeatBrowser}}<a class="item" data-tab="feat">{{localize "CMPBrowser.Tab.FeatBrowser"}}</a>{{/if}}
{{#if showItemBrowser}}<a class="item" data-tab="item">{{localize "CMPBrowser.Tab.ItemBrowser"}}</a>{{/if}}
{{#if showNpcBrowser}}<a class="item" data-tab="npc">{{localize "CMPBrowser.Tab.NPCBrowser"}}</a>{{/if}}
{{#if isGM}}<a class="item" data-tab="setting">{{localize "CMPBrowser.Tab.Settings"}}</a>{{/if}}
</div>
<div class="content">
<div class="tab" data-tab="spell">{{#if showSpellBrowser}}{{> "modules/compendium-browser/template/spell-browser.html"}}{{/if}}</div>
<div class="tab" data-tab="feat">{{#if showSpellBrowser}}{{> "modules/compendium-browser/template/feat-browser.html"}}{{/if}}</div>
<div class="tab" data-tab="item">{{#if showSpellBrowser}}{{> "modules/compendium-browser/template/item-browser.html"}}{{/if}}</div>
<div class="tab" data-tab="feat">{{#if showFeatBrowser}}{{> "modules/compendium-browser/template/feat-browser.html"}}{{/if}}</div>
<div class="tab" data-tab="item">{{#if showItemBrowser}}{{> "modules/compendium-browser/template/item-browser.html"}}{{/if}}</div>
<div class="tab" data-tab="npc">{{#if showNpcBrowser}} {{> "modules/compendium-browser/template/npc-browser.html"}}{{/if}}</div>
<div class="tab" data-tab="setting">{{#if isGM}} {{> "modules/compendium-browser/template/settings.html"}}{{/if}}</div>
</div>