src/js/serializers/JSONSerializer.js
branchpopcorn-port
changeset 639 f18233d3a7fa
parent 636 b1629eed3e11
child 666 08d1656c608a
equal deleted inserted replaced
638:1cbe440312e1 639:f18233d3a7fa
   290       console.log("neither view.annotation_types nor view.annotation-types are defined");      
   290       console.log("neither view.annotation_types nor view.annotation-types are defined");      
   291       return;
   291       return;
   292     }
   292     }
   293   }
   293   }
   294 
   294 
   295   var available_types = this._data["available_types"];    
   295   var available_types = this._data["annotation_types"];    
   296   if (IriSP.null_or_undefined(available_types)) {
   296   if (IriSP.null_or_undefined(available_types)) {
   297     available_types = this._data["available-types"];
   297     available_types = this._data["annotation-types"];
   298     if (IriSP.null_or_undefined(available_types)) {
   298     if (IriSP.null_or_undefined(available_types)) {
   299       console.log("neither available_types nor available-types are defined");      
   299       console.log("neither annotation_types nor annotation-types are defined");      
   300       return;
   300       return;
   301     }
   301     }
   302   }
   302   }
   303   
   303   
   304   var potential_types = [];
   304   var potential_types = [];
   337 
   337 
   338   var available_types = this._data["annotation_types"];    
   338   var available_types = this._data["annotation_types"];    
   339   if (IriSP.null_or_undefined(available_types)) {
   339   if (IriSP.null_or_undefined(available_types)) {
   340     available_types = this._data["annotation-types"];
   340     available_types = this._data["annotation-types"];
   341     if (IriSP.null_or_undefined(available_types)) {
   341     if (IriSP.null_or_undefined(available_types)) {
   342       console.log("neither available_types nor available-types are defined");      
   342       console.log("neither annotation_types nor annotation-types are defined");      
   343       return;
   343       return;
   344     }
   344     }
   345   }
   345   }
   346 
   346 
   347   var potential_types = [];
   347   var potential_types = [];
   350   for (var i = 0; i < available_types.length; i++) {
   350   for (var i = 0; i < available_types.length; i++) {
   351     if (!(/Tw/i.test(available_types[i]["dc:title"]))) {
   351     if (!(/Tw/i.test(available_types[i]["dc:title"]))) {
   352       potential_types.push(available_types[i].id);
   352       potential_types.push(available_types[i].id);
   353     }
   353     }
   354   }
   354   }
   355   console.log("pot", potential_types, "avail", annotation_types);
   355 
   356   // Get the intersection of both.
   356   // Get the intersection of both.
   357   var nonTweetsId = IriSP.underscore.intersection(annotation_types, potential_types);
   357   var nonTweetsId = IriSP.underscore.intersection(annotation_types, potential_types);
   358   
   358   
   359   return nonTweetsId;
   359   return nonTweetsId;
   360   
   360