diff -r f53a7999ae7b -r 15e048e00002 client/js/ldtjson-bin.js --- a/client/js/ldtjson-bin.js Fri Jun 14 12:36:32 2013 +0200 +++ b/client/js/ldtjson-bin.js Wed Jul 03 13:42:59 2013 +0200 @@ -1,8 +1,11 @@ -Rkns.Ldt = {}; +(function(Rkns) { +"use strict" -Rkns.Ldt.Bin = function(_renkan, _opts) { +var Ldt = Rkns.Ldt = {}; + +var Bin = Ldt.Bin = function(_renkan, _opts) { if (_opts.ldt_type) { - var resclass = Rkns.Ldt[_opts.ldt_type+"Bin"]; + var resclass = Ldt[_opts.ldt_type+"Bin"]; if (resclass) { return new resclass(_renkan, _opts); } @@ -10,19 +13,19 @@ console.error("No such LDT Bin Type"); }; -Rkns.Ldt.ProjectBin = Rkns.Utils.inherit(Rkns._BaseBin); +var ProjectBin = Ldt.ProjectBin = Rkns.Utils.inherit(Rkns._BaseBin); -Rkns.Ldt.ProjectBin.prototype.tagTemplate = Rkns._.template( +ProjectBin.prototype.tagTemplate = Rkns._.template( '
  • ' + '

    <%=htitle%>

  • ' ); -Rkns.Ldt.ProjectBin.prototype.annotationTemplate = Rkns._.template( +ProjectBin.prototype.annotationTemplate = Rkns._.template( '
  • ' + '

    <%=htitle%>

    <%=hdescription%>

    Start: <%=start%>, End: <%=end%>, Duration: <%=duration%>

  • ' ); -Rkns.Ldt.ProjectBin.prototype._init = function(_renkan, _opts) { +ProjectBin.prototype._init = function(_renkan, _opts) { this.renkan = _renkan; this.proj_id = _opts.project_id; this.ldt_platform = _opts.ldt_platform || "http://ldt.iri.centrepompidou.fr/"; @@ -31,7 +34,7 @@ this.refresh(); }; -Rkns.Ldt.ProjectBin.prototype.render = function(searchstr) { +ProjectBin.prototype.render = function(searchstr) { if (searchstr) { var rxbase = searchstr.replace(/(\W)/g,'\\$1'), _rgxp = new RegExp('('+rxbase+')','gi'), @@ -123,7 +126,7 @@ this.renkan.resizeBins(); }; -Rkns.Ldt.ProjectBin.prototype.refresh = function() { +ProjectBin.prototype.refresh = function() { var _this = this; Rkns.$.ajax({ url: this.ldt_platform + 'ldtplatform/ldt/cljson/id/' + this.proj_id, @@ -135,35 +138,35 @@ }); }; -Rkns.Ldt.Search = function(_renkan, _opts) { +var Search = Ldt.Search = function(_renkan, _opts) { this.renkan = _renkan; this.lang = _opts.lang || "en"; }; -Rkns.Ldt.Search.prototype.getBgClass = function() { +Search.prototype.getBgClass = function() { return "Rk-Ldt-Icon"; }; -Rkns.Ldt.Search.prototype.getSearchTitle = function() { +Search.prototype.getSearchTitle = function() { return this.renkan.translate("Lignes de Temps"); }; -Rkns.Ldt.Search.prototype.search = function(_q) { +Search.prototype.search = function(_q) { this.renkan.tabs.push( - new Rkns.Ldt.ResultsBin(this.renkan, { + new ResultsBin(this.renkan, { search: _q }) ); }; -Rkns.Ldt.ResultsBin = Rkns.Utils.inherit(Rkns._BaseBin); +var ResultsBin = Ldt.ResultsBin = Rkns.Utils.inherit(Rkns._BaseBin); -Rkns.Ldt.ResultsBin.prototype.segmentTemplate = Rkns._.template( +ResultsBin.prototype.segmentTemplate = Rkns._.template( '
  • ' + '

    <%=htitle%>

    <%=hdescription%>

    Start: <%=start%>, End: <%=end%>, Duration: <%=duration%>

  • ' ); -Rkns.Ldt.ResultsBin.prototype._init = function(_renkan, _opts) { +ResultsBin.prototype._init = function(_renkan, _opts) { this.renkan = _renkan; this.ldt_platform = _opts.ldt_platform || "http://ldt.iri.centrepompidou.fr/"; this.max_results = _opts.max_results || 50; @@ -173,7 +176,7 @@ this.refresh(); }; -Rkns.Ldt.ResultsBin.prototype.render = function(searchstr) { +ResultsBin.prototype.render = function(searchstr) { if (searchstr) { var rxbase = searchstr.replace(/(\W)/g,'\\$1'), _rgxp = new RegExp('('+rxbase+')','gi'), @@ -254,7 +257,7 @@ this.renkan.resizeBins(); }; -Rkns.Ldt.ResultsBin.prototype.refresh = function() { +ResultsBin.prototype.refresh = function() { var _this = this; Rkns.$.ajax({ url: this.ldt_platform + 'ldtplatform/api/ldt/1.0/segments/search/', @@ -269,4 +272,6 @@ _this.render(); } }); -}; \ No newline at end of file +}; + +})(window.Rkns);