src/js/widgets/createAnnotationWidget.js
branchpopcorn-port
changeset 651 c43441822b1b
parent 645 0c8ca890c9f1
child 678 45385e19022a
equal deleted inserted replaced
650:54ad76d6f9fe 651:c43441822b1b
   194 IriSP.createAnnotationWidget.prototype.showWaitScreen = function() {
   194 IriSP.createAnnotationWidget.prototype.showWaitScreen = function() {
   195   this.selector.find(".Ldt-createAnnotation-DoubleBorder").children().hide();
   195   this.selector.find(".Ldt-createAnnotation-DoubleBorder").children().hide();
   196   this.selector.find(".Ldt-createAnnotation-waitScreen").show();  
   196   this.selector.find(".Ldt-createAnnotation-waitScreen").show();  
   197 };
   197 };
   198 
   198 
   199 IriSP.createAnnotationWidget.prototype.showEndScreen = function() {
   199 IriSP.createAnnotationWidget.prototype.showEndScreen = function(annotation) {
   200   this.selector.find(".Ldt-createAnnotation-DoubleBorder").children().hide();
   200   this.selector.find(".Ldt-createAnnotation-DoubleBorder").children().hide();
   201   
   201   
   202   if (this.cinecast_version) {
   202   if (this.cinecast_version) {
   203     this.selector.find(".Ldt-createAnnotation-Title").parent().show();      
   203     this.selector.find(".Ldt-createAnnotation-Title").parent().show();      
   204   }
   204   }
   205 
   205 
   206   var twStatus = IriSP.mkTweetUrl(document.location.href);
   206   var url = document.location.href + "id=" + annotation.id;
   207   var gpStatus = IriSP.mkGplusUrl(document.location.href);
   207   var twStatus = IriSP.mkTweetUrl(url);
   208   var fbStatus = IriSP.mkFbUrl(document.location.href);
   208   var gpStatus = IriSP.mkGplusUrl(url);
       
   209   var fbStatus = IriSP.mkFbUrl(url);
   209   
   210   
   210   this.selector.find(".Ldt-createAnnotation-endScreen-TweetLink").attr("href", twStatus);
   211   this.selector.find(".Ldt-createAnnotation-endScreen-TweetLink").attr("href", twStatus);
   211   this.selector.find(".Ldt-createAnnotation-endScreen-FbLink").attr("href", fbStatus);
   212   this.selector.find(".Ldt-createAnnotation-endScreen-FbLink").attr("href", fbStatus);
   212   this.selector.find(".Ldt-createAnnotation-endScreen-GplusLink").attr("href", gpStatus);
   213   this.selector.find(".Ldt-createAnnotation-endScreen-GplusLink").attr("href", gpStatus);
   213           
   214           
   313                     /* if the media doesn't have a contributions line, we need to add one */
   314                     /* if the media doesn't have a contributions line, we need to add one */
   314                     if (typeof(this._serializer.getContributions()) === "undefined") {
   315                     if (typeof(this._serializer.getContributions()) === "undefined") {
   315                       /* set up a basic view */
   316                       /* set up a basic view */
   316                       var tmp_view = {"dc:contributor": "perso", "dc:creator": "perso", "dc:title": "Contributions",
   317                       var tmp_view = {"dc:contributor": "perso", "dc:creator": "perso", "dc:title": "Contributions",
   317                                       "id": json.annotations[0].type}
   318                                       "id": json.annotations[0].type}
   318                       console.log(tmp_view);
   319 
   319                       this._serializer._data["annotation-types"].push(tmp_view);
   320                       this._serializer._data["annotation-types"].push(tmp_view);
   320                     }
   321                     }
   321                     
   322                     
   322                     delete annotation.tags;
   323                     delete annotation.tags;
   323                     annotation.content.description = annotation.content.data;
   324                     annotation.content.description = annotation.content.data;
   328                     annotation.meta = meta;
   329                     annotation.meta = meta;
   329                     annotation.meta["id-ref"] = json.annotations[0]["type"];
   330                     annotation.meta["id-ref"] = json.annotations[0]["type"];
   330                     
   331                     
   331                     // everything is shared so there's no need to propagate the change
   332                     // everything is shared so there's no need to propagate the change
   332                     _this._serializer._data.annotations.push(annotation);
   333                     _this._serializer._data.annotations.push(annotation);
   333                     console.log(_this._serializer._data);
   334  
   334                     _this._Popcorn.trigger("IriSP.createAnnotationWidget.addedAnnotation", annotation);
   335                     _this._Popcorn.trigger("IriSP.createAnnotationWidget.addedAnnotation", annotation);
   335                     callback();
   336                     callback(annotation);
   336       }), 
   337       }), 
   337       error: 
   338       error: 
   338               function(jqXHR, textStatus, errorThrown) { 
   339               function(jqXHR, textStatus, errorThrown) { 
   339                             console.log("an error occured while contacting " 
   340                             console.log("an error occured while contacting " 
   340                             + url + " and sending " + jsonString + textStatus ); } });
   341                             + url + " and sending " + jsonString + textStatus ); } });