mirror of
https://github.com/Vendicated/Vencord.git
synced 2025-02-24 15:35:11 +00:00
Preload: Load core CSS in main world instead of preload :/
This commit is contained in:
parent
277bdb29d7
commit
26911d924b
1 changed files with 2 additions and 3 deletions
|
@ -16,7 +16,6 @@
|
||||||
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
import { createStyle } from "@api/Styles";
|
|
||||||
import { debounce } from "@shared/debounce";
|
import { debounce } from "@shared/debounce";
|
||||||
import { contextBridge, webFrame } from "electron";
|
import { contextBridge, webFrame } from "electron";
|
||||||
import { readFileSync, watch } from "fs";
|
import { readFileSync, watch } from "fs";
|
||||||
|
@ -31,12 +30,12 @@ if (location.protocol !== "data:") {
|
||||||
// #region cssInsert
|
// #region cssInsert
|
||||||
const rendererCss = join(__dirname, IS_VESKTOP ? "vencordDesktopRenderer.css" : "renderer.css");
|
const rendererCss = join(__dirname, IS_VESKTOP ? "vencordDesktopRenderer.css" : "renderer.css");
|
||||||
|
|
||||||
const injectStyle = () => createStyle("vencord-css-core", readFileSync(rendererCss, "utf-8"));
|
const injectStyle = () => webFrame.executeJavaScript(`Vencord.Api.Styles.createStyle("vencord-css-core", atob("${btoa(readFileSync(rendererCss, "utf-8"))}"));`);
|
||||||
|
|
||||||
if (document.readyState === "complete") {
|
if (document.readyState === "complete") {
|
||||||
injectStyle();
|
injectStyle();
|
||||||
} else {
|
} else {
|
||||||
document.addEventListener("DOMContentLoaded", injectStyle, {
|
document.addEventListener("DOMContentLoaded", () => injectStyle(), {
|
||||||
once: true
|
once: true
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Reference in a new issue