Added a commonListeners in helper to avoid repetitions
Added a "compendium-link" listener class to open compendium folder in JournalEntries
This commit is contained in:
@@ -289,12 +289,8 @@ export class BaseSheetL5r5e extends ActorSheet {
|
|||||||
activateListeners(html) {
|
activateListeners(html) {
|
||||||
super.activateListeners(html);
|
super.activateListeners(html);
|
||||||
|
|
||||||
// Toggle
|
// Commons
|
||||||
html.find(".toggle-on-click").on("click", (event) => {
|
game.l5r5e.HelpersL5r5e.commonListeners(html);
|
||||||
const elmt = $(event.currentTarget).data("toggle");
|
|
||||||
const tgt = html.find("." + elmt);
|
|
||||||
tgt.toggleClass("toggle-active");
|
|
||||||
});
|
|
||||||
|
|
||||||
// *** Everything below here is only needed if the sheet is editable ***
|
// *** Everything below here is only needed if the sheet is editable ***
|
||||||
if (!this.options.editable) {
|
if (!this.options.editable) {
|
||||||
|
|||||||
@@ -160,12 +160,8 @@ export class TwentyQuestionsDialog extends FormApplication {
|
|||||||
activateListeners(html) {
|
activateListeners(html) {
|
||||||
super.activateListeners(html);
|
super.activateListeners(html);
|
||||||
|
|
||||||
// Toggle
|
// Commons
|
||||||
html.find(".toggle-on-click").on("click", (event) => {
|
game.l5r5e.HelpersL5r5e.commonListeners(html);
|
||||||
const elmt = $(event.currentTarget).data("toggle");
|
|
||||||
const tgt = html.find("." + elmt);
|
|
||||||
tgt.toggleClass("toggle-active");
|
|
||||||
});
|
|
||||||
|
|
||||||
// BT Next
|
// BT Next
|
||||||
html.find(".next").on("click", (event) => {
|
html.find(".next").on("click", (event) => {
|
||||||
|
|||||||
@@ -362,4 +362,28 @@ export class HelpersL5r5e {
|
|||||||
});
|
});
|
||||||
return { xp_used, xp_used_total };
|
return { xp_used, xp_used_total };
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Subscribe to common events from the sheet.
|
||||||
|
* @param {jQuery} html HTML content of the sheet.
|
||||||
|
*/
|
||||||
|
static commonListeners(html) {
|
||||||
|
// Toggle
|
||||||
|
html.find(".toggle-on-click").on("click", (event) => {
|
||||||
|
const elmt = $(event.currentTarget).data("toggle");
|
||||||
|
const tgt = html.find("." + elmt);
|
||||||
|
tgt.toggleClass("toggle-active");
|
||||||
|
});
|
||||||
|
|
||||||
|
// Compendium folder link
|
||||||
|
html.find(".compendium-link").on("click", (event) => {
|
||||||
|
const packId = $(event.currentTarget).data("pack");
|
||||||
|
if (packId) {
|
||||||
|
const pack = game.packs.get(packId);
|
||||||
|
if (pack) {
|
||||||
|
pack.render(true);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -88,12 +88,8 @@ export class ItemSheetL5r5e extends ItemSheet {
|
|||||||
activateListeners(html) {
|
activateListeners(html) {
|
||||||
super.activateListeners(html);
|
super.activateListeners(html);
|
||||||
|
|
||||||
// Toggle
|
// Commons
|
||||||
html.find(".toggle-on-click").on("click", (event) => {
|
game.l5r5e.HelpersL5r5e.commonListeners(html);
|
||||||
const elmt = $(event.currentTarget).data("toggle");
|
|
||||||
const tgt = html.find("." + elmt);
|
|
||||||
tgt.toggleClass("toggle-active");
|
|
||||||
});
|
|
||||||
|
|
||||||
// Everything below here is only needed if the sheet is editable
|
// Everything below here is only needed if the sheet is editable
|
||||||
if (!this.options.editable) {
|
if (!this.options.editable) {
|
||||||
|
|||||||
@@ -31,4 +31,20 @@ export class BaseJournalSheetL5r5e extends JournalSheet {
|
|||||||
}
|
}
|
||||||
return super._updateObject(event, formData);
|
return super._updateObject(event, formData);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Subscribe to events from the sheet.
|
||||||
|
* @param {jQuery} html HTML content of the sheet.
|
||||||
|
*/
|
||||||
|
activateListeners(html) {
|
||||||
|
super.activateListeners(html);
|
||||||
|
|
||||||
|
// Commons
|
||||||
|
game.l5r5e.HelpersL5r5e.commonListeners(html);
|
||||||
|
|
||||||
|
// *** Everything below here is only needed if the sheet is editable ***
|
||||||
|
// if (!this.options.editable) {
|
||||||
|
// return;
|
||||||
|
// }
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
File diff suppressed because one or more lines are too long
@@ -324,6 +324,16 @@ sup {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Entity link style for compendium folder custom link
|
||||||
|
a.compendium-link {
|
||||||
|
background: #ddd;
|
||||||
|
padding: 1px 4px;
|
||||||
|
border: 1px solid #4b4a44;
|
||||||
|
border-radius: 2px;
|
||||||
|
white-space: nowrap;
|
||||||
|
word-break: break-all;
|
||||||
|
}
|
||||||
|
|
||||||
// Fix for "search anywhere" draggable icon
|
// Fix for "search anywhere" draggable icon
|
||||||
.window-draggable-handle {
|
.window-draggable-handle {
|
||||||
z-index: 2;
|
z-index: 2;
|
||||||
|
|||||||
Reference in New Issue
Block a user