mirror of
https://github.com/SoPat712/videospeed.git
synced 2025-08-21 18:08:46 -04:00
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.head.appendChild(link);
|
||||||
}
|
}
|
||||||
|
|
||||||
document.addEventListener('keypress', function(event) {
|
document.addEventListener('keydown', function(event) {
|
||||||
// if lowercase letter pressed, check for uppercase key code
|
var keyCode = event.keyCode;
|
||||||
var keyCode = String.fromCharCode(event.keyCode).toUpperCase().charCodeAt();
|
|
||||||
|
|
||||||
// Ignore keypress event if typing in an input box
|
// Ignore keydown event if typing in an input box
|
||||||
if ((document.activeElement.nodeName === 'INPUT'
|
if ((document.activeElement.nodeName === 'INPUT'
|
||||||
&& document.activeElement.getAttribute('type') === 'text')
|
&& document.activeElement.getAttribute('type') === 'text')
|
||||||
|| document.activeElement.isContentEditable) {
|
|| document.activeElement.isContentEditable) {
|
||||||
|
@@ -113,7 +113,7 @@ function restore_defaults() {
|
|||||||
function initShortcutInput(inputId) {
|
function initShortcutInput(inputId) {
|
||||||
document.getElementById(inputId).addEventListener('focus', inputFocus);
|
document.getElementById(inputId).addEventListener('focus', inputFocus);
|
||||||
document.getElementById(inputId).addEventListener('blur', inputBlur);
|
document.getElementById(inputId).addEventListener('blur', inputBlur);
|
||||||
document.getElementById(inputId).addEventListener('keypress', recordKeyPress);
|
document.getElementById(inputId).addEventListener('keydown', recordKeyPress);
|
||||||
}
|
}
|
||||||
|
|
||||||
document.addEventListener('DOMContentLoaded', function () {
|
document.addEventListener('DOMContentLoaded', function () {
|
||||||
|
Reference in New Issue
Block a user