Skip to content

Commit

Permalink
v2.2.0
Browse files Browse the repository at this point in the history
fixes for v11 and before
  • Loading branch information
mouse0270 committed Jun 7, 2023
1 parent 2c2da4f commit afbe962
Show file tree
Hide file tree
Showing 5 changed files with 38 additions and 9 deletions.
11 changes: 11 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,14 @@
# Version 2.2.0 - Foundry v11 Compatibility
- Increased `compatibility.maximum` to `11`
- Fixed package title selector to handle for v10 and v11 of foundry Module Management Window
- Replaced Foundry's `Info` and `Author` tags because, I disagree with their current implementation
- Not saying either mine or theirs is the proper way, this is completely a personal opinion of mine
- Removed Safe Tag, because its useless information. (Once again, personal opinion)
- Added Version back to the Modules Tags
- Fixed **Expanded Module Dependencies** to not throw an error when Optional modules are not installed.
> I left `compatibility.verified` as I only did a quick test to make sure most features worked as expected.
> If I get reports that most features work as expected then I will update this to version 11
# 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
Expand Down
2 changes: 1 addition & 1 deletion languages/en.json
Original file line number Diff line number Diff line change
Expand Up @@ -119,7 +119,7 @@
"tags": {
"socket": "Module uses Socket API",
"library": "Is a Library Module",
"authors": "Authors",
"authors": "Authors (click to view)",
"url": "View Website",
"readme": "View Readme",
"changelog": "View Changelog",
Expand Down
4 changes: 2 additions & 2 deletions module.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,11 @@
"id": "module-credits",
"title": "Module Management+",
"description": "Is packed with features and design improvements designed to make managing large module list easy. MM+ provides more detailed information about modules at a glance and allows you to read packages changelogs/readmes directly in foundry meant to help you find answers quickly. Some of the notable features of Module Management+ is the Addition of new tags such as readme, changelog, issues and authors. A cleaner easier list view of the modules with stripped rows and more spacing to make the viewing experiance easier on the eyes. The ability to see conflicts and known issues with your installed modules.",
"version": "2.1.2",
"version": "2.2.0",
"compatibility": {
"minimum": 10,
"verified": 10,
"maximum": 10
"maximum": 11
},
"authors": [
{
Expand Down
8 changes: 4 additions & 4 deletions scripts/init.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ Hooks.once('ready', async () => {
const allPackages = Array.from(game.modules).concat([game.system, game.world]);

// Get All Required Packages
const getValidRelationship = (relationship) => (relationship.reduce((filtered, requirement) => {
const getValidRelationship = (relationship, isOptional) => (relationship.reduce((filtered, requirement) => {
// If required Module is already enabled or checked, then exclude
const isEnabled = (requirementID) => {
return input.form.querySelector(`.package input[type="checkbox"][name="${requirementID}"]`).checked;
Expand All @@ -60,7 +60,7 @@ Hooks.once('ready', async () => {

// If Required Module is not installed
if (!game.modules.get(requirement.id) ?? false) {
ui.notifications.error(game.i18n.format("MODMANAGE.DepNotInstalled", {missing: requirement.id}));
if (!isOptional) ui.notifications.error(game.i18n.format("MODMANAGE.DepNotInstalled", {missing: requirement.id}));
return filtered.concat([]);
}

Expand Down Expand Up @@ -103,8 +103,8 @@ Hooks.once('ready', async () => {
}, { inplace: false })]);
}, []));

const requires = getValidRelationship(Array.from(module?.relationships?.requires ?? []));
const optionals = getValidRelationship(Array.from(module?.relationships?.optional ?? (Array.from(module?.relationships?.flags?.optional ?? []))));
const requires = getValidRelationship(Array.from(module?.relationships?.requires ?? []), false);
const optionals = getValidRelationship(Array.from(module?.relationships?.optional ?? (Array.from(module?.relationships?.flags?.optional ?? []))), true);

// If Dependencies is Empty
if (!(requires?.length ?? 0) && !(optionals?.length ?? 0)) return false;
Expand Down
22 changes: 20 additions & 2 deletions scripts/module.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -327,8 +327,8 @@ export class MMP {
let tooltips = smartLabel.join(' / ')
smartLabel = `${smartLabel.length > 0 ? '<i class="fa-regular fa-arrow-turn-down-right" data-tooltip="'+tooltips+'"></i> ' : ''}${game.modules.get(element.dataset.moduleId).title}`;
}
$(Array.from(element.querySelectorAll(titleSelector)).pop()).contents().filter(function(){ return this.nodeType == 3; }).last().replaceWith(smartLabel ?? '');

$(element.querySelector(titleSelector)).contents().filter(function(){ return this.nodeType == 3; }).last().replaceWith(smartLabel ?? '');
$(element).attr('data-sort-title', sortLabel.toUpperCase().replace(/[^\w]/gi, ''));
});

Expand All @@ -355,7 +355,7 @@ export class MMP {
// F### Your Emoji (Better Title Sorting)
// ? Needs to be rewritten to use plain JS
/* ─────────────── ⋆⋅☆⋅⋆ ─────────────── */
MMP.screwYourEmoji($(elem).find('#module-list .package'), '.package-title');
MMP.screwYourEmoji($(elem).find('#module-list .package'), '.package-title .title-group .title, .package-title');

// Focus on Filter
elem.querySelector('nav.list-filters input[type="search"]').focus();
Expand Down Expand Up @@ -802,7 +802,25 @@ export class MMP {
interactive: true,
trigger: 'click',
});

// Remove Foundrys Author Tag cause I dislike it.
elemPackage.querySelector('.package-overview span.tag i.fas.fa-user').closest('span.tag').remove();
}

// Why have a tag that says this is okay?
if (elemPackage.querySelector('.package-overview span.tag.safe')) elemPackage.querySelector('.package-overview span.tag.safe').remove();


// Add Version Tag if one Does not exist
if (!elemPackage.querySelector('.package-overview span.tag.version')) {
// Add Version Tag
elemPackage.querySelector('.package-overview').insertAdjacentHTML('beforeend', `<span class="tag version"><i class="fas fa-code-branch"></i> ${moduleData?.version}</span>`);

// Remove Foundrys Info Tag cause I dislike it and because I use the same icon from the Readme Tag
// Also my Website Tag already does this.
elemPackage.querySelector('.package-overview span.tag i.fas.fa-circle-info').closest('span.tag').remove();
}

// Add ReadMe Tag
if (readme || ((MMP.getModuleProperty(moduleData.id, 'readme') || "").match(APIs.github) ?? false) || ((MMP.getModuleProperty(moduleData.id, 'readme') || "").match(APIs.rawGithub) ?? false)) {
elemPackage.querySelector('.package-overview').insertAdjacentHTML('beforeend', `<span class="tag readme" data-tooltip="${MODULE.localize("dialog.moduleManagement.tags.readme")}" aria-describedby="tooltip">
Expand Down

0 comments on commit afbe962

Please sign in to comment.