YouTube Alternative frontends

10/21/2023, 2:15:40 PM

ही स्क्रिप्ट इंस्टॉल करण्यासाठी तुम्हाला Tampermonkey, Greasemonkey किंवा Violentmonkey यासारखे एक्स्टेंशन इंस्टॉल करावे लागेल.

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

ही स्क्रिप्ट इंस्टॉल करण्यासाठी तुम्हाला Tampermonkey किंवा Violentmonkey यासारखे एक्स्टेंशन इंस्टॉल करावे लागेल..

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

ही स्क्रिप्ट इंस्टॉल करण्यासाठी तुम्हाला Tampermonkey यासारखे एक्स्टेंशन इंस्टॉल करावे लागेल..

ही स्क्रिप्ट इंस्टॉल करण्यासाठी तुम्हाला एक युझर स्क्रिप्ट व्यवस्थापक एक्स्टेंशन इंस्टॉल करावे लागेल.

(माझ्याकडे आधीच युझर स्क्रिप्ट व्यवस्थापक आहे, मला इंस्टॉल करू द्या!)

ही स्टाईल इंस्टॉल करण्यासाठी तुम्हाला Stylus सारखे एक्स्टेंशन इंस्टॉल करावे लागेल.

ही स्टाईल इंस्टॉल करण्यासाठी तुम्हाला Stylus सारखे एक्स्टेंशन इंस्टॉल करावे लागेल.

ही स्टाईल इंस्टॉल करण्यासाठी तुम्हाला Stylus सारखे एक्स्टेंशन इंस्टॉल करावे लागेल.

ही स्टाईल इंस्टॉल करण्यासाठी तुम्हाला एक युझर स्टाईल व्यवस्थापक इंस्टॉल करावे लागेल.

ही स्टाईल इंस्टॉल करण्यासाठी तुम्हाला एक युझर स्टाईल व्यवस्थापक इंस्टॉल करावे लागेल.

ही स्टाईल इंस्टॉल करण्यासाठी तुम्हाला एक युझर स्टाईल व्यवस्थापक इंस्टॉल करावे लागेल.

(माझ्याकडे आधीच युझर स्टाईल व्यवस्थापक आहे, मला इंस्टॉल करू द्या!)

// ==UserScript==
// @name        YouTube Alternative frontends
// @namespace   Violentmonkey Scripts
// @match       *://www.youtube.com/watch?v=*
// @grant       none
// @version     1.1
// @author      -
// @description 10/21/2023, 2:15:40 PM
// @require https://code.jquery.com/jquery-3.7.1.min.js
// @run-at document-end
 // @license GPLv3
// ==/UserScript==
setInterval(
  function() {
    let subButton = document.querySelector("#subscribe-button")
    let videoId = window.location.href;
    videoId = videoId.substring(videoId.search("=") + 1)
    let frontendLinks =
    [
      ["Piped", "https://piped.video/watch?v=" + videoId],
      ["Invidious", "https://yewtu.be/watch?v=" + videoId]
    ];


    let button;
    let youtubeButtonAttrs = 'class="yt-spec-button-shape-next yt-spec-button-shape-next--filled yt-spec-button-shape-next--mono yt-spec-button-shape-next--size-m" type="button" id="dropdownMenuButton" aria-haspopup="true" aria-expanded="false" style="padding: 10px; margin: 10px;"'
    for (let i = 0; i < frontendLinks.length; i++){
      button = $("#" + frontendLinks[i][0])
      if (button){
        button.remove()
      }
      button = $(
        `
          <div class="style-scope ytd-watch-metadata"id="${frontendLinks[i][0]}">
            <button ${youtubeButtonAttrs}>
              <a href="${frontendLinks[i][1]}" target="_blank">
                ${frontendLinks[i][0]}
              </a>
            </button>
          </div>
        `
      )
      subButton.parentNode.insertBefore(button[0], subButton);
    }
  },
  3000
)