Merge pull request #1995 from syeopite/watch-on-invidious

Add watch on Invidious button to embeds
このコミットが含まれているのは:
TheFrenchGhosty 2021-05-13 10:32:02 +02:00 committed by GitHub
コミット 76c9cf62ff
この署名に対応する既知のキーがデータベースに存在しません
GPGキーID: 4AEE18F83AFDEB23
2個のファイルの変更33行の追加0行の削除

ファイルの表示

@ -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);;
}

ファイルの表示

@ -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)
};