From 957c4bc67898a9b86d4373352bb5d983ef3989fc Mon Sep 17 00:00:00 2001 From: Geraint White Date: Thu, 26 Mar 2020 11:55:49 +0000 Subject: [PATCH] Add support for YouTube embeds --- extension/keysocket-youtube-embed.js | 9 +++++++++ extension/manifest.json | 5 +++++ 2 files changed, 14 insertions(+) create mode 100644 extension/keysocket-youtube-embed.js diff --git a/extension/keysocket-youtube-embed.js b/extension/keysocket-youtube-embed.js new file mode 100644 index 0000000..72ddd97 --- /dev/null +++ b/extension/keysocket-youtube-embed.js @@ -0,0 +1,9 @@ +keySocket.init( + "youtube.embed", + function (key) { + if (key === keySocket.PLAY) { + var playPauseButton = document.querySelector('.ytp-play-button'); + keySocket.simulateClick(playPauseButton); + } + } +); diff --git a/extension/manifest.json b/extension/manifest.json index 4002ffb..aef1739 100644 --- a/extension/manifest.json +++ b/extension/manifest.json @@ -309,6 +309,11 @@ "matches": ["*://*.youtube.com/*"], "js": ["plugin-api.js", "keysocket-youtube.js"] }, + { + "matches": ["*://*.youtube.com/embed/*"], + "js": ["plugin-api.js", "keysocket-youtube-embed.js"], + "all_frames": true + }, { "matches": ["*://zvooq.com/*"], "js": ["plugin-api.js", "keysocket-zvooq.js"]