blob: ae07cf2a5c5d55ec824487d44a9095709f777ba3 (
plain)
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
35
36
37
38
39
40
41
42
|
/**
* @name largePiPEnergy
* @version 0.0.1
* @author loekaars
* @description Enables resizing the screenshare/webcam picture in picture window by scrolling
*
* @website https://github.com/lonkaars
*/
module.exports = class largePiPEnergy {
constructor() {
this.size = 320;
}
start() {
BdApi.injectCSS("largePiPEnergy", [
":root {",
` --largePiPEnergySize: ${this.size}`,
"}",
".da-pictureInPicture .da-pictureInPictureVideo {",
` width: calc(var(--largePiPEnergySize) * 1px);`,
" height: unset;",
" padding-bottom: 56.25%;",
" transition: width .3s;",
"}"
].join("\n"))
setInterval(() => {
var element = document.getElementsByClassName("da-pictureInPictureWindow")[0];
if (!element) return;
element.onmousewheel = event => {
this.size -= event.deltaY / 3;
document.documentElement.style.setProperty("--largePiPEnergySize", `${this.size}`)
console.log(event.deltaY)
}
}, 1e3); // this is a crappy solution but i'll fix this tomorrow or something
}
stop() {
BdApi.clearCSS("largePiPEnergy")
}
}
|