Skip to content

Commit

Permalink
Initial commit.
Browse files Browse the repository at this point in the history
  • Loading branch information
niek265 committed May 7, 2021
0 parents commit 8624167
Show file tree
Hide file tree
Showing 6 changed files with 69 additions and 0 deletions.
10 changes: 10 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
# HTML Video Youtube Controls

Use the YouTube keyboard controls on any HTML video player.
First of all, you must click the video that you want to use this on.
Controls:
J: rewind 10 seconds
K: play/pause
L: skip 10 seconds

Chrome Webstore page: *under review*
40 changes: 40 additions & 0 deletions content.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
// content.js
$(document).ready(function () {
$(document).on('keypress',function(e) {
if (e.target.tagName === "VIDEO") {
if (e.which === 74 || e.which === 106) {
e.target.currentTime = e.target.currentTime - 10
}
else if (e.which === 76 || e.which === 108) {
e.target.currentTime = e.target.currentTime + 10
}
else if (e.which === 75 || e.which === 107) {
if (e.target.paused) {
e.target.play()
}
else {
e.target.pause()
}
}
}
else if (e.target.children[0].tagName === "VIDEO") {
if (e.which === 74 || e.which === 106) {
e.target.children[0].currentTime = e.target.children[0].currentTime - 10
}
else if (e.which === 76 || e.which === 108) {
e.target.children[0].currentTime = e.target.children[0].currentTime + 10
}
else if (e.which === 75 || e.which === 107) {
if (e.target.children[0].paused) {
e.target.children[0].play()
}
else {
e.target.children[0].pause()
}
}
}
}
)
}
)

Binary file added icon.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
2 changes: 2 additions & 0 deletions jquery-3.6.0.min.js

Large diffs are not rendered by default.

17 changes: 17 additions & 0 deletions manifest.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
{
"manifest_version": 2,
"name": "HTML Video Youtube Controls",
"version": "1.0",
"permissions": [
"activeTab"
],
"description": "Use the Youtube keyboard controls on any HTML video player.",
"content_scripts": [
{
"matches": [
"https://*/*"
],
"js": ["jquery-3.6.0.min.js", "content.js"]
}
]
}
Binary file added screenshot.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.

0 comments on commit 8624167

Please sign in to comment.