--- a/client/css/renkan.css Wed Mar 13 10:24:23 2013 +0100
+++ b/client/css/renkan.css Wed Mar 13 15:37:31 2013 +0100
@@ -500,6 +500,10 @@
font-size: 11px;
}
+.Rk-Bin-Main h4 a {
+ color: #303080;
+}
+
.Rk-Twitter-Icon {
background-image: url(../img/search-logos.png); background-position: 0 -80px;
}
--- 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(
'<li class="Rk-Bin-Item Rk-ListBin-Item" draggable="true" data-uri="<%-url%>" '
+ 'data-title="<%-title%>" data-description="<%-description%>" data-image="<%-image%>">'
- + '<% if (image) { %><img class="Rk-ListBin-Image" src="<%-image%>"><% } %></div><h4 class="Rk-ListBin-Title"><a href="<%-url%>" target="_blank"><%=htitle%></a></h4>'
+ + '<% if (image) { %><img class="Rk-ListBin-Image" src="<%-image%>"><% } %></div><h4 class="Rk-ListBin-Title">'
+ + '<% if (url) { %><a href="<%-url%>" target="_blank"><% } %><%=htitle%><% if (url) { %></a><% } %></h4>'
+ '<% if (description) { %><p class="Rk-ListBin-Description"><%=hdescription%></p><% } %><% if (image) { %><div style="clear: both;"></div><% } %></li>'
);
@@ -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;
}
--- a/client/js/main.js Wed Mar 13 10:24:23 2013 +0100
+++ b/client/js/main.js Wed Mar 13 15:37:31 2013 +0100
@@ -242,12 +242,12 @@
}
Rkns.Renkan.prototype.template = Rkns._.template(
- '<% if (show_bins) { %><div class="Rk-Bins"><h2 class="Rk-Bins-Title"><%- translate("Select contents:")%></h2>'
+ '<% if (show_bins) { %><div class="Rk-Bins"><div class="Rk-Bins-Head"><h2 class="Rk-Bins-Title"><%- translate("Select contents:")%></h2>'
+ '<form class="Rk-Web-Search-Form Rk-Search-Form"><input class="Rk-Web-Search-Input Rk-Search-Input" type="search" placeholder="<%- translate("Search the Web") %>" />'
+ '<div class="Rk-Search-Select"><div class="Rk-Search-Current"></div><ul class="Rk-Search-List"></ul></div>'
+ '<input type="submit" value="" class="Rk-Web-Search-Submit Rk-Search-Submit" /></form>'
+ '<form class="Rk-Bins-Search-Form Rk-Search-Form"><input class="Rk-Bins-Search-Input Rk-Search-Input" type="search" placeholder="<%- translate("Search in Bins") %>" />'
- + '<input type="submit" value="" class="Rk-Bins-Search-Submit Rk-Search-Submit" /></form>'
+ + '<input type="submit" value="" class="Rk-Bins-Search-Submit Rk-Search-Submit" /></form></div>'
+ '<ul class="Rk-Bin-List"></ul></div><% } %><div class="Rk-Render Rk-Render-<% if (show_bins) { %>Panel<% } else { %>Full<% } %>"></div>'
);
@@ -258,7 +258,7 @@
}
Rkns.Renkan.prototype.resizeBins = function() {
- var _d = + this.$.find(".Rk-Web-Search-Form").outerHeight() + this.$.find(".Rk-Bins-Search-Form").outerHeight();
+ var _d = + this.$.find(".Rk-Bins-Head").outerHeight();
this.$.find(".Rk-Bin-Title:visible").each(function() {
_d += Rkns.$(this).outerHeight();
});
--- a/client/js/paper-renderer.js Wed Mar 13 10:24:23 2013 +0100
+++ b/client/js/paper-renderer.js Wed Mar 13 15:37:31 2013 +0100
@@ -384,12 +384,14 @@
this.remove_button.show();
this.link_button.show();
var _uri = this.model.get("uri");
- Rkns.$('.Rk-Bin-Item').each(function() {
- var _el = Rkns.$(this);
- if (_el.attr("data-uri") == _uri) {
- _el.addClass("selected");
- }
- });
+ if (_uri) {
+ Rkns.$('.Rk-Bin-Item').each(function() {
+ var _el = Rkns.$(this);
+ if (_el.attr("data-uri") == _uri) {
+ _el.addClass("selected");
+ }
+ });
+ }
if (this.renderer.renkan.read_only) {
this.openEditor();
}