]> jfr.im git - irc/quakenet/qwebirc.git/commitdiff
You can now middle click on tabs to close them.
authorChris Porter <redacted>
Sun, 9 Nov 2008 10:46:43 +0000 (10:46 +0000)
committerChris Porter <redacted>
Sun, 9 Nov 2008 10:46:43 +0000 (10:46 +0000)
js/ui/baseuiwindow.js
js/ui/qui.js

index cc05e9009aaa6476e61207c6ae9265b5eb94ba78..3dc7026931e7c95b9e09914ead2c2d12ce65a63d 100644 (file)
@@ -19,6 +19,7 @@ qwebirc.ui.Window = new Class({
     this.scrollpos = null;
     this.lastNickHash = {};
     this.lastSelected = null;
+    this.closed = false;
   },
   updateNickList: function(nicks) {
   },
@@ -26,6 +27,8 @@ qwebirc.ui.Window = new Class({
     qwebirc.ui.Colourise("[" + topic + "]", element, this.client.exec, this.parentObject.urlDispatcher.bind(this.parentObject), this);
   },
   close: function() {
+    this.closed = true;
+    
     if($defined(this.scrolltimer)) {
       $clear(this.scrolltimer);
       this.scrolltimer = null;
index f9a834046b2e809f7b950f3c5c3f4f1c2f3fdb98..0f515dea2d0ac395a1b166e6ed9868cd3a654c69 100644 (file)
@@ -233,6 +233,10 @@ qwebirc.ui.QUI.Window = new Class({
     this.tab.appendText(name);
     this.tab.addEvent("click", function(e) {
       new Event(e).stop();
+      
+      if(this.closed)
+        return;
+        
       parentObject.selectWindow(this);
     }.bind(this));
     
@@ -240,15 +244,24 @@ qwebirc.ui.QUI.Window = new Class({
       var tabclose = new Element("span");
       tabclose.set("text", "X");
       tabclose.addClass("tabclose");
-      tabclose.addEvent("click", function(e) {
+      var close = function(e) {
         new Event(e).stop();
         
+        if(this.closed)
+          return;
+          
         if(type == qwebirc.ui.WINDOW_CHANNEL)
           this.client.exec("/PART " + name);
 
         this.close();
         
         parentObject.inputbox.focus();
+      }.bind(this);
+      
+      tabclose.addEvent("click", close);
+      this.tab.addEvent("mouseup", function(e) {
+        if(e.event.button == 1)
+          close(e);
       }.bind(this));
       
       this.tab.appendChild(tabclose);