aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--manifest.json2
-rw-r--r--peniquitous.js14
2 files changed, 13 insertions, 3 deletions
diff --git a/manifest.json b/manifest.json
index f293dd7..68f6489 100644
--- a/manifest.json
+++ b/manifest.json
@@ -7,6 +7,6 @@
"content_scripts": [{
"matches": ["<all_urls>"],
- "js": ["peniquitous.js"]
+ "js": ["lib/mousetrap/tests/libs/key-event.js", "peniquitous.js"]
}]
}
diff --git a/peniquitous.js b/peniquitous.js
index 2c01232..c858f42 100644
--- a/peniquitous.js
+++ b/peniquitous.js
@@ -8,8 +8,18 @@
var all_inputs = document.querySelectorAll('input[type="text"]');
for (var i = 0; i < all_inputs.length; i++) {
- all_inputs[i].addEventListener('focus', function() {
- // Bind keyboard event
+ all_inputs[i].addEventListener('keyup', function(e) {
+ if (e.ctrlKey && e.keyCode === 80) {
+ KeyEvent.simulate(0, 38, [], e.target);
+ }
+ else if (e.ctrlKey && e.keyCode === 78) {
+ KeyEvent.simulate(0, 40, [], e.target);
+ }
});
}
+
+ window.setTimeout(function() {
+ KeyEvent.simulate(0, 40, [], document.getElementById('lst-ib'));
+ console.log('fired');
+ }, 6000);
})();