mirror of
https://github.com/SoPat712/videospeed.git
synced 2025-08-22 02:18:45 -04:00
Fixed unwanted keypress events when typing into input fields
This commit is contained in:
@@ -110,6 +110,9 @@ chrome.extension.sendMessage({}, function(response) {
|
|||||||
// if lowercase letter pressed, check for uppercase key code
|
// if lowercase letter pressed, check for uppercase key code
|
||||||
var keyCode = String.fromCharCode(event.keyCode).toUpperCase().charCodeAt();
|
var keyCode = String.fromCharCode(event.keyCode).toUpperCase().charCodeAt();
|
||||||
|
|
||||||
|
// Ignore keypress event if typing in an input box
|
||||||
|
if (document.activeElement.nodeName === "INPUT" && document.activeElement.getAttribute("type") === "text") { return false; }
|
||||||
|
|
||||||
if (keyCode == rewindKeyCode) { runAction('rewind') }
|
if (keyCode == rewindKeyCode) { runAction('rewind') }
|
||||||
else if (keyCode == fasterKeyCode) { runAction('faster') }
|
else if (keyCode == fasterKeyCode) { runAction('faster') }
|
||||||
else if (keyCode == slowerKeyCode) { runAction('slower') }
|
else if (keyCode == slowerKeyCode) { runAction('slower') }
|
||||||
|
Reference in New Issue
Block a user