src/widgets/AnnotationsList.js
changeset 1011 7396abb7e251
parent 1010 5566738cb829
child 1013 392ddcd212d7
equal deleted inserted replaced
1010:5566738cb829 1011:7396abb7e251
   220                     if (_this.audio_url_transform) {
   220                     if (_this.audio_url_transform) {
   221                         _audiofile = _this.audio_url_transform(_annotation.audio.href);
   221                         _audiofile = _this.audio_url_transform(_annotation.audio.href);
   222                     }
   222                     }
   223                     var _tmpId = "jwplayer-" + IriSP.Model.getUID();
   223                     var _tmpId = "jwplayer-" + IriSP.Model.getUID();
   224                     _this.jwplayers[_annotation.id] = _tmpId;
   224                     _this.jwplayers[_annotation.id] = _tmpId;
   225                     _this.$.find(".Ldt-AnnotationsList-Audio").append($("<div>").attr("id", _tmpId));
   225                     _this.$.find(".Ldt-AnnotationsList-Audio").append(IriSP.jQuery("<div>").attr("id", _tmpId));
   226                     console.log(_audiofile);
       
   227                     jwplayer(_tmpId).setup({
   226                     jwplayer(_tmpId).setup({
   228                         flashplayer: IriSP.getLib("jwPlayerSWF"),
   227                         flashplayer: IriSP.getLib("jwPlayerSWF"),
   229                         file: _audiofile,
   228                         file: _audiofile,
   230                         fallback: false,
   229                         fallback: false,
   231                         primary: "flash",
   230                         primary: "flash",
   236                             onPause: function() {
   235                             onPause: function() {
   237                                 _this.$.find(".Ldt-AnnotationsList-Play[data-annotation-id=" + _annotation.id + "]").text(_this.l10n.voice_annotation)
   236                                 _this.$.find(".Ldt-AnnotationsList-Play[data-annotation-id=" + _annotation.id + "]").text(_this.l10n.voice_annotation)
   238                             },
   237                             },
   239                             onPlay: function() {
   238                             onPlay: function() {
   240                                 _this.$.find(".Ldt-AnnotationsList-Play[data-annotation-id=" + _annotation.id + "]").text(_this.l10n.now_playing)
   239                                 _this.$.find(".Ldt-AnnotationsList-Play[data-annotation-id=" + _annotation.id + "]").text(_this.l10n.now_playing)
   241                             },
   240                             }
   242                         }
   241                         }
   243                     });
   242                     });
   244                 }
   243                 }
   245             }
   244             }
   246             var _html = Mustache.to_html(_this.annotationTemplate, _data),
   245             var _html = Mustache.to_html(_this.annotationTemplate, _data),
   247                 _el = IriSP.jQuery(_html),
   246                 _el = IriSP.jQuery(_html),
   248                 _onselect = function() {
   247                 _onselect = function() {
   249                     _this.annotations_$.removeClass("selected");
   248                     _this.$.find('.Ldt-AnnotationsList-li').removeClass("selected");
   250                     _el.addClass("selected");
   249                     _el.addClass("selected");
   251                 },
   250                 },
   252                 _onunselect = function() {
   251                 _onunselect = function() {
   253                     _this.annotations_$.removeClass("selected");
   252                     _this.$.find('.Ldt-AnnotationsList-li').removeClass("selected");
   254                 };
   253                 };
   255             _el.mouseover(function() {
   254             _el.mouseover(function() {
   256                     _annotation.trigger("select");
   255                     _annotation.trigger("select");
   257                 })
   256                 })
   258                 .mouseout(function() {
   257                 .mouseout(function() {
   271             });
   270             });
   272             _annotation.on("select", _onselect);
   271             _annotation.on("select", _onselect);
   273             _annotation.on("unselect", _onunselect);
   272             _annotation.on("unselect", _onunselect);
   274         });
   273         });
   275         
   274         
   276         this.annotations_$ = this.$.find('.Ldt-AnnotationsList-li');
       
   277         
       
   278         /* Correct the empty tag bug */
   275         /* Correct the empty tag bug */
   279         this.$.find('.Ldt-AnnotationsList-Tag-Li').each(function() {
   276         this.$.find('.Ldt-AnnotationsList-Tag-Li').each(function() {
   280             var _el = IriSP.jQuery(this);
   277             var _el = IriSP.jQuery(this);
   281             if (!_el.text().replace(/(^\s+|\s+$)/g,'')) {
   278             if (!_el.text().replace(/(^\s+|\s+$)/g,'')) {
   282                 _el.remove();
   279                 _el.remove();