42 this.onMdpEvent("search", "onSearch"); |
42 this.onMdpEvent("search", "onSearch"); |
43 this.onMdpEvent("search.closed", "onSearch"); |
43 this.onMdpEvent("search.closed", "onSearch"); |
44 this.onMdpEvent("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.onMediaEvent("timeupdate","onTimeupdate"); |
47 var _this = this; |
|
48 this.source.getAnnotationsByTypeTitle(this.segment_annotation_type).forEach(function(_a) { |
|
49 _a.on("enter", function() { |
|
50 _this.redraw(_a.begin, _a.end); |
|
51 }) |
|
52 }); |
48 } else { |
53 } else { |
49 this.redraw(); |
54 this.redraw(); |
50 } |
55 } |
51 } |
56 } |
52 |
57 |
53 IriSP.Widgets.Tagcloud.prototype.onTimeupdate = function(_time) { |
58 IriSP.Widgets.Tagcloud.prototype.redraw = function(_from, _to) { |
54 var _list = this.source.getAnnotationsByTypeTitle(this.segment_annotation_type).filter(function(_annotation) { |
|
55 return _annotation.begin <= _time && _annotation.end > _time; |
|
56 }); |
|
57 if (_list.length) { |
|
58 if (_list[0].begin !== this.begin_time || _list[0].end !== this.end_time) { |
|
59 this.begin_time = _list[0].begin; |
|
60 this.end_time = _list[0].end; |
|
61 this.redraw(); |
|
62 } |
|
63 } |
|
64 } |
|
65 |
|
66 IriSP.Widgets.Tagcloud.prototype.redraw = function() { |
|
67 var _urlRegExp = /https?:\/\/[0-9a-zA-Z\.%\/-_]+/g, |
59 var _urlRegExp = /https?:\/\/[0-9a-zA-Z\.%\/-_]+/g, |
68 _regexpword = /[^\s\.&;,'"!\?\d\(\)\+\[\]\\\…\-«»:\/]{3,}/g, |
60 _regexpword = /[^\s\.&;,'"!\?\d\(\)\+\[\]\\\…\-«»:\/]{3,}/g, |
69 _words = {}, |
61 _words = {}, |
70 _this = this, |
62 _this = this, |
71 _annotations = this.getWidgetAnnotations(); |
63 _annotations = this.getWidgetAnnotations(); |
72 |
64 |
73 if (typeof this.begin_time !== "undefined" && typeof this.end_time !== "undefined") { |
65 if (typeof _from !== "undefined" && typeof _to !== "undefined") { |
74 _annotations = _annotations.filter(function(_annotation) { |
66 _annotations = _annotations.filter(function(_annotation) { |
75 return _annotation.begin >= _this.begin_time && _annotation.end <= _this.end_time; |
67 return _annotation.begin >= _from && _annotation.end <= _to; |
76 }) |
68 }) |
77 } |
69 } |
78 |
70 |
79 _annotations.forEach(function(_annotation) { |
71 _annotations.forEach(function(_annotation) { |
80 var _txt = |
72 var _txt = |