Skip to content

Commit

Permalink
Crunchyroll_scrollVolume
Browse files Browse the repository at this point in the history
Dreamlinerm committed Oct 8, 2024
1 parent 4b22feb commit dd5bb64
Showing 4 changed files with 19 additions and 6 deletions.
2 changes: 1 addition & 1 deletion firefox/badge.js
Original file line number Diff line number Diff line change
@@ -113,7 +113,7 @@ if (isMobile) {
disableNumpad: true,
},
HBO: { skipIntro: true, skipCredits: true, watchCredits: false, speedSlider: true, showRating: true },
Video: { playOnFullScreen: true, epilepsy: false, userAgent: true, doubleClick: true },
Video: { playOnFullScreen: true, epilepsy: false, userAgent: true, doubleClick: true, scrollVolume: true },
Statistics: { AmazonAdTimeSkipped: 0, NetflixAdTimeSkipped: 0, IntroTimeSkipped: 0, RecapTimeSkipped: 0, SegmentsSkipped: 0 },
General: {
Crunchyroll_profilePicture: null,
18 changes: 17 additions & 1 deletion firefox/cr.js
Original file line number Diff line number Diff line change
@@ -47,7 +47,7 @@ const defaultSettings = {
disableNumpad: true,
},
HBO: { skipIntro: true, skipCredits: true, watchCredits: false, speedSlider: true, showRating: true },
Video: { playOnFullScreen: true, epilepsy: false, userAgent: true, doubleClick: true },
Video: { playOnFullScreen: true, epilepsy: false, userAgent: true, doubleClick: true, scrollVolume: true },
Statistics: { AmazonAdTimeSkipped: 0, NetflixAdTimeSkipped: 0, IntroTimeSkipped: 0, RecapTimeSkipped: 0, SegmentsSkipped: 0 },
General: {
Crunchyroll_profilePicture: null,
@@ -93,6 +93,22 @@ function Crunchyroll() {
const time = video?.currentTime;
if (settings.Crunchyroll?.skipIntro) Crunchyroll_Intro(video, time);
if (settings.Crunchyroll?.speedSlider) Crunchyroll_SpeedSlider(video);
if (settings.Video?.scrollVolume) Crunchyroll_scrollVolume(video);
}
async function Crunchyroll_scrollVolume(video) {
const volumeControl = document.querySelector('[data-testid="vilos-volume_container"]:not(.enhanced)');
if (volumeControl) {
volumeControl.classList.add("enhanced");
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);
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)`;
});
}
}
const date = new Date();
function log(...args) {
2 changes: 1 addition & 1 deletion firefox/popup/settings.js
Original file line number Diff line number Diff line change
@@ -97,7 +97,7 @@ const defaultSettings = {
disableNumpad: true,
},
HBO: { skipIntro: true, skipCredits: true, watchCredits: false, speedSlider: true, showRating: true },
Video: { playOnFullScreen: true, epilepsy: false, userAgent: true, doubleClick: true },
Video: { playOnFullScreen: true, epilepsy: false, userAgent: true, doubleClick: true, scrollVolume: true },
Statistics: { AmazonAdTimeSkipped: 0, NetflixAdTimeSkipped: 0, IntroTimeSkipped: 0, RecapTimeSkipped: 0, SegmentsSkipped: 0 },
General: {
Crunchyroll_profilePicture: null,
3 changes: 0 additions & 3 deletions firefox/skipper.js
Original file line number Diff line number Diff line change
@@ -509,7 +509,6 @@ if (isPrimeVideo || isNetflix || isDisney || isHotstar || isCrunchyroll || isHBO
sliderContainer.firstChild.children[1].style.strokeDashoffset = 100 - volume * 100 + "px";
sliderContainer.children[1].style.height = volume * 100 + "%";
sliderContainer.children[2].style.height = volume * 100 + "%";
console.log("test", event);
});
}
}
@@ -756,7 +755,6 @@ if (isPrimeVideo || isNetflix || isDisney || isHotstar || isCrunchyroll || isHBO
if (event.deltaY < 0) volume = Math.min(1, volume + 0.05);
else volume = Math.max(0, volume - 0.05);
video.volume = volume;
console.log("test", event);
});
}
}
@@ -908,7 +906,6 @@ if (isPrimeVideo || isNetflix || isDisney || isHotstar || isCrunchyroll || isHBO
if (event.deltaY < 0) volume = Math.min(1, volume + 0.05);
else volume = Math.max(0, volume - 0.05);
video.volume = volume;
console.log("test", event);
});
}
}

0 comments on commit dd5bb64

Please sign in to comment.