Skip to content

Commit 9b8febf

Browse files
committed
v1.181.7
1 parent a73db2d commit 9b8febf

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

45 files changed

+1935
-1614
lines changed

bestiary.html

+1-1
Original file line numberDiff line numberDiff line change
@@ -156,7 +156,7 @@ <h1 class="page__title">Bestiary</h1>
156156
title="See the Dungeon Master&apos;s Guide, p263.">Use Proficiency Dice
157157
</button>
158158
</div>
159-
<button class="btn btn-default btn-xs" id="btn-printbook">Printer View</button>
159+
<button class="btn btn-default btn-xs" id="btn-book">Printer View</button>
160160
<button class="btn btn-default btn-xs" id="btn-show-table" title="View and Download Creatures in Tabular Format">Table View</button>
161161
<button class="btn btn-xs btn-info" id="manage-brew">Manage Homebrew</button>
162162
</div>

css/classes.css

+1-1
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

css/dmscreen.css

+1-1
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

css/main.css

+1-1
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

data/changelog.json

+5
Original file line numberDiff line numberDiff line change
@@ -2451,5 +2451,10 @@
24512451
"ver": "1.181.6",
24522452
"date": "2023-06-16",
24532453
"txt": "- (Brew) Fixed loading performance regression\n- (Fixed typos/added tags)"
2454+
},
2455+
{
2456+
"ver": "1.181.7",
2457+
"date": "2023-06-18",
2458+
"txt": "- Fixed DM Screen Initiative Tracker crash when loading encounters with custom stat columns\n- Fixed DM Screen crashes when attempting to load Player Initiative Tracker panels\n- (Brew) Fixed Creature Homebrew Builder crashing when attempting to finalize statblocks\n- (Brew) Fixed Classes page coloring of reprinted homebrew subclass selectors"
24542459
}
24552460
]

dmscreen.html

-4
Original file line numberDiff line numberDiff line change
@@ -107,10 +107,6 @@ <h1 class="page__title">DM Screen</h1>
107107
<script type="text/javascript" src="js/hist.js"></script>
108108
<script type="text/javascript" src="js/initiativetrackerutils.js"></script>
109109
<script type="module" src="js/dmscreen.js"></script>
110-
<script type="text/javascript" src="js/dmscreen-moneyconverter.js"></script>
111-
<script type="text/javascript" src="js/dmscreen-timetracker.js"></script>
112-
<script type="text/javascript" src="js/dmscreen-counter.js"></script>
113-
<script type="text/javascript" src="js/dmscreen-mapper.js"></script>
114110
<script type="text/javascript" src="js/list2.js"></script>
115111
<script type="text/javascript" src="lib/elasticlunr.js"></script>
116112
</body>

js/bestiary.js

+75-57
Original file line numberDiff line numberDiff line change
@@ -177,6 +177,80 @@ class BestiarySublistManager extends SublistManager {
177177
}
178178
}
179179

180+
class BestiaryPageBookView extends ListPageBookView {
181+
constructor (opts) {
182+
super({
183+
namePlural: "creatures",
184+
pageTitle: "Bestiary Printer View",
185+
...opts,
186+
});
187+
}
188+
189+
_$getWrpControls ({$wrpContent}) {
190+
const out = super._$getWrpControls({$wrpContent});
191+
const {$wrpPrint} = out;
192+
193+
// region Markdown
194+
// TODO refactor this and spell markdown section
195+
const pGetAsMarkdown = async () => {
196+
const toRender = this._bookViewToShow.length ? this._bookViewToShow : [this._fnGetEntLastLoaded()];
197+
return RendererMarkdown.monster.pGetMarkdownDoc(toRender);
198+
};
199+
200+
const $btnDownloadMarkdown = $(`<button class="btn btn-default btn-sm">Download as Markdown</button>`)
201+
.click(async () => DataUtil.userDownloadText("bestiary.md", await pGetAsMarkdown()));
202+
203+
const $btnCopyMarkdown = $(`<button class="btn btn-default btn-sm px-2" title="Copy Markdown to Clipboard"><span class="glyphicon glyphicon-copy"/></button>`)
204+
.click(async () => {
205+
await MiscUtil.pCopyTextToClipboard(await pGetAsMarkdown());
206+
JqueryUtil.showCopiedEffect($btnCopyMarkdown);
207+
});
208+
209+
const $btnDownloadMarkdownSettings = $(`<button class="btn btn-default btn-sm px-2" title="Markdown Settings"><span class="glyphicon glyphicon-cog"/></button>`)
210+
.click(async () => RendererMarkdown.pShowSettingsModal());
211+
212+
$$`<div class="ve-flex-v-center btn-group ml-2">
213+
${$btnDownloadMarkdown}
214+
${$btnCopyMarkdown}
215+
${$btnDownloadMarkdownSettings}
216+
</div>`.appendTo($wrpPrint);
217+
// endregion
218+
219+
return out;
220+
}
221+
222+
async _pGetRenderContentMeta ({$wrpContent}) {
223+
this._bookViewToShow = this._sublistManager.getPinnedEntities()
224+
.sort(this._getSorted.bind(this));
225+
226+
let cntSelectedEnts = 0;
227+
let isAnyEntityRendered = false;
228+
229+
const stack = [];
230+
231+
const renderCreature = (mon) => {
232+
isAnyEntityRendered = true;
233+
stack.push(`<div class="bkmv__wrp-item ve-inline-block print__ve-block print__my-2"><table class="w-100 stats stats--book stats--bkmv"><tbody>`);
234+
stack.push(Renderer.monster.getCompactRenderedString(mon));
235+
stack.push(`</tbody></table></div>`);
236+
};
237+
238+
this._bookViewToShow.forEach(mon => renderCreature(mon));
239+
if (!this._bookViewToShow.length && Hist.lastLoadedId != null) {
240+
renderCreature(this._fnGetEntLastLoaded());
241+
}
242+
243+
cntSelectedEnts += this._bookViewToShow.length;
244+
$wrpContent.append(stack.join(""));
245+
246+
return {cntSelectedEnts, isAnyEntityRendered};
247+
}
248+
249+
_getSorted (a, b) {
250+
return SortUtil.ascSort(a._displayName || a.name, b._displayName || b.name);
251+
}
252+
}
253+
180254
class BestiaryPage extends ListPageMultiSource {
181255
static async _prereleaseBrewDataSource ({brewUtil}) {
182256
const brew = await brewUtil.pGetBrewProcessed();
@@ -210,9 +284,7 @@ class BestiaryPage extends ListPageMultiSource {
210284
hasAudio: true,
211285

212286
bookViewOptions: {
213-
$btnOpen: $(`#btn-printbook`),
214-
$eleNoneVisible: $(`<span class="initial-message">If you wish to view multiple creatures, please first make a list</span>`),
215-
pageTitle: "Bestiary Printer View",
287+
ClsBookView: BestiaryPageBookView,
216288
},
217289

218290
tableViewOptions: {
@@ -321,60 +393,6 @@ class BestiaryPage extends ListPageMultiSource {
321393

322394
get list_ () { return this._list; }
323395

324-
async _bookView_popTblGetNumShown ({$wrpContent, $dispName, $wrpControls}) {
325-
this._bookViewToShow = await this._sublistManager.getPinnedEntities();
326-
327-
this._bookViewToShow.sort((a, b) => SortUtil.ascSort(a._displayName || a.name, b._displayName || b.name));
328-
329-
let numShown = 0;
330-
331-
const stack = [];
332-
333-
const renderCreature = (mon) => {
334-
stack.push(`<div class="bkmv__wrp-item"><table class="w-100 stats stats--book stats--bkmv"><tbody>`);
335-
stack.push(Renderer.monster.getCompactRenderedString(mon));
336-
stack.push(`</tbody></table></div>`);
337-
};
338-
339-
stack.push(`<div class="w-100 h-100">`);
340-
this._bookViewToShow.forEach(mon => renderCreature(mon));
341-
if (!this._bookViewToShow.length && Hist.lastLoadedId != null) {
342-
renderCreature(this._dataList[Hist.lastLoadedId]);
343-
}
344-
stack.push(`</div>`);
345-
346-
numShown += this._bookViewToShow.length;
347-
$wrpContent.append(stack.join(""));
348-
349-
// region Markdown
350-
// TODO refactor this and spell markdown section
351-
const pGetAsMarkdown = async () => {
352-
const toRender = this._bookViewToShow.length ? this._bookViewToShow : [this._dataList[Hist.lastLoadedId]];
353-
return RendererMarkdown.monster.pGetMarkdownDoc(toRender);
354-
};
355-
356-
const $btnDownloadMarkdown = $(`<button class="btn btn-default btn-sm">Download as Markdown</button>`)
357-
.click(async () => DataUtil.userDownloadText("bestiary.md", await pGetAsMarkdown()));
358-
359-
const $btnCopyMarkdown = $(`<button class="btn btn-default btn-sm px-2" title="Copy Markdown to Clipboard"><span class="glyphicon glyphicon-copy"/></button>`)
360-
.click(async () => {
361-
await MiscUtil.pCopyTextToClipboard(await pGetAsMarkdown());
362-
JqueryUtil.showCopiedEffect($btnCopyMarkdown);
363-
});
364-
365-
const $btnDownloadMarkdownSettings = $(`<button class="btn btn-default btn-sm px-2" title="Markdown Settings"><span class="glyphicon glyphicon-cog"/></button>`)
366-
.click(async () => RendererMarkdown.pShowSettingsModal());
367-
368-
$$`<div class="ve-flex-v-center btn-group ml-2">
369-
${$btnDownloadMarkdown}
370-
${$btnCopyMarkdown}
371-
${$btnDownloadMarkdownSettings}
372-
</div>`.appendTo($wrpControls);
373-
// endregion
374-
375-
return numShown;
376-
}
377-
378396
getListItem (mon, mI) {
379397
const hash = UrlUtil.autoEncodeHash(mon);
380398
if (this._seenHashes.has(hash)) return null;

0 commit comments

Comments
 (0)