src/js/serializers/JSONSerializer.js
branchpopcorn-port
changeset 590 495ea8d73bed
parent 566 098929cd2d62
child 591 e0df88905af8
equal deleted inserted replaced
589:5f74eb3b2262 590:495ea8d73bed
   241   var i;
   241   var i;
   242   
   242   
   243   for (i in this._data.annotations) {
   243   for (i in this._data.annotations) {
   244     var annotation = this._data.annotations[i];
   244     var annotation = this._data.annotations[i];
   245     
   245     
   246     if (IriSP.underscore.include(legal_ids, annotation.meta["id-ref"]) && annotation.begin <= currentTimeMs && annotation.end >= currentTimeMs)
   246     if (IriSP.underscore.include(legal_ids, annotation.meta["id-ref"]) && 
   247       ret_array.push(annotation);
   247         annotation.begin <= currentTimeMs &&
       
   248         annotation.end >= currentTimeMs)
       
   249           ret_array.push(annotation);
   248   }
   250   }
   249 
   251  
       
   252   if (ret_array == []) {
       
   253     console.log("ret_array empty, ", legal_ids);
       
   254   }
       
   255   
   250   return ret_array;
   256   return ret_array;
   251 };
   257 };
   252 
   258 
   253 
   259 
   254 /** returns a list of ids of tweet lines (aka: groups in cinelab) */
   260 /** returns a list of ids of tweet lines (aka: groups in cinelab) */
   283                                                          
   289                                                          
   284   var illegal_values = this.getTweetIds();
   290   var illegal_values = this.getTweetIds();
   285   return IriSP.underscore.difference(ids, illegal_values);
   291   return IriSP.underscore.difference(ids, illegal_values);
   286   
   292   
   287 };
   293 };
       
   294 
       
   295 /** return the id of the ligne de temps which contains name
       
   296     @param name of the ligne de temps
       
   297 */
       
   298 IriSP.JSONSerializer.prototype.getId = function(name) {
       
   299   if (typeof(this._data.lists) === "undefined" || this._data.lists === null)
       
   300     return;
       
   301 
       
   302   var e;
       
   303   debugger;
       
   304   /* first get the list containing the tweets */
       
   305   e = IriSP.underscore.find(this._data["annotation-types"], 
       
   306                                   function(entry) { return (entry["dc:title"].indexOf(name) !== -1) });
       
   307   
       
   308   if (typeof(e) === "undefined")
       
   309     return;
       
   310     
       
   311   var id = e.id;
       
   312 
       
   313   return id;
       
   314 };
       
   315 
       
   316 /** return the id of the ligne de temps named "Chapitrage" */
       
   317 IriSP.JSONSerializer.prototype.getChapitrage = function() {
       
   318   return this.getId("Chapitrage");
       
   319 };
       
   320 
       
   321 /** return the id of the ligne de temps named "Tweets" */
       
   322 IriSP.JSONSerializer.prototype.getTweets = function() {
       
   323   return this.getId("Tweets");
       
   324 };
       
   325 
       
   326 /** return the id of the ligne de temps named "Contributions" */
       
   327 IriSP.JSONSerializer.prototype.getContributions = function() {
       
   328   return this.getId("Contributions");
       
   329 };