src/js/widgets/createAnnotationWidget.js
branchpopcorn-port
changeset 643 3e522b6f7bd0
parent 630 7c53857650b1
child 645 0c8ca890c9f1
equal deleted inserted replaced
642:37693f217f8c 643:3e522b6f7bd0
   268     if (typeof(this._currentAnnotation) !== "undefined") {
   268     if (typeof(this._currentAnnotation) !== "undefined") {
   269       annotation["begin"] = this._currentAnnotation.begin;
   269       annotation["begin"] = this._currentAnnotation.begin;
   270       annotation["end"] = this._currentAnnotation.end;
   270       annotation["end"] = this._currentAnnotation.end;
   271     }
   271     }
   272   } else {
   272   } else {
   273     var duration = +this._serializer.currentMedia().meta["dc:duration"];
   273     var duration = +this._serializer.currentMedia().meta["dc:duration"];    
   274     annotation["begin"] = +((duration * (this.sliceLeft / 100)).toFixed(0));
   274     annotation["begin"] = +((duration * (this.sliceLeft / this.selector.width())).toFixed(0));
   275     annotation["end"] = +((duration * ((this.sliceWidth + this.sliceLeft) / 100)).toFixed(0));
   275     annotation["end"] = +((duration * ((this.sliceWidth + this.sliceLeft) / this.selector.width())).toFixed(0));
   276   }
   276   }
   277   
   277 
   278   annotation["type"] = this._serializer.getContributions();
   278   annotation["type"] = this._serializer.getContributions();
   279   if (typeof(annotation["type"]) === "undefined")
   279   if (typeof(annotation["type"]) === "undefined")
   280     annotation["type"] = "";
   280     annotation["type"] = "";
   281   
   281   
   282   annotation["type_title"] = "Contributions";
   282   annotation["type_title"] = "Contributions";
   316                       var tmp_view = {"dc:contributor": "perso", "dc:creator": "perso", "dc:title": "Contributions",
   316                       var tmp_view = {"dc:contributor": "perso", "dc:creator": "perso", "dc:title": "Contributions",
   317                                       "id": json.annotations[0].type}
   317                                       "id": json.annotations[0].type}
   318                       console.log(tmp_view);
   318                       console.log(tmp_view);
   319                       this._serializer._data["annotation-types"].push(tmp_view);
   319                       this._serializer._data["annotation-types"].push(tmp_view);
   320                     }
   320                     }
   321                     annotation["type"] = "";
       
   322                     
   321                     
   323                     delete annotation.tags;
   322                     delete annotation.tags;
   324                     annotation.content.description = annotation.content.data;
   323                     annotation.content.description = annotation.content.data;
   325                     annotation.content.title = "";
   324                     annotation.content.title = "";
   326                     delete annotation.content.data;
   325                     delete annotation.content.data;
   327                     annotation.id = json.annotations[0].id;
   326                     annotation.id = json.annotations[0].id;
   328 
   327 
   329                     annotation.meta = meta;
   328                     annotation.meta = meta;
   330                     annotation.meta["id-ref"] = annotation["type"];
   329                     annotation.meta["id-ref"] = json.annotations[0]["type"];
       
   330                     
   331                     // everything is shared so there's no need to propagate the change
   331                     // everything is shared so there's no need to propagate the change
   332                     _this._serializer._data.annotations.push(annotation);
   332                     _this._serializer._data.annotations.push(annotation);
   333                     console.log(_this._serializer._data);
   333                     console.log(_this._serializer._data);
   334                     _this._Popcorn.trigger("IriSP.createAnnotationWidget.addedAnnotation");
   334                     _this._Popcorn.trigger("IriSP.createAnnotationWidget.addedAnnotation", annotation);
   335                     callback();
   335                     callback();
   336       }), 
   336       }), 
   337       error: 
   337       error: 
   338               function(jqXHR, textStatus, errorThrown) { 
   338               function(jqXHR, textStatus, errorThrown) { 
   339                             console.log("an error occured while contacting " 
   339                             console.log("an error occured while contacting "