Permalink
Browse files

Pressing backspace when empty takes user back in history. Closes #180

  • Loading branch information...
1 parent a4fc924 commit d9085c13add568ce2d5adf630abb0e0616e46ea9 @ankit ankit committed May 31, 2011
Showing with 11 additions and 2 deletions.
  1. +11 −2 Chrome/glee_chrome/js/events.js
@@ -4,11 +4,11 @@ Glee.Events = {
* When a key is pressed down inside gleeBox
*/
onKeyDown: function(e) {
-
// esc: hide gleeBox if empty. otherwise, empty gleeBox
if (e.keyCode === 27)
{
e.preventDefault();
+
if (!Glee.value())
Glee.close();
else
@@ -20,17 +20,19 @@ Glee.Events = {
{
e.stopPropagation();
e.preventDefault();
+
Glee.Events.onTabKeyDown(e);
}
// enter: execute query
else if (e.keyCode === 13)
{
e.preventDefault();
+
Glee.Events.execute(e, e.target.value);
+
if (Glee.isEspRunning)
Glee.setState(Glee.selectedElement, "el");
-
}
// Up / Down Arrow keys: Begin scrolling
@@ -57,7 +59,9 @@ Glee.Events = {
{
if (e.metaKey || e.ctrlKey || e.shiftKey)
return true;
+
Glee.Browser.openTabManager();
+
return true;
}
@@ -70,6 +74,11 @@ Glee.Events = {
// send the request to copy URL to clipboard
Glee.Browser.copyToClipboard(Utils.makeURLAbsolute(Glee.URL, location.href));
}
+
+ // Backspace takes user back in history if gleeBox is empty
+ else if (e.keyCode === 8 && Glee.isEmpty()) {
+ window.history.back();
+ }
},
/**

0 comments on commit d9085c1

Please sign in to comment.