Skip to content

Commit

Permalink
Netflix_scrollVolume
Browse files Browse the repository at this point in the history
  • Loading branch information
Dreamlinerm committed Oct 8, 2024
1 parent dd5bb64 commit deb7845
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 8 deletions.
4 changes: 2 additions & 2 deletions firefox/cr.js
Original file line number Diff line number Diff line change
Expand Up @@ -102,8 +102,8 @@ async function Crunchyroll_scrollVolume(video) {
volumeControl?.addEventListener("wheel", (event) => {
event.preventDefault();
let volume = video.volume;
if (event.deltaY < 0) volume = Math.min(1, volume + 0.05);
else volume = Math.max(0, volume - 0.05);
if (event.deltaY < 0) volume = Math.min(1, volume + 0.1);
else volume = Math.max(0, volume - 0.1);
video.volume = volume;
const sliderKnob = document.querySelector('div[data-testid="vilos-volume_slider"]').children[1].firstChild.firstChild;
sliderKnob.style.transform = `translateX(${volume * 61}px) translateX(-8px) scale(1)`;
Expand Down
14 changes: 8 additions & 6 deletions firefox/skipper.js
Original file line number Diff line number Diff line change
Expand Up @@ -502,8 +502,8 @@ if (isPrimeVideo || isNetflix || isDisney || isHotstar || isCrunchyroll || isHBO
volumeControl.classList.add("enhanced");
volumeControl?.addEventListener("wheel", (event) => {
let volume = video.volume;
if (event.deltaY < 0) volume = Math.min(1, volume + 0.05);
else volume = Math.max(0, volume - 0.05);
if (event.deltaY < 0) volume = Math.min(1, volume + 0.1);
else volume = Math.max(0, volume - 0.1);
video.volume = volume;
const sliderContainer = volumeControl.querySelector(".slider-container");
sliderContainer.firstChild.children[1].style.strokeDashoffset = 100 - volume * 100 + "px";
Expand Down Expand Up @@ -750,12 +750,14 @@ if (isPrimeVideo || isNetflix || isDisney || isHotstar || isCrunchyroll || isHBO
const volumeControl = document.querySelector('[data-uia*="control-volume"]:not(.enhanced)');
if (volumeControl) {
volumeControl.classList.add("enhanced");
volumeControl?.addEventListener("wheel", (event) => {
const handleVolumeControl = (event) => {
let volume = video.volume;
if (event.deltaY < 0) volume = Math.min(1, volume + 0.05);
else volume = Math.max(0, volume - 0.05);
video.volume = volume;
});
};
removeEventListener("wheel", handleVolumeControl);
volumeControl?.addEventListener("wheel", handleVolumeControl);
}
}
// to parse html umlaut symbols like &auml; to ä
Expand Down Expand Up @@ -903,8 +905,8 @@ if (isPrimeVideo || isNetflix || isDisney || isHotstar || isCrunchyroll || isHBO
volumeControl?.addEventListener("wheel", (event) => {
const video = document.querySelector(AmazonVideoClass);
let volume = video.volume;
if (event.deltaY < 0) volume = Math.min(1, volume + 0.05);
else volume = Math.max(0, volume - 0.05);
if (event.deltaY < 0) volume = Math.min(1, volume + 0.1);
else volume = Math.max(0, volume - 0.1);
video.volume = volume;
});
}
Expand Down

0 comments on commit deb7845

Please sign in to comment.