From 01cfc318b1dcd2b7beb9fb530a8dfea9ef98fcc7 Mon Sep 17 00:00:00 2001 From: Neale Pickett Date: Mon, 27 Oct 2014 23:12:05 -0600 Subject: [PATCH] URLize --- app/room.js | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/app/room.js b/app/room.js index 86d58bc..3f087c7 100644 --- a/app/room.js +++ b/app/room.js @@ -7,7 +7,7 @@ function djbhash(a) { return r; } -function addText(p, text, kiboze) { +function purtify(text) { // Look for a URL var txtElement = document.createElement("span"); txtElement.className = "text"; @@ -30,7 +30,11 @@ function addText(p, text, kiboze) { rhs = rhs.substr(match.index + match[0].length); } txtElement.appendChild(document.createTextNode(rhs)); - p.appendChild(txtElement); + + return txtElement; +} + +function kiboze(busted) { if ((kiboze) || (-1 != text.search(kibozeRe))) { var k = document.getElementById("kiboze"); @@ -72,7 +76,7 @@ function newRoom(element, network, name, maxSize) { eTimestamp.textContent = timestamp.toLocaleTimeString(); eSource.textContent = source; eSource.setAttribute("colornumber", djbhash(source) % 31); - eContent.textContent = content; + eContent.appendChild(purtify(content)); messages.appendChild(message);