From 438358f01bef8888afe45f976e846caddc5e4992 Mon Sep 17 00:00:00 2001 From: Blair Date: Sun, 3 Sep 2023 18:22:16 +1000 Subject: [PATCH] v2.7.7 - Moulinette Exporter changes: - now defaults to nothing selected, rather than everything in the world selected for export. - now remembers the previously entered URL and Journal. - selecting a single entity will now automatically select any parent folders. --- CHANGELOG.md | 7 ++++++ module.json | 2 +- scripts/constants.js | 10 +++++++++ scripts/export-import/exporter.js | 33 ++++++++++++++-------------- scripts/scene-packer.js | 14 ++++++++++++ templates/export-import/exporter.hbs | 24 ++++++++++---------- 6 files changed, 60 insertions(+), 30 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index a97e647..5ff23a4 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,12 @@ # Changelog +## v2.7.7 + +- Moulinette Exporter changes: + - now defaults to nothing selected, rather than everything in the world selected for export. + - now remembers the previously entered URL and Journal. + - selecting a single entity will now automatically select any parent folders. + ## v2.7.6 - "Relink compendium entries" macro will no longer remove compendiums from their folders. diff --git a/module.json b/module.json index d4842f4..349e6ba 100644 --- a/module.json +++ b/module.json @@ -3,7 +3,7 @@ "name": "scene-packer", "title": "Library: Scene Packer", "description": "A module to assist with Scene and Adventure packing and unpacking.", - "version": "2.7.6", + "version": "2.7.7", "library": "true", "manifestPlusVersion": "1.2.0", "minimumCoreVersion": "0.8.6", diff --git a/scripts/constants.js b/scripts/constants.js index e9fd873..02cd24f 100644 --- a/scripts/constants.js +++ b/scripts/constants.js @@ -169,6 +169,16 @@ export const CONSTANTS = Object.freeze({ */ SETTING_EXPORT_TO_MOULINETTE_THEMES: 'exportToMoulinetteThemes', + /** + * The setting key for tracking previously used URL in the Moulinette Exporter. + */ + SETTING_EXPORT_TO_MOULINETTE_URL: 'exportToMoulinetteURL', + + /** + * The setting key for tracking previously used Welcome Journal in the Moulinette Exporter. + */ + SETTING_EXPORT_TO_MOULINETTE_WELCOME_JOURNAL: 'exportToMoulinetteWelcomeJournal', + /** * The setting key for triggering the Importer class. */ diff --git a/scripts/export-import/exporter.js b/scripts/export-import/exporter.js index 99b6e58..4114f03 100644 --- a/scripts/export-import/exporter.js +++ b/scripts/export-import/exporter.js @@ -288,17 +288,7 @@ export default class Exporter extends FormApplication { supportsCards: this.supportsCards, cards: this.Cards, macros: this.Macro, - summary: game.i18n.format('SCENE-PACKER.exporter.selected-count', { - count: - this.Scene.documents.size + - this.Actor.documents.size + - this.Item.documents.size + - this.Cards.documents.size + - this.JournalEntry.documents.size + - this.RollTable.documents.size + - this.Playlist.documents.size + - this.Macro.documents.size, - }), + summary: game.i18n.format('SCENE-PACKER.exporter.selected-count', {count: 0}), complete: this.complete, packageName: worldData.title, packageAuthor: game.settings.get(CONSTANTS.MODULE_NAME, CONSTANTS.SETTING_EXPORT_TO_MOULINETTE_AUTHOR) || '', @@ -307,6 +297,8 @@ export default class Exporter extends FormApplication { packageDescription: worldData.description, packageDiscord: game.settings.get(CONSTANTS.MODULE_NAME, CONSTANTS.SETTING_EXPORT_TO_MOULINETTE_DISCORD) || '', packageEmail: game.settings.get(CONSTANTS.MODULE_NAME, CONSTANTS.SETTING_EXPORT_TO_MOULINETTE_EMAIL) || '', + packageUrl: game.settings.get(CONSTANTS.MODULE_NAME, CONSTANTS.SETTING_EXPORT_TO_MOULINETTE_URL) || '', + packageWelcomeJournal: game.settings.get(CONSTANTS.MODULE_NAME, CONSTANTS.SETTING_EXPORT_TO_MOULINETTE_WELCOME_JOURNAL) || '', adventureSystem: game.system.id, adventureCategoryOptions: this.adventureCategoryOptions, adventureThemeSuggestions: Array.from(this.adventureThemeSuggestions), @@ -527,8 +519,12 @@ export default class Exporter extends FormApplication { _onClickCheckbox(event) { event.stopPropagation(); const element = event.currentTarget; + const isBeingTicked = $(element).prop('checked'); let $input = $(element).closest('li').find('input[type="checkbox"]'); - $input.prop('checked', $(element).prop('checked')); + $input.prop('checked', isBeingTicked); + if (isBeingTicked) { + $input.parents('.directory-item.folder').children('header').find('input[type="checkbox"]').prop('checked', isBeingTicked); + } this._updateCounts(); } @@ -543,8 +539,13 @@ export default class Exporter extends FormApplication { return; } event.preventDefault(); - const $input = $(event.currentTarget).find('input[type="checkbox"]'); - $input.prop('checked', !$input.prop('checked')); + const element = event.currentTarget; + const $input = $(element).find('input[type="checkbox"]'); + const isBeingTicked = !$input.prop('checked'); + $input.prop('checked', isBeingTicked); + if (isBeingTicked) { + $input.parents('.directory-item.folder').children('header').find('input[type="checkbox"]').prop('checked', isBeingTicked); + } this._updateCounts(); } @@ -553,9 +554,7 @@ export default class Exporter extends FormApplication { */ _updateCounts() { let scenePackerExporter = $('#scene-packer-exporter'); - this.selected = scenePackerExporter - .find('input[type="checkbox"]:checked') - .filter((i, e) => e.dataset.type !== 'Folder'); + this.selected = scenePackerExporter.find('div.tab:not([data-tab=options]) input[type="checkbox"]:checked'); scenePackerExporter .find('footer p.summary') .text( diff --git a/scripts/scene-packer.js b/scripts/scene-packer.js index b6c1f50..238e62d 100755 --- a/scripts/scene-packer.js +++ b/scripts/scene-packer.js @@ -5870,6 +5870,20 @@ Hooks.once('setup', () => { type: Array, default: [], }); + + game.settings.register(CONSTANTS.MODULE_NAME, CONSTANTS.SETTING_EXPORT_TO_MOULINETTE_URL, { + scope: 'client', + config: false, + type: String, + default: '', + }); + + game.settings.register(CONSTANTS.MODULE_NAME, CONSTANTS.SETTING_EXPORT_TO_MOULINETTE_WELCOME_JOURNAL, { + scope: 'client', + config: false, + type: String, + default: '', + }); }); /** diff --git a/templates/export-import/exporter.hbs b/templates/export-import/exporter.hbs index 47e542d..cf3326d 100644 --- a/templates/export-import/exporter.hbs +++ b/templates/export-import/exporter.hbs @@ -8,7 +8,7 @@ {{/if}}

- + {{#if isV9}}{{folder.name}}{{else}}{{folder.folder.name}}{{/if}}

@@ -33,7 +33,7 @@ {{#*inline "entityPartial"}}
  • - +
    - +