From 67f6e526f22db041384c33693bcb5205828a128c Mon Sep 17 00:00:00 2001 From: Mattias Erming Date: Fri, 12 Dec 2014 00:48:43 +0100 Subject: [PATCH] Fetch max 1 link per message --- client/css/style.css | 3 +++ src/plugins/irc-events/link.js | 11 +++++------ 2 files changed, 8 insertions(+), 6 deletions(-) diff --git a/client/css/style.css b/client/css/style.css index 882570b6..c3b09108 100644 --- a/client/css/style.css +++ b/client/css/style.css @@ -652,6 +652,9 @@ button { } #chat .toggle-content .body { color: #999; + max-width: 460px; + word-break: normal; + word-wrap: break-word; } #chat .toggle-content.show { display: inline-block !important; diff --git a/src/plugins/irc-events/link.js b/src/plugins/irc-events/link.js index 9fe103cf..7e3e2fe7 100644 --- a/src/plugins/irc-events/link.js +++ b/src/plugins/irc-events/link.js @@ -11,7 +11,7 @@ module.exports = function(irc, network) { if (!config.prefetch) { return; } - + var links = []; var split = data.message.split(" "); _.each(split, function(w) { @@ -41,10 +41,9 @@ module.exports = function(irc, network) { msg: msg }); - _.each(links, function(url) { - fetch(url, function(res) { - parse(msg, url, res, client); - }); + var link = links[0]; + fetch(link, function(res) { + parse(msg, link, res, client); }); }); }; @@ -68,7 +67,7 @@ function parse(msg, url, res, client) { $('meta[name=description]').attr('content') || $('meta[property="og:description"]').attr('content') || "No description found."; - toggle.thumb = + toggle.thumb = $('meta[property="og:image"]').attr('content') || $('meta[name="twitter:image:src"]').attr('content') || "";