You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
GooseMod/src/ui/goosemodChangelog.js

51 lines
1.2 KiB

import sleep from '../util/sleep';
const image = 'https://media.discordapp.net/attachments/756146058924392542/771374562184658944/2018-11-14-11-36-30-1200x800.png';
let version, generated;
let goosemodScope = {};
export const setThisScope = (scope) => {
goosemodScope = scope;
};
export const show = async () => {
if (!generated) {
generate();
}
goosemodScope.changelog.resetChangelog();
goosemodScope.changelog.setChangelog(generated);
goosemodScope.changelog.showChangelog();
await sleep(300);
const customTweaks = () => {
document.querySelector('.modal-3Hrb0S .size20-9iTTnl').textContent = `GooseMod ${version}`; // Set changelog modal title
document.querySelector('.modal-3Hrb0S .footer-31IekZ').remove(); // Remove footer of modal with social media
};
customTweaks();
goosemodScope.changelog.resetChangelog();
// Tweak again since opening it right at beginning of injection / Discord load (eg: GooseMod update) often fails to do after first wait
setTimeout(customTweaks, 300);
};
export const generate = () => {
const changelog = JSON.parse("<changelog>");
version = changelog.version;
generated = {
image,
date: changelog.date,
body: changelog.body
};
};