client/js/list-bin.js
changeset 293 fba23fde14ba
parent 196 2a2fcec209d0
child 426 05ed0d95a511
--- a/client/js/list-bin.js	Fri May 16 12:37:51 2014 +0200
+++ b/client/js/list-bin.js	Fri May 16 14:09:57 2014 +0200
@@ -3,12 +3,12 @@
 Rkns.ResourceList.Bin = Rkns.Utils.inherit(Rkns._BaseBin);
 
 Rkns.ResourceList.Bin.prototype.resultTemplate = Rkns._.template(
-    '<li class="Rk-Bin-Item Rk-ResourceList-Item" draggable="true" data-uri="<%-url%>" '
-    + 'data-title="<%-title%>" data-description="<%-description%>" '
-    + '<% if (image) { %>data-image="<%- Rkns.Utils.getFullURL(image) %>"<% } else { %>data-image=""<% } %> >'
-    + '<% if (image) { %><img class="Rk-ResourceList-Image" src="<%-image%>"/><% } %><h4 class="Rk-ResourceList-Title">'
-    + '<% if (url) { %><a href="<%-url%>" target="_blank"><% } %><%=htitle%><% if (url) { %></a><% } %></h4>'
-    + '<% if (description) { %><p class="Rk-ResourceList-Description"><%=hdescription%></p><% } %><% if (image) { %><div style="clear: both;"></div><% } %></li>'
+    '<li class="Rk-Bin-Item Rk-ResourceList-Item" draggable="true" data-uri="<%-url%>" ' +
+    'data-title="<%-title%>" data-description="<%-description%>" ' +
+    '<% if (image) { %>data-image="<%- Rkns.Utils.getFullURL(image) %>"<% } else { %>data-image=""<% } %> >' +
+    '<% if (image) { %><img class="Rk-ResourceList-Image" src="<%-image%>"/><% } %><h4 class="Rk-ResourceList-Title">' +
+    '<% if (url) { %><a href="<%-url%>" target="_blank"><% } %><%=htitle%><% if (url) { %></a><% } %></h4>' +
+    '<% if (description) { %><p class="Rk-ResourceList-Description"><%=hdescription%></p><% } %><% if (image) { %><div style="clear: both;"></div><% } %></li>'
 );
 
 Rkns.ResourceList.Bin.prototype._init = function(_renkan, _opts) {
@@ -30,12 +30,13 @@
         _this = this,
         count = 0;
     Rkns._(this.data).each(function(_item) {
+        var _element;
         if (typeof _item === "string") {
             if (/^(https?:\/\/|www)/.test(_item)) {
-                var _element = { url: _item };
+                _element = { url: _item };
             } else {
-                var _element = { title: _item.replace(/[:,]?\s?(https?:\/\/|www)[\d\w\/.&?=#%-_]+\s?/,'').trim() },
-                    _match = _item.match(/(https?:\/\/|www)[\d\w\/.&?=#%-_]+/);
+                _element = { title: _item.replace(/[:,]?\s?(https?:\/\/|www)[\d\w\/.&?=#%-_]+\s?/,'').trim() };
+                var _match = _item.match(/(https?:\/\/|www)[\d\w\/.&?=#%-_]+/);
                 if (_match) {
                     _element.url = _match[0];
                 }
@@ -45,7 +46,7 @@
                 }
             }
         } else {
-            var _element = _item;
+            _element = _item;
         }
         var title = _element.title || (_element.url || "").replace(/^https?:\/\/(www\.)?/,'').replace(/^(.{40}).+$/,'$1…'),
             url = _element.url || "",
@@ -81,9 +82,9 @@
     }
     this.renkan.resizeBins();
 };
-    
+
 Rkns.ResourceList.Bin.prototype.refresh = function() {
     if (this.data) {
         this.render();
     }
-};
\ No newline at end of file
+};