mirror of
https://github.com/Equicord/Equicord.git
synced 2025-06-08 14:13:01 -04:00
Fix BetterFolders For QuickCSS
This commit is contained in:
parent
cb4e7579a2
commit
d938ad3a87
1 changed files with 24 additions and 3 deletions
|
@ -44,15 +44,36 @@ export async function toggle(isEnabled: boolean) {
|
||||||
if (!style) {
|
if (!style) {
|
||||||
if (isEnabled) {
|
if (isEnabled) {
|
||||||
style = createStyle("vencord-custom-css");
|
style = createStyle("vencord-custom-css");
|
||||||
|
|
||||||
VencordNative.quickCss.addChangeListener(css => {
|
VencordNative.quickCss.addChangeListener(css => {
|
||||||
|
css = patchSidebar(css);
|
||||||
style.textContent = css;
|
style.textContent = css;
|
||||||
// At the time of writing this, changing textContent resets the disabled state
|
|
||||||
style.disabled = !Settings.useQuickCss;
|
style.disabled = !Settings.useQuickCss;
|
||||||
});
|
});
|
||||||
style.textContent = await VencordNative.quickCss.get();
|
|
||||||
|
const css = await VencordNative.quickCss.get();
|
||||||
|
style.textContent = patchSidebar(css);
|
||||||
}
|
}
|
||||||
} else
|
} else {
|
||||||
style.disabled = !isEnabled;
|
style.disabled = !isEnabled;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
function patchSidebar(css: string): string {
|
||||||
|
if (
|
||||||
|
css.includes("grid-template-columns") ||
|
||||||
|
css.includes("grid-template-areas")
|
||||||
|
) {
|
||||||
|
css = css.replace(
|
||||||
|
/(["'])([^"']*?)guildsList\s+/g,
|
||||||
|
(_, quote, pre) => `${quote}${pre}guildsList sidebar `
|
||||||
|
);
|
||||||
|
css = css.replace(
|
||||||
|
/guildsEnd\]/g,
|
||||||
|
"guildsEnd] min-content [sidebarEnd]"
|
||||||
|
);
|
||||||
|
}
|
||||||
|
return css;
|
||||||
}
|
}
|
||||||
|
|
||||||
async function initThemes() {
|
async function initThemes() {
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue