Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1)

Unified Diff: go-back-with-backspace/content_script.js

Issue 2260633002: Add more input types, fix lowercase nodeName, support shift-backspace (Closed) Base URL: https://chromium.googlesource.com/chromium/extensions-by-google.git@master
Patch Set: Remove trailing CR Created 4 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | go-back-with-backspace/is_editable.js » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: go-back-with-backspace/content_script.js
diff --git a/go-back-with-backspace/content_script.js b/go-back-with-backspace/content_script.js
index cf3a2991ed644ed2418b24028d3b15d046c37470..32fff927f8e80fe94fee0fc0c711ce42554a484f 100644
--- a/go-back-with-backspace/content_script.js
+++ b/go-back-with-backspace/content_script.js
@@ -1,8 +1,12 @@
-// Listen for the backspace key and go back if not in an editable field.
+// Listen for shift-backspace or unmodified backspace and navigate if not in
+// an editable field.
document.addEventListener('keydown', function(e) {
- if (e.which === 8 && // backspace key code
+ if (e.key === 'Backspace' &&
+ !e.altKey &&
+ !e.ctrlKey &&
+ !e.metaKey &&
!isEditable(e.path)) {
- window.history.back();
+ e.shiftKey ? window.history.forward(): window.history.back();
e.preventDefault();
}
});
« no previous file with comments | « no previous file | go-back-with-backspace/is_editable.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698