| author | durandn |
| Fri, 18 Sep 2015 17:21:12 +0200 | |
| changeset 1058 | ded3cd1312c1 |
| parent 1044 | d8339b45edc4 |
| child 1068 | 7623f9af9272 |
| permissions | -rw-r--r-- |
|
937
eb3c442cec50
Added events on annotation for inter widget communication
veltr
parents:
930
diff
changeset
|
1 |
// TODO: Trigger IriSP.SegmentsWidget.click |
| 876 | 2 |
|
|
875
43629caa77bc
Big refactoring of widget files + started migration of segmentwidget
veltr
parents:
diff
changeset
|
3 |
IriSP.Widgets.Segments = function(player, config) { |
|
43629caa77bc
Big refactoring of widget files + started migration of segmentwidget
veltr
parents:
diff
changeset
|
4 |
IriSP.Widgets.Widget.call(this, player, config); |
|
43629caa77bc
Big refactoring of widget files + started migration of segmentwidget
veltr
parents:
diff
changeset
|
5 |
}; |
|
43629caa77bc
Big refactoring of widget files + started migration of segmentwidget
veltr
parents:
diff
changeset
|
6 |
|
|
43629caa77bc
Big refactoring of widget files + started migration of segmentwidget
veltr
parents:
diff
changeset
|
7 |
IriSP.Widgets.Segments.prototype = new IriSP.Widgets.Widget(); |
|
43629caa77bc
Big refactoring of widget files + started migration of segmentwidget
veltr
parents:
diff
changeset
|
8 |
|
|
43629caa77bc
Big refactoring of widget files + started migration of segmentwidget
veltr
parents:
diff
changeset
|
9 |
IriSP.Widgets.Segments.prototype.defaults = { |
|
43629caa77bc
Big refactoring of widget files + started migration of segmentwidget
veltr
parents:
diff
changeset
|
10 |
annotation_type : "chap", |
|
43629caa77bc
Big refactoring of widget files + started migration of segmentwidget
veltr
parents:
diff
changeset
|
11 |
colors: ["#1f77b4","#aec7e8","#ff7f0e","#ffbb78","#2ca02c","#98df8a","#d62728","#ff9896","#9467bd","#c5b0d5","#8c564b","#c49c94","#e377c2","#f7b6d2","#7f7f7f","#c7c7c7","#bcbd22","#dbdb8d","#17becf","#9edae5"], |
| 982 | 12 |
line_height: 8, |
13 |
background: "#e0e0e0", |
|
| 983 | 14 |
overlap: .25, |
15 |
found_color: "#FF00FC", |
|
| 1033 | 16 |
faded_found_color: "#ff80fc", |
|
1044
d8339b45edc4
Added support for defining a "time range" for a Playable to set the time boundaries of what can be played by the diffenrent players (Popcorn and HtmlPlayer for now). Added option in Segment widget to define a timerange on click.
durandn
parents:
1033
diff
changeset
|
17 |
selected_color: "#74d600", |
|
d8339b45edc4
Added support for defining a "time range" for a Playable to set the time boundaries of what can be played by the diffenrent players (Popcorn and HtmlPlayer for now). Added option in Segment widget to define a timerange on click.
durandn
parents:
1033
diff
changeset
|
18 |
faded_selected_color: "#baf9b5", |
|
d8339b45edc4
Added support for defining a "time range" for a Playable to set the time boundaries of what can be played by the diffenrent players (Popcorn and HtmlPlayer for now). Added option in Segment widget to define a timerange on click.
durandn
parents:
1033
diff
changeset
|
19 |
no_tooltip: false, |
|
d8339b45edc4
Added support for defining a "time range" for a Playable to set the time boundaries of what can be played by the diffenrent players (Popcorn and HtmlPlayer for now). Added option in Segment widget to define a timerange on click.
durandn
parents:
1033
diff
changeset
|
20 |
use_timerange: false, |
|
875
43629caa77bc
Big refactoring of widget files + started migration of segmentwidget
veltr
parents:
diff
changeset
|
21 |
}; |
|
43629caa77bc
Big refactoring of widget files + started migration of segmentwidget
veltr
parents:
diff
changeset
|
22 |
|
|
43629caa77bc
Big refactoring of widget files + started migration of segmentwidget
veltr
parents:
diff
changeset
|
23 |
IriSP.Widgets.Segments.prototype.template = |
|
937
eb3c442cec50
Added events on annotation for inter widget communication
veltr
parents:
930
diff
changeset
|
24 |
'<div class="Ldt-Segments-List"></div>' |
| 924 | 25 |
+ '<div class="Ldt-Segments-Position"></div>' |
26 |
+ '<div class="Ldt-Segments-Tooltip"></div>'; |
|
|
875
43629caa77bc
Big refactoring of widget files + started migration of segmentwidget
veltr
parents:
diff
changeset
|
27 |
|
|
937
eb3c442cec50
Added events on annotation for inter widget communication
veltr
parents:
930
diff
changeset
|
28 |
IriSP.Widgets.Segments.prototype.annotationTemplate = |
|
996
c472984db275
refactored drag-and-drop interface (IE Compatibility)
veltr
parents:
994
diff
changeset
|
29 |
'<div class="Ldt-Segments-Segment Ldt-TraceMe" trace-info="segment-id:{{id}}, media-id:{{media_id}}, from:{{from}}, to:{{to}}" segment-text="{{text}}"' |
| 1013 | 30 |
+ 'style="top:{{top}}px; height:{{height}}px; left:{{left}}px; width:{{width}}px; background:{{medcolor}}" data-base-color="{{color}}" data-low-color="{{lowcolor}}" data-medium-color="{{medcolor}}"></div>'; |
|
937
eb3c442cec50
Added events on annotation for inter widget communication
veltr
parents:
930
diff
changeset
|
31 |
|
|
eb3c442cec50
Added events on annotation for inter widget communication
veltr
parents:
930
diff
changeset
|
32 |
|
|
875
43629caa77bc
Big refactoring of widget files + started migration of segmentwidget
veltr
parents:
diff
changeset
|
33 |
IriSP.Widgets.Segments.prototype.draw = function() { |
| 957 | 34 |
this.onMediaEvent("timeupdate", "onTimeupdate"); |
|
937
eb3c442cec50
Added events on annotation for inter widget communication
veltr
parents:
930
diff
changeset
|
35 |
this.renderTemplate(); |
|
eb3c442cec50
Added events on annotation for inter widget communication
veltr
parents:
930
diff
changeset
|
36 |
|
| 982 | 37 |
var _list = this.getWidgetAnnotations().filter(function(_ann) { |
38 |
return _ann.getDuration() > 0; |
|
39 |
}), |
|
|
875
43629caa77bc
Big refactoring of widget files + started migration of segmentwidget
veltr
parents:
diff
changeset
|
40 |
_this = this, |
| 983 | 41 |
_scale = this.width / this.source.getDuration(), |
42 |
list_$ = this.$.find('.Ldt-Segments-List'), |
|
| 982 | 43 |
lines = [], |
| 983 | 44 |
zindex = 1, |
45 |
searching = false; |
|
| 982 | 46 |
|
47 |
function saturate(r, g, b, s) { |
|
48 |
function satcomp(c) { |
|
49 |
return Math.floor(240 * (1 - s) + c * s); |
|
50 |
} |
|
51 |
var res = ( 0x10000 * satcomp(r) + 0x100 * satcomp(g) + satcomp(b)).toString(16); |
|
52 |
while (res.length < 6) { |
|
53 |
res = "0" + res; |
|
54 |
} |
|
55 |
return "#" + res; |
|
56 |
} |
|
57 |
|
|
|
937
eb3c442cec50
Added events on annotation for inter widget communication
veltr
parents:
930
diff
changeset
|
58 |
_list.forEach(function(_annotation, _k) { |
|
eb3c442cec50
Added events on annotation for inter widget communication
veltr
parents:
930
diff
changeset
|
59 |
var _left = _annotation.begin * _scale, |
|
eb3c442cec50
Added events on annotation for inter widget communication
veltr
parents:
930
diff
changeset
|
60 |
_width = ( _annotation.getDuration() ) * _scale, |
|
eb3c442cec50
Added events on annotation for inter widget communication
veltr
parents:
930
diff
changeset
|
61 |
_center = Math.floor( _left + _width / 2 ), |
| 982 | 62 |
_fulltext = _annotation.title + ( _annotation.description ? ( '<br/>' + _annotation.description ) : '' ), |
63 |
line = IriSP._(lines).find(function(line) { |
|
64 |
return !IriSP._(line.annotations).find(function(a) { |
|
| 1013 | 65 |
return a.begin < _annotation.end && a.end > _annotation.begin; |
| 982 | 66 |
}); |
67 |
}); |
|
68 |
if (!line) { |
|
69 |
line = { index: lines.length, annotations: []}; |
|
70 |
lines.push(line); |
|
71 |
} |
|
72 |
line.annotations.push(_annotation); |
|
73 |
var _top = ((1 - _this.overlap) * line.index) * _this.line_height, |
|
74 |
color = ( typeof _annotation.color !== "undefined" && _annotation.color ? _annotation.color : _this.colors[_k % _this.colors.length] ), |
|
75 |
r = parseInt(color.substr(1,2),16), |
|
76 |
g = parseInt(color.substr(3,2),16), |
|
77 |
b = parseInt(color.substr(5,2),16), |
|
78 |
medcolor = saturate(r, g, b, .5), |
|
79 |
lowcolor = saturate(r, g, b, .2); |
|
|
937
eb3c442cec50
Added events on annotation for inter widget communication
veltr
parents:
930
diff
changeset
|
80 |
var _data = { |
| 982 | 81 |
color : color, |
82 |
medcolor: medcolor, |
|
83 |
lowcolor: lowcolor, |
|
|
1044
d8339b45edc4
Added support for defining a "time range" for a Playable to set the time boundaries of what can be played by the diffenrent players (Popcorn and HtmlPlayer for now). Added option in Segment widget to define a timerange on click.
durandn
parents:
1033
diff
changeset
|
84 |
text: (_annotation.creator ? (_annotation.creator + " : ") : "" ) + _fulltext.replace(/(\n|\r|\r\n)/mg,' ').replace(/(^.{120,140})[\s].+$/m,'$1…'), |
| 982 | 85 |
left : _left, |
86 |
width : _width, |
|
87 |
top: _top, |
|
88 |
height: _this.line_height - 1, |
|
|
937
eb3c442cec50
Added events on annotation for inter widget communication
veltr
parents:
930
diff
changeset
|
89 |
id : _annotation.id, |
| 990 | 90 |
media_id : _annotation.getMedia().id, |
91 |
from: _annotation.begin.toString(), |
|
92 |
to: _annotation.end.toString() |
|
|
937
eb3c442cec50
Added events on annotation for inter widget communication
veltr
parents:
930
diff
changeset
|
93 |
}; |
|
eb3c442cec50
Added events on annotation for inter widget communication
veltr
parents:
930
diff
changeset
|
94 |
var _html = Mustache.to_html(_this.annotationTemplate, _data), |
|
eb3c442cec50
Added events on annotation for inter widget communication
veltr
parents:
930
diff
changeset
|
95 |
_el = IriSP.jQuery(_html); |
|
1044
d8339b45edc4
Added support for defining a "time range" for a Playable to set the time boundaries of what can be played by the diffenrent players (Popcorn and HtmlPlayer for now). Added option in Segment widget to define a timerange on click.
durandn
parents:
1033
diff
changeset
|
96 |
_el.mouseover(function() { |
|
937
eb3c442cec50
Added events on annotation for inter widget communication
veltr
parents:
930
diff
changeset
|
97 |
_annotation.trigger("select"); |
|
eb3c442cec50
Added events on annotation for inter widget communication
veltr
parents:
930
diff
changeset
|
98 |
}) |
|
eb3c442cec50
Added events on annotation for inter widget communication
veltr
parents:
930
diff
changeset
|
99 |
.mouseout(function() { |
|
eb3c442cec50
Added events on annotation for inter widget communication
veltr
parents:
930
diff
changeset
|
100 |
_annotation.trigger("unselect"); |
|
eb3c442cec50
Added events on annotation for inter widget communication
veltr
parents:
930
diff
changeset
|
101 |
}) |
|
eb3c442cec50
Added events on annotation for inter widget communication
veltr
parents:
930
diff
changeset
|
102 |
.click(function() { |
|
1044
d8339b45edc4
Added support for defining a "time range" for a Playable to set the time boundaries of what can be played by the diffenrent players (Popcorn and HtmlPlayer for now). Added option in Segment widget to define a timerange on click.
durandn
parents:
1033
diff
changeset
|
103 |
if(_this.use_timerange){ |
|
d8339b45edc4
Added support for defining a "time range" for a Playable to set the time boundaries of what can be played by the diffenrent players (Popcorn and HtmlPlayer for now). Added option in Segment widget to define a timerange on click.
durandn
parents:
1033
diff
changeset
|
104 |
if(!_this.media.getTimeRange()){ |
|
1058
ded3cd1312c1
If TimeRange is set, clicking on a segment will play the video
durandn
parents:
1044
diff
changeset
|
105 |
_this.media.setCurrentTime(_annotation.begin); |
|
ded3cd1312c1
If TimeRange is set, clicking on a segment will play the video
durandn
parents:
1044
diff
changeset
|
106 |
_this.media.setTimeRange(_annotation.begin, _annotation.end); |
|
ded3cd1312c1
If TimeRange is set, clicking on a segment will play the video
durandn
parents:
1044
diff
changeset
|
107 |
_this.media.play(); |
|
1044
d8339b45edc4
Added support for defining a "time range" for a Playable to set the time boundaries of what can be played by the diffenrent players (Popcorn and HtmlPlayer for now). Added option in Segment widget to define a timerange on click.
durandn
parents:
1033
diff
changeset
|
108 |
_this.$segments.each(function(){ |
|
d8339b45edc4
Added support for defining a "time range" for a Playable to set the time boundaries of what can be played by the diffenrent players (Popcorn and HtmlPlayer for now). Added option in Segment widget to define a timerange on click.
durandn
parents:
1033
diff
changeset
|
109 |
var _segment = IriSP.jQuery(this); |
|
d8339b45edc4
Added support for defining a "time range" for a Playable to set the time boundaries of what can be played by the diffenrent players (Popcorn and HtmlPlayer for now). Added option in Segment widget to define a timerange on click.
durandn
parents:
1033
diff
changeset
|
110 |
_segment.css("background", lowcolor).removeClass("selected"); |
|
d8339b45edc4
Added support for defining a "time range" for a Playable to set the time boundaries of what can be played by the diffenrent players (Popcorn and HtmlPlayer for now). Added option in Segment widget to define a timerange on click.
durandn
parents:
1033
diff
changeset
|
111 |
}) |
|
d8339b45edc4
Added support for defining a "time range" for a Playable to set the time boundaries of what can be played by the diffenrent players (Popcorn and HtmlPlayer for now). Added option in Segment widget to define a timerange on click.
durandn
parents:
1033
diff
changeset
|
112 |
_el.css("background", _this.selected_color).addClass("selected"); |
|
d8339b45edc4
Added support for defining a "time range" for a Playable to set the time boundaries of what can be played by the diffenrent players (Popcorn and HtmlPlayer for now). Added option in Segment widget to define a timerange on click.
durandn
parents:
1033
diff
changeset
|
113 |
} |
|
d8339b45edc4
Added support for defining a "time range" for a Playable to set the time boundaries of what can be played by the diffenrent players (Popcorn and HtmlPlayer for now). Added option in Segment widget to define a timerange on click.
durandn
parents:
1033
diff
changeset
|
114 |
else if (_this.media.getTimeRange()[0]==_annotation.begin || _this.media.getTimeRange()[1]==_annotation.end){ |
|
d8339b45edc4
Added support for defining a "time range" for a Playable to set the time boundaries of what can be played by the diffenrent players (Popcorn and HtmlPlayer for now). Added option in Segment widget to define a timerange on click.
durandn
parents:
1033
diff
changeset
|
115 |
_this.media.resetTimeRange(); |
|
d8339b45edc4
Added support for defining a "time range" for a Playable to set the time boundaries of what can be played by the diffenrent players (Popcorn and HtmlPlayer for now). Added option in Segment widget to define a timerange on click.
durandn
parents:
1033
diff
changeset
|
116 |
_this.$segments.each(function(){ |
|
d8339b45edc4
Added support for defining a "time range" for a Playable to set the time boundaries of what can be played by the diffenrent players (Popcorn and HtmlPlayer for now). Added option in Segment widget to define a timerange on click.
durandn
parents:
1033
diff
changeset
|
117 |
var _segment = IriSP.jQuery(this); |
|
d8339b45edc4
Added support for defining a "time range" for a Playable to set the time boundaries of what can be played by the diffenrent players (Popcorn and HtmlPlayer for now). Added option in Segment widget to define a timerange on click.
durandn
parents:
1033
diff
changeset
|
118 |
_segment.css("background", lowcolor).removeClass("selected"); |
|
d8339b45edc4
Added support for defining a "time range" for a Playable to set the time boundaries of what can be played by the diffenrent players (Popcorn and HtmlPlayer for now). Added option in Segment widget to define a timerange on click.
durandn
parents:
1033
diff
changeset
|
119 |
_annotation.trigger("select"); |
|
d8339b45edc4
Added support for defining a "time range" for a Playable to set the time boundaries of what can be played by the diffenrent players (Popcorn and HtmlPlayer for now). Added option in Segment widget to define a timerange on click.
durandn
parents:
1033
diff
changeset
|
120 |
}) |
|
d8339b45edc4
Added support for defining a "time range" for a Playable to set the time boundaries of what can be played by the diffenrent players (Popcorn and HtmlPlayer for now). Added option in Segment widget to define a timerange on click.
durandn
parents:
1033
diff
changeset
|
121 |
} |
|
d8339b45edc4
Added support for defining a "time range" for a Playable to set the time boundaries of what can be played by the diffenrent players (Popcorn and HtmlPlayer for now). Added option in Segment widget to define a timerange on click.
durandn
parents:
1033
diff
changeset
|
122 |
else { |
|
1058
ded3cd1312c1
If TimeRange is set, clicking on a segment will play the video
durandn
parents:
1044
diff
changeset
|
123 |
_this.media.setCurrentTime(_annotation.begin); |
|
1044
d8339b45edc4
Added support for defining a "time range" for a Playable to set the time boundaries of what can be played by the diffenrent players (Popcorn and HtmlPlayer for now). Added option in Segment widget to define a timerange on click.
durandn
parents:
1033
diff
changeset
|
124 |
_this.media.setTimeRange(_annotation.begin, _annotation.end); |
|
1058
ded3cd1312c1
If TimeRange is set, clicking on a segment will play the video
durandn
parents:
1044
diff
changeset
|
125 |
_this.media.play(); |
|
1044
d8339b45edc4
Added support for defining a "time range" for a Playable to set the time boundaries of what can be played by the diffenrent players (Popcorn and HtmlPlayer for now). Added option in Segment widget to define a timerange on click.
durandn
parents:
1033
diff
changeset
|
126 |
_this.$segments.each(function(){ |
|
d8339b45edc4
Added support for defining a "time range" for a Playable to set the time boundaries of what can be played by the diffenrent players (Popcorn and HtmlPlayer for now). Added option in Segment widget to define a timerange on click.
durandn
parents:
1033
diff
changeset
|
127 |
var _segment = IriSP.jQuery(this); |
|
d8339b45edc4
Added support for defining a "time range" for a Playable to set the time boundaries of what can be played by the diffenrent players (Popcorn and HtmlPlayer for now). Added option in Segment widget to define a timerange on click.
durandn
parents:
1033
diff
changeset
|
128 |
_segment.css("background", lowcolor).removeClass("selected"); |
|
d8339b45edc4
Added support for defining a "time range" for a Playable to set the time boundaries of what can be played by the diffenrent players (Popcorn and HtmlPlayer for now). Added option in Segment widget to define a timerange on click.
durandn
parents:
1033
diff
changeset
|
129 |
}) |
|
d8339b45edc4
Added support for defining a "time range" for a Playable to set the time boundaries of what can be played by the diffenrent players (Popcorn and HtmlPlayer for now). Added option in Segment widget to define a timerange on click.
durandn
parents:
1033
diff
changeset
|
130 |
_el.css("background", _this.selected_color).addClass("selected"); |
|
d8339b45edc4
Added support for defining a "time range" for a Playable to set the time boundaries of what can be played by the diffenrent players (Popcorn and HtmlPlayer for now). Added option in Segment widget to define a timerange on click.
durandn
parents:
1033
diff
changeset
|
131 |
} |
|
d8339b45edc4
Added support for defining a "time range" for a Playable to set the time boundaries of what can be played by the diffenrent players (Popcorn and HtmlPlayer for now). Added option in Segment widget to define a timerange on click.
durandn
parents:
1033
diff
changeset
|
132 |
} |
| 964 | 133 |
_annotation.trigger("click"); |
|
937
eb3c442cec50
Added events on annotation for inter widget communication
veltr
parents:
930
diff
changeset
|
134 |
}) |
|
996
c472984db275
refactored drag-and-drop interface (IE Compatibility)
veltr
parents:
994
diff
changeset
|
135 |
.appendTo(list_$); |
|
c472984db275
refactored drag-and-drop interface (IE Compatibility)
veltr
parents:
994
diff
changeset
|
136 |
IriSP.attachDndData(_el, { |
|
c472984db275
refactored drag-and-drop interface (IE Compatibility)
veltr
parents:
994
diff
changeset
|
137 |
title: _annotation.title, |
|
c472984db275
refactored drag-and-drop interface (IE Compatibility)
veltr
parents:
994
diff
changeset
|
138 |
description: _annotation.description, |
|
c472984db275
refactored drag-and-drop interface (IE Compatibility)
veltr
parents:
994
diff
changeset
|
139 |
uri: (typeof _annotation.url !== "undefined" |
|
c472984db275
refactored drag-and-drop interface (IE Compatibility)
veltr
parents:
994
diff
changeset
|
140 |
? _annotation.url |
|
c472984db275
refactored drag-and-drop interface (IE Compatibility)
veltr
parents:
994
diff
changeset
|
141 |
: (document.location.href.replace(/#.*$/,'') + '#id=' + _annotation.id)), |
|
c472984db275
refactored drag-and-drop interface (IE Compatibility)
veltr
parents:
994
diff
changeset
|
142 |
image: _annotation.thumbnail |
|
c472984db275
refactored drag-and-drop interface (IE Compatibility)
veltr
parents:
994
diff
changeset
|
143 |
}); |
|
937
eb3c442cec50
Added events on annotation for inter widget communication
veltr
parents:
930
diff
changeset
|
144 |
_annotation.on("select", function() { |
| 982 | 145 |
_this.$segments.each(function() { |
146 |
var _segment = IriSP.jQuery(this); |
|
147 |
_segment.css({ |
|
| 983 | 148 |
background: _segment.hasClass("found") ? _this.faded_found_color : _segment.attr("data-low-color") |
| 982 | 149 |
}); |
|
1044
d8339b45edc4
Added support for defining a "time range" for a Playable to set the time boundaries of what can be played by the diffenrent players (Popcorn and HtmlPlayer for now). Added option in Segment widget to define a timerange on click.
durandn
parents:
1033
diff
changeset
|
150 |
_segment.css({ |
|
d8339b45edc4
Added support for defining a "time range" for a Playable to set the time boundaries of what can be played by the diffenrent players (Popcorn and HtmlPlayer for now). Added option in Segment widget to define a timerange on click.
durandn
parents:
1033
diff
changeset
|
151 |
background: _segment.hasClass("selected") ? _this.faded_selected_color : _segment.attr("data-low-color") |
|
d8339b45edc4
Added support for defining a "time range" for a Playable to set the time boundaries of what can be played by the diffenrent players (Popcorn and HtmlPlayer for now). Added option in Segment widget to define a timerange on click.
durandn
parents:
1033
diff
changeset
|
152 |
}) |
| 982 | 153 |
}); |
| 983 | 154 |
_el.css({ |
155 |
background: _el.hasClass("found") ? _this.found_color: color, |
|
|
1044
d8339b45edc4
Added support for defining a "time range" for a Playable to set the time boundaries of what can be played by the diffenrent players (Popcorn and HtmlPlayer for now). Added option in Segment widget to define a timerange on click.
durandn
parents:
1033
diff
changeset
|
156 |
background: _el.hasClass("selected") ? _this.selected_color: color, |
| 983 | 157 |
"z-index": ++zindex |
158 |
}); |
|
| 986 | 159 |
if (_this.tooltip) { |
160 |
_this.tooltip.show( _center, _top, _data.text, _data.color ); |
|
161 |
} |
|
| 983 | 162 |
}); |
163 |
_annotation.on("unselect", function() { |
|
| 986 | 164 |
if (_this.tooltip) { |
165 |
_this.tooltip.hide(); |
|
166 |
} |
|
| 983 | 167 |
_this.$segments.each(function() { |
168 |
var _segment = IriSP.jQuery(this); |
|
169 |
_segment.css("background", _segment.hasClass("found") ? _this.found_color : _segment.attr(searching ? "data-low-color" : "data-medium-color")); |
|
|
1044
d8339b45edc4
Added support for defining a "time range" for a Playable to set the time boundaries of what can be played by the diffenrent players (Popcorn and HtmlPlayer for now). Added option in Segment widget to define a timerange on click.
durandn
parents:
1033
diff
changeset
|
170 |
_segment.css("background", _segment.hasClass("selected") ? _this.selected_color : _segment.attr(searching ? "data-low-color" : "data-medium-color")); |
| 982 | 171 |
}); |
|
937
eb3c442cec50
Added events on annotation for inter widget communication
veltr
parents:
930
diff
changeset
|
172 |
}); |
| 983 | 173 |
_annotation.on("found", function() { |
174 |
_el.css("background", _this.found_color).addClass("found"); |
|
175 |
}); |
|
176 |
_annotation.on("not-found", function() { |
|
177 |
_el.css("background", lowcolor).removeClass("found"); |
|
178 |
}); |
|
| 982 | 179 |
}); |
180 |
|
|
181 |
this.$.css({ |
|
182 |
width : this.width + "px", |
|
183 |
height : (((1 - this.overlap) * lines.length + this.overlap) * this.line_height) + "px", |
|
184 |
background : this.background, |
|
185 |
margin: "1px 0" |
|
|
937
eb3c442cec50
Added events on annotation for inter widget communication
veltr
parents:
930
diff
changeset
|
186 |
}); |
|
1044
d8339b45edc4
Added support for defining a "time range" for a Playable to set the time boundaries of what can be played by the diffenrent players (Popcorn and HtmlPlayer for now). Added option in Segment widget to define a timerange on click.
durandn
parents:
1033
diff
changeset
|
187 |
if (!this.no_tooltip){ |
|
d8339b45edc4
Added support for defining a "time range" for a Playable to set the time boundaries of what can be played by the diffenrent players (Popcorn and HtmlPlayer for now). Added option in Segment widget to define a timerange on click.
durandn
parents:
1033
diff
changeset
|
188 |
this.insertSubwidget( |
|
d8339b45edc4
Added support for defining a "time range" for a Playable to set the time boundaries of what can be played by the diffenrent players (Popcorn and HtmlPlayer for now). Added option in Segment widget to define a timerange on click.
durandn
parents:
1033
diff
changeset
|
189 |
this.$.find(".Ldt-Segments-Tooltip"), |
|
d8339b45edc4
Added support for defining a "time range" for a Playable to set the time boundaries of what can be played by the diffenrent players (Popcorn and HtmlPlayer for now). Added option in Segment widget to define a timerange on click.
durandn
parents:
1033
diff
changeset
|
190 |
{ |
|
d8339b45edc4
Added support for defining a "time range" for a Playable to set the time boundaries of what can be played by the diffenrent players (Popcorn and HtmlPlayer for now). Added option in Segment widget to define a timerange on click.
durandn
parents:
1033
diff
changeset
|
191 |
type: "Tooltip", |
|
d8339b45edc4
Added support for defining a "time range" for a Playable to set the time boundaries of what can be played by the diffenrent players (Popcorn and HtmlPlayer for now). Added option in Segment widget to define a timerange on click.
durandn
parents:
1033
diff
changeset
|
192 |
min_x: 0, |
|
d8339b45edc4
Added support for defining a "time range" for a Playable to set the time boundaries of what can be played by the diffenrent players (Popcorn and HtmlPlayer for now). Added option in Segment widget to define a timerange on click.
durandn
parents:
1033
diff
changeset
|
193 |
max_x: this.width |
|
d8339b45edc4
Added support for defining a "time range" for a Playable to set the time boundaries of what can be played by the diffenrent players (Popcorn and HtmlPlayer for now). Added option in Segment widget to define a timerange on click.
durandn
parents:
1033
diff
changeset
|
194 |
}, |
|
d8339b45edc4
Added support for defining a "time range" for a Playable to set the time boundaries of what can be played by the diffenrent players (Popcorn and HtmlPlayer for now). Added option in Segment widget to define a timerange on click.
durandn
parents:
1033
diff
changeset
|
195 |
"tooltip" |
|
d8339b45edc4
Added support for defining a "time range" for a Playable to set the time boundaries of what can be played by the diffenrent players (Popcorn and HtmlPlayer for now). Added option in Segment widget to define a timerange on click.
durandn
parents:
1033
diff
changeset
|
196 |
); |
|
d8339b45edc4
Added support for defining a "time range" for a Playable to set the time boundaries of what can be played by the diffenrent players (Popcorn and HtmlPlayer for now). Added option in Segment widget to define a timerange on click.
durandn
parents:
1033
diff
changeset
|
197 |
} |
| 876 | 198 |
this.$segments = this.$.find('.Ldt-Segments-Segment'); |
| 983 | 199 |
this.source.getAnnotations().on("search", function() { |
200 |
searching = true; |
|
201 |
}); |
|
202 |
this.source.getAnnotations().on("search-cleared", function() { |
|
203 |
searching = false; |
|
| 982 | 204 |
_this.$segments.each(function() { |
205 |
var _segment = IriSP.jQuery(this); |
|
| 983 | 206 |
_segment.css("background", _segment.attr("data-medium-color")).removeClass("found"); |
| 982 | 207 |
}); |
| 983 | 208 |
}); |
| 1013 | 209 |
}; |
| 876 | 210 |
|
|
1044
d8339b45edc4
Added support for defining a "time range" for a Playable to set the time boundaries of what can be played by the diffenrent players (Popcorn and HtmlPlayer for now). Added option in Segment widget to define a timerange on click.
durandn
parents:
1033
diff
changeset
|
211 |
IriSP.Widgets.Segments.prototype.onTimeupdate = function(_time) { |
| 957 | 212 |
var _x = Math.floor( this.width * _time / this.media.duration); |
| 876 | 213 |
this.$.find('.Ldt-Segments-Position').css({ |
214 |
left: _x + "px" |
|
| 1013 | 215 |
}); |
| 1033 | 216 |
}; |
|
1044
d8339b45edc4
Added support for defining a "time range" for a Playable to set the time boundaries of what can be played by the diffenrent players (Popcorn and HtmlPlayer for now). Added option in Segment widget to define a timerange on click.
durandn
parents:
1033
diff
changeset
|
217 |