GooseMod v5.1.1: Fixed context menu patcher extra info and removed logging

pull/8/head
Oj18 4 years ago
parent 306b40e902
commit ee51fd21f1

@ -1,5 +1,12 @@
# GooseMod Changelog
## v5.1.1 [2020-11-16]
- ### Fixes
- Fixed extra info not being sent to handlers properly for context menu patcher
- Removed extra unneeded logging in context menu patcher
## v5.1.0 [2020-11-15]
- ### Features

6
dist/index.js vendored

File diff suppressed because one or more lines are too long

2
dist/index.js.map vendored

File diff suppressed because one or more lines are too long

@ -99,7 +99,7 @@ const init = async function () {
this.disabledModules = {};
this.lastVersion = localStorage.getItem('goosemodLastVersion');
this.version = '5.1.0';
this.version = '5.1.1';
this.versionHash = '<hash>'; // Hash of built final js file is inserted here via build script
fetch('https://goosemod-api.netlify.app/injectVersion.json').then((x) => x.json().then((latestInjectVersionInfo) => {

@ -52,38 +52,30 @@ export const add = (type, itemProps) => {
const origAction = itemProps.action;
itemProps.action = function() {
return origAction(arguments, getExtraInfo(type));
};
inject(getInjectId(id), Menu, 'default', (args) => {
const [ { navId, children } ] = args;
if (navId !== wantedNavId) {
return args;
}
console.log('inj');
const extraInfo = getExtraInfo(type);
itemProps.action = function() {
return origAction(arguments, extraInfo);
};
const alreadyHasItem = findInReactTree(children, child => child && child.props && child.props.id === itemProps.id);
if (alreadyHasItem) return args;
const item = React.createElement(Menu.MenuItem, itemProps);
console.log(item);
let goosemodGroup = findInReactTree(children, child => child && child.props && child.props.goosemod === true);
console.log(goosemodGroup);
if (!goosemodGroup) {
goosemodGroup = React.createElement(Menu.MenuGroup, { goosemod: true }, item);
console.log('a', goosemodGroup);
children.push([ React.createElement(Menu.MenuSeparator), goosemodGroup ]);
} else {
console.log('b', goosemodGroup);
if (!Array.isArray(goosemodGroup.props.children)) {
goosemodGroup.props.children = [ goosemodGroup.props.children ];
}

Loading…
Cancel
Save