src/widgets/AnnotationsList.js
changeset 1033 c20df1c080e6
parent 1021 7253d4d06f0d
child 1037 5c0416e8bba1
equal deleted inserted replaced
1032:74ac0be7655c 1033:c20df1c080e6
    27     annotation_type : false,
    27     annotation_type : false,
    28     refresh_interval : 0,
    28     refresh_interval : 0,
    29     limit_count : 20,
    29     limit_count : 20,
    30     newest_first : false,
    30     newest_first : false,
    31     show_audio: true,
    31     show_audio: true,
       
    32     show_creator: false,
       
    33     show_controls: false,
    32     polemics : [{
    34     polemics : [{
    33         keyword: "++",
    35         keyword: "++",
    34         background_color: "#c9ecc6"
    36         background_color: "#c9ecc6"
    35     },{
    37     },{
    36         keyword: "--",
    38         keyword: "--",
    56 };
    58 };
    57 
    59 
    58 IriSP.Widgets.AnnotationsList.prototype.template =
    60 IriSP.Widgets.AnnotationsList.prototype.template =
    59     '<div class="Ldt-AnnotationsListWidget">'
    61     '<div class="Ldt-AnnotationsListWidget">'
    60     + '{{#show_audio}}<div class="Ldt-AnnotationsList-Audio"></div>{{/show_audio}}'
    62     + '{{#show_audio}}<div class="Ldt-AnnotationsList-Audio"></div>{{/show_audio}}'
       
    63     + '{{#show_controls}}<div class="Ldt-AnnotationsList-Controls"><span class="Ldt-AnnotationsList-Control-Prev">Previous</span> | <span class="Ldt-AnnotationsList-Control-Next">Next</span></div>{{/show_controls}}'
    61     + '<ul class="Ldt-AnnotationsList-ul">'
    64     + '<ul class="Ldt-AnnotationsList-ul">'
    62     + '</ul>'
    65     + '</ul>'
    63     + '</div>';
    66     + '</div>';
    64 
    67 
    65 IriSP.Widgets.AnnotationsList.prototype.annotationTemplate = 
    68 IriSP.Widgets.AnnotationsList.prototype.annotationTemplate = 
    66     '<li class="Ldt-AnnotationsList-li Ldt-TraceMe" trace-info="annotation-id:{{id}}, media-id:{{media_id}}" style="{{specific_style}}">'
    69     '<li class="Ldt-AnnotationsList-li Ldt-Highlighter-Annotation Ldt-TraceMe" data-annotation="{{ id }}" data-begin="{{ begin_ms }}" data-end="{{ end_ms }}" trace-info="annotation-id:{{id}}, media-id:{{media_id}}" style="{{specific_style}}">'
    67     + '<div class="Ldt-AnnotationsList-ThumbContainer">'
    70     + '<div class="Ldt-AnnotationsList-ThumbContainer">'
    68     + '<a href="{{url}}" draggable="true">'
    71     + '<a href="{{url}}" draggable="true">'
    69     + '<img class="Ldt-AnnotationsList-Thumbnail" src="{{thumbnail}}" />'
    72     + '<img title="{{ begin }} - {{ atitle }}" class="Ldt-AnnotationsList-Thumbnail" src="{{thumbnail}}" />'
    70     + '</a>'
    73     + '</a>'
    71     + '</div>'
    74     + '</div>'
    72     + '<div class="Ldt-AnnotationsList-Duration">{{begin}} - {{end}}</div>'
    75     + '<div class="Ldt-AnnotationsList-Duration">{{begin}} - {{end}}</div>'
    73     + '<h3 class="Ldt-AnnotationsList-Title" draggable="true">'
    76     + '<h3 class="Ldt-AnnotationsList-Title" draggable="true">'
    74     + '<a href="{{url}}">{{{htitle}}}</a>'
    77     + '<a href="{{url}}">{{{htitle}}}</a>'
   185             );
   188             );
   186             var _title = "",
   189             var _title = "",
   187                 _description = _annotation.description,
   190                 _description = _annotation.description,
   188                 _thumbnail = (typeof _annotation.thumbnail !== "undefined" && _annotation.thumbnail ? _annotation.thumbnail : _this.default_thumbnail);
   191                 _thumbnail = (typeof _annotation.thumbnail !== "undefined" && _annotation.thumbnail ? _annotation.thumbnail : _this.default_thumbnail);
   189             // Update : display creator
   192             // Update : display creator
   190             if (_annotation.creator) {
   193             if (_annotation.creator && _this.show_creator) {
   191             	_title = _annotation.creator;
   194             	_title = _annotation.creator;
   192             }
   195             }
   193             if (_annotation.title) {
   196             if (_annotation.title) {
   194             	var tempTitle = _annotation.title;
   197             	var tempTitle = _annotation.title;
   195             	if( tempTitle.substr(0, _title.length + 1) == (_title + ":") ){
   198             	if( tempTitle.substr(0, _title.length + 1) == (_title + ":") ){
   205                 }
   208                 }
   206             });
   209             });
   207             var _data = {
   210             var _data = {
   208                 id : _annotation.id,
   211                 id : _annotation.id,
   209                 media_id : _annotation.getMedia().id,
   212                 media_id : _annotation.getMedia().id,
       
   213                 atitle: IriSP.textFieldHtml(_annotation.title),
   210                 htitle : IriSP.textFieldHtml(_title),
   214                 htitle : IriSP.textFieldHtml(_title),
   211                 hdescription : IriSP.textFieldHtml(_description),
   215                 hdescription : IriSP.textFieldHtml(_description),
   212                 begin : _annotation.begin.toString(),
   216                 begin : _annotation.begin.toString(),
   213                 end : _annotation.end.toString(),
   217                 end : _annotation.end.toString(),
       
   218                 begin_ms : _annotation.begin.milliseconds,
       
   219                 end_ms : _annotation.end.milliseconds,
   214                 thumbnail : _thumbnail,
   220                 thumbnail : _thumbnail,
   215                 url : _url,
   221                 url : _url,
   216                 tags : _annotation.getTagTexts(),
   222                 tags : _annotation.getTagTexts(),
   217                 specific_style : (typeof _bgcolor !== "undefined" ? "background-color: " + _bgcolor : ""),
   223                 specific_style : (typeof _bgcolor !== "undefined" ? "background-color: " + _bgcolor : ""),
   218                 l10n: _this.l10n
   224                 l10n: _this.l10n
   219             };
   225             };
       
   226             if (_this.show_controls) {
       
   227                 _this.$.find(".Ldt-AnnotationsList-Control-Prev").on("click", function (e) { e.preventDefault(); _this.navigate(-1); });
       
   228                 _this.$.find(".Ldt-AnnotationsList-Control-Next").on("click", function (e) { e.preventDefault(); _this.navigate(+1); });
       
   229            }
   220             if (_this.show_audio && _annotation.audio && _annotation.audio.href && _annotation.audio.href != "null") {
   230             if (_this.show_audio && _annotation.audio && _annotation.audio.href && _annotation.audio.href != "null") {
   221                 _data.audio = true;
   231                 _data.audio = true;
   222                 if (!_this.jwplayers[_annotation.id]) {
   232                 if (!_this.jwplayers[_annotation.id]) {
   223                     var _audiofile = _annotation.audio.href;
   233                     var _audiofile = _annotation.audio.href;
   224                     if (_this.audio_url_transform) {
   234                     if (_this.audio_url_transform) {