diff options
author | lonkaars <l.leblansch@gmail.com> | 2021-02-05 16:17:02 +0100 |
---|---|---|
committer | lonkaars <l.leblansch@gmail.com> | 2021-02-05 16:17:02 +0100 |
commit | 61d43c17a6d73f1c380fa70633abde49b88b5e6d (patch) | |
tree | 68730e2a4fa34b60a61ed2092c15bcdcac67a4b2 | |
parent | 1a4496df265a10c67a7b903c7f03ef28de3ba91d (diff) |
-rw-r--r-- | largePiPEnergy.plugin.js | 17 |
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"); } } |