itchyny/ChromePlayer — Issue #4: bugs, implementation on "keydown from other tab"
Author: itchyny
Created: 2011-12-17 03:45:41+00:00
State: open

Ignore keydown in textarea or input.

Prevent default behavior (using preventDefault) on keydown in other tab. Of cource, we must not prevent all the keydown.
Current implementation goes:
keydown -> js/shortcuts.js
-> if the key is in the array [ 32, 37, 38, 39, 40, 119, 1 ... <- hard coded!!!
-> chrome.extension.sendRequest
Maybe I should change to:
keydown -> js/shortcuts.js
-> it is in the user's setting

...
-> chrome.extension.sendRequest
User should be able to change the global keydown mapping.
Global keydown mapping goes with "g-" prefix.
For example in default key binding, "" is mapped to command.PlayPause.
So, problem goes here:
How contents script(js/shortcuts.js) get the app's setting?
I can't use localStorage in this case because localStorage which contents script can see is the one of the online page, not of the app.