]> jfr.im git - irc/quakenet/qwebirc.git/commitdiff
fix hotkeys
authorChris Porter <redacted>
Sun, 17 Aug 2014 21:47:16 +0000 (22:47 +0100)
committerChris Porter <redacted>
Sun, 17 Aug 2014 21:47:16 +0000 (22:47 +0100)
js/ui/baseui.js

index 05bb6497b11b3e6ef9ac2652825904175dcf5331..c20129e3e4b87696ef908a2a53c25dc44b008ba3 100644 (file)
@@ -228,28 +228,19 @@ qwebirc.ui.StandardUI = new Class({
     if(this.options.tsaturation !== null) this.__styleValues.textSaturation = this.options.tsaturation;
     if(this.options.tlightness !== null) this.__styleValues.textLightness = this.options.tlightness;
     
-    var ev;
-    if(Browser.Engine.trident) {
-      ev = "keydown";
-    } else {
-      ev = "keypress";
-    }
-    document.addEvent(ev, this.__handleHotkey.bind(this));
+    document.addEvent("keydown", this.__handleHotkey.bind(this));
   },
   __handleHotkey: function(x) {
-    if(!x.alt || x.control) {
-      if(x.key == "backspace" || x.key == "/")
-        if(!this.getInputFocused(x))
-          new Event(x).stop();
-      return;
-    }
     var success = false;
-    if(x.key == "a" || x.key == "A") {
+    if(!x.alt || x.control) {
+      if((x.key == "backspace" || x.key == "/") && !this.getInputFocused(x)) {
+        success = true;
+      }
+    } else if(x.key == "a" || x.key == "A") {
       var highestNum = 0;
       var highestIndex = -1;
       success = true;
-      
-      new Event(x).stop();
+
       for(var i=0;i<this.windowArray.length;i++) {
         var h = this.windowArray[i].hilighted;
         if(h > highestNum) {
@@ -279,8 +270,10 @@ qwebirc.ui.StandardUI = new Class({
       this.nextWindow();
       success = true;
     }
-    if(success)
+    if(success) {
       new Event(x).stop();
+      x.preventDefault();
+    }
   },
   getInputFocused: function(x) {
     if($$("input").indexOf(x.target) == -1 && $$("textarea").indexOf(x.target) == -1)