generated from JohnBra/vite-web-extension
-
Notifications
You must be signed in to change notification settings - Fork 17
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #70 from VampireChicken12/dev
fix: Forgot to enable hide scrollbar on page load
- Loading branch information
Showing
3 changed files
with
35 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,17 +1,16 @@ | ||
export function hideScrollBar() { | ||
const style = document.createElement("style"); | ||
style.innerHTML = ` | ||
::-webkit-scrollbar { | ||
width: 0px; | ||
height: 0px; | ||
} | ||
`; | ||
style.id = "yte-hide-scroll-bar"; | ||
document.head.appendChild(style); | ||
} | ||
export function showScrollBar() { | ||
const style = document.getElementById("yte-hide-scroll-bar"); | ||
if (style) { | ||
style.remove(); | ||
} | ||
import { waitForSpecificMessage } from "@/src/utils/utilities"; | ||
import { hideScrollBar } from "./utils"; | ||
|
||
export async function enableHideScrollBar() { | ||
// Wait for the "options" message from the content script | ||
const optionsData = await waitForSpecificMessage("options", "request_data", "content"); | ||
if (!optionsData) return; | ||
const { | ||
data: { options } | ||
} = optionsData; | ||
// Extract the necessary properties from the options object | ||
const { enable_hide_scroll_bar } = options; | ||
// If the hide scroll bar option is disabled, return | ||
if (!enable_hide_scroll_bar) return; | ||
hideScrollBar(); | ||
} |
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 |
---|---|---|
@@ -0,0 +1,17 @@ | ||
export function hideScrollBar() { | ||
const style = document.createElement("style"); | ||
style.innerHTML = ` | ||
::-webkit-scrollbar { | ||
width: 0px; | ||
height: 0px; | ||
} | ||
`; | ||
style.id = "yte-hide-scroll-bar"; | ||
document.head.appendChild(style); | ||
} | ||
export function showScrollBar() { | ||
const style = document.getElementById("yte-hide-scroll-bar"); | ||
if (style) { | ||
style.remove(); | ||
} | ||
} |
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