src/js/widgets/createAnnotationWidget.js
branchpopcorn-port
changeset 776 f3c758ef9952
parent 773 b284013327fd
child 778 8329f476d852
equal deleted inserted replaced
775:59927257f43b 776:f3c758ef9952
   194     this._Popcorn.trigger("IriSP.ArrowWidget.blockArrow");
   194     this._Popcorn.trigger("IriSP.ArrowWidget.blockArrow");
   195     
   195     
   196     var duration = +this._serializer.currentMedia().meta["dc:duration"];
   196     var duration = +this._serializer.currentMedia().meta["dc:duration"];
   197         
   197         
   198     var currentChapter = this._serializer.currentChapitre(currentTime);
   198     var currentChapter = this._serializer.currentChapitre(currentTime);
   199     if (typeof(currentChapter) === "undefined") {
   199     if (IriSP.null_or_undefined(currentChapter)) {
   200       var left = this.selector.width() / 2;
   200       var left = this.selector.width() / 2;
   201       var width = this.selector.width() / 10;
   201       var width = this.selector.width() / 10;
   202     } else {
   202     } else {
   203       var left = (currentChapter.begin / duration) * this.selector.width();
   203       var left = (currentChapter.begin / duration) * this.selector.width();
   204       var width = (currentChapter.end / duration) * this.selector.width() - left;
   204       var width = (currentChapter.end / duration) * this.selector.width() - left;
   208     this.sliceWidth = width;
   208     this.sliceWidth = width;
   209     this._Popcorn.trigger("IriSP.SliceWidget.position", [left, width]);
   209     this._Popcorn.trigger("IriSP.SliceWidget.position", [left, width]);
   210     this._Popcorn.listen("IriSP.SliceWidget.zoneChange", IriSP.wrap(this, this.handleSliderChanges));
   210     this._Popcorn.listen("IriSP.SliceWidget.zoneChange", IriSP.wrap(this, this.handleSliderChanges));
   211     this._Popcorn.trigger("IriSP.SliceWidget.show");
   211     this._Popcorn.trigger("IriSP.SliceWidget.show");
   212     
   212     
   213     this.selector.find(".Ldt-createAnnotation-Title").html(currentChapter.content.title);
   213     if (!IriSP.null_or_undefined(currentChapter)) {
   214 
   214       this.selector.find(".Ldt-createAnnotation-Title").html(currentChapter.content.title);
   215     this._currentcurrentChapter = currentChapter;
   215 
   216     var beginTime = IriSP.msToTime(currentChapter.begin);
   216       this._currentcurrentChapter = currentChapter;
   217     var endTime = IriSP.msToTime(currentChapter.end);
   217       var beginTime = IriSP.msToTime(currentChapter.begin);
   218     var timeTemplate = IriSP.templToHTML("- ({{begin}} - {{ end }})", {begin: beginTime, end: endTime });
   218       var endTime = IriSP.msToTime(currentChapter.end);
   219     this.selector.find(".Ldt-createAnnotation-TimeFrame").html(timeTemplate);
   219       var timeTemplate = IriSP.templToHTML("- ({{begin}} - {{ end }})", {begin: beginTime, end: endTime });
       
   220       this.selector.find(".Ldt-createAnnotation-TimeFrame").html(timeTemplate);
       
   221     }
   220   }
   222   }
   221 };
   223 };
   222 
   224 
   223 
   225 
   224 /** watch for changes in the textfield and change the buttons accordingly */
   226 /** watch for changes in the textfield and change the buttons accordingly */