src/js/serializers/JSONSerializer.js
branchpopcorn-port
changeset 628 55282f5ef477
parent 613 c2726c5c6477
child 633 00a59060d78d
equal deleted inserted replaced
627:13b9f14bf49a 628:55282f5ef477
   312 */
   312 */
   313 IriSP.JSONSerializer.prototype.getId = function(name) {
   313 IriSP.JSONSerializer.prototype.getId = function(name) {
   314   if (typeof(this._data.lists) === "undefined" || this._data.lists === null)
   314   if (typeof(this._data.lists) === "undefined" || this._data.lists === null)
   315     return;
   315     return;
   316 
   316 
   317   var e;
   317   name = name.toUpperCase();
   318   /* first get the list containing the tweets */
   318   var e;  
   319   e = IriSP.underscore.find(this._data["annotation-types"], 
   319   e = IriSP.underscore.find(this._data["annotation-types"], 
   320                                   function(entry) { return (entry["dc:title"].indexOf(name) !== -1) });
   320                                   function(entry) { return (entry["dc:title"].toUpperCase().indexOf(name) !== -1) });
   321   
   321   
   322   if (typeof(e) === "undefined")
   322   if (typeof(e) === "undefined")
   323     return;
   323     return;
   324     
   324     
   325   var id = e.id;
   325   var id = e.id;
   332   return this.getId("Chapitrage");
   332   return this.getId("Chapitrage");
   333 };
   333 };
   334 
   334 
   335 /** return the id of the ligne de temps named "Tweets" */
   335 /** return the id of the ligne de temps named "Tweets" */
   336 IriSP.JSONSerializer.prototype.getTweets = function() {
   336 IriSP.JSONSerializer.prototype.getTweets = function() {
   337   return this.getId("Tweets");
   337   var val = this.getId("Tweets");
       
   338   if (typeof(val) === "undefined")
       
   339     val = this.getId("Tweet");
       
   340   if (typeof(val) === "undefined")
       
   341     val = this.getId("Twitter");
       
   342   if (typeof(val) === "undefined")
       
   343     val = this.getId("twit");
       
   344   if (typeof(val) === "undefined")
       
   345     val = this.getId("Polemic");
       
   346   
       
   347   return val;
   338 };
   348 };
   339 
   349 
   340 /** return the id of the ligne de temps named "Contributions" */
   350 /** return the id of the ligne de temps named "Contributions" */
   341 IriSP.JSONSerializer.prototype.getContributions = function() {
   351 IriSP.JSONSerializer.prototype.getContributions = function() {
   342   return this.getId("Contributions");
   352   return this.getId("Contributions");