37 'they', 'this', 'very', 'what', 'when', 'where', 'who', 'why', 'will', 'with', 'www', 'you', 'your' |
37 'they', 'this', 'very', 'what', 'when', 'where', 'who', 'why', 'will', 'with', 'www', 'you', 'your' |
38 ] |
38 ] |
39 } |
39 } |
40 |
40 |
41 IriSP.Widgets.Tagcloud.prototype.draw = function() { |
41 IriSP.Widgets.Tagcloud.prototype.draw = function() { |
42 this.bindPopcorn("IriSP.search", "onSearch"); |
42 this.onMdpEvent("search", "onSearch"); |
43 this.bindPopcorn("IriSP.search.closed", "onSearch"); |
43 this.onMdpEvent("search.closed", "onSearch"); |
44 this.bindPopcorn("IriSP.search.cleared", "onSearch"); |
44 this.onMdpEvent("search.cleared", "onSearch"); |
45 |
45 |
46 if (this.segment_annotation_type) { |
46 if (this.segment_annotation_type) { |
47 this.bindPopcorn("timeupdate","onTimeupdate"); |
47 this.onMediaEvent("timeupdate","onTimeupdate"); |
48 } else { |
48 } else { |
49 this.redraw(); |
49 this.redraw(); |
50 } |
50 } |
51 } |
51 } |
52 |
52 |
53 IriSP.Widgets.Tagcloud.prototype.onTimeupdate = function() { |
53 IriSP.Widgets.Tagcloud.prototype.onTimeupdate = function(_time) { |
54 var _time = Math.floor(this.player.popcorn.currentTime() * 1000), |
54 var _list = this.source.getAnnotationsByTypeTitle(this.segment_annotation_type).filter(function(_annotation) { |
55 _list = this.source.getAnnotationsByTypeTitle(this.segment_annotation_type).filter(function(_annotation) { |
|
56 return _annotation.begin <= _time && _annotation.end > _time; |
55 return _annotation.begin <= _time && _annotation.end > _time; |
57 }); |
56 }); |
58 if (_list.length) { |
57 if (_list.length) { |
59 if (_list[0].begin !== this.begin_time || _list[0].end !== this.end_time) { |
58 if (_list[0].begin !== this.begin_time || _list[0].end !== this.end_time) { |
60 this.begin_time = _list[0].begin; |
59 this.begin_time = _list[0].begin; |
115 }); |
114 }); |
116 } |
115 } |
117 this.$.html(Mustache.to_html(this.template, {words: _words })); |
116 this.$.html(Mustache.to_html(this.template, {words: _words })); |
118 this.$.find(".Ldt-Tagcloud-item").click(function() { |
117 this.$.find(".Ldt-Tagcloud-item").click(function() { |
119 var _txt = IriSP.jQuery(this).attr("content"); |
118 var _txt = IriSP.jQuery(this).attr("content"); |
120 _this.player.popcorn.trigger("IriSP.search.triggeredSearch", _txt); |
119 _this.player.trigger("search.triggeredSearch", _txt); |
121 }); |
120 }); |
122 |
121 |
123 } |
122 } |
124 |
123 |
125 IriSP.Widgets.Tagcloud.prototype.onSearch = function(searchString) { |
124 IriSP.Widgets.Tagcloud.prototype.onSearch = function(searchString) { |