Created
June 1, 2019 15:48
-
-
Save MaPePeR/0caedf0f9b3cc5c08354b6d815a039f9 to your computer and use it in GitHub Desktop.
Chrome extension/JavaScript Snippet um in der ZDF Mediathek Videos mit Leertaste zu Pausieren.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ | |
"name": "MediathekSpacePause", | |
"version": "1.0", | |
"description": "In der ZDF Mediathek Videos mit Leertaste pausieren", | |
"permissions": [], | |
"content_scripts" : [{ | |
"matches" : [ "http://www.zdf.de/*", "https://www.zdf.de/*"], | |
"js" : ["mediathekSpacePause.js"] | |
}], | |
"manifest_version": 2 | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
document.onkeyup = function(e){ | |
if (e.which == 32){ | |
var v=document.getElementsByTagName('VIDEO')[0]; | |
if(document.activeElement.tagName === 'INPUT'||!v.src) return | |
if(v.paused){ | |
v.play() | |
}else{ | |
v.pause() | |
} | |
e.preventDefault() | |
} | |
}; | |
document.onkeydown = function(e){ | |
if(e.which == 32 && document.activeElement.tagName !=='INPUT'){ | |
e.preventDefault(); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment