summaryrefslogtreecommitdiffstats
path: root/assets/js
diff options
context:
space:
mode:
authorTheFrenchGhosty <47571719+TheFrenchGhosty@users.noreply.github.com>2021-05-13 10:32:02 +0200
committerGitHub <noreply@github.com>2021-05-13 10:32:02 +0200
commit76c9cf62ff6738c6563786a663cd788a0636887f (patch)
tree01fed2f05ea207d3a9a0ad01ebdbf172babe592f /assets/js
parent7a93af1786947f554c139a8048333f72f287c6f6 (diff)
parentbc5c0f65b8bf69da4d75596ac11a5d75b64c4b7d (diff)
downloadinvidious-76c9cf62ff6738c6563786a663cd788a0636887f.tar.gz
invidious-76c9cf62ff6738c6563786a663cd788a0636887f.tar.bz2
invidious-76c9cf62ff6738c6563786a663cd788a0636887f.zip
Merge pull request #1995 from syeopite/watch-on-invidious
Add watch on Invidious button to embeds
Diffstat (limited to 'assets/js')
-rw-r--r--assets/js/player.js17
1 files changed, 17 insertions, 0 deletions
diff --git a/assets/js/player.js b/assets/js/player.js
index 1c6e336c..f1429233 100644
--- a/assets/js/player.js
+++ b/assets/js/player.js
@@ -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)
+};