]> jfr.im git - irc/quakenet/qwebirc.git/commitdiff
Add hyperlinks to nicknames.
authorChris Porter <redacted>
Mon, 20 Oct 2008 20:12:55 +0000 (21:12 +0100)
committerChris Porter <redacted>
Mon, 20 Oct 2008 20:12:55 +0000 (21:12 +0100)
$z -> $(, $Z -> $).

TODO.txt
js/ui/baseui.js
js/ui/theme.js
js/ui/url.js
static/css/qui.css

index 093aafa874397084350e6411b3f97f01fcee0264..041106062ae1f99ee6e2a7ac9deeaf6bf06f1100 100644 (file)
--- a/TODO.txt
+++ b/TODO.txt
@@ -4,4 +4,5 @@ prettify wizard
 tab completion\r
 options for notices and stuff\r
 @+ in nick shown in text\r
+scroll pos isn't saved when you go between tabs if not at bottom.\r
 \r
index ed05624d0547e18b791bc50b9057b51e41ebca59..4ba7c7a874afea0802209c86da6da0ea490e9126 100644 (file)
@@ -162,7 +162,7 @@ qwebirc.ui.StandardUI = new Class({
   },
   urlDispatcher: function(name) {
     if(name == "embedded")
-      return this.embeddedWindow.bind(this);
+      return ["a", this.embeddedWindow.bind(this)];
 
     return null;
   }
@@ -172,9 +172,14 @@ qwebirc.ui.QuakeNetUI = new Class({
   Extends: qwebirc.ui.StandardUI,
   urlDispatcher: function(name, window) {
     if(name == "qwhois") {
-      return function(auth) {
+      return ["a", function(auth) {
         this.client.exec("/MSG Q whois #" + auth);
-      }.bind(window);
+      }.bind(window)];
+    }
+    if(name == "whois") {
+      return ["span", function(nick) {
+        this.client.exec("/WHOIS " + nick);
+      }.bind(window)];
     }
     
     return this.parent(name);
index 10d9accc0fc14716f4d462c067830b2f230c2631..f9d3659a593a53627b4828b8b8c6e5ac1fc02a2b 100644 (file)
@@ -3,6 +3,8 @@ qwebirc.ui.themes.ThemeControlCodeMap = {
   "B": "\x02",
   "U": "\x1F",
   "O": "\x0F",
+  "[": "qwebirc://",
+  "]": "/",
   "$": "$"
 };
 
@@ -14,39 +16,39 @@ qwebirc.ui.themes.Default = {
   "DISCONNECT": ["Disconnected from server: $m", true],
   "ERROR": ["ERROR: $m", true],
   "SERVERNOTICE": ["$m", true],
-  "JOIN": ["$n [$h] has joined $c", true],
-  "OURJOIN": ["$n [$h] has joined $c", true],
-  "PART": ["$n [$h] has left $c [$m]", true],
-  "KICK": ["$v was kicked from $c by $n [$m]", true],
-  "MODE": ["mode/$c [$m] by $n", true],
-  "QUIT": ["$n [$h] has quit [$m]", true],
-  "NICK": ["$n has changed nick to $w", true],
-  "TOPIC": ["$n changed the topic of $c to: $m", true],
+  "JOIN": ["$N [$h] has joined $c", true],
+  "OURJOIN": ["$N [$h] has joined $c", true],
+  "PART": ["$N [$h] has left $c [$m]", true],
+  "KICK": ["$v was kicked from $c by $N [$m]", true],
+  "MODE": ["mode/$c [$m] by $N", true],
+  "QUIT": ["$N [$h] has quit [$m]", true],
+  "NICK": ["$n has changed nick to $[$w$]", true],
+  "TOPIC": ["$N changed the topic of $c to: $m", true],
   "UMODE": ["MODE $n $m", true],
-  "INVITE": ["$n invites you to join $c", true],
+  "INVITE": ["$N invites you to join $c", true],
   "HILIGHT": ["$C4"],
   "HILIGHTEND": ["$O"],
-  "CHANMSG": ["<$z$n$Z> $m"],
-  "PRIVMSG": ["<$z$n$Z> $m"],
-  "CHANNOTICE": ["-$z$n$Z:$c- $m"],
-  "PRIVNOTICE": ["-$z$n$Z- $m"],
-  "OURCHANMSG": ["<$z$n$Z> $m"],
-  "OURPRIVMSG": ["<$z$n$Z> $m"],
-  "OURTARGETEDMSG": ["*$z$t$Z* $m"],
-  "OURTARGETEDNOTICE": ["[notice($z$t$Z)] $m"],
-  "OURCHANNOTICE": ["-$z$n$Z:$t- $m"],
-  "OURPRIVNOTICE": ["-$z$n$Z- $m"],
-  "OURCHANACTION": [" * $z$n$Z $m"],
-  "OURPRIVACTION": [" * $z$n$Z $m"],
-  "CHANACTION": [" * $z$n$Z $m"],
-  "PRIVACTION": [" * $z$n$Z $m"],
-  "CHANCTCP": ["$n [$h] requested CTCP $x from $c: $m"],
-  "PRIVCTCP": ["$n [$h] requested CTCP $x from $-: $m"],
-  "CTCPREPLY": ["CTCP $x reply from $n: $m"],
+  "CHANMSG": ["<$($N$)> $m"],
+  "PRIVMSG": ["<$($N$)> $m"],
+  "CHANNOTICE": ["-$($N$):$c- $m"],
+  "PRIVNOTICE": ["-$($N$)- $m"],
+  "OURCHANMSG": ["<$N> $m"],
+  "OURPRIVMSG": ["<$N> $m"],
+  "OURTARGETEDMSG": ["*$[$t$]* $m"],
+  "OURTARGETEDNOTICE": ["[notice($[$t$])] $m"],
+  "OURCHANNOTICE": ["-$N:$t- $m"],
+  "OURPRIVNOTICE": ["-$N- $m"],
+  "OURCHANACTION": [" * $N $m"],
+  "OURPRIVACTION": [" * $N $m"],
+  "CHANACTION": [" * $($N$) $m"],
+  "PRIVACTION": [" * $($N$) $m"],
+  "CHANCTCP": ["$N [$h] requested CTCP $x from $c: $m"],
+  "PRIVCTCP": ["$N [$h] requested CTCP $x from $-: $m"],
+  "CTCPREPLY": ["CTCP $x reply from $N: $m"],
   "OURCHANCTCP": ["[ctcp($t)] $x $m"],
   "OURPRIVCTCP": ["[ctcp($t)] $x $m"],
   "OURTARGETEDCTCP": ["[ctcp($t)] $x $m"],
-  "WHOISUSER": ["$B$n$B [$h]", true],
+  "WHOISUSER": ["$B$N$B [$h]", true],
   "WHOISREALNAME": [" realname : $m", true],
   "WHOISCHANNELS": [" channels : $m", true],
   "WHOISSERVER": [" server   : $x [$m]", true],
@@ -57,7 +59,7 @@ qwebirc.ui.themes.Default = {
   "WHOISOPERNAME": [" operedas : $m", true],
   "WHOISACTUALLY": [" realhost : $m [ip: $x]", true],
   "WHOISEND": ["End of WHOIS", true],
-  "AWAY": ["$n is away: $m", true],
+  "AWAY": ["$N is away: $m", true],
   "GENERICERROR": ["$m: $t", true],
   "GENERICMESSAGE": ["$m", true]
 };
@@ -84,12 +86,12 @@ qwebirc.ui.Theme = new Class({
     
     this.__ccmap = qwebirc.util.dictCopy(qwebirc.ui.themes.ThemeControlCodeMap);
     this.__ccmaph = qwebirc.util.dictCopy(this.__ccmap);
+
+    this.__ccmap["("] = "";
+    this.__ccmap[")"] = "";
     
-    this.__ccmap["z"] = "";
-    this.__ccmap["Z"] = "";
-    
-    this.__ccmaph["z"] = this.message("HILIGHT", {}, this.__ccmap);
-    this.__ccmaph["Z"] = this.message("HILIGHTEND", {}, this.__ccmap);
+    this.__ccmaph["("] = this.message("HILIGHT", {}, this.__ccmap);
+    this.__ccmaph[")"] = this.message("HILIGHTEND", {}, this.__ccmap);
   },
   __dollarSubstitute: function(x, h, mapper) {
     var msg = [];
@@ -119,6 +121,9 @@ qwebirc.ui.Theme = new Class({
     } else {
       map = this.__ccmap;
     }
+    
+    if(data && data["n"])
+      data["N"] = "qwebirc://whois/" + data.n + "/";
     return this.__dollarSubstitute(this.__theme[type], data, map);
   }
 });
index 81cbae738a6beb9a1f56d14ddcc2f2142941a6c1..3a841126f263750529043741335aec11b371490e 100644 (file)
@@ -50,10 +50,12 @@ qwebirc.ui.urlificate = function(element, text, execfn, cmdfn, window) {
     var fn = null;
     var target = "new";
     var disptext = url;
+    var elementType = "a";
+    var addClass;
     
     var ma = url.match(/^qwebirc:\/\/(.*)$/);
     if(ma) {
-      var m = ma[1].match(/^([^\/]+)\/(.+)$/);
+      var m = ma[1].match(/^([^\/]+)\/([^\/]+)\/?(.*)$/);
       if(!m) {
         appendfn(text);
         return; 
@@ -61,24 +63,37 @@ qwebirc.ui.urlificate = function(element, text, execfn, cmdfn, window) {
       
       var cmd = cmdfn(m[1], window);
       if(cmd) {
-        url = "#";
-        fn = cmd;
+        addClass = m[1];
+        elementType = cmd[0];
+        if(cmd[0] != "a") {
+          url = null;
+        } else {
+          url = "#";
+        }
+        fn = cmd[1];
         disptext = unescape(m[2]);
         target = null;
       } else {
         appendfn(text);
         return;
       }
+      if(m[3])
+        punct = m[3] + punct;
     } else {
       if(url.match(/^www\./))
         url = "http://" + url;
     }
     
-    var a = new Element("a");
-    a.href = url;
+    var a = new Element(elementType);
+    if(addClass)
+      a.addClass("hyperlink-" + addClass);
+      
+    if(url) {
+      a.href = url;
     
-    if(target)
-      a.target = target;
+      if(target)
+        a.target = target;
+    }
     a.appendChild(document.createTextNode(disptext));
     
     element.appendChild(a);
index 5b3d61c53308c08bfbeae707bf4faecede56a624..dd062f973f198689a630d09eae47d0dcbf83f6f4 100644 (file)
@@ -78,6 +78,7 @@ body {
 }
 
 .qwebirc-qui .lines {
+  color: black;
   overflow: auto;
   font-family: Consolas, "Lucida Console", Verdana, monospace, sans-serif, "sans serif";
   font-size: 0.8em;
@@ -239,4 +240,9 @@ div#noscript {
 .qwebirc-qui .nicklist div.menu a {
   border-bottom: 0;
   border-top: 0;
+}
+
+.qwebirc-qui .hyperlink-whois {
+       cursor: pointer;
+       cursor: hand;
 }
\ No newline at end of file