src/js/widgets/createAnnotationWidget.js
branchpopcorn-port
changeset 778 8329f476d852
parent 776 f3c758ef9952
child 779 52be94ec8e1c
equal deleted inserted replaced
777:96e89720ff18 778:8329f476d852
   174 };
   174 };
   175 
   175 
   176 /** handles clicks on the annotate button. Works only for the non-cinecast version */
   176 /** handles clicks on the annotate button. Works only for the non-cinecast version */
   177 IriSP.createAnnotationWidget.prototype.handleAnnotateSignal = function() {
   177 IriSP.createAnnotationWidget.prototype.handleAnnotateSignal = function() {
   178   
   178   
   179   if (this._hidden == false) {
   179   if (this._hidden == false && this._state == 'startScreen') {
   180     this.selector.hide();
   180     this.selector.hide();
   181     this._hidden = true;
   181     this._hidden = true;
   182     
   182     
   183     // free the arrow.
   183     // free the arrow.
   184     this._Popcorn.trigger("IriSP.ArrowWidget.releaseArrow");
   184     this._Popcorn.trigger("IriSP.ArrowWidget.releaseArrow");
   185     this._Popcorn.trigger("IriSP.SliceWidget.hide");
   185     this._Popcorn.trigger("IriSP.SliceWidget.hide");
       
   186     this._Popcorn.trigger("IriSP.AnnotationsWidget.show");
   186     
   187     
   187   } else {
   188   } else {
       
   189     this._Popcorn.trigger("IriSP.AnnotationsWidget.hide");
   188     this.showStartScreen();
   190     this.showStartScreen();
   189     this.selector.show();
   191     this.selector.show();
   190     this._hidden = false;
   192     this._hidden = false;
   191     var currentTime = this._Popcorn.currentTime();
   193     var currentTime = this._Popcorn.currentTime();
   192     
   194     
   261 };
   263 };
   262 
   264 
   263 IriSP.createAnnotationWidget.prototype.showStartScreen = function() {
   265 IriSP.createAnnotationWidget.prototype.showStartScreen = function() {
   264   this.selector.find(".Ldt-createAnnotation-DoubleBorder").children().hide();
   266   this.selector.find(".Ldt-createAnnotation-DoubleBorder").children().hide();
   265   this.selector.find(".Ldt-createAnnotation-startScreen").show();
   267   this.selector.find(".Ldt-createAnnotation-startScreen").show();
   266   this.selector.find(".Ldt-createAnnotation-Description").val("Type your annotation here.");  
   268   this.selector.find(".Ldt-createAnnotation-Description").val("Type your annotation here.");
       
   269 
       
   270   this._state = "startScreen";
   267 };
   271 };
   268 
   272 
   269 IriSP.createAnnotationWidget.prototype.showWaitScreen = function() {
   273 IriSP.createAnnotationWidget.prototype.showWaitScreen = function() {
   270   this.selector.find(".Ldt-createAnnotation-DoubleBorder").children().hide();
   274   this.selector.find(".Ldt-createAnnotation-DoubleBorder").children().hide();
   271   this.selector.find(".Ldt-createAnnotation-waitScreen").show();  
   275   this.selector.find(".Ldt-createAnnotation-waitScreen").show();
       
   276   this._state = "waitScreen";
   272 };
   277 };
   273 
   278 
   274 IriSP.createAnnotationWidget.prototype.showErrorScreen = function() {
   279 IriSP.createAnnotationWidget.prototype.showErrorScreen = function() {
   275   this.selector.find(".Ldt-createAnnotation-DoubleBorder").children().hide();
   280   this.selector.find(".Ldt-createAnnotation-DoubleBorder").children().hide();
   276   this.selector.find(".Ldt-createAnnotation-errorScreen").show();  
   281   this.selector.find(".Ldt-createAnnotation-errorScreen").show();
       
   282   this._state = "errorScreen";
   277 };
   283 };
   278 
   284 
   279 /** update show the final screen with links to share the created annotation */
   285 /** update show the final screen with links to share the created annotation */
   280 IriSP.createAnnotationWidget.prototype.showEndScreen = function(annotation) {
   286 IriSP.createAnnotationWidget.prototype.showEndScreen = function(annotation) {
   281   this.selector.find(".Ldt-createAnnotation-DoubleBorder").children().hide();
   287   this.selector.find(".Ldt-createAnnotation-DoubleBorder").children().hide();
   292   this.selector.find(".Ldt-createAnnotation-endScreen-TweetLink").attr("href", twStatus);
   298   this.selector.find(".Ldt-createAnnotation-endScreen-TweetLink").attr("href", twStatus);
   293   this.selector.find(".Ldt-createAnnotation-endScreen-FbLink").attr("href", fbStatus);
   299   this.selector.find(".Ldt-createAnnotation-endScreen-FbLink").attr("href", fbStatus);
   294   this.selector.find(".Ldt-createAnnotation-endScreen-GplusLink").attr("href", gpStatus);
   300   this.selector.find(".Ldt-createAnnotation-endScreen-GplusLink").attr("href", gpStatus);
   295           
   301           
   296   this.selector.find(".Ldt-createAnnotation-endScreen").show();
   302   this.selector.find(".Ldt-createAnnotation-endScreen").show();
       
   303   this._state = "endScreen";
   297 };
   304 };
   298 
   305 
   299 /** handle clicks on "send annotation" button */
   306 /** handle clicks on "send annotation" button */
   300 IriSP.createAnnotationWidget.prototype.handleButtonClick = function(event) {
   307 IriSP.createAnnotationWidget.prototype.handleButtonClick = function(event) {
   301   var _this = this;
   308   var _this = this;
   326                       if (_this.cinecast_version) {
   333                       if (_this.cinecast_version) {
   327                           if (_this._Popcorn.media.paused)
   334                           if (_this._Popcorn.media.paused)
   328                             _this._Popcorn.play();
   335                             _this._Popcorn.play();
   329                       }
   336                       }
   330 
   337 
   331                       _this.showEndScreen(annotation);
   338                       if (_this._state == "waitScreen") {
   332                       if (_this.cinecast_version) {
   339                         _this.showEndScreen(annotation);
   333                         window.setTimeout(IriSP.wrap(_this, function() { this.showStartScreen(); }), 5000);
   340                         if (_this.cinecast_version) {
       
   341                           window.setTimeout(IriSP.wrap(_this, function() { this.showStartScreen(); }), 5000);
       
   342                         }
   334                       }
   343                       }
   335                       
       
   336                       // hide the slicer widget
   344                       // hide the slicer widget
   337                       if (!_this.cinecast_version) {                      
   345                       if (!_this.cinecast_version) {                      
   338                         _this._Popcorn.trigger("IriSP.SliceWidget.hide");
   346                         _this._Popcorn.trigger("IriSP.SliceWidget.hide");
   339                       }           
   347                       }           
   340                     });
   348                     });