src/js/widgets/annotationsWidget.js
branchpopcorn-port
changeset 264 9fb001b19dd2
parent 162 2ef47ccb290f
child 309 49c2b9e63591
equal deleted inserted replaced
263:2d87a07fa3d0 264:9fb001b19dd2
    11     this.selector.find(".Ldt-SaDescription").text("");
    11     this.selector.find(".Ldt-SaDescription").text("");
    12     this.selector.find(".Ldt-SaKeywordText").text("");
    12     this.selector.find(".Ldt-SaKeywordText").text("");
    13 };
    13 };
    14 
    14 
    15 IriSP.AnnotationsWidget.prototype.displayAnnotation = function(annotation) {
    15 IriSP.AnnotationsWidget.prototype.displayAnnotation = function(annotation) {
       
    16 
    16     var title = annotation.content.title;
    17     var title = annotation.content.title;
    17     var description = annotation.content.description;
    18     var description = annotation.content.description;
    18     var keywords =  "" // FIXME;
    19     var keywords =  "" // FIXME;
    19     var begin = +annotation.begin;
    20     var begin = +annotation.begin;
    20     var end = +annotation.end;
    21     var end = +annotation.end;
    21     var duration = +this._serializer.currentMedia().meta["dc:duration"];
    22     var duration = +this._serializer.currentMedia().meta["dc:duration"];
    22 
    23 
    23     this.selector.find(".Ldt-SaTitle").text(title);
    24     this.selector.find(".Ldt-SaTitle").text(title);
    24     this.selector.find(".Ldt-SaDescription").text(description);
    25     this.selector.find(".Ldt-SaDescription").text(description);
    25 		var startPourcent = parseInt(Math.round((begin*1+(end*1-begin*1)/2) / (duration*1)) / 100); 
    26 		var startPourcent = parseInt(Math.round((begin*1+(end*1-begin*1)/2) / (duration*1)) / 100); 		
    26 		this.selector.find(".Ldt-Show-Arrow").animate({left:startPourcent+'%'},1000);
       
    27 		//IriSP.jQuery("#"+annotationTempo.id).animate({alpha:'100%'},1000);
       
    28 
    27 
    29 };
    28 };
    30 
    29 
    31 IriSP.AnnotationsWidget.prototype.clearWidget = function() {
    30 IriSP.AnnotationsWidget.prototype.clearWidget = function() {
       
    31 
       
    32     
    32     /* retract the pane between two annotations */
    33     /* retract the pane between two annotations */
    33     this.selector.find(".Ldt-SaTitle").text("");
    34     this.selector.find(".Ldt-SaTitle").text("");
    34     this.selector.find(".Ldt-SaDescription").text("");
    35     this.selector.find(".Ldt-SaDescription").text("");
    35     this.selector.find(".Ldt-SaKeywordText").html("");
    36     this.selector.find(".Ldt-SaKeywordText").html("");
    36     this.selector.find(".Ldt-ShowAnnotation").slideUp();
    37     this.selector.find(".Ldt-ShowAnnotation").slideUp();
    50     var begin = Math.round((+ annotation.begin) / 1000);
    51     var begin = Math.round((+ annotation.begin) / 1000);
    51     var end = Math.round((+ annotation.end) / 1000);
    52     var end = Math.round((+ annotation.end) / 1000);
    52 
    53 
    53     var conf = {start: begin, end: end, 
    54     var conf = {start: begin, end: end, 
    54                 onStart: 
    55                 onStart: 
    55                        function(annotation) { return function() { _this.displayAnnotation(annotation); } }(annotation),
    56                        function(annotation) { 
       
    57                         return function() { 
       
    58                           /* we need it because we have to restore
       
    59                              the display after displaying the contents
       
    60                              of a tweet.
       
    61                           */
       
    62                           _this._currentAnnotation = annotation;
       
    63                           _this.displayAnnotation(annotation); 
       
    64                           
       
    65                         } }(annotation),
    56                 onEnd: 
    66                 onEnd: 
    57                        function() { _this.clearWidget(); },
    67                        function() { _this.clearWidget.call(_this); },
    58                 };
    68                 };
    59     this._Popcorn = this._Popcorn.code(conf);                                             
    69     this._Popcorn = this._Popcorn.code(conf);                                             
    60   }
    70   }
       
    71 
    61 };
    72 };