2021-12-16 16:52:25 +00:00
|
|
|
const update = async () => {
|
|
|
|
const getVar = (name, el = document.body) => el && (getComputedStyle(el).getPropertyValue(name) || getVar(name, el.parentElement)).trim();
|
|
|
|
const vars = [ '--background-primary', '--background-secondary', '--brand-experiment', '--header-primary', '--text-muted' ];
|
|
|
|
|
|
|
|
let cached = await DiscordNative.userDataCache.getCached() || {};
|
|
|
|
|
2021-12-17 23:00:33 +00:00
|
|
|
const value = `.theme-dark { ${vars.reduce((acc, x) => acc += `${x}: ${getVar(x)}; `, '')} }`;
|
2021-12-16 16:52:25 +00:00
|
|
|
|
|
|
|
cached['openasarSplashCSS'] = value;
|
|
|
|
|
|
|
|
DiscordNative.userDataCache.cacheUserData(JSON.stringify(cached));
|
|
|
|
};
|
2021-12-17 23:00:33 +00:00
|
|
|
setInterval(update, 5000);
|
2021-12-16 16:52:25 +00:00
|
|
|
|
2021-12-17 23:00:33 +00:00
|
|
|
const settingsInject = async () => {
|
|
|
|
const infoEl = document.querySelector('.info-1VyQPT');
|
|
|
|
if (!infoEl || document.getElementById('openasar-version')) return;
|
|
|
|
|
|
|
|
const el = document.createElement('el');
|
|
|
|
el.id = 'openasar-version';
|
|
|
|
el.className = 'colorMuted-HdFt4q size12-3cLvbJ line-3ColD0 versionHash-2gXjIB';
|
|
|
|
el.textContent = 'OpenAsar <version_1> (<version_2>)';
|
|
|
|
|
|
|
|
infoEl.appendChild(el);
|
|
|
|
};
|
|
|
|
setInterval(settingsInject, 1000);
|