-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmain.js
34 lines (26 loc) · 1.05 KB
/
main.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
let primaryTarget, primaryStyle, playerTarget, playerHeight, playerInterval
window.addEventListener('load', (event) => {
console.log('YouTube - Scrollable Playlist: Loading')
playerInterval = setInterval(() => {
primaryTarget = document.querySelector("#primary")
playerTarget = primaryTarget?.querySelector("#player")
if(playerTarget) {
console.log('YouTube - Scrollable Playlist: playerTarget -->', playerTarget)
clearInterval(playerInterval);
load();
window.addEventListener('resize', function(event) {
load();
}, true);
}
}, 100);
});
function load() {
primaryTarget = document.querySelector("#primary")
primaryStyle = primaryTarget.currentStyle || window.getComputedStyle(primaryTarget)
playerTarget = primaryTarget.querySelector("#player")
playerHeight = playerTarget.offsetHeight
let secondaryTarget = document.querySelector("#secondary")
secondaryTarget.style.height = `${playerHeight + parseInt(primaryStyle.paddingTop)}px`
secondaryTarget.style.overflow = `auto`
console.log('YouTube - Scrollable Playlist: Loaded')
}