aboutsummaryrefslogtreecommitdiff
path: root/largePiPEnergy.plugin.js
diff options
context:
space:
mode:
Diffstat (limited to 'largePiPEnergy.plugin.js')
-rw-r--r--largePiPEnergy.plugin.js17
1 files changed, 10 insertions, 7 deletions
diff --git a/largePiPEnergy.plugin.js b/largePiPEnergy.plugin.js
index ae07cf2..de4bc52 100644
--- a/largePiPEnergy.plugin.js
+++ b/largePiPEnergy.plugin.js
@@ -10,6 +10,9 @@
module.exports = class largePiPEnergy {
constructor() {
this.size = 320;
+ this.resizeStep = 0.3;
+ this.resizeTransitionSpeed = 300;
+ this.aspectRatio = [16, 9];
}
start() {
@@ -20,23 +23,23 @@ module.exports = class largePiPEnergy {
".da-pictureInPicture .da-pictureInPictureVideo {",
` width: calc(var(--largePiPEnergySize) * 1px);`,
" height: unset;",
- " padding-bottom: 56.25%;",
- " transition: width .3s;",
+ ` padding-bottom: calc(${this.aspectRatio[1]} / ${this.aspectRatio[0]} * 100%);`,
+ ` transition: width ${this.resizeTransitionSpeed}ms;`,
"}"
- ].join("\n"))
+ ].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)
+ this.size -= event.deltaY * this.resizeStep;
+ 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")
+ BdApi.clearCSS("largePiPEnergy");
}
}