]> jfr.im git - irc/quakenet/qwebirc.git/blobdiff - js/ui/frontends/qui.js
Make our nick in our own messages bold.
[irc/quakenet/qwebirc.git] / js / ui / frontends / qui.js
index a5557029d3a6414d327db0516708253cb667b79c..8863808c41acb59f40976ff8123be0e52ab288be 100644 (file)
@@ -49,7 +49,8 @@ qwebirc.ui.QUI = new Class({
     
     this.createInput();
     this.reflow();
-
+    this.reflow.delay(100); /* Konqueror fix */
+    
     /* HACK, in Chrome this should work immediately but doesn't */
     this.__createDropdownHint.delay(100, this);
   },
@@ -146,6 +147,7 @@ qwebirc.ui.QUI = new Class({
     var inputbox = new Element("input");
     form.appendChild(inputbox);
     this.inputbox = inputbox;
+    this.inputbox.maxLength = 512;
     
     form.addEvent("submit", function(e) {
       new Event(e).stop();
@@ -384,6 +386,7 @@ qwebirc.ui.QUI.Window = new Class({
       this.topic.addClass("topic");
       this.topic.addClass("tab-invisible");
       this.topic.set("html", " ");
+      this.topic.addEvent("click", this.editTopic.bind(this));
       this.parentObject.qjsui.applyClasses("topic", this.topic);
       
       this.prevNick = null;
@@ -400,6 +403,20 @@ qwebirc.ui.QUI.Window = new Class({
       this.reflow();
     }
   },
+  editTopic: function() {
+    if(!this.client.nickOnChanHasPrefix(this.client.nickname, this.name, "@")) {
+/*      var cmodes = this.client.getChannelModes(channel);
+      if(cmodes.indexOf("t")) {*/
+        alert("Sorry, you need to be opped to change the topic!");
+        return;
+      /*}*/
+    }
+    var newTopic = prompt("Change topic of " + this.name + " to:", this.topic.topicText);
+    if(newTopic === null)
+      return;
+
+    this.client.exec("/TOPIC " + newTopic);
+  },
   reflow: function() {
     this.parentObject.reflow();
   },
@@ -423,15 +440,19 @@ qwebirc.ui.QUI.Window = new Class({
     parent.appendChild(e);
     e.addClass("menu");
     
+    var nickArray = [nick];
     qwebirc.ui.MENU_ITEMS.forEach(function(x) {
+      if(!x.predicate || x.predicate !== true && !x.predicate.apply(this, nickArray))
+        return;
+      
       var e2 = new Element("a");
       e.appendChild(e2);
-      
+
       e2.href = "#";
-      e2.set("text", "- " + x[0]);
-      
+      e2.set("text", "- " + x.text);
+
       e2.addEvent("focus", function() { this.blur() }.bind(e2));
-      e2.addEvent("click", function(ev) { new Event(ev.stop()); this.menuClick(x[1]); }.bind(this));
+      e2.addEvent("click", function(ev) { new Event(ev.stop()); this.menuClick(x.fn); }.bind(this));
     }.bind(this));
     return e;
   },
@@ -481,7 +502,7 @@ qwebirc.ui.QUI.Window = new Class({
       this.prevNick = e;
       e.addClass("selected");
       this.moveMenuClass();
-      e.menu = this.createMenu(x.realNick, e);
+      e.menu = this.createMenu(e.realNick, e);
       new Event(x).stop();
     }.bind(this));
     
@@ -500,8 +521,10 @@ qwebirc.ui.QUI.Window = new Class({
       t.removeChild(t.firstChild);
 
     if(topic) {
+      t.topicText = topic;
       this.parent(topic, t);
     } else {
+      t.topicText = topic;
       var e = new Element("div");
       e.set("text", "(no topic set)");
       e.addClass("emptytopic");