Skip to content

Commit

Permalink
v2.1.6
Browse files Browse the repository at this point in the history
- Added Notification for when an Update for Core or System are waiting for you
- Fixed Missing Active Modules Count. By Default this is hidden, however there is a setting to display it either on the button or in its default location
- Fixed Locked Settings not being checked if the setting no longer exists after closing.
  - Fix provided by [@PepijnMC](#89 (comment))
- Added Individual Expand Button for Module Details
  • Loading branch information
mouse0270 committed Mar 4, 2023
1 parent e0d3dc3 commit 2c2da4f
Show file tree
Hide file tree
Showing 8 changed files with 147 additions and 11 deletions.
11 changes: 10 additions & 1 deletion .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,12 @@ jobs:
id: get_version
uses: battila7/get-version-action@v2

- uses: actions/setup-node@v2
with:
node-version: '16'
- run: npm install
- run: npm run build

# Substitute the Manifest and Download URLs in the module.json
- name: Substitute Manifest and Download Links For Versioned Ones
id: sub_manifest_link_version
Expand All @@ -23,16 +29,19 @@ jobs:
files: 'module.json'
env:
version: ${{steps.get_version.outputs.version-without-v}}
esmodules.0: "/scripts/bundle.min.mjs"
url: https://github.com/${{github.repository}}
manifest: https://github.com/${{github.repository}}/releases/latest/download/module.json
download: https://github.com/${{github.repository}}/releases/download/${{github.event.release.tag_name}}/module.zip
readme: "https://github.com/${{github.repository}}/blob/master/README.md"
changelog: "https://raw.githubusercontent.com/${{github.repository}}/master/CHANGELOG.md"
license: "https://github.com/mouse0270/${{github.repository}}/blob/master/LICENSE"
bugs: "https://github.com/${{github.repository}}/issues"
flags.allowBugReporter: true
flags.attributions: "https://github.com/${{github.repository}}/blob/master/ATTRIBUTIONS.md"

# Create a zip file with all files required by the module to add to the release
- run: zip -r ./module.zip module.json LICENSE README.md CHANGELOG.md ATTRIBUTIONS.md styles/ scripts/ templates/ languages/
- run: zip -r ./module.zip module.json LICENSE Api_License_Agreement.pdf README.md CHANGELOG.md ATTRIBUTIONS.md images/ styles/ scripts/bundle.min.mjs templates/ languages/

# Create a release for this specific version
- name: Update Release with Files
Expand Down
7 changes: 7 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,10 @@
# Version 2.1.6 - Hey Listen! You have an update waiting
- Added Notification for when an Update for Core or System are waiting for you
- Fixed Missing Active Modules Count. By Default this is hidden, however there is a setting to display it either on the button or in its default location
- Fixed Locked Settings not being checked if the setting no longer exists after closing.
- Fix provided by [@PepijnMC](https://github.com/mouse0270/module-credits/issues/89#issue-1530854149)
- Added Individual Expand Button for Module Details

# Version 2.1.5 - 99 Bugs in the Code, Take One Down, Patch it Around, 127 Bugs in the Code
- Fixed Big Picture Mode so that it properly fits if there are multiple rows of buttons.
- Fixed Expanded Module Dependencies trying to disable required/optional modules that are already disabled.
Expand Down
9 changes: 9 additions & 0 deletions languages/en.json
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,15 @@
"name": "Big Picture Mode",
"hint": "Enabling this feature will set the Module Management and Configure Settings windows to the full height of the foundry window."
},
"showActiveModules": {
"name": "Show Active Modules",
"hint": "When enabled this will show a list of active modules in the settings tab of the sidebar.",
"choices": {
"hidden": "Hidden",
"button": "On Button",
"default": "Core Default"
}
},
"enableGlobalConflicts": {
"name": "Enable Global Conflicts",
"hint": "When this setting is enabled, MM+ will grab conflicts from a publicly available google sheet. Using this feature will mean that Google will receive your IP address. If you are uncomfortable with this, turn off this feature."
Expand Down
10 changes: 10 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
{
"scripts": {
"build": "rollup -c",
"dev": "rollup -wcm"
},
"devDependencies": {
"rollup": "^3.7.2",
"rollup-terser": "^1.0.3"
}
}
16 changes: 16 additions & 0 deletions rollup.config.mjs
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
import MODULE from './module.json' assert { type: 'json' };

//
import { terser } from "rollup-terser";

export default {
input: `.${MODULE.esmodules[0]}`,
output: {
file: `./scripts/bundle.min.mjs`,
format: 'es',
compact: true
},
plugins: [
terser()
]
};
16 changes: 11 additions & 5 deletions scripts/_settings.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -113,6 +113,16 @@ Hooks.once('setup', () => {
default: true,
config: true,
});
MODULE.setting('register', 'showActiveModules', {
type: String,
default: 'hidden',
config: true,
choices: {
'hidden': `${MODULE.ID}.settings.showActiveModules.choices.hidden`,
'button': `${MODULE.ID}.settings.showActiveModules.choices.button`,
'default': `${MODULE.ID}.settings.showActiveModules.choices.default`
}
});

const trackedChangelogs = {
name: `${MODULE.ID}.settings.trackedChangelogs.name`,
Expand Down Expand Up @@ -240,8 +250,4 @@ Hooks.once('setup', () => {
}
}
}, {inplace: false}));
});

/*
*/
});
60 changes: 55 additions & 5 deletions scripts/module.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -880,6 +880,32 @@ export class MMP {
</span>`);
}

// Add Expand Module Button
elemPackage.querySelector('.package-overview').insertAdjacentHTML('beforeend', `<button class="tag expand" data-tooltip="${game.i18n.localize("Expand")}" aria-describedby="tooltip">
<i class="fa-solid fa-circle-caret-up"></i>
</button>`);
elemPackage.querySelector('.package-overview button.tag.expand').addEventListener('click', (event) => {
const currentElem = event.target.closest('button.tag.expand');
const parentElem = event.target.closest('.package');

// Toggle Package Description
parentElem.querySelector('.package-description').classList.toggle('hidden');

// Update Expand Button Tooltip
currentElem.dataset.tooltip = parentElem.querySelector('.package-description').classList.contains('hidden') ? game.i18n.localize("Expand") : game.i18n.localize("Collapse");

// Update Expand Button If All Modules Are Expanded
const isExpanded = document.querySelectorAll('#module-management .package-description:not(.hidden)').length == document.querySelectorAll('#module-management .package-description').length;
// Update Expand Button Title and Tooltip
document.querySelector('#module-management .list-filters button.expand').setAttribute('title', isExpanded ? game.i18n.localize("Collapse") : game.i18n.localize("Expand"));
document.querySelector('#module-management .list-filters button.expand').dataset.tooltip = isExpanded ? game.i18n.localize("Collapse") : game.i18n.localize("Expand");
// Toggle Expand Button Icon
document.querySelector('#module-management .list-filters button.expand i').classList.toggle('fa-angle-double-up', !isExpanded);
document.querySelector('#module-management .list-filters button.expand i').classList.toggle('fa-angle-double-down', isExpanded);
// Update Expand Button If All Modules Are Expanded
Object.values(ui.windows).find((window) => window.id === 'module-management')._expanded = isExpanded;
});

// Add Locked Status
if (MODULE.setting('lockedModules').hasOwnProperty(moduleKey) ?? false) {
elemPackage.querySelector('.package-overview .package-title input[type="checkbox"]').insertAdjacentHTML('afterend', `<i class="fa-duotone fa-lock" data-tooltip="${MODULE.localize('dialog.moduleManagement.tooltips.moduleLocked')}" style="margin-right: 0.25rem;"></i>`);
Expand Down Expand Up @@ -1184,7 +1210,14 @@ export class MMP {
if (game.user.isGM) {
for (const [key, value] of Object.entries(MMP.#LockedSettings)) {
const settingDetails = game.settings.settings.get(key);
MMP.#LockedSettings[`${key}`] = game.settings.get(settingDetails.namespace, settingDetails.key);

// Check if Setting is Still Valid, Otherwise Remove it from the Locked Settings
// Fix provided by @PepijnMC (https://github.com/mouse0270/module-credits/issues/89#issue-1530854149)
if (settingDetails) {
MMP.#LockedSettings[`${key}`] = game.settings.get(settingDetails.namespace, settingDetails.key);
}else{
delete MMP.#LockedSettings[`${key}`];
}
}

MODULE.setting('lockedSettings', MMP.#LockedSettings).then(response => {
Expand Down Expand Up @@ -1223,9 +1256,18 @@ export class MMP {

// Cleanup General Information
elem[0].querySelector('#game-details li.build').classList.add('hidden');
elem[0].querySelector('#game-details li.version span').innerHTML = `v${game.version}`;

elem[0].querySelector('#game-details li.system span').innerHTML = `v${game.system.version}`;
elem[0].querySelector('#game-details li.version span').innerHTML = `${game.data.coreUpdate.hasUpdate ? `<i class="notification-pip update fas fa-exclamation-circle" data-action="core-update" data-tooltip="${game.i18n.format("SETUP.UpdateAvailable", {
type: game.i18n.localize("Software"),
channel: game.data.coreUpdate.channel,
version: game.data.coreUpdate.version
})}"></i> ` : ''}v${game.version}`;

elem[0].querySelector('#game-details li.system span').innerHTML = `${game.data.systemUpdate.hasUpdate ? `<i class="notification-pip update fas fa-exclamation-circle" data-action="system-update" data-tooltip="${game.i18n.format("SETUP.UpdateAvailable", {
type: game.i18n.localize("System"),
channel: game.data.system.title,
version: game.data.systemUpdate.version
})}"></i> ` : ''}v${game.system.version}`;

if (readme || changelog || attributions || license) {
elem[0].querySelector('#game-details li.system').insertAdjacentHTML('afterend', '<li class="system-buttons"></li>');
if (readme || ((game.system.readme || "").match(APIs.github) ?? false) || ((game.system.readme || "").match(APIs.rawGithub) ?? false)) {
Expand Down Expand Up @@ -1284,7 +1326,15 @@ export class MMP {
}

// Hide Active Modules
elem[0].querySelector('#game-details li.modules').classList.add('hidden');
MODULE.log('Show Active Modules', MODULE.setting('showActiveModules'));

// If Hidden or Button, hide default Active Modules
if (['hidden', 'button'].includes(MODULE.setting('showActiveModules'))) elem[0].querySelector('#game-details li.modules').classList.add('hidden');

// If Button, add active modules / total modules text to button
if (MODULE.setting('showActiveModules') === 'button') {
elem[0].querySelector('#settings-game button[data-action="modules"]').insertAdjacentHTML('beforeend', ` <small><span class="modules-count-active">${game.modules.filter(module => module.active).length}</span><span class="modules-count-total">${game.modules.size}</span></small>`);
}
}
}
}
29 changes: 29 additions & 0 deletions styles/module.css
Original file line number Diff line number Diff line change
Expand Up @@ -154,6 +154,22 @@
cursor: pointer;
}

#module-management .package-list .package .package-overview .tag.expand {
background: rgba(0, 0, 0, 0.1);
border: 1px solid var(--color-border-light-primary);
color: buttontext;
margin: 0px;
margin-bottom: -5px;
margin-top: -5px;
margin-left: 6px;
}
.package-list .package .package-overview .tag.expand i {
margin: 0px;
}
#module-management .package-list .package:has(.package-description:not(.hidden)) .package-overview .tag.expand i:before {
content: '\f32d';
}

/* ────────────────────────────── ⋆⋅☆⋅⋆ ────────────────────────────── */
/* ORDER TAGS */
.package-list .package .package-overview .tag.author {
Expand Down Expand Up @@ -199,6 +215,10 @@
order: 14;
margin-right: 0px !important;
}
.package-list .package .package-overview .tag.expand {
order: 99;
margin-right: 0px !important;
}
#module-credits-dialog.sheet.journal-entry .sidebar.hidden {
display: none !important;
}
Expand Down Expand Up @@ -453,6 +473,15 @@ input[name="module-credits-preset-title"] + textarea {
margin-right: 0.25rem;
}

#settings div#settings-game button[data-action="modules"] small:before {
content: '(';
}
#settings div#settings-game button[data-action="modules"] small:after {
content: ')';
}
#settings div#settings-game button[data-action="modules"] small .modules-count-total:before {
content: ' / ';
}


/* ────────────────────────────── ⋆⋅☆⋅⋆ ────────────────────────────── */
Expand Down

0 comments on commit 2c2da4f

Please sign in to comment.