mirror of https://github.com/GooseMod/GooseMod
[i18n-2] i18n rewrite - core done
parent
a8720fe0e6
commit
986c6a2260
@ -0,0 +1,18 @@
|
||||
import sleep from '../src/util/sleep';
|
||||
|
||||
const init = async () => {
|
||||
while (!window.webpackJsonp?.push) {
|
||||
await sleep(10);
|
||||
}
|
||||
|
||||
const wpRequire = window.webpackJsonp.push([[], { get_require: (mod, _exports, wpRequire) => mod.exports = wpRequire }, [["get_require"]]]);
|
||||
const locale = Object.keys(wpRequire.c).map((x) => wpRequire.c[x].exports).find((x) => x?.default?.getLocaleInfo).default.getLocale();
|
||||
|
||||
console.log('[GooseMod Bootstrap]', 'Found locale', locale);
|
||||
|
||||
// eval(await (await fetch(`http://localhost:1234/goosemod.${locale}.js`)).text());
|
||||
eval(await (await fetch(`https://raw.githubusercontent.com/GooseMod/GooseMod/dist-dev/goosemod.${locale}.js`)).text());
|
||||
};
|
||||
|
||||
init();
|
||||
//# sourceURL=GooseMod%20Bootstrap
|
@ -0,0 +1,226 @@
|
||||
{
|
||||
"en-US": {
|
||||
"name": "English, US",
|
||||
"englishName": "English, US",
|
||||
"code": "en-US",
|
||||
"postgresLang": "english",
|
||||
"enabled": true
|
||||
},
|
||||
"en-GB": {
|
||||
"name": "English, UK",
|
||||
"englishName": "English, UK",
|
||||
"code": "en-GB",
|
||||
"postgresLang": "english",
|
||||
"enabled": true
|
||||
},
|
||||
"zh-CN": {
|
||||
"name": "中文",
|
||||
"englishName": "Chinese Simplified",
|
||||
"code": "zh-CN",
|
||||
"postgresLang": "simple",
|
||||
"enabled": true
|
||||
},
|
||||
"zh-TW": {
|
||||
"name": "繁體中文",
|
||||
"englishName": "Traditional Chinese",
|
||||
"code": "zh-TW",
|
||||
"postgresLang": "simple",
|
||||
"enabled": true
|
||||
},
|
||||
"cs": {
|
||||
"name": "Čeština",
|
||||
"englishName": "Czech",
|
||||
"code": "cs",
|
||||
"postgresLang": "simple",
|
||||
"enabled": true
|
||||
},
|
||||
"da": {
|
||||
"name": "Dansk",
|
||||
"englishName": "Danish",
|
||||
"code": "da",
|
||||
"postgresLang": "danish",
|
||||
"enabled": true
|
||||
},
|
||||
"nl": {
|
||||
"name": "Nederlands",
|
||||
"englishName": "Dutch",
|
||||
"code": "nl",
|
||||
"postgresLang": "dutch",
|
||||
"enabled": true
|
||||
},
|
||||
"fr": {
|
||||
"name": "Français",
|
||||
"englishName": "French",
|
||||
"code": "fr",
|
||||
"postgresLang": "french",
|
||||
"enabled": true
|
||||
},
|
||||
"de": {
|
||||
"name": "Deutsch",
|
||||
"englishName": "German",
|
||||
"code": "de",
|
||||
"postgresLang": "german",
|
||||
"enabled": true
|
||||
},
|
||||
"el": {
|
||||
"name": "Ελληνικά",
|
||||
"englishName": "Greek",
|
||||
"code": "el",
|
||||
"postgresLang": "simple",
|
||||
"enabled": true
|
||||
},
|
||||
"hu": {
|
||||
"name": "Magyar",
|
||||
"englishName": "Hungarian",
|
||||
"code": "hu",
|
||||
"postgresLang": "hungarian",
|
||||
"enabled": true
|
||||
},
|
||||
"it": {
|
||||
"name": "Italiano",
|
||||
"englishName": "Italian",
|
||||
"code": "it",
|
||||
"postgresLang": "italian",
|
||||
"enabled": true
|
||||
},
|
||||
"ja": {
|
||||
"name": "日本語",
|
||||
"englishName": "Japanese",
|
||||
"code": "ja",
|
||||
"postgresLang": "simple",
|
||||
"enabled": true
|
||||
},
|
||||
"ko": {
|
||||
"name": "한국어",
|
||||
"englishName": "Korean",
|
||||
"code": "ko",
|
||||
"postgresLang": "simple",
|
||||
"enabled": true
|
||||
},
|
||||
"pl": {
|
||||
"name": "Polski",
|
||||
"englishName": "Polish",
|
||||
"code": "pl",
|
||||
"postgresLang": "simple",
|
||||
"enabled": true
|
||||
},
|
||||
"pt-PT": {
|
||||
"name": "Português",
|
||||
"englishName": "Portuguese",
|
||||
"code": "pt-PT",
|
||||
"postgresLang": "portuguese",
|
||||
"enabled": false
|
||||
},
|
||||
"pt-BR": {
|
||||
"name": "Português do Brasil",
|
||||
"englishName": "Portuguese, Brazilian",
|
||||
"code": "pt-BR",
|
||||
"postgresLang": "portuguese",
|
||||
"enabled": true
|
||||
},
|
||||
"ru": {
|
||||
"name": "Русский",
|
||||
"englishName": "Russian",
|
||||
"code": "ru",
|
||||
"postgresLang": "russian",
|
||||
"enabled": true
|
||||
},
|
||||
"sk": {
|
||||
"name": "Slovenčina",
|
||||
"englishName": "Slovak",
|
||||
"code": "sk",
|
||||
"postgresLang": "simple",
|
||||
"enabled": false
|
||||
},
|
||||
"es-ES": {
|
||||
"name": "Español",
|
||||
"englishName": "Spanish",
|
||||
"code": "es-ES",
|
||||
"postgresLang": "spanish",
|
||||
"enabled": true
|
||||
},
|
||||
"sv-SE": {
|
||||
"name": "Svenska",
|
||||
"englishName": "Swedish",
|
||||
"code": "sv-SE",
|
||||
"postgresLang": "swedish",
|
||||
"enabled": true
|
||||
},
|
||||
"tr": {
|
||||
"name": "Türkçe",
|
||||
"englishName": "Turkish",
|
||||
"code": "tr",
|
||||
"postgresLang": "turkish",
|
||||
"enabled": true
|
||||
},
|
||||
"bg": {
|
||||
"name": "български",
|
||||
"englishName": "Bulgarian",
|
||||
"code": "bg",
|
||||
"postgresLang": "simple",
|
||||
"enabled": true
|
||||
},
|
||||
"uk": {
|
||||
"name": "Українська",
|
||||
"englishName": "Ukrainian",
|
||||
"code": "uk",
|
||||
"postgresLang": "simple",
|
||||
"enabled": true
|
||||
},
|
||||
"fi": {
|
||||
"name": "Suomi",
|
||||
"englishName": "Finnish",
|
||||
"code": "fi",
|
||||
"postgresLang": "finnish",
|
||||
"enabled": true
|
||||
},
|
||||
"no": {
|
||||
"name": "Norsk",
|
||||
"englishName": "Norwegian",
|
||||
"code": "no",
|
||||
"postgresLang": "norwegian",
|
||||
"enabled": true
|
||||
},
|
||||
"hr": {
|
||||
"name": "Hrvatski",
|
||||
"englishName": "Croatian",
|
||||
"code": "hr",
|
||||
"postgresLang": "simple",
|
||||
"enabled": true
|
||||
},
|
||||
"ro": {
|
||||
"name": "Română",
|
||||
"englishName": "Romanian",
|
||||
"code": "ro",
|
||||
"postgresLang": "romanian",
|
||||
"enabled": true
|
||||
},
|
||||
"lt": {
|
||||
"name": "Lietuviškai",
|
||||
"englishName": "Lithuanian",
|
||||
"code": "lt",
|
||||
"postgresLang": "simple",
|
||||
"enabled": true
|
||||
},
|
||||
"th": {
|
||||
"name": "ไทย",
|
||||
"englishName": "Thai",
|
||||
"code": "th",
|
||||
"postgresLang": "simple",
|
||||
"enabled": true
|
||||
},
|
||||
"vi": {
|
||||
"name": "Tiếng Việt",
|
||||
"englishName": "Vietnamese",
|
||||
"code": "vi",
|
||||
"postgresLang": "simple",
|
||||
"enabled": true
|
||||
},
|
||||
"hi": {
|
||||
"name": "हिंदी",
|
||||
"englishName": "Hindi",
|
||||
"code": "hi",
|
||||
"postgresLang": "simple",
|
||||
"enabled": true
|
||||
}
|
||||
}
|
@ -0,0 +1,104 @@
|
||||
{
|
||||
"terms": {
|
||||
"goosemod": {
|
||||
"store": "GooseMod Store",
|
||||
"settings": "GooseMod Settings",
|
||||
"modules": "GooseMod Modules"
|
||||
},
|
||||
|
||||
"add": "Add",
|
||||
"remove": "Remove",
|
||||
|
||||
"refresh": "Refresh",
|
||||
|
||||
"settings": "Settings",
|
||||
"changelog": "Change Log",
|
||||
|
||||
"store": {
|
||||
"store": "Store",
|
||||
|
||||
"themes": "Themes",
|
||||
"plugins": "Plugins",
|
||||
"snippets": "Snippets",
|
||||
|
||||
"modules": "Modules",
|
||||
"repos": "Repos",
|
||||
|
||||
"developers": "Developers"
|
||||
}
|
||||
},
|
||||
|
||||
"store": {
|
||||
"options": {
|
||||
"tabs": {
|
||||
"store": "Store",
|
||||
"imported": "Imported"
|
||||
},
|
||||
|
||||
"search": {
|
||||
"placeholder": {
|
||||
"themes": "Search Themes",
|
||||
"plugins": "Search Plugins"
|
||||
}
|
||||
},
|
||||
|
||||
"sort": {
|
||||
"label": "Sort by",
|
||||
|
||||
"stars": "Stars",
|
||||
"az": "A-Z",
|
||||
"last_updated": "Last Updated"
|
||||
},
|
||||
|
||||
"author": {
|
||||
"label": "Author",
|
||||
|
||||
"all": "All"
|
||||
}
|
||||
},
|
||||
|
||||
"categories": {
|
||||
"top_starred": "Top Starred",
|
||||
"recently_updated": "Recently Updated",
|
||||
"upcoming": "Upcoming",
|
||||
|
||||
"all": {
|
||||
"themes": "All Themes",
|
||||
"plugins": "All Plugins"
|
||||
}
|
||||
},
|
||||
|
||||
"pgp": {
|
||||
"verified": "PGP Verified",
|
||||
"untrusted": "PGP Untrusted",
|
||||
"unknown": "No PGP"
|
||||
}
|
||||
},
|
||||
|
||||
"modals": {
|
||||
"external_repo_security": {
|
||||
"main": "External repos pose security risks as they are not controlled by GooseMod developers. We are not responsible for any dangers because of external repos added by users.\n\nIf you do not trust the owner of this repo do not use it as it could compromise your Discord install.\n\nPlease confirm adding this repo by pressing OK.",
|
||||
"bad_pgp": "This repo is not known or trusted (no PGP verification), please be extra careful. Make sure you trust the owner(s) of this repo completely.\n\nTo solve this issue ask the repo maintainer to add PGP support.\n\nPlease reconfirm adding this repo by pressing OK."
|
||||
}
|
||||
},
|
||||
|
||||
"toasts": {
|
||||
|
||||
},
|
||||
|
||||
"settings": {
|
||||
|
||||
},
|
||||
|
||||
"ootb": {
|
||||
|
||||
},
|
||||
|
||||
"badges": {
|
||||
"sponsor": "GooseMod Sponsor",
|
||||
"translator": "GooseMod Translator",
|
||||
"developer": "GooseMod Developer",
|
||||
|
||||
"guild": "GooseMod Official Discord"
|
||||
}
|
||||
}
|
@ -0,0 +1,61 @@
|
||||
import { readFileSync, writeFileSync, existsSync } from 'fs';
|
||||
|
||||
import langs from '../i18n/langs.json';
|
||||
|
||||
|
||||
import { join, resolve, dirname } from 'path';
|
||||
import { fileURLToPath } from 'url';
|
||||
|
||||
const __dirname = dirname(fileURLToPath(import.meta.url));
|
||||
|
||||
const distDir = resolve(join(__dirname, '..', '..', 'dist'));
|
||||
const translationsDir = resolve(join(__dirname, '..', 'i18n', 'translations'));
|
||||
|
||||
const getTranslation = (lang) => {
|
||||
const path = join(translationsDir, lang + '.json');
|
||||
if (!existsSync(path)) return false;
|
||||
|
||||
return JSON.parse(readFileSync(path, 'utf8'));
|
||||
};
|
||||
|
||||
const flattenObj = (obj, key = '') => Object.keys(obj).reduce((acc, x) => {
|
||||
const k = (key ? key + '.' : '') + x;
|
||||
|
||||
if (typeof obj[x] === 'object') {
|
||||
const f = flattenObj(obj[x], k);
|
||||
|
||||
for (const y of Object.keys(f)) {
|
||||
acc[y] = f[y];
|
||||
}
|
||||
} else {
|
||||
acc[k] = obj[x];
|
||||
}
|
||||
|
||||
return acc;
|
||||
}, {});
|
||||
|
||||
export default (code) => {
|
||||
const defaultTranslation = getTranslation('en-US');
|
||||
|
||||
for (const lang of Object.keys(langs)) {
|
||||
const outPath = join(distDir, 'goosemod.' + lang + '.js');
|
||||
|
||||
const translation = {
|
||||
...defaultTranslation,
|
||||
...(getTranslation(lang) || {})
|
||||
};
|
||||
|
||||
let langCode = code;
|
||||
|
||||
const flatTranslation = flattenObj(translation);
|
||||
|
||||
console.log(flatTranslation);
|
||||
|
||||
for (const key in flatTranslation) {
|
||||
const val = flatTranslation[key].replaceAll('\n', '\\n');
|
||||
langCode = langCode.replaceAll(`#${key}#`, val);
|
||||
}
|
||||
|
||||
writeFileSync(outPath, langCode);
|
||||
}
|
||||
};
|
@ -1,34 +0,0 @@
|
||||
// Based on moduleStore/jsCache - make generic cache class in future as part of util?
|
||||
import { sha512 } from '../util/hash';
|
||||
|
||||
let goosemodScope = {};
|
||||
|
||||
export const setThisScope = (scope) => {
|
||||
goosemodScope = scope;
|
||||
};
|
||||
|
||||
export const getCache = () => JSON.parse(goosemod.storage.get('goosemodi18nCache') || '{}');
|
||||
export const purgeCache = () => goosemod.storage.remove('goosemodi18nCache');
|
||||
|
||||
export const updateCache = (lang, hash, goosemodStrings) => {
|
||||
let cache = getCache();
|
||||
|
||||
cache[lang] = { hash, goosemodStrings };
|
||||
|
||||
goosemod.storage.set('goosemodi18nCache', JSON.stringify(cache));
|
||||
};
|
||||
|
||||
export const geti18nData = async (lang) => {
|
||||
const cache = getCache();
|
||||
|
||||
if (cache[lang]) { // && moduleInfo.hash === cache[lang].hash) {
|
||||
return cache[lang].goosemodStrings;
|
||||
} else {
|
||||
const goosemodStrings = await goosemodScope.i18n.geti18nData(lang);
|
||||
const newHash = await sha512(JSON.stringify(goosemodStrings));
|
||||
|
||||
updateCache(lang, newHash, goosemodStrings);
|
||||
|
||||
return goosemodStrings;
|
||||
}
|
||||
};
|
@ -1,78 +0,0 @@
|
||||
import * as Cache from './cache';
|
||||
export const cache = Cache;
|
||||
|
||||
let goosemodScope = {};
|
||||
|
||||
export let forced = false;
|
||||
|
||||
export let goosemodStrings; // goosemod.i18n.strings
|
||||
export let discordStrings;
|
||||
|
||||
|
||||
export const setThisScope = (scope) => {
|
||||
Cache.setThisScope(scope);
|
||||
|
||||
goosemodScope = scope;
|
||||
|
||||
goosemodScope.i18nCheckNewLangInterval = setInterval(checkForNewLang, 1000);
|
||||
};
|
||||
|
||||
const getDiscordLang = () => goosemodScope.webpackModules.findByProps('getLocaleInfo').getLocaleInfo();
|
||||
|
||||
let lastLangCode;
|
||||
|
||||
export const checkForNewLang = async () => {
|
||||
if (forced) return; // If forced, ignore Discord lang
|
||||
|
||||
const { code } = getDiscordLang();
|
||||
|
||||
if (code === lastLangCode) return; // Lang not changed
|
||||
|
||||
// goosemodScope.showToast(`New lang detected`);
|
||||
|
||||
await updateExports(code);
|
||||
};
|
||||
|
||||
export const updateExports = async (code) => {
|
||||
lastLangCode = code;
|
||||
|
||||
goosemodStrings = await Cache.geti18nData(code);
|
||||
|
||||
const module = goosemodScope.webpackModules.findByProps('getLocaleInfo');
|
||||
|
||||
const context = module._proxyContext || module._provider._context; // _proxyContext is old, not in Canary since 12th July
|
||||
|
||||
discordStrings = {
|
||||
...context.defaultMessages,
|
||||
...context.messages
|
||||
};
|
||||
};
|
||||
|
||||
export const geti18nData = async (lang = (getDiscordLang().code)) => {
|
||||
let json; // Undefined by default
|
||||
|
||||
try {
|
||||
json = await (await fetch(`https://raw.githubusercontent.com/GooseMod/i18n/main/langs/${lang}.json`)).json();
|
||||
} catch (e) { // Likely no translation for language so fallback to en-US
|
||||
lang = `en-US`;
|
||||
|
||||
console.log(`Failed to get GooseMod i18n data, falling back to ${lang}`, e);
|
||||
|
||||
json = await (await fetch(`https://raw.githubusercontent.com/GooseMod/i18n/main/langs/${lang}.json`)).json();
|
||||
}
|
||||
|
||||
return json;
|
||||
};
|
||||
|
||||
export const forceLang = async (code) => {
|
||||
if (code === 'Unspecified') {
|
||||
forced = false;
|
||||
await checkForNewLang();
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
forced = true;
|
||||
|
||||
await updateExports(code);
|
||||
};
|
@ -1,209 +0,0 @@
|
||||
let goosemodScope = {};
|
||||
|
||||
export const setThisScope = (scope) => {
|
||||
goosemodScope = scope;
|
||||
};
|
||||
|
||||
let themes = [
|
||||
'Dracula Theme',
|
||||
'Darkest Theme',
|
||||
'Solarized Dark Theme',
|
||||
//'Slate'
|
||||
];
|
||||
|
||||
let packs = [
|
||||
{
|
||||
text: 'Minimal',
|
||||
subtext: 'A basic installation with no visual changes; only analytics blocking and fixes',
|
||||
modules: ['Hardcoded Color Fixer', 'Fucklytics']
|
||||
},
|
||||
{
|
||||
text: 'Recommended',
|
||||
subtext: 'The recommended starting experience: a few visual improvements and customisation options',
|
||||
modules: ['Visual Tweaks', 'Username In Author', 'Custom Sounds', 'Better Message Deletion', 'Nickname Panel'],
|
||||
base: 'Minimal'
|
||||
},
|
||||
{
|
||||
text: 'Complete',
|
||||
subtext: 'A large amount of the avaliable modules which overhauls the UI and adds extra features',
|
||||
modules: ['WYSIWYG Messages', 'Twitch Emotes', 'RadialStatus', 'Simple Status Icons', 'User Popout Creation Date', 'Clear Recent Games', 'Game Activity Button', 'Macros', 'Role Colored Messages'],
|
||||
base: 'Recommended'
|
||||
}
|
||||
];
|
||||
|
||||
packs = packs.map((x) => {
|
||||
if (x.base) {
|
||||
let basePack = packs.find((y) => y.text === x.base);
|
||||
x.modules = basePack.modules.concat(...x.modules);
|
||||
}
|
||||
|
||||
return x;
|
||||
});
|
||||
|
||||
const selectionModal = (title, options) => {
|
||||
return new Promise((res) => {
|
||||
goosemodScope.webpackModules.findByPropsAll('show')[0].show({
|
||||
title,
|
||||
|
||||
body: 'Body'
|
||||
});
|
||||
|
||||
let form = [...document.getElementsByClassName('form-26zE04')].pop();
|
||||
|
||||
form.lastChild.remove(); // Remove footer with button
|
||||
|
||||
let content = form.firstChild.firstChild;
|
||||
|
||||
content.firstChild.style.flex = 'unset'; // Stop title taking up all of contents
|
||||
|
||||
content.lastChild.remove(); // Remove body
|
||||
|
||||
let container = form.parentElement;
|
||||
container.style.maxHeight = 'none';
|
||||
// container.style.height = '70vh';
|
||||
|
||||
let buttonsContainerEl = document.createElement('div');
|
||||
|
||||
buttonsContainerEl.style.display = 'flex';
|
||||
buttonsContainerEl.style.flexDirection = 'column';
|
||||
buttonsContainerEl.style.justifyContent = 'center';
|
||||
buttonsContainerEl.style.flexGrow = '1';
|
||||
|
||||
for (let p of options) {
|
||||
let el = document.createElement('div');
|
||||
el.style.margin = '20px';
|
||||
|
||||
el.style.display = 'flex';
|
||||
el.style.flexDirection = 'column';
|
||||
|
||||
let buttonEl = document.createElement('button');
|
||||
buttonEl.classList.add('primaryButton-2BsGPp', 'button-38aScr', 'lookFilled-1Gx00P', 'colorBrand-3pXr91', 'sizeXlarge-2yFAlZ', 'grow-q77ONN');
|
||||
|
||||
buttonEl.onclick = () => {
|
||||
res(p);
|
||||
};
|
||||
|
||||
if (p.onmouseenter) {
|
||||
buttonEl.onmouseenter = () => {
|
||||
p.onmouseenter(container);
|
||||
};
|
||||
}
|
||||
|
||||
if (p.onmouseleave) {
|
||||
buttonEl.onmouseleave = () => {
|
||||
p.onmouseleave(container);
|
||||
};
|
||||
}
|
||||
|
||||
let contentsEl = document.createElement('div');
|
||||
contentsEl.classList.add('contents-18-Yxp');
|
||||
|
||||
let displayName = p.text; //p.name[0].toUpperCase() + p.name.substring(1);
|
||||
|
||||
contentsEl.textContent = displayName;
|
||||
|
||||
buttonEl.appendChild(contentsEl);
|
||||
|
||||
buttonEl.style.flex = 'unset';
|
||||
|
||||
el.appendChild(buttonEl);
|
||||
|
||||
let minorEl = document.createElement('div');
|
||||
minorEl.classList.add('minorContainer-Oi4S_y');
|
||||
|
||||
minorEl.style.cursor = 'default';
|
||||
|
||||
let minorTextEl = document.createElement('div');
|
||||
minorTextEl.classList.add('colorStandard-2KCXvj', 'size12-3cLvbJ');
|
||||
|
||||
minorTextEl.style.textAlign = 'center';
|
||||
minorTextEl.style.opacity = '.6';
|
||||
|
||||
minorTextEl.textContent = p.subtext; // `${packs[p].length} modules`; //packs[p].map((x) => goosemodScope.moduleStoreAPI.modules.find((y) => y.filename === x)).map((x) => x.name).join(', ');
|
||||
|
||||
minorEl.appendChild(minorTextEl);
|
||||
|
||||
el.appendChild(minorEl);
|
||||
|
||||
buttonsContainerEl.appendChild(el);
|
||||
}
|
||||
|
||||
content.appendChild(buttonsContainerEl);
|
||||
});
|
||||
};
|
||||
|
||||
const installModules = async (modules) => {
|
||||
for (let m of modules) {
|
||||
goosemodScope.updateLoadingScreen(`${goosemodScope.moduleStoreAPI.modules.find((x) => x.name === m).name} - ${modules.indexOf(m) + 1}/${modules.length}`);
|
||||
|
||||
await goosemodScope.moduleStoreAPI.importModule(m);
|
||||
}
|
||||
};
|
||||
|
||||
export const ask = () => {
|
||||
return new Promise(async (res) => {
|
||||
goosemodScope.stopLoadingScreen();
|
||||
|
||||
let packModules = (await selectionModal('Please pick a pack', packs)).modules;
|
||||
|
||||
goosemodScope.startLoadingScreen();
|
||||
|
||||
await installModules(packModules);
|
||||
|
||||
let themesOptions = themes.map((x) => {
|
||||
let mod = goosemodScope.moduleStoreAPI.modules.find((y) => y.name === x);
|
||||
|
||||
// let imported;
|
||||
|
||||
return {
|
||||
text: mod.name.replace(' Theme', ''),
|
||||
subtext: mod.description,
|
||||
actual: x,
|
||||
onmouseenter: async function(container) {
|
||||
//if (!x.css) return;
|
||||
|
||||
container.style.transition = 'opacity 1s';
|
||||
container.style.opacity = '0.2';
|
||||
|
||||
let backdropEl = document.getElementsByClassName('backdrop-1wrmKB')[0];
|
||||
backdropEl.style.transition = 'opacity 1s';
|
||||
backdropEl.style.opacity = '0';
|
||||
|
||||
await goosemodScope.moduleStoreAPI.importModule(mod.name);
|
||||
},
|
||||
onmouseleave: function(container) {
|
||||
container.style.opacity = '1';
|
||||
document.getElementsByClassName('backdrop-1wrmKB')[0].style.opacity = '0.85';
|
||||
|
||||
if (!goosemodScope.modules[mod.name]) return;
|
||||
|
||||
goosemodScope.settings.removeModuleUI(mod.name);
|
||||
}
|
||||
};
|
||||
});
|
||||
|
||||
themesOptions.unshift({
|
||||
text: 'None',
|
||||
subtext: 'No additonal theming, stick with default Discord',
|
||||
actual: ''
|
||||
});
|
||||
|
||||
goosemodScope.stopLoadingScreen();
|
||||
|
||||
const theme = (await selectionModal('Please pick a theme', themesOptions)).actual;
|
||||
|
||||
let themeEls = document.getElementsByClassName('gm-setup-theme');
|
||||
|
||||
for (let e of themeEls) {
|
||||
e.remove();
|
||||
}
|
||||
|
||||
goosemodScope.startLoadingScreen();
|
||||
|
||||
if (theme) {
|
||||
await installModules([theme]);
|
||||
}
|
||||
|
||||
return res(packModules);
|
||||
});
|
||||
};
|
Loading…
Reference in new issue