aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorlonkaars <l.leblansch@gmail.com>2021-02-04 22:11:47 +0100
committerlonkaars <l.leblansch@gmail.com>2021-02-04 22:11:47 +0100
commitede1443810ab14878d31de37c8b72102d0f210bd (patch)
tree886c4c1ec00dd9de2de4462c8e87837e462b2f26
initial poopy
-rw-r--r--largePiPEnergy.plugin.js42
1 files changed, 42 insertions, 0 deletions
diff --git a/largePiPEnergy.plugin.js b/largePiPEnergy.plugin.js
new file mode 100644
index 0000000..ae07cf2
--- /dev/null
+++ b/largePiPEnergy.plugin.js
@@ -0,0 +1,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")
+ }
+}