Add watch on Invidious button to embeds

pull/1995/head
syeopite 2021-04-08 04:15:15 -07:00
rodzic ae353cef2e
commit bc5c0f65b8
Nie znaleziono w bazie danych klucza dla tego podpisu
ID klucza GPG: 6FA616E5A5294A82
2 zmienionych plików z 33 dodań i 0 usunięć

Wyświetl plik

@ -8,3 +8,19 @@
height: auto;
z-index: -100;
}
.watch-on-invidious {
font-size: 1.3em !important;
font-weight: bold;
white-space: nowrap;
margin: 0 1em 0 1em !important;
order: 3;
}
.watch-on-invidious > a {
color: white;
}
.watch-on-invidious > a:hover {
color: rgba(0, 182, 240, 1);;
}

Wyświetl plik

@ -566,3 +566,20 @@ if (navigator.vendor == "Apple Computer, Inc." && video_data.params.listen) {
});
});
}
// Watch on Invidious link
if (window.location.pathname.startsWith("/embed/")) {
const Button = videojs.getComponent('Button');
let watch_on_invidious_button = new Button(player);
// Create hyperlink for current instance
redirect_element = document.createElement("a");
redirect_element.setAttribute("href", `http://${window.location.host}/watch?v=${window.location.pathname.replace("/embed/","")}`)
redirect_element.appendChild(document.createTextNode("Invidious"))
watch_on_invidious_button.el().appendChild(redirect_element)
watch_on_invidious_button.addClass("watch-on-invidious")
cb = player.getChild('ControlBar')
cb.addChild(watch_on_invidious_button)
};