From 039b020a488d0a896c668ce85e835ad81af2eca8 Mon Sep 17 00:00:00 2001 From: rsek Date: Sun, 22 Jan 2023 17:55:47 -0800 Subject: [PATCH 1/6] data-on: initial commit --- src/module/actor/sheets/compactsheet.ts | 14 +++---- src/module/applications/createActorDialog.ts | 14 +++---- src/module/applications/firstStartDialog.ts | 4 +- src/module/applications/worldTruthsDialog.ts | 8 ++-- src/module/chat/cards.ts | 31 +++++++------- src/module/item/asset/assetsheet.ts | 40 +++++++++---------- .../delvethemeordomainsheet.ts | 12 +++--- src/module/journal/sheet/progress-page.ts | 6 +-- system/templates/actor/compact.hbs | 11 ++--- system/templates/actor/create.hbs | 2 +- system/templates/chat/sf-move.hbs | 3 +- system/templates/first-start.hbs | 12 ++++-- system/templates/item/asset.hbs | 20 +++++----- system/templates/item/delve-domain.hbs | 2 +- system/templates/item/delve-theme.hbs | 2 +- system/templates/journal/progress-buttons.hbs | 11 +++-- .../rolls/ironsworn-roll-message.hbs | 11 +++-- system/templates/sf-truths.hbs | 4 +- system/templates/truths.hbs | 4 +- 19 files changed, 112 insertions(+), 99 deletions(-) diff --git a/src/module/actor/sheets/compactsheet.ts b/src/module/actor/sheets/compactsheet.ts index 8edaec39a..b73ea778f 100644 --- a/src/module/actor/sheets/compactsheet.ts +++ b/src/module/actor/sheets/compactsheet.ts @@ -23,13 +23,13 @@ export class IronswornCompactCharacterSheet extends ActorSheet { super.activateListeners(html) html - .find('.ironsworn__stat__roll') - .on('click', (e) => this._onStatRoll.call(this, e)) + .find('[data-on-click="rollStat"]') + .on('click', (e) => this._rollStat.call(this, e)) html - .find('.ironsworn__resource__adjust') - .on('click', (e) => this._resourceAdjust.call(this, e)) + .find('[data-on-click="adjustResource"]') + .on('click', (e) => this._adjustResource.call(this, e)) html - .find('.ironsworn__momentum__burn') + .find('[data-on-click="momentumBurn"]') .on('click', (e) => this._momentumBurn.call(this, e)) } @@ -60,7 +60,7 @@ export class IronswornCompactCharacterSheet extends ActorSheet { this.actor.moveSheet.render(true, { focus: true }) } - async _onStatRoll(ev: JQuery.ClickEvent) { + async _rollStat(ev: JQuery.ClickEvent) { ev.preventDefault() const el = ev.currentTarget @@ -75,7 +75,7 @@ export class IronswornCompactCharacterSheet extends ActorSheet { } } - _resourceAdjust(ev: JQuery.ClickEvent) { + _adjustResource(ev: JQuery.ClickEvent) { ev.preventDefault() const amt = parseInt(ev.currentTarget.dataset.amt || '0') diff --git a/src/module/applications/createActorDialog.ts b/src/module/applications/createActorDialog.ts index f171c4cdc..59fa23e3e 100644 --- a/src/module/applications/createActorDialog.ts +++ b/src/module/applications/createActorDialog.ts @@ -45,25 +45,25 @@ export class CreateActorDialog extends FormApplication super.activateListeners(html) html - .find('.ironsworn__character__create') + .find('[data-on-click="createCharacter]') .on('click', (ev) => this._characterCreate.call(this, ev)) html - .find('.ironsworn__shared__create') + .find('[data-on-click="createShared"]') .on('click', (ev) => this._sharedCreate.call(this, ev)) html - .find('.ironsworn__site__create') + .find('[data-on-click="createSite"]') .on('click', (ev) => this._siteCreate.call(this, ev)) html - .find('.ironsworn__foe__create') + .find('[data-on-click="createFoe"]') .on('click', (ev) => this._foeCreate.call(this, ev)) html - .find('.ironsworn__sfcharacter__create') + .find('[data-on-click="createCharacterSf"]') .on('click', (ev) => this._sfcharacterCreate.call(this, ev)) html - .find('.ironsworn__sfship__create') + .find('[data-on-click="createStarship"]') .on('click', (ev) => this._sfshipCreate.call(this, ev)) html - .find('.ironsworn__sflocation__create') + .find('[data-on-click="createSfLocation"]') .on('click', (ev) => this._sfLocationCreate.call(this, ev)) } diff --git a/src/module/applications/firstStartDialog.ts b/src/module/applications/firstStartDialog.ts index 9fa47c2bb..3cc6e0cff 100644 --- a/src/module/applications/firstStartDialog.ts +++ b/src/module/applications/firstStartDialog.ts @@ -30,7 +30,9 @@ export class FirstStartDialog extends FormApplication { activateListeners(html: JQuery) { super.activateListeners(html) - html.find('.ironsworn__save').on('click', (ev) => this._save.call(this, ev)) + html + .find('[data-on-click="saveSettings"]') + .on('click', (ev) => this._save.call(this, ev)) } async _save(ev: JQuery.ClickEvent) { diff --git a/src/module/applications/worldTruthsDialog.ts b/src/module/applications/worldTruthsDialog.ts index 69368ec7e..627426863 100644 --- a/src/module/applications/worldTruthsDialog.ts +++ b/src/module/applications/worldTruthsDialog.ts @@ -56,14 +56,14 @@ export class WorldTruthsDialog extends FormApplication { super.activateListeners(html) html - .find('.ironsworn__custom__truth') - .on('focus', (ev) => this._customTruthFocus.call(this, ev)) + .find('[data-on-focus="selectTruthOption"]') + .on('focus', (ev) => this._selectTruthOption.call(this, ev)) html - .find('.ironsworn__save__truths') + .find('[data-on-click="saveTruths"]') .on('click', (ev) => this._save.call(this, ev)) } - _customTruthFocus(ev: JQuery.FocusEvent) { + _selectTruthOption(ev: JQuery.FocusEvent) { $(ev.currentTarget).siblings('input').prop('checked', true) } diff --git a/src/module/chat/cards.ts b/src/module/chat/cards.ts index c7fc7fd71..5a7df1194 100644 --- a/src/module/chat/cards.ts +++ b/src/module/chat/cards.ts @@ -66,27 +66,24 @@ export class IronswornChatCard { html .find('a.oracle-category-link') .on('click', (ev) => this._oracleNavigate.call(this, ev)) + // FIXME: the classes in these selectors below don't appear in new messages, but they're provided so that recent chat messages have coverage. Remove them in April 2023. html - .find('.burn-momentum') + .find( + '[data-on-click="burnMomentum"], .burn-momentum, .burn-momentum-sf, .ironsworn-roll-burn-momentum' + ) .on('click', (ev) => this._burnMomentum.call(this, ev)) html - .find('.burn-momentum-sf') - .on('click', (ev) => this._burnMomentum.call(this, ev)) - html - .find('.ironsworn-roll-burn-momentum') - .on('click', (ev) => this._burnMomentum.call(this, ev)) - html - .find('.oracle-roll .oracle-reroll') + .find('[data-on-click="rerollOracle"], .oracle-roll .oracle-reroll') .on('click', (ev) => this._oracleReroll.call(this, ev)) html - .find('.copy-result') - .on('click', (ev) => this._oracleResultCopy.call(this, ev)) + .find('[data-on-click="copyOracleResult"], .copy-result') + .on('click', (ev) => this._copyOracleResult.call(this, ev)) html - .find('.ironsworn-roll-resolve') - .on('click', (ev) => this._resolveChallenge.call(this, ev)) + .find('[data-on-click="resolveChallengeDice"], .ironsworn-roll-resolve') + .on('click', (ev) => this._resolveChallengeDice.call(this, ev)) html - .find('.starforged__oracle__roll') - .on('click', (ev) => this._oracleRoll.call(this, ev)) + .find('[data-on-click="rollOracle"], .starforged__oracle__roll') + .on('click', (ev) => this._rollOracle.call(this, ev)) } async _moveNavigate(ev: JQuery.ClickEvent) { @@ -122,7 +119,7 @@ export class IronswornChatCard { return irmsg?.burnMomentum() } - async _resolveChallenge(ev: JQuery.ClickEvent) { + async _resolveChallengeDice(ev: JQuery.ClickEvent) { ev.preventDefault() const msgId = $(ev.target).parents('.chat-message').data('message-id') @@ -138,7 +135,7 @@ export class IronswornChatCard { return orm?.createOrUpdate() } - async _oracleRoll(ev: JQuery.ClickEvent) { + async _rollOracle(ev: JQuery.ClickEvent) { ev.preventDefault() const { tableid } = ev.currentTarget.dataset const sfPack = game.packs.get('foundry-ironsworn.starforgedoracles') @@ -154,7 +151,7 @@ export class IronswornChatCard { msg.createOrUpdate() } - async _oracleResultCopy(ev: JQuery.ClickEvent) { + async _copyOracleResult(ev: JQuery.ClickEvent) { const { result } = ev.currentTarget.dataset await navigator.clipboard.writeText(result) const icon = $(ev.currentTarget).find('i.fas') diff --git a/src/module/item/asset/assetsheet.ts b/src/module/item/asset/assetsheet.ts index 3981e5a31..6c03a735c 100644 --- a/src/module/item/asset/assetsheet.ts +++ b/src/module/item/asset/assetsheet.ts @@ -13,35 +13,35 @@ export class AssetSheet extends IronswornItemSheet { if (!this.options.editable) return html - .find('.ironsworn__ability__enable') - .on('click', (ev) => this._abilityToggle.call(this, ev)) + .find('[data-on-click="toggleAbility"]') + .on('click', (ev) => this._toggleAbility.call(this, ev)) html - .find('.ironsworn__option__enable') - .on('click', (ev) => this._optionToggle.call(this, ev)) + .find('[data-on-click="toggleOption"]') + .on('click', (ev) => this._toggleOption.call(this, ev)) html - .find('.ironsworn__option__name') + .find('[data-on-blur="updateOptionName"]') .on('blur', (ev) => this._updateOptionName.call(this, ev)) html - .find('.ironsworn__option__delete') - .on('click', (ev) => this._optionDelete.call(this, ev)) + .find('[data-on-click="deleteOption"]') + .on('click', (ev) => this._deleteOption.call(this, ev)) html - .find('.ironsworn__option__add') - .on('click', (ev) => this._optionAdd.call(this, ev)) + .find('[data-on-click="addOption"]') + .on('click', (ev) => this._addOption.call(this, ev)) html - .find('.ironsworn__field__add') + .find('[data-on-click="addField"]') .on('click', (ev) => this._addField.call(this, ev)) html - .find('.ironsworn__field__label') + .find('[data-on-blur="updateFieldLabel"]') .on('blur', (ev) => this._updateFieldLabel.call(this, ev)) html - .find('.ironsworn__field__value') + .find('[data-on-blur="updateFieldValue"]') .on('blur', (ev) => this._updateFieldValue.call(this, ev)) html - .find('.ironsworn__field__delete') + .find('[data-on-click="deleteField"]') .on('click', (ev) => this._deleteField.call(this, ev)) html - .find('.ironsworn__asset__delete') - .on('click', (ev) => this.assetDelete.call(this, ev)) + .find('[data-on-click="deleteAsset"]') + .on('click', (ev) => this._deleteAsset.call(this, ev)) attachInlineRollListeners(html, { actor: this.actor || undefined }) } @@ -70,7 +70,7 @@ export class AssetSheet extends IronswornItemSheet { this.item.setFlag('foundry-ironsworn', 'edit-mode', !currentValue) } - _abilityToggle(ev: JQuery.ClickEvent) { + _toggleAbility(ev: JQuery.ClickEvent) { ev.preventDefault() const { idx } = ev.currentTarget.dataset @@ -79,7 +79,7 @@ export class AssetSheet extends IronswornItemSheet { this.item.update({ system: { abilities } }) } - _optionToggle(ev: JQuery.ClickEvent) { + _toggleOption(ev: JQuery.ClickEvent) { ev.preventDefault() const { idx } = ev.currentTarget.dataset @@ -99,7 +99,7 @@ export class AssetSheet extends IronswornItemSheet { this.item.update({ system: { exclusiveOptions } }) } - _optionAdd(ev: JQuery.ClickEvent) { + _addOption(ev: JQuery.ClickEvent) { ev.preventDefault() const exclusiveOptions = Object.values( @@ -109,7 +109,7 @@ export class AssetSheet extends IronswornItemSheet { this.item.update({ system: { exclusiveOptions } }) } - _optionDelete(ev: JQuery.ClickEvent) { + _deleteOption(ev: JQuery.ClickEvent) { ev.preventDefault() const { idx } = ev.currentTarget.dataset @@ -153,7 +153,7 @@ export class AssetSheet extends IronswornItemSheet { this.item.update({ system: { fields } }) } - assetDelete(ev: JQuery.ClickEvent) { + _deleteAsset(ev: JQuery.ClickEvent) { ev.preventDefault() Dialog.confirm({ diff --git a/src/module/item/delve-theme-domain/delvethemeordomainsheet.ts b/src/module/item/delve-theme-domain/delvethemeordomainsheet.ts index ebd43aff5..042566dfb 100644 --- a/src/module/item/delve-theme-domain/delvethemeordomainsheet.ts +++ b/src/module/item/delve-theme-domain/delvethemeordomainsheet.ts @@ -16,14 +16,14 @@ export class DelveThemeOrDomainSheet extends IronswornItemSheet { super.activateListeners(html) html - .find('.ironsworn__features__description') - .on('blur', (ev) => this._featureDescription.call(this, ev)) + .find('[data-on-blur="ironsworn:updateFeatureText"]') + .on('blur', (ev) => this._updateFeatureText.call(this, ev)) html - .find('.ironsworn__dangers__description') - .on('blur', (ev) => this._dangerDescription.call(this, ev)) + .find('[data-on-blur="ironsworn:updateDangerText"]') + .on('blur', (ev) => this._updateDangerText.call(this, ev)) } - _featureDescription(ev: JQuery.BlurEvent) { + _updateFeatureText(ev: JQuery.BlurEvent) { const val = $(ev.currentTarget).val()?.toString() || '' const idx = parseInt(ev.target.dataset.idx) const { features } = this.themeData @@ -31,7 +31,7 @@ export class DelveThemeOrDomainSheet extends IronswornItemSheet { this.item.update({ system: { features } }, { render: false }) } - _dangerDescription(ev: JQuery.BlurEvent) { + _updateDangerText(ev: JQuery.BlurEvent) { const val = $(ev.currentTarget).val()?.toString() || '' const idx = parseInt(ev.target.dataset.idx) const { dangers } = this.themeData diff --git a/src/module/journal/sheet/progress-page.ts b/src/module/journal/sheet/progress-page.ts index dced3d09b..096b1bc8d 100644 --- a/src/module/journal/sheet/progress-page.ts +++ b/src/module/journal/sheet/progress-page.ts @@ -86,15 +86,15 @@ export class JournalProgressPageSheet extends JournalPageSheet { }) this.render() }) - html.find('.ironsworn__progress__mark').on('click', async () => { + html.find('[data-on-click="markProgress"]').on('click', async () => { await increment(this.object, 1) this.render() }) - html.find('.ironsworn__progress__unmark').on('click', async () => { + html.find('[data-on-click="eraseProgress"]').on('click', async () => { await increment(this.object, -1) this.render() }) - html.find('.ironsworn__progress__roll').on('click', async () => { + html.find('[data-on-click="rollProgress"]').on('click', async () => { const { filledBoxes } = await this.getData() IronswornPrerollDialog.showForProgress( this.object.name ?? '(progress)', diff --git a/system/templates/actor/compact.hbs b/system/templates/actor/compact.hbs index 534e26f70..df60b81f1 100644 --- a/system/templates/actor/compact.hbs +++ b/system/templates/actor/compact.hbs @@ -3,7 +3,7 @@
{{#*inline "stat"}} -
+

{{localize (concat 'IRONSWORN.' (capitalize stat))}}

{{lookup data.system stat}}

@@ -22,24 +22,25 @@
{{#*inline "resource"}}
-
{{localize (concat 'IRONSWORN.' (capitalize stat))}}

{{lookup data.system stat}}

-
{{#if burn}}
{{/if}} -
+
diff --git a/system/templates/actor/create.hbs b/system/templates/actor/create.hbs index b8309ffa5..ce8e56847 100644 --- a/system/templates/actor/create.hbs +++ b/system/templates/actor/create.hbs @@ -1,5 +1,5 @@ {{#*inline "createBox"}} -
diff --git a/system/templates/chat/sf-move.hbs b/system/templates/chat/sf-move.hbs index ca6510685..177d2a43e 100644 --- a/system/templates/chat/sf-move.hbs +++ b/system/templates/chat/sf-move.hbs @@ -21,7 +21,8 @@
{{#each nextOracles}}
@@ -100,7 +102,11 @@
- diff --git a/system/templates/item/asset.hbs b/system/templates/item/asset.hbs index 143c2bc8d..30414d51e 100644 --- a/system/templates/item/asset.hbs +++ b/system/templates/item/asset.hbs @@ -19,20 +19,20 @@
  - +
  - +
-
+
{{/each}} -
+
@@ -42,7 +42,7 @@ {{#each data.data.abilities}}
- {{#if ../item.data.flags.foundry-ironsworn.edit-mode}} {{localize 'IRONSWORN.Options'}} {{#each data.data.exclusiveOptions}}
- - -
+ +
{{/each}} -
+
@@ -93,5 +93,5 @@

- + \ No newline at end of file diff --git a/system/templates/item/delve-domain.hbs b/system/templates/item/delve-domain.hbs index 1d8d4be0f..719f86b85 100644 --- a/system/templates/item/delve-domain.hbs +++ b/system/templates/item/delve-domain.hbs @@ -5,7 +5,7 @@ {{#if (eq low high)}}{{low}}{{else}}{{low}} - {{high}}{{/if}} - + {{/each}} diff --git a/system/templates/item/delve-theme.hbs b/system/templates/item/delve-theme.hbs index 1d8d4be0f..719f86b85 100644 --- a/system/templates/item/delve-theme.hbs +++ b/system/templates/item/delve-theme.hbs @@ -5,7 +5,7 @@ {{#if (eq low high)}}{{low}}{{else}}{{low}} - {{high}}{{/if}} - + {{/each}} diff --git a/system/templates/journal/progress-buttons.hbs b/system/templates/journal/progress-buttons.hbs index d02f90b09..ce9dcfd3d 100644 --- a/system/templates/journal/progress-buttons.hbs +++ b/system/templates/journal/progress-buttons.hbs @@ -4,7 +4,8 @@ style='flex-flow: nowrap;' > - + \ No newline at end of file diff --git a/system/templates/rolls/ironsworn-roll-message.hbs b/system/templates/rolls/ironsworn-roll-message.hbs index a18a3a5ca..c01b3bdfc 100644 --- a/system/templates/rolls/ironsworn-roll-message.hbs +++ b/system/templates/rolls/ironsworn-roll-message.hbs @@ -33,7 +33,8 @@ {{#if unresolved}}
- + \ No newline at end of file diff --git a/system/templates/sf-truths.hbs b/system/templates/sf-truths.hbs index 65490b82d..6a733759a 100644 --- a/system/templates/sf-truths.hbs +++ b/system/templates/sf-truths.hbs @@ -28,14 +28,14 @@
- +
{{/each}}
- diff --git a/system/templates/truths.hbs b/system/templates/truths.hbs index b3714b9cc..21457226e 100644 --- a/system/templates/truths.hbs +++ b/system/templates/truths.hbs @@ -18,14 +18,14 @@
- +
{{/each}}
- From e24ca505a11f535e5b2401aed4e41dc0a60bd659 Mon Sep 17 00:00:00 2001 From: rsek Date: Sun, 22 Jan 2023 18:37:16 -0800 Subject: [PATCH 2/6] fix unecessary namespace --- src/module/applications/createActorDialog.ts | 32 +++++++++---------- .../delvethemeordomainsheet.ts | 4 +-- 2 files changed, 18 insertions(+), 18 deletions(-) diff --git a/src/module/applications/createActorDialog.ts b/src/module/applications/createActorDialog.ts index d8fa1c946..966465563 100644 --- a/src/module/applications/createActorDialog.ts +++ b/src/module/applications/createActorDialog.ts @@ -45,29 +45,29 @@ export class CreateActorDialog extends FormApplication super.activateListeners(html) html - .find('[data-on-click="createCharacter]') - .on('click', (ev) => this._characterCreate.call(this, ev)) + .find('[data-on-click="createCharacter"]') + .on('click', (ev) => this._createCharacter.call(this, ev)) html .find('[data-on-click="createShared"]') - .on('click', (ev) => this._sharedCreate.call(this, ev)) + .on('click', (ev) => this._createShared.call(this, ev)) html .find('[data-on-click="createSite"]') - .on('click', (ev) => this._siteCreate.call(this, ev)) + .on('click', (ev) => this._createSite.call(this, ev)) html .find('[data-on-click="createFoe"]') - .on('click', (ev) => this._foeCreate.call(this, ev)) + .on('click', (ev) => this._createFoe.call(this, ev)) html - .find('[data-on-click="createCharacterSf"]') - .on('click', (ev) => this._sfcharacterCreate.call(this, ev)) + .find('[data-on-click="createSfCharacter"]') + .on('click', (ev) => this._createSfCharacter.call(this, ev)) html .find('[data-on-click="createStarship"]') - .on('click', (ev) => this._sfshipCreate.call(this, ev)) + .on('click', (ev) => this._createStarship.call(this, ev)) html .find('[data-on-click="createSfLocation"]') - .on('click', (ev) => this._sfLocationCreate.call(this, ev)) + .on('click', (ev) => this._createSfLocation.call(this, ev)) } - async _characterCreate(ev: JQuery.ClickEvent) { + async _createCharacter(ev: JQuery.ClickEvent) { ev.preventDefault() // Roll an Ironlander name @@ -82,7 +82,7 @@ export class CreateActorDialog extends FormApplication ) } - async _sharedCreate(ev: JQuery.ClickEvent) { + async _createShared(ev: JQuery.ClickEvent) { ev.preventDefault() this._createWithFolder( game.i18n.localize('IRONSWORN.ACTOR.TypeShared'), @@ -91,7 +91,7 @@ export class CreateActorDialog extends FormApplication ) } - async _siteCreate(ev: JQuery.ClickEvent) { + async _createSite(ev: JQuery.ClickEvent) { ev.preventDefault() this._createWithFolder( game.i18n.localize('IRONSWORN.ACTOR.TypeDelveSite'), @@ -100,7 +100,7 @@ export class CreateActorDialog extends FormApplication ) } - async _foeCreate(ev: JQuery.ClickEvent) { + async _createFoe(ev: JQuery.ClickEvent) { ev.preventDefault() this._createWithFolder( game.i18n.localize('IRONSWORN.ACTOR.TypeFoe'), @@ -109,7 +109,7 @@ export class CreateActorDialog extends FormApplication ) } - async _sfcharacterCreate(ev: JQuery.ClickEvent) { + async _createSfCharacter(ev: JQuery.ClickEvent) { ev.preventDefault() const name = await this._randomStarforgedName() @@ -122,7 +122,7 @@ export class CreateActorDialog extends FormApplication ) } - async _sfshipCreate(ev: JQuery.ClickEvent) { + async _createStarship(ev: JQuery.ClickEvent) { ev.preventDefault() this._createWithFolder( game.i18n.localize('IRONSWORN.ACTOR.TypeStarship'), @@ -131,7 +131,7 @@ export class CreateActorDialog extends FormApplication ) } - async _sfLocationCreate(ev: JQuery.ClickEvent) { + async _createSfLocation(ev: JQuery.ClickEvent) { ev.preventDefault() this._createWithFolder( game.i18n.localize('IRONSWORN.ACTOR.TypeLocation'), diff --git a/src/module/item/delve-theme-domain/delvethemeordomainsheet.ts b/src/module/item/delve-theme-domain/delvethemeordomainsheet.ts index e69322c1c..903f6195a 100644 --- a/src/module/item/delve-theme-domain/delvethemeordomainsheet.ts +++ b/src/module/item/delve-theme-domain/delvethemeordomainsheet.ts @@ -16,10 +16,10 @@ export class DelveThemeOrDomainSheet extends IronswornItemSheet { super.activateListeners(html) html - .find('[data-on-blur="ironsworn:updateFeatureText"]') + .find('[data-on-blur="updateFeatureText"]') .on('blur', (ev) => this._updateFeatureText.call(this, ev)) html - .find('[data-on-blur="ironsworn:updateDangerText"]') + .find('[data-on-blur="updateDangerText"]') .on('blur', (ev) => this._updateDangerText.call(this, ev)) } From b9382c75b78dfff6dccb6de7e3da1539387091d1 Mon Sep 17 00:00:00 2001 From: rsek Date: Sun, 22 Jan 2023 18:38:56 -0800 Subject: [PATCH 3/6] more verbose save method names --- src/module/applications/firstStartDialog.ts | 4 ++-- src/module/applications/worldTruthsDialog.ts | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/src/module/applications/firstStartDialog.ts b/src/module/applications/firstStartDialog.ts index 3cc6e0cff..748c234f3 100644 --- a/src/module/applications/firstStartDialog.ts +++ b/src/module/applications/firstStartDialog.ts @@ -32,10 +32,10 @@ export class FirstStartDialog extends FormApplication { super.activateListeners(html) html .find('[data-on-click="saveSettings"]') - .on('click', (ev) => this._save.call(this, ev)) + .on('click', (ev) => this._saveSettings.call(this, ev)) } - async _save(ev: JQuery.ClickEvent) { + async _saveSettings(ev: JQuery.ClickEvent) { ev.preventDefault() const setValues = this.element.find('form').serializeArray() diff --git a/src/module/applications/worldTruthsDialog.ts b/src/module/applications/worldTruthsDialog.ts index 627426863..2099ada43 100644 --- a/src/module/applications/worldTruthsDialog.ts +++ b/src/module/applications/worldTruthsDialog.ts @@ -60,14 +60,14 @@ export class WorldTruthsDialog extends FormApplication { .on('focus', (ev) => this._selectTruthOption.call(this, ev)) html .find('[data-on-click="saveTruths"]') - .on('click', (ev) => this._save.call(this, ev)) + .on('click', (ev) => this._saveTruths.call(this, ev)) } _selectTruthOption(ev: JQuery.FocusEvent) { $(ev.currentTarget).siblings('input').prop('checked', true) } - async _save(ev: JQuery.ClickEvent) { + async _saveTruths(ev: JQuery.ClickEvent) { ev.preventDefault() // Get elements that are checked From faedeff653d692bab4d2787e35247201f6edbbcc Mon Sep 17 00:00:00 2001 From: rsek Date: Tue, 24 Jan 2023 16:41:16 -0800 Subject: [PATCH 4/6] update method names --- src/module/actor/sheets/compactsheet.ts | 6 +++--- src/module/chat/cards.ts | 5 ++--- 2 files changed, 5 insertions(+), 6 deletions(-) diff --git a/src/module/actor/sheets/compactsheet.ts b/src/module/actor/sheets/compactsheet.ts index b73ea778f..02eb5dd9a 100644 --- a/src/module/actor/sheets/compactsheet.ts +++ b/src/module/actor/sheets/compactsheet.ts @@ -29,8 +29,8 @@ export class IronswornCompactCharacterSheet extends ActorSheet { .find('[data-on-click="adjustResource"]') .on('click', (e) => this._adjustResource.call(this, e)) html - .find('[data-on-click="momentumBurn"]') - .on('click', (e) => this._momentumBurn.call(this, e)) + .find('[data-on-click="burnMomentum"]') + .on('click', (e) => this._burnMomentum.call(this, e)) } _getHeaderButtons() { @@ -95,7 +95,7 @@ export class IronswornCompactCharacterSheet extends ActorSheet { } } - _momentumBurn(ev: JQuery.ClickEvent) { + _burnMomentum(ev: JQuery.ClickEvent) { ev.preventDefault() if (this.actor.type === 'character') { diff --git a/src/module/chat/cards.ts b/src/module/chat/cards.ts index 5a7df1194..6a61f7fc2 100644 --- a/src/module/chat/cards.ts +++ b/src/module/chat/cards.ts @@ -1,7 +1,6 @@ import { compact, flatten } from 'lodash' import { SFMoveDataPropertiesData } from '../item/itemtypes' import { IronswornItem } from '../item/item' -import { cachedDocumentsForPack } from '../features/pack-cache' import { IronswornRollMessage, OracleRollMessage } from '../rolls' import { ChallengeResolutionDialog } from '../rolls/challenge-resolution-dialog' import { getFoundryTableByDfId } from '../dataforged' @@ -74,7 +73,7 @@ export class IronswornChatCard { .on('click', (ev) => this._burnMomentum.call(this, ev)) html .find('[data-on-click="rerollOracle"], .oracle-roll .oracle-reroll') - .on('click', (ev) => this._oracleReroll.call(this, ev)) + .on('click', (ev) => this._rerollOracle.call(this, ev)) html .find('[data-on-click="copyOracleResult"], .copy-result') .on('click', (ev) => this._copyOracleResult.call(this, ev)) @@ -126,7 +125,7 @@ export class IronswornChatCard { ChallengeResolutionDialog.showForMessage(msgId) } - async _oracleReroll(ev: JQuery.ClickEvent) { + async _rerollOracle(ev: JQuery.ClickEvent) { ev.preventDefault() const msgId = $(ev.target).parents('.chat-message').data('message-id') From db8f5f91536d9b32248eba9fe54143e46295d4cc Mon Sep 17 00:00:00 2001 From: rsek Date: Tue, 24 Jan 2023 16:47:26 -0800 Subject: [PATCH 5/6] fix casing in method name --- src/module/applications/createActorDialog.ts | 12 ++++++------ system/templates/actor/create.hbs | 2 +- 2 files changed, 7 insertions(+), 7 deletions(-) diff --git a/src/module/applications/createActorDialog.ts b/src/module/applications/createActorDialog.ts index 966465563..2d58ff013 100644 --- a/src/module/applications/createActorDialog.ts +++ b/src/module/applications/createActorDialog.ts @@ -57,14 +57,14 @@ export class CreateActorDialog extends FormApplication .find('[data-on-click="createFoe"]') .on('click', (ev) => this._createFoe.call(this, ev)) html - .find('[data-on-click="createSfCharacter"]') - .on('click', (ev) => this._createSfCharacter.call(this, ev)) + .find('[data-on-click="createSfcharacter"]') + .on('click', (ev) => this._createSfcharacter.call(this, ev)) html .find('[data-on-click="createStarship"]') .on('click', (ev) => this._createStarship.call(this, ev)) html - .find('[data-on-click="createSfLocation"]') - .on('click', (ev) => this._createSfLocation.call(this, ev)) + .find('[data-on-click="createSflocation"]') + .on('click', (ev) => this._createSflocation.call(this, ev)) } async _createCharacter(ev: JQuery.ClickEvent) { @@ -109,7 +109,7 @@ export class CreateActorDialog extends FormApplication ) } - async _createSfCharacter(ev: JQuery.ClickEvent) { + async _createSfcharacter(ev: JQuery.ClickEvent) { ev.preventDefault() const name = await this._randomStarforgedName() @@ -131,7 +131,7 @@ export class CreateActorDialog extends FormApplication ) } - async _createSfLocation(ev: JQuery.ClickEvent) { + async _createSflocation(ev: JQuery.ClickEvent) { ev.preventDefault() this._createWithFolder( game.i18n.localize('IRONSWORN.ACTOR.TypeLocation'), diff --git a/system/templates/actor/create.hbs b/system/templates/actor/create.hbs index 29ae448ac..d814d44ae 100644 --- a/system/templates/actor/create.hbs +++ b/system/templates/actor/create.hbs @@ -1,5 +1,5 @@ {{#*inline "createBox"}} -
From b1a9e7eea72f13a3a795725f6e41a5734a71f04f Mon Sep 17 00:00:00 2001 From: rsek Date: Tue, 24 Jan 2023 18:16:29 -0800 Subject: [PATCH 6/6] update changelog --- CHANGELOG.md | 2 ++ 1 file changed, 2 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 34b7b5e1d..35d97296d 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -2,6 +2,8 @@ ## Next Release +- Under the hood: apply Handlebars template listeners with `data-on-*` HTML attributes rather than classes ([#608](https://github.com/ben/foundry-ironsworn/pull/608)) + ## 1.20.14 - Allow pre-setting of challenge dice, and revamp the advanced rolling options UI ([#606](https://github.com/ben/foundry-ironsworn/pull/606))