mirror of
https://github.com/th-ch/youtube-music.git
synced 2026-01-11 10:31:47 +00:00
Fixed running before #main-panel exists
This commit is contained in:
@ -22,7 +22,6 @@
|
|||||||
color: #fff;
|
color: #fff;
|
||||||
padding-right: 120px;
|
padding-right: 120px;
|
||||||
position: absolute;
|
position: absolute;
|
||||||
left: var(--align);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
.video-switch-button:before {
|
.video-switch-button:before {
|
||||||
|
|||||||
@ -31,21 +31,6 @@ module.exports = (_options) => {
|
|||||||
document.addEventListener("apiLoaded", setup, { once: true, passive: true });
|
document.addEventListener("apiLoaded", setup, { once: true, passive: true });
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
const mainpanel = document.querySelector("#main-panel");
|
|
||||||
switch (_options.align) {
|
|
||||||
case "right": {
|
|
||||||
mainpanel.style.setProperty("--align", "calc(100% - 240px)");
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
case "middle": {
|
|
||||||
mainpanel.style.setProperty("--align", "calc(50% - 120px)");
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
default:
|
|
||||||
case "left": {
|
|
||||||
mainpanel.style.setProperty("--align", "0px");
|
|
||||||
}
|
|
||||||
}
|
|
||||||
};
|
};
|
||||||
|
|
||||||
function setup(e) {
|
function setup(e) {
|
||||||
@ -73,6 +58,21 @@ function setup(e) {
|
|||||||
video.addEventListener('srcChanged', videoStarted);
|
video.addEventListener('srcChanged', videoStarted);
|
||||||
|
|
||||||
observeThumbnail();
|
observeThumbnail();
|
||||||
|
|
||||||
|
switch (options.align) {
|
||||||
|
case "right": {
|
||||||
|
switchButtonDiv.style.left = "calc(100% - 240px)";
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
case "middle": {
|
||||||
|
switchButtonDiv.style.left = "calc(50% - 120px)";
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
default:
|
||||||
|
case "left": {
|
||||||
|
switchButtonDiv.style.left = "0px";
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
function changeDisplay(showVideo) {
|
function changeDisplay(showVideo) {
|
||||||
|
|||||||
Reference in New Issue
Block a user