diff -r c059efca2d7a -r 7adef9ce92aa client/js/list-bin.js
--- a/client/js/list-bin.js Wed Mar 13 10:24:23 2013 +0100
+++ b/client/js/list-bin.js Wed Mar 13 15:37:31 2013 +0100
@@ -3,7 +3,8 @@
Rkns.ListBin.prototype.resultTemplate = Rkns._.template(
'
" data-description="<%-description%>" data-image="<%-image%>">'
- + '<% if (image) { %>
<% } %>'
+ + '<% if (image) { %>
<% } %>'
+ '<% if (description) { %><%=hdescription%>
<% } %><% if (image) { %><% } %>'
);
@@ -32,11 +33,30 @@
_this = this,
count = 0;
Rkns._(this.data).each(function(_item) {
- var _element = (typeof _item === "string" ? { url: _item } : _item)
- var title = _element.title || _element.url || "",
+ if (typeof _item === "string") {
+ if (/^(https?:\/\/|www)/.test(_item)) {
+ var _element = { url: _item }
+ } else {
+ var _element = { title: _item.replace(/[:,]?\s?(https?:\/\/|www)[\d\w\/.&?=#%-_]+\s?/,'').trim() },
+ _match = _item.match(/(https?:\/\/|www)[\d\w\/.&?=#%-_]+/);
+ if (_match) {
+ _element.url = _match[0];
+ }
+ if (_element.title.length > 80) {
+ _element.description = _element.title;
+ _element.title = _element.title.replace(/^(.{30,60})\s.+$/,'$1…');
+ }
+ }
+ } else {
+ var _element = _item;
+ }
+ var title = _element.title || (_element.url || "").replace(/^https?:\/\/(www\.)?/,'').replace(/^(.{40}).+$/,'$1…'),
url = _element.url || "",
description = _element.description || "",
image = _element.image || "";
+ if (url && !/^https?:\/\//.test(url)) {
+ url = 'http://' + url;
+ }
if (searchstr && !rxtest.test(title) && !rxtest.test(description)) {
return;
}