Skip to content

Commit

Permalink
this'll do.
Browse files Browse the repository at this point in the history
  • Loading branch information
twnlink committed Jan 29, 2024
1 parent 5de415d commit 9b017b7
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 7 deletions.
19 changes: 13 additions & 6 deletions src/api/utils.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,15 +2,22 @@ import { createStore as createIdbStore, set as idbSet, get as idbGet } from "idb
import { store } from "voby";

export function appendStyle(style) {
const sheet = new CSSStyleSheet();
sheet.replaceSync(style);

document.adoptedStyleSheets.push(sheet);
const styleTag = document.createElement("style");
styleTag.innerHTML = style;

// Forgive me, for I have sinned.
if (document.head) {
document.head.appendChild(styleTag);
} else {
document.addEventListener("DOMContentLoaded", () => {
document.head.appendChild(styleTag);
})
}

return (newStyle) => {
if (newStyle == undefined) return [...document.adoptedStyleSheets.slice(document.adoptedStyleSheets.indexOf(sheet), 1)]
if (newStyle == undefined) return document.head.removeChild(styleTag);

sheet.replaceSync(newStyle)
styleTag.innerHTML = newStyle;
};
}

Expand Down
1 change: 0 additions & 1 deletion src/handleExfiltrations.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@ import loadStyles from "./styles.js";
*/

// Variables used for hooking into webpack.
let patchedPush = false;
let webpackObject;

// Exfiltrations gained from hooking into webpack.
Expand Down

0 comments on commit 9b017b7

Please sign in to comment.