-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
3 changed files
with
21 additions
and
17 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
11 changes: 5 additions & 6 deletions
11
content-scripts/modules/options/addStyle.ts → content-scripts/modules/options/addStyle.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,15 +1,14 @@ | ||
// eslint-disable-next-line @typescript-eslint/no-unused-vars | ||
import jsx from "texsaur"; | ||
|
||
import removeElement from "../utilities/removeElement"; | ||
|
||
// Utility function to inject CSS into the page | ||
export default function addStyles(id: string, css: string): void { | ||
// If the element already exists, remove it | ||
removeElement(id); | ||
|
||
const style = <style id={id}>{css}</style>; | ||
const head = document.querySelector("head"); | ||
if (head) { | ||
const style = document.createElement("style"); | ||
style.id = id; | ||
style.textContent = css; | ||
head.appendChild(style); | ||
} | ||
if (head) head.appendChild(style); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters