2021-12-26 14:06:10 +00:00
|
|
|
let lastBgPrimary = '';
|
2021-12-26 17:47:04 +00:00
|
|
|
const themesync = async () => {
|
2022-01-15 20:43:06 +00:00
|
|
|
const getVar = (name, el = document.body) => el && (getComputedStyle(el).getPropertyValue(name) || getVar(name, el.parentElement))?.trim();
|
2021-12-26 14:05:20 +00:00
|
|
|
|
|
|
|
const bgPrimary = getVar('--background-primary');
|
2022-01-15 20:43:06 +00:00
|
|
|
if (!bgPrimary || bgPrimary === '#36393f' || bgPrimary === lastBgPrimary) return; // Default primary bg or same as last
|
2021-12-26 14:05:20 +00:00
|
|
|
lastBgPrimary = bgPrimary;
|
|
|
|
|
2021-12-16 16:52:25 +00:00
|
|
|
const vars = [ '--background-primary', '--background-secondary', '--brand-experiment', '--header-primary', '--text-muted' ];
|
|
|
|
|
|
|
|
let cached = await DiscordNative.userDataCache.getCached() || {};
|
|
|
|
|
2021-12-22 13:39:50 +00:00
|
|
|
const value = `body { ${vars.reduce((acc, x) => acc += `${x}: ${getVar(x)}; `, '')} }`;
|
2021-12-21 08:42:20 +00:00
|
|
|
const pastValue = cached['openasarSplashCSS'];
|
2021-12-16 16:52:25 +00:00
|
|
|
cached['openasarSplashCSS'] = value;
|
|
|
|
|
2021-12-21 08:42:20 +00:00
|
|
|
if (value !== pastValue) DiscordNative.userDataCache.cacheUserData(JSON.stringify(cached));
|
2021-12-16 16:52:25 +00:00
|
|
|
};
|
2022-01-15 20:41:01 +00:00
|
|
|
|
|
|
|
setInterval(() => {
|
|
|
|
try {
|
|
|
|
themesync();
|
|
|
|
} catch (e) { }
|
|
|
|
}, 5000);
|
2021-12-26 17:47:04 +00:00
|
|
|
|
2021-12-16 16:52:25 +00:00
|
|
|
|
2021-12-18 18:48:04 +00:00
|
|
|
const css = `
|
2022-01-08 22:02:32 +00:00
|
|
|
[class^="socialLinks-"] + [class^="info-"] [class^="colorMuted-"]:nth-last-child(2)::after {
|
2021-12-26 14:05:20 +00:00
|
|
|
content: " | OpenAsar <oa_version_hash>";
|
2021-12-18 18:48:04 +00:00
|
|
|
display: inline;
|
|
|
|
text-transform: none;
|
|
|
|
}
|
2021-12-17 23:00:33 +00:00
|
|
|
|
2022-01-08 22:02:32 +00:00
|
|
|
[class^="socialLinks-"] + [class^="info-"] {
|
2021-12-18 18:48:04 +00:00
|
|
|
padding-right: 0;
|
|
|
|
}
|
2021-12-26 17:47:04 +00:00
|
|
|
|
2022-01-08 22:02:32 +00:00
|
|
|
[class^="vertical-"] > div[style="display: flex; justify-content: space-between;"] > div > [class^="description-"] {
|
2021-12-26 17:47:04 +00:00
|
|
|
white-space: pre-wrap;
|
|
|
|
overflow-wrap: anywhere;
|
|
|
|
}
|
2021-12-18 18:48:04 +00:00
|
|
|
`;
|
2021-12-17 23:00:33 +00:00
|
|
|
|
2021-12-18 18:48:04 +00:00
|
|
|
const el = document.createElement('style');
|
|
|
|
el.appendChild(document.createTextNode(css));
|
2021-12-26 17:47:04 +00:00
|
|
|
document.body.appendChild(el);
|
|
|
|
|
|
|
|
|
|
|
|
const injectGMSettings = async () => {
|
|
|
|
const sleep = (ms) => new Promise((res) => setTimeout(res, ms));
|
|
|
|
|
2022-01-08 22:02:32 +00:00
|
|
|
await sleep(3000);
|
|
|
|
if (!window.goosemod) return;
|
2021-12-26 17:47:04 +00:00
|
|
|
|
|
|
|
goosemod.settings.items.unshift(
|
|
|
|
['item', 'OpenAsar', ['',
|
|
|
|
{
|
|
|
|
type: 'header',
|
|
|
|
text: 'Info'
|
|
|
|
},
|
|
|
|
|
|
|
|
{
|
|
|
|
type: 'text',
|
|
|
|
text: 'Version',
|
|
|
|
subtext: 'Channel: <oa_version_channel>\nHash: <oa_version_hash>'
|
|
|
|
},
|
|
|
|
|
|
|
|
{
|
|
|
|
type: 'text',
|
|
|
|
text: 'Cmd',
|
|
|
|
subtext: 'Preset: <oa_cmd_preset>\nCmd: <oa_cmd_full>'
|
|
|
|
}
|
|
|
|
], undefined, false],
|
|
|
|
['separator']
|
|
|
|
)
|
|
|
|
};
|
2022-01-19 11:19:09 +00:00
|
|
|
injectGMSettings();
|
|
|
|
|
|
|
|
window.openasar = {};
|