diff -r 15e048e00002 -r 2a2fcec209d0 client/js/main.js
--- a/client/js/main.js Wed Jul 03 13:42:59 2013 +0200
+++ b/client/js/main.js Thu Jul 04 12:43:30 2013 +0200
@@ -125,7 +125,7 @@
this.options = _.defaults(_opts, Rkns.defaults);
- Rkns._(this.options.property_files).each(function(f) {
+ _(this.options.property_files).each(function(f) {
Rkns.$.getJSON(f, function(data) {
_this.options.properties = _this.options.properties.concat(data);
});
@@ -166,17 +166,17 @@
if (!this.options.search.length) {
this.$.find(".Rk-Web-Search-Form").detach();
} else {
- var _tmpl = Rkns._.template('
<%= title %>'),
+ var _tmpl = _.template('<%= title %>'),
_select = this.$.find(".Rk-Search-List"),
_input = this.$.find(".Rk-Web-Search-Input"),
_form = this.$.find(".Rk-Web-Search-Form");
- Rkns._(this.options.search).each(function(_search, _key) {
+ _(this.options.search).each(function(_search, _key) {
if (Rkns[_search.type] && Rkns[_search.type].Search) {
_this.search_engines.push(new Rkns[_search.type].Search(_this, _search));
}
});
_select.html(
- Rkns._(this.search_engines).map(function(_search, _key) {
+ _(this.search_engines).map(function(_search, _key) {
return _tmpl({
key: _key,
title: _search.getSearchTitle(),
@@ -204,7 +204,7 @@
);
this.setSearchEngine(0);
}
- Rkns._(this.options.bins).each(function(_bin) {
+ _(this.options.bins).each(function(_bin) {
if (Rkns[_bin.type] && Rkns[_bin.type].Bin) {
_this.tabs.push(new Rkns[_bin.type].Bin(_this, _bin));
}
@@ -229,7 +229,7 @@
var _models = _this.project.get("nodes").where({
uri: $(_t).attr("data-uri")
});
- Rkns._(_models).each(function(_model) {
+ _(_models).each(function(_model) {
_this.renderer.highlightModel(_model);
});
}
@@ -281,11 +281,22 @@
_this.resizeBins();
});
+ var lastsearch = false, lastval = '';
+
this.$.find(".Rk-Bins-Search-Input").on("change keyup paste input", function() {
- var val = Rkns.$(this).val();
- Rkns._(_this.tabs).each(function(tab) {
- tab.render(val);
- });
+ var val = Rkns.$(this).val();
+ if (val === lastval) {
+ return;
+ }
+ var search = Rkns.Utils.regexpFromTextOrArray(val.length > 1 ? val: null);
+ if (search.source === lastsearch) {
+ return;
+ }
+ lastsearch = search.source;
+ _(_this.tabs).each(function(tab) {
+ tab.render(search);
+ });
+
});
this.$.find(".Rk-Bins-Search-Form").submit(function() {
return false;
@@ -293,7 +304,7 @@
};
-Renkan.prototype.template = Rkns._.template(
+Renkan.prototype.template = _.template(
'<% if (options.show_bins) { %><%- translate("Select contents:")%>
'
+ '