CyTube But Nice 2

29/08/2023, 06:02:02

您需要先安装一个扩展,例如 篡改猴Greasemonkey暴力猴,之后才能安装此脚本。

You will need to install an extension such as Tampermonkey to install this script.

您需要先安装一个扩展,例如 篡改猴暴力猴,之后才能安装此脚本。

您需要先安装一个扩展,例如 篡改猴Userscripts ,之后才能安装此脚本。

您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey,才能安装此脚本。

您需要先安装用户脚本管理器扩展后才能安装此脚本。

(我已经安装了用户脚本管理器,让我安装!)

您需要先安装一款用户样式管理器扩展,比如 Stylus,才能安装此样式。

您需要先安装一款用户样式管理器扩展,比如 Stylus,才能安装此样式。

您需要先安装一款用户样式管理器扩展,比如 Stylus,才能安装此样式。

您需要先安装一款用户样式管理器扩展后才能安装此样式。

您需要先安装一款用户样式管理器扩展后才能安装此样式。

您需要先安装一款用户样式管理器扩展后才能安装此样式。

(我已经安装了用户样式管理器,让我安装!)

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

(function () {
  "use strict";
  function styling() {
    // 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";

    // Poll visibilty
    document.getElementById("pollwrap").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 = 100;
  setInterval(recurringTasks, interval);

  function recurringTasks() {
    CreateLink();
    HideMOTD();
    interval = 10000;
  }

  function HideMOTD() {
    // If it's currently visible, hide it; otherwise show it
    if (window.getComputedStyle(motd).display !== "none") {
        motd.style.display = "none";
    }
  }

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

    if (document.getElementById("video_link") == null) {
      const linkContainer = document.createElement("p");
      linkContainer.innerHTML = "Direct media link: ";
      const myLink = document.createElement("a");
      myLink.href = currentURL;
      myLink.id = "video_link";
      myLink.style.color = "white";
      myLink.innerHTML = currentURL;
      linkContainer.appendChild(myLink);
      document.getElementById("rightcontrols").appendChild(linkContainer);
    }
    document.getElementById("video_link").innerHTML = currentURL;
    document.getElementById("video_link").href = currentURL;
    currentURL = "";
  }

  if (document.readyState === "loading") {
    document.addEventListener("DOMContentLoaded", styling);
  } else {
    styling();
  }
})();