35 lines
1.1 KiB
JavaScript
35 lines
1.1 KiB
JavaScript
// ==UserScript==
|
|
// @name YouTube - YouTube to Invidious
|
|
// @namespace youtube-to-invidious
|
|
// @match *://*.youtube.com/*
|
|
// @version 1
|
|
// @grant none
|
|
// ==/UserScript==
|
|
|
|
var invidiousInstance = "https://invidio.xamh.de"
|
|
|
|
var toYouTube = function() {
|
|
sessionStorage.setItem("yti-visityt",true)
|
|
location.reload()
|
|
}
|
|
|
|
var main = function() {
|
|
if (sessionStorage.getItem("yti-visityt") !== null) {
|
|
sessionStorage.removeItem("yti-visityt")
|
|
return
|
|
}
|
|
document.body.innerHTML = `
|
|
<center style="background-color: rgba(0,0,0,0.5); color: white; width: 100%; height: 100%">
|
|
<h1>YouTube to Invidious</h1>
|
|
<a href="` +invidiousInstance + window.location.pathname + window.location.search + window.location.hash + `"><button>To Invidious (recommended)</button></a> <button id="toYouTube">To YouTube</button><br>
|
|
Should Invidious not work, click "Back" in your browser, and then choose "To YouTube"<br>
|
|
<br>
|
|
<i>To get back to this site:</i><br>
|
|
<b>From Invidious:</b> Click "Watch on YouTube" or click a YouTube-icon<br>
|
|
<b>From YouTube:</b> Reload page
|
|
</center>
|
|
`
|
|
document.getElementById("toYouTube").onclick = toYouTube
|
|
}
|
|
|
|
main() |