GooseMod v5.1.0: Module Store UI improvements and fixes

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

@ -1,5 +1,17 @@
# GooseMod Changelog
## v5.1.0 [2020-11-15]
- ### Features
- Clicking on (some) authors now opens their profile in Module Store
- ### Tweaks
- Clicking title / main text on card no longer toggles switch in Module Store
- ### Fixes
- Fixed toggling modules in Module Store with switch would try and call the module's loading finished event handler even if it did not exist
## v5.0.1 [2020-11-12]
- ### Tweaks

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.0.1';
this.version = '5.1.0';
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) => {

@ -64,6 +64,21 @@ export default {
item.showToggle = false;
},
parseAuthors: (str) => {
let authors = str.split(', ');
authors = authors.map((x) => {
let idMatch = x.match(/(.*) \(([0-9]{18})\)/);
console.log(x, idMatch);
if (idMatch === null) return `<span class="author">${x}</span>`;
return `<span class="author" style="cursor: pointer;" onmouseover="this.style.color = '#ccc'" onmouseout="this.style.color = '#fff'" onclick="try { window.goosemod.webpackModules.findByProps('open', 'fetchMutualFriends').open('${idMatch[2]}') } catch (e) { }">${idMatch[1]}</span>`; // todo
});
return authors.join(', ');
},
updateStoreSetting: () => {
let item = goosemodScope.settings.items.find((x) => x[1] === 'Module Store');
@ -97,7 +112,7 @@ export default {
buttonType: goosemodScope.modules[m.filename] ? 'danger' : 'brand',
showToggle: goosemodScope.modules[m.filename],
text: `${m.name} <span class="description-3_Ncsb">by</span> ${m.author}`, // ` <span class="description-3_Ncsb">(v${m.version})</span>`,
text: `${m.name} <span class="description-3_Ncsb">by</span> ${goosemodScope.moduleStoreAPI.parseAuthors(m.author)}`, // ` <span class="description-3_Ncsb">(v${m.version})</span>`,
subtext: m.description,
subtext2: `v${m.version}`,
@ -125,7 +140,9 @@ export default {
await goosemodScope.modules[m.filename].onImport();
await goosemodScope.modules[m.filename].onLoadingFinished();
if (goosemodScope.modules[moduleName].onLoadingFinished !== undefined) {
await goosemodScope.modules[m.filename].onLoadingFinished();
}
goosemodScope.loadSavedModuleSetting(m.filename);
} else {

@ -725,11 +725,11 @@ export const _createItem = (panelName, content) => {
let txtEl = document.createElement('span');
if (!e.showToggle) {
//if (!e.showToggle) {
txtEl.style.cursor = 'auto';
} else {
/*} else {
txtEl.onclick = fn;
}
}*/
txtEl.classList.add('titleDefault-a8-ZSr', 'title-31JmR4');
@ -1328,16 +1328,18 @@ export const makeGooseModSettings = () => {
for (let c of cards) {
const title = c.getElementsByClassName('title-31JmR4')[0];
const author = title.childNodes[2].wholeText.trim().toLowerCase();
const authors = [...title.getElementsByClassName('author')].map((x) => x.textContent.toLowerCase());
const name = title.childNodes[0].wholeText;
// console.log(authors, selectors);
const description = c.getElementsByClassName('description-3_Ncsb')[1].innerText;
const matches = (fuzzyReg.test(name) || fuzzyReg.test(description));
const importedSelector = c.getElementsByClassName('control-2BBjec')[0] !== undefined ? 'imported' : 'not imported';
c.style.display = matches && selectors[c.className] && selectors[author] && selectors[importedSelector] ? 'block' : 'none';
c.style.display = matches && selectors[c.className] && authors.every((x) => selectors[x]) && selectors[importedSelector] ? 'block' : 'none';
}
const visibleModules = cards.filter((x) => x.style.display !== 'none').length;
@ -1390,7 +1392,7 @@ export const makeGooseModSettings = () => {
const cards = [...parentEl.children[0].children[3].children].filter((x) => x.getElementsByClassName('description-3_Ncsb')[1]);
let final = [...cards.reduce((acc, e) => {
let x = e.getElementsByClassName('control-2BBjec')[0] !== undefined ? 'Imported' : 'Not Imported';
const x = e.getElementsByClassName('control-2BBjec')[0] !== undefined ? 'Imported' : 'Not Imported';
return acc.set(x, (acc.get(x) || 0) + 1);
}, new Map()).entries()].sort((a, b) => b[1] - a[1]);
@ -1401,8 +1403,12 @@ export const makeGooseModSettings = () => {
final.push(['Authors', 0, 'divider']);
final = final.concat([...cards.reduce((acc, e) => {
let x = e.getElementsByClassName('title-31JmR4')[0].childNodes[2].textContent.trim();
return acc.set(x, (acc.get(x) || 0) + 1);
for (let el of e.getElementsByClassName('author')) {
const x = el.textContent;
acc.set(x, (acc.get(x) || 0) + 1);
}
return acc;
}, new Map()).entries()].sort((a, b) => b[1] - a[1]));
console.log(final);

Loading…
Cancel
Save