mirror of
https://github.com/SoPat712/videospeed.git
synced 2025-08-22 02:18:45 -04:00
Merge pull request #86 from AKtor/master
Keypress event changed to keydown. It allows to control the extension with different keyboard layouts
This commit is contained in:
@@ -155,11 +155,10 @@ chrome.extension.sendMessage({}, function(response) {
|
||||
document.head.appendChild(link);
|
||||
}
|
||||
|
||||
document.addEventListener('keypress', function(event) {
|
||||
// if lowercase letter pressed, check for uppercase key code
|
||||
var keyCode = String.fromCharCode(event.keyCode).toUpperCase().charCodeAt();
|
||||
document.addEventListener('keydown', function(event) {
|
||||
var keyCode = event.keyCode;
|
||||
|
||||
// Ignore keypress event if typing in an input box
|
||||
// Ignore keydown event if typing in an input box
|
||||
if ((document.activeElement.nodeName === 'INPUT'
|
||||
&& document.activeElement.getAttribute('type') === 'text')
|
||||
|| document.activeElement.isContentEditable) {
|
||||
|
@@ -113,7 +113,7 @@ function restore_defaults() {
|
||||
function initShortcutInput(inputId) {
|
||||
document.getElementById(inputId).addEventListener('focus', inputFocus);
|
||||
document.getElementById(inputId).addEventListener('blur', inputBlur);
|
||||
document.getElementById(inputId).addEventListener('keypress', recordKeyPress);
|
||||
document.getElementById(inputId).addEventListener('keydown', recordKeyPress);
|
||||
}
|
||||
|
||||
document.addEventListener('DOMContentLoaded', function () {
|
||||
|
Reference in New Issue
Block a user