]> jfr.im git - irc/quakenet/qwebirc.git/blobdiff - js/ui/url.js
fix silly typo in nicktracker
[irc/quakenet/qwebirc.git] / js / ui / url.js
index f8b70e660bcd72d1bedb34aa89e299bb682a6d0a..0c7e6b021dd54d3f2f4ed1dd9ab2a9ccafcd75b2 100644 (file)
@@ -1,6 +1,7 @@
 qwebirc.ui.urlificate = function(element, text, execfn, cmdfn, window) {
-  var punct_re = /(\.*|\,|;|\])$/;
-
+  var punct_re = /[[\)|\]>]?(\.*|[\,;])$/;
+  var addedText = [];
+  
   var txtprocess = function(text, regex, appendfn, matchfn) {
     for(;;) {
       var index = text.search(regex);
@@ -23,11 +24,13 @@ qwebirc.ui.urlificate = function(element, text, execfn, cmdfn, window) {
   };
   
   var appendText = function(text) {
+    addedText.push(text);
     qwebirc.util.NBSPCreate(text, element);
   };
   
   var appendChan = function(text) {
     var newtext = text.replace(punct_re, "");
+    addedText.push(newtext);
     var punct = text.substring(newtext.length);
 
     var a = new Element("span");
@@ -49,7 +52,7 @@ qwebirc.ui.urlificate = function(element, text, execfn, cmdfn, window) {
     
     var href = "";
     var fn = null;
-    var target = "new";
+    var target = "_blank";
     var disptext = url;
     var elementType = "a";
     var addClass;
@@ -95,6 +98,7 @@ qwebirc.ui.urlificate = function(element, text, execfn, cmdfn, window) {
       if(target)
         a.target = target;
     }
+    addedText.push(disptext);
     a.appendChild(document.createTextNode(disptext));
     
     element.appendChild(a);
@@ -107,4 +111,6 @@ qwebirc.ui.urlificate = function(element, text, execfn, cmdfn, window) {
   txtprocess(text, /\b((https?|ftp|qwebirc):\/\/|www\.)[^ ]+/, function(text) {
     txtprocess(text, /\B#[^ ,]+/, appendText, appendChan);
   }, appendURL);
+  
+  return addedText.join("");
 }