Avoid polluting the global namespace

Closes #6
This commit is contained in:
Ell 2022-03-25 15:25:25 +01:00
parent 2f6bff67f7
commit 6cf6eb04f2

View file

@ -100,9 +100,11 @@ class CustomFrameView extends ItemView {
for (let other of require("electron").remote.getCurrentWebContents().mainFrame.frames) { for (let other of require("electron").remote.getCurrentWebContents().mainFrame.frames) {
if (frame.src.contains(new URL(other.url).host)) { if (frame.src.contains(new URL(other.url).host)) {
other.executeJavaScript(` other.executeJavaScript(`
let style = document.createElement("style"); (() => {
style.textContent = \`${this.frame.customCss}\`; let style = document.createElement("style");
document.head.appendChild(style); style.textContent = \`${this.frame.customCss}\`;
document.head.appendChild(style);
})();
`); `);
} }
} }