Advertisement
Guest User

Untitled

a guest
Apr 19th, 2025
40
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. // ==UserScript==
  2. // @name        Fullscreen Chat cytu.be
  3. // @namespace   Violentmonkey Scripts
  4. // @match       https://cytu.be/*
  5. // @grant       none
  6. // @version     1.0
  7. // @description 4/19/2025, 9:15:25 PM
  8. // @run-at document-end
  9. // ==/UserScript==
  10.  
  11. /*
  12.  * Note: Form input in fullscreen does not seem to work, so the script won't activate it automatically, but F11 will work.
  13.  */
  14.  
  15. const videoControls = document.querySelector("#videocontrols");
  16. if (videoControls) {
  17.   const fsChatBtn = document.createElement("button");
  18.   fsChatBtn.classList.add("btn", "btn-sm", "btn-default");
  19.   fsChatBtn.innerText = "FSC";
  20.   fsChatBtn.setAttribute("alt", "Fullscreen Chat");
  21.   videoControls.insertBefore(fsChatBtn, videoControls.children[0]);
  22.  
  23.   function openFullscreen() {
  24.     if (elem.requestFullscreen) {
  25.       elem.requestFullscreen();
  26.     } else if (elem.webkitRequestFullscreen) { /* Safari */
  27.       elem.webkitRequestFullscreen();
  28.     } else if (elem.msRequestFullscreen) { /* IE11 */
  29.       elem.msRequestFullscreen();
  30.     }
  31.   }
  32.  
  33.   function disableFs() {
  34.     fsEnabled = false;
  35.  
  36.     const videoElement = document.querySelector("video");
  37.     if (videoElement) {
  38.       videoElement.removeAttribute("style");
  39.     }
  40.  
  41.     const chatElement = document.querySelector("#chatwrap");
  42.     if (chatElement) {
  43.       chatElement.removeAttribute("style");
  44.       chatElement.querySelector("input").removeAttribute("style");
  45.     }
  46.  
  47.     const videoChatElement = document.querySelector(".videochatContainer");
  48.     if (videoChatElement) {
  49.       videoChatElement.removeAttribute("style");
  50.     }
  51.  
  52.     const userList = document.querySelector("#userlist");
  53.     const messageBuffer = document.querySelector("#messagebuffer");
  54.     messageBuffer.style.height = messageBuffer.initialHeight;
  55.     userlist.style.height = userlist.initialHeight;
  56.   }
  57.  
  58.   function enableFs() {
  59.     const videoElement = document.querySelector("video");
  60.     const chatElement = document.querySelector("#chatwrap");
  61.     const videoChatElement = document.querySelector(".videochatContainer");
  62.     const userList = document.querySelector("#userlist");
  63.     const messageBuffer = document.querySelector("#messagebuffer");
  64.  
  65.     if (!videoElement) {
  66.       alert("This script only supports <video> tags.");
  67.       return;
  68.     }
  69.  
  70.     fsEnabled = true;
  71.     //openFullscreen();
  72.  
  73.     videoElement.style.position = "fixed";
  74.     videoElement.style.left = "0";
  75.     videoElement.style.top = "0";
  76.     videoElement.style.left = "20vw";
  77.     videoElement.style.right = "0";
  78.     videoElement.style.maxHeight = "100vh";
  79.     videoElement.style.width = "80vw";
  80.     videoElement.style.zIndex = "10000";
  81.     videoElement.style.objectFit = "contain";
  82.     videoElement.style.backgroundColor = "black";
  83.  
  84.     videoChatElement.style.position = "fixed";
  85.     videoChatElement.style.left = "0";
  86.     videoChatElement.style.top = "0";
  87.     videoChatElement.style.left = "20vw";
  88.     videoChatElement.style.right = "0";
  89.     videoChatElement.style.maxHeight = "100vh";
  90.     videoChatElement.style.width = "80vw";
  91.     videoChatElement.style.zIndex = "10001";
  92.     videoChatElement.style.objectFit = "contain";
  93.     videoChatElement.style.backgroundColor = "black";
  94.  
  95.     if (chatElement) {
  96.       chatElement.style.position = "fixed";
  97.       chatElement.style.left = "0";
  98.       chatElement.style.top = "0";
  99.       chatElement.style.bottom = "0";
  100.       chatElement.style.zIndex = "10002";
  101.       chatElement.style.backgroundColor = "black";
  102.       chatElement.style.maxWidth = "20vw";
  103.       chatElement.style.marginBottom = "0";
  104.     }
  105.  
  106.     messageBuffer.initialHeight = messageBuffer.style.height;
  107.     userlist.initialHeight = userlist.style.height;
  108.  
  109.     setTimeout(() => {
  110.       messageBuffer.style.height = "90vh";
  111.       userlist.style.height = "90vh";
  112.     }, 500);
  113.   }
  114.  
  115.   let fsEnabled = false;
  116.  
  117.   document.body.addEventListener("keyup", e => {
  118.     console.log(e.key);
  119.     if (e.key == "Escape") {
  120.       disableFs();
  121.     }
  122.   });
  123.  
  124.   window.addEventListener("resize", e => {
  125.     if (fsEnabled) {
  126.       const userList = document.querySelector("#userlist");
  127.       const messageBuffer = document.querySelector("#messagebuffer");
  128.       messageBuffer.style.height = "90vh";
  129.       userlist.style.height = "90vh";
  130.     }
  131.   });
  132.  
  133.   fsChatBtn.addEventListener("click", e => {
  134.     e.preventDefault();
  135.  
  136.     if (fsEnabled) {
  137.       disableFs();
  138.     } else {
  139.       enableFs();
  140.     }
  141.   });
  142.  
  143.   document.addEventListener("fullscreenchange", e => {
  144.     if (!document.fullscreenElement) disableFs();
  145.   });
  146. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement