diff --git a/client/css/style.css b/client/css/style.css
index 4a3fc87f..da240f11 100644
--- a/client/css/style.css
+++ b/client/css/style.css
@@ -92,6 +92,9 @@ h2 {
right: 0;
top: 0;
}
+#chat a {
+ color: inherit;
+}
#chat form {
border-top: 1px solid #ddd;
bottom: 1px;
diff --git a/client/js/chat.js b/client/js/chat.js
index f09542a2..7aafe098 100644
--- a/client/js/chat.js
+++ b/client/js/chat.js
@@ -53,8 +53,10 @@ $(function() {
users: render("#user"),
messages: render("#message"),
};
- json.forEach(function(network) {
- html += render("#window", network, partials);
+ json.forEach(function(n) {
+ html += render(
+ "#window", n, partials
+ );
});
$("#windows")[0].innerHTML = html;
@@ -62,13 +64,12 @@ $(function() {
render("#network", {networks: json}, {channels: render("#channel")})
).find(".channel")
.first()
- .addClass("active");
+ .addClass("active")
+ .end();
chat.find(".messages")
.scrollGlue({animate: 400})
.scrollToBottom()
- .find(".text")
- .uri()
.end();
chat.find(".window")
.find("input")
@@ -129,9 +130,6 @@ $(function() {
}
var msg = $(render("#message", {messages: message}))
- .find(".text")
- .uri()
- .end();
target = target.find(".messages");
target.append(msg);
@@ -245,6 +243,19 @@ $(function() {
chat.on("focus", "input[type=text]", function() {
$(this).closest(".window").find(".messages").scrollToBottom();
});
+
+ chat.on("mouseover", ".text", function() {
+ var self = $(this);
+ if (!self.hasClass("parsed")) {
+ self.addClass("parsed").html(uri(self.html()));
+ }
+ });
+
+ function uri(text) {
+ return URI.withinString(text, function(url) {
+ return "" + url + "";
+ });
+ }
var highest = 1;
$.fn.bringToTop = function() {
@@ -257,13 +268,4 @@ $(function() {
.removeClass("active")
.end();
};
-
- $.fn.uri = function() {
- return this.each(function() {
- var html = $(this).html();
- return $(this).html(URI.withinString(html, function(url) {
- return "" + url + "";
- }));
- });
- };
});