CyTube But Nice 2

29/08/2023, 06:02:02

// ==UserScript==
// @name        CyTube But Nice 2
// @namespace   Violentmonkey Scripts
// @match       https://cytu.be/*
// @grant       none
// @version     1.1
// @license     GPLv2
// @author      Gum Coblin
// @description 29/08/2023, 06:02:02
// ==/UserScript==

// Wide video player
document.getElementById("videowrap").style.width = "85%"

// Chat visibility
document.getElementById("chatwrap").style.display = "none"

// Empty footer visibilty
document.getElementById("footer").style.display = "none"

// Padding on the left of the player to center it
document.getElementById("videowrap").style.paddingLeft = "15%"

// Set control width to 100% so the rightmost controls are on the right of the screen
document.getElementById("rightcontrols").style.width = "100%"

var currentURL = ""
//setTimeout(CreateLink, 5000)

var interval = 1000
setInterval(recurringTasks, interval)

function recurringTasks(){
  // MOTD visibility
  document.getElementById("motd").style.display = "none"

  console.log("Interval {}", interval)

  if(document.getElementById("motd").style.display = "none"){
    interval = 10000
  }

  CreateLink();
}


function CreateLink() {
  // Create a variable containing the link to the currently playing video
  currentURL = document.getElementById("ytapiplayer_html5_api").src
  console.log(currentURL)

  if (document.getElementById("video_link") == null) {
    const myLink = document.createElement("a");
    myLink.href = currentURL
    myLink.id = "video_link"
    myLink.style.color = "white"
    myLink.innerHTML = currentURL
    document.getElementById("mainpage").appendChild(myLink)
  }
  document.getElementById("video_link").innerHTML = currentURL
  document.getElementById("video_link").href = currentURL
  currentURL = ""
}