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

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

Issue 2126003003: Go Back With Backspace extension (Closed) Base URL: https://chromium.googlesource.com/chromium/extensions-by-google.git@master
Patch Set: Fix quotation marks Created 4 years, 5 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 | « go-back-with-backspace/_locales/en/messages.json ('k') | go-back-with-backspace/icon128.png » ('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
new file mode 100755
index 0000000000000000000000000000000000000000..cf3a2991ed644ed2418b24028d3b15d046c37470
--- /dev/null
+++ b/go-back-with-backspace/content_script.js
@@ -0,0 +1,8 @@
+// Listen for the backspace key and go back if not in an editable field.
+document.addEventListener('keydown', function(e) {
+ if (e.which === 8 && // backspace key code
+ !isEditable(e.path)) {
+ window.history.back();
+ e.preventDefault();
+ }
+});
« no previous file with comments | « go-back-with-backspace/_locales/en/messages.json ('k') | go-back-with-backspace/icon128.png » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698