Skip to content

Commit

Permalink
Merge pull request #27 from VampireChicken12/dev
Browse files Browse the repository at this point in the history
fix(content/index.tsx): Fix code running twice on page load
  • Loading branch information
VampireChicken12 authored Aug 31, 2023
2 parents 1a6b00b + 3d9dc74 commit a81861e
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 10 deletions.
2 changes: 1 addition & 1 deletion release.config.cjs
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ module.exports = {
[
"@semantic-release/exec",
{
verifyReleaseCmd: 'npm version ${nextRelease.version} -m "chore(release): ${nextRelease.version}";npm run build'
verifyReleaseCmd: "node -e \"const packageJson = require('./package.json');packageJson.version=${nextRelease.version}\";npm run build"
}
]
],
Expand Down
10 changes: 1 addition & 9 deletions src/pages/content/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@ import {
} from "@/src/types";
// TODO: Add remaining time feature
// TODO: Add always show progressbar feature
// TODO: Fix double running of code from video reloading when page first loads

// Centralized Event Manager
type EventCallback<K extends keyof HTMLElementEventMap> = (event: HTMLElementEventMap[K]) => void;
Expand Down Expand Up @@ -1153,14 +1152,7 @@ function sendMessage<T extends MessageTypes>(eventType: T, data: Omit<MessageDat
}
// #endregion Intercommunication functions
window.onload = function () {
addScreenshotButton();
addMaximizePlayerButton();
setRememberedVolume();
setPlayerQuality();
setPlayerSpeed();
volumeBoost();
adjustVolumeOnScrollWheel();
setupVideoHistory();
const enableFeatures = () => {
eventManager.removeAllEventListeners();
addScreenshotButton();
Expand All @@ -1172,7 +1164,7 @@ window.onload = function () {
adjustVolumeOnScrollWheel();
setupVideoHistory();
};
document.addEventListener("yt-navigate-finish", enableFeatures);
document.addEventListener("yt-player-updated", enableFeatures);
/**
* Listens for the "yte-message-from-youtube" event and handles incoming messages from the YouTube page.
*
Expand Down

0 comments on commit a81861e

Please sign in to comment.