mirror of
https://github.com/th-ch/youtube-music.git
synced 2026-01-14 20:01:47 +00:00
minify firstRun()
This commit is contained in:
@ -93,11 +93,10 @@ function writeOptions(options) {
|
|||||||
|
|
||||||
/** Restore saved volume and setup tooltip */
|
/** Restore saved volume and setup tooltip */
|
||||||
function firstRun(options) {
|
function firstRun(options) {
|
||||||
const videoStream = $(".video-stream");
|
const video = $("video");
|
||||||
const slider = $("#volume-slider");
|
|
||||||
// Those elements load abit after DOMContentLoaded
|
// Those elements load abit after DOMContentLoaded
|
||||||
if (videoStream && slider) {
|
if (video) {
|
||||||
setupVolumeOverride(options);
|
setupVolumeOverride(video, options);
|
||||||
if (typeof options.savedVolume === "number") {
|
if (typeof options.savedVolume === "number") {
|
||||||
// Set saved volume as tooltip
|
// Set saved volume as tooltip
|
||||||
setTooltip(options.savedVolume);
|
setTooltip(options.savedVolume);
|
||||||
@ -151,9 +150,7 @@ function changeVolume(toIncrease, options) {
|
|||||||
showVolumeHud(options.savedVolume);
|
showVolumeHud(options.savedVolume);
|
||||||
}
|
}
|
||||||
|
|
||||||
function setupVolumeOverride(options) {
|
function setupVolumeOverride(video, options) {
|
||||||
const video = $('video');
|
|
||||||
|
|
||||||
video.addEventListener("canplay", () => {
|
video.addEventListener("canplay", () => {
|
||||||
if (typeof options.savedVolume === "number") {
|
if (typeof options.savedVolume === "number") {
|
||||||
const newVolume = (options.savedVolume / 100).toFixed(2);
|
const newVolume = (options.savedVolume / 100).toFixed(2);
|
||||||
|
|||||||
Reference in New Issue
Block a user