Skip to content
This repository has been archived by the owner on Apr 11, 2023. It is now read-only.

Fix opaque console iframe overlaying some websites #1437

Open
wants to merge 6 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions src/console/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,10 @@ import { AppProvider } from "./app/provider";
import App from "./App";
import "./index.css";

const colorScheme = (new URLSearchParams(window.location.search)).get('colorScheme')
/* @ts-expect-error: The colorScheme property is not on the CSSStyleDeclaration type in TypeScript v4.3.5 */
window.document.documentElement.style.colorScheme = colorScheme ?? ''

window.addEventListener("DOMContentLoaded", () => {
const wrapper = document.getElementById("vimvixen-console");
ReactDOM.render(
Expand Down
6 changes: 5 additions & 1 deletion src/content/presenters/ConsoleFramePresenter.ts
Original file line number Diff line number Diff line change
Expand Up @@ -19,10 +19,13 @@ export class ConsoleFramePresenterImpl implements ConsoleFramePresenter {
return;
}

/* @ts-expect-error: The colorScheme property is not on the CSSStyleDeclaration type in TypeScript v4.3.5 */
const colorScheme = getComputedStyle(document.body).colorScheme
const iframe = document.createElement("iframe");
iframe.src = browser.runtime.getURL("build/console.html");
iframe.src = browser.runtime.getURL("build/console.html?colorScheme=" + colorScheme);
iframe.id = ConsoleFramePresenterImpl.IframeId;
iframe.className = "vimvixen-console-frame";
iframe.style.height = '0px';
document.body.append(iframe);
}

Expand All @@ -39,6 +42,7 @@ export class ConsoleFramePresenterImpl implements ConsoleFramePresenter {
if (!ele) {
return;
}
this.resize(0, 0)
ele.blur();
}

Expand Down