| author | veltr |
| Wed, 09 Oct 2013 18:40:40 +0200 | |
| changeset 1017 | b6e39f6fd24f |
| parent 1012 | 7e18d953a1f8 |
| child 1021 | 7253d4d06f0d |
| permissions | -rw-r--r-- |
|
875
43629caa77bc
Big refactoring of widget files + started migration of segmentwidget
veltr
parents:
874
diff
changeset
|
1 |
IriSP.Widgets.Polemic = function(player, config) { |
|
43629caa77bc
Big refactoring of widget files + started migration of segmentwidget
veltr
parents:
874
diff
changeset
|
2 |
IriSP.Widgets.Widget.call(this, player, config); |
| 169 | 3 |
}; |
4 |
||
|
875
43629caa77bc
Big refactoring of widget files + started migration of segmentwidget
veltr
parents:
874
diff
changeset
|
5 |
IriSP.Widgets.Polemic.prototype = new IriSP.Widgets.Widget(); |
| 187 | 6 |
|
| 882 | 7 |
IriSP.Widgets.Polemic.prototype.messages = { |
8 |
fr: { |
|
9 |
from_: "de ", |
|
10 |
_to_: " à ", |
|
11 |
_annotations: " annotation(s)" |
|
12 |
}, |
|
13 |
en: { |
|
14 |
from_: "from ", |
|
15 |
_to_: " to ", |
|
16 |
_annotations: " annotation(s)" |
|
17 |
} |
|
| 1012 | 18 |
}; |
19 |
||
|
875
43629caa77bc
Big refactoring of widget files + started migration of segmentwidget
veltr
parents:
874
diff
changeset
|
20 |
IriSP.Widgets.Polemic.prototype.defaults = { |
|
43629caa77bc
Big refactoring of widget files + started migration of segmentwidget
veltr
parents:
874
diff
changeset
|
21 |
element_width : 5, |
|
43629caa77bc
Big refactoring of widget files + started migration of segmentwidget
veltr
parents:
874
diff
changeset
|
22 |
element_height : 5, |
| 987 | 23 |
max_elements: 20, |
|
875
43629caa77bc
Big refactoring of widget files + started migration of segmentwidget
veltr
parents:
874
diff
changeset
|
24 |
annotation_type : "tweet", |
| 1017 | 25 |
only_allow_zero_duration_annotations: true, |
|
875
43629caa77bc
Big refactoring of widget files + started migration of segmentwidget
veltr
parents:
874
diff
changeset
|
26 |
defaultcolor : "#585858", |
|
43629caa77bc
Big refactoring of widget files + started migration of segmentwidget
veltr
parents:
874
diff
changeset
|
27 |
foundcolor : "#fc00ff", |
| 880 | 28 |
polemics : [ |
|
875
43629caa77bc
Big refactoring of widget files + started migration of segmentwidget
veltr
parents:
874
diff
changeset
|
29 |
{ |
| 930 | 30 |
"name" : "OK", |
|
875
43629caa77bc
Big refactoring of widget files + started migration of segmentwidget
veltr
parents:
874
diff
changeset
|
31 |
"keywords" : [ "++" ], |
|
43629caa77bc
Big refactoring of widget files + started migration of segmentwidget
veltr
parents:
874
diff
changeset
|
32 |
"color" : "#1D973D" |
|
43629caa77bc
Big refactoring of widget files + started migration of segmentwidget
veltr
parents:
874
diff
changeset
|
33 |
}, |
|
43629caa77bc
Big refactoring of widget files + started migration of segmentwidget
veltr
parents:
874
diff
changeset
|
34 |
{ |
| 930 | 35 |
"name" : "KO", |
|
875
43629caa77bc
Big refactoring of widget files + started migration of segmentwidget
veltr
parents:
874
diff
changeset
|
36 |
"keywords" : [ "--" ], |
|
43629caa77bc
Big refactoring of widget files + started migration of segmentwidget
veltr
parents:
874
diff
changeset
|
37 |
"color" : "#CE0A15" |
|
43629caa77bc
Big refactoring of widget files + started migration of segmentwidget
veltr
parents:
874
diff
changeset
|
38 |
}, |
|
43629caa77bc
Big refactoring of widget files + started migration of segmentwidget
veltr
parents:
874
diff
changeset
|
39 |
{ |
| 930 | 40 |
"name" : "REF", |
| 909 | 41 |
"keywords" : [ "==", "http://" ], |
|
875
43629caa77bc
Big refactoring of widget files + started migration of segmentwidget
veltr
parents:
874
diff
changeset
|
42 |
"color" : "#C5A62D" |
|
43629caa77bc
Big refactoring of widget files + started migration of segmentwidget
veltr
parents:
874
diff
changeset
|
43 |
}, |
|
43629caa77bc
Big refactoring of widget files + started migration of segmentwidget
veltr
parents:
874
diff
changeset
|
44 |
{ |
| 930 | 45 |
"name" : "Q", |
| 909 | 46 |
"keywords" : [ "?" ], |
|
875
43629caa77bc
Big refactoring of widget files + started migration of segmentwidget
veltr
parents:
874
diff
changeset
|
47 |
"color" : "#036AAE" |
|
43629caa77bc
Big refactoring of widget files + started migration of segmentwidget
veltr
parents:
874
diff
changeset
|
48 |
} |
|
43629caa77bc
Big refactoring of widget files + started migration of segmentwidget
veltr
parents:
874
diff
changeset
|
49 |
] |
|
43629caa77bc
Big refactoring of widget files + started migration of segmentwidget
veltr
parents:
874
diff
changeset
|
50 |
}; |
|
43629caa77bc
Big refactoring of widget files + started migration of segmentwidget
veltr
parents:
874
diff
changeset
|
51 |
|
|
43629caa77bc
Big refactoring of widget files + started migration of segmentwidget
veltr
parents:
874
diff
changeset
|
52 |
IriSP.Widgets.Polemic.prototype.draw = function() { |
|
43629caa77bc
Big refactoring of widget files + started migration of segmentwidget
veltr
parents:
874
diff
changeset
|
53 |
|
| 957 | 54 |
this.onMediaEvent("timeupdate", "onTimeupdate"); |
|
875
43629caa77bc
Big refactoring of widget files + started migration of segmentwidget
veltr
parents:
874
diff
changeset
|
55 |
this.$zone = IriSP.jQuery('<div>'); |
| 882 | 56 |
this.$zone.addClass("Ldt-Polemic"); |
|
875
43629caa77bc
Big refactoring of widget files + started migration of segmentwidget
veltr
parents:
874
diff
changeset
|
57 |
this.$.append(this.$zone); |
|
43629caa77bc
Big refactoring of widget files + started migration of segmentwidget
veltr
parents:
874
diff
changeset
|
58 |
|
| 882 | 59 |
this.$elapsed = IriSP.jQuery('<div>') |
60 |
.css({ |
|
61 |
background: '#cccccc', |
|
62 |
position: "absolute", |
|
63 |
top: 0, |
|
64 |
left: 0, |
|
65 |
width: 0, |
|
66 |
height: "100%" |
|
67 |
}); |
|
68 |
|
|
69 |
this.$zone.append(this.$elapsed); |
|
70 |
|
|
|
874
38b65761a7d5
TooltipWidget, SliderWidget, corrections in AnnotationList, CSS are now split
veltr
parents:
842
diff
changeset
|
71 |
var _slices = [], |
|
875
43629caa77bc
Big refactoring of widget files + started migration of segmentwidget
veltr
parents:
874
diff
changeset
|
72 |
_slice_count = Math.floor( this.width / this.element_width ), |
|
874
38b65761a7d5
TooltipWidget, SliderWidget, corrections in AnnotationList, CSS are now split
veltr
parents:
842
diff
changeset
|
73 |
_duration = this.source.getDuration(), |
|
38b65761a7d5
TooltipWidget, SliderWidget, corrections in AnnotationList, CSS are now split
veltr
parents:
842
diff
changeset
|
74 |
_max = 0, |
| 1017 | 75 |
_this = this, |
76 |
_list = this.getWidgetAnnotations(); |
|
77 |
|
|
78 |
if (this.only_allow_zero_duration_annotations) { |
|
79 |
_list = _list.filter(function(_a) { |
|
| 1012 | 80 |
return !_a.getDuration().milliseconds; |
| 1017 | 81 |
}); |
82 |
} |
|
|
874
38b65761a7d5
TooltipWidget, SliderWidget, corrections in AnnotationList, CSS are now split
veltr
parents:
842
diff
changeset
|
83 |
|
|
875
43629caa77bc
Big refactoring of widget files + started migration of segmentwidget
veltr
parents:
874
diff
changeset
|
84 |
for (var _i = 0; _i < _slice_count; _i++) { |
|
43629caa77bc
Big refactoring of widget files + started migration of segmentwidget
veltr
parents:
874
diff
changeset
|
85 |
var _begin = new IriSP.Model.Time( _i * _duration / _slice_count ), |
|
43629caa77bc
Big refactoring of widget files + started migration of segmentwidget
veltr
parents:
874
diff
changeset
|
86 |
_end = new IriSP.Model.Time( ( _i + 1 ) * _duration / _slice_count ), |
|
874
38b65761a7d5
TooltipWidget, SliderWidget, corrections in AnnotationList, CSS are now split
veltr
parents:
842
diff
changeset
|
87 |
_count = 0, |
|
38b65761a7d5
TooltipWidget, SliderWidget, corrections in AnnotationList, CSS are now split
veltr
parents:
842
diff
changeset
|
88 |
_res = { |
| 882 | 89 |
begin : _begin.toString(), |
90 |
end : _end.toString(), |
|
|
874
38b65761a7d5
TooltipWidget, SliderWidget, corrections in AnnotationList, CSS are now split
veltr
parents:
842
diff
changeset
|
91 |
annotations : _list.filter(function(_annotation) { |
| 1004 | 92 |
return _annotation.begin >= _begin && _annotation.begin < _end; |
|
874
38b65761a7d5
TooltipWidget, SliderWidget, corrections in AnnotationList, CSS are now split
veltr
parents:
842
diff
changeset
|
93 |
}), |
|
38b65761a7d5
TooltipWidget, SliderWidget, corrections in AnnotationList, CSS are now split
veltr
parents:
842
diff
changeset
|
94 |
polemicStacks : [] |
| 1012 | 95 |
}; |
|
566
098929cd2d62
made the polemicwidget adjust its size automatically and fixed a couple edgecases.
hamidouk
parents:
565
diff
changeset
|
96 |
|
| 880 | 97 |
for (var _j = 0; _j < this.polemics.length; _j++) { |
98 |
var _polemic = _res.annotations.searchByDescription(this.polemics[_j].keywords); |
|
|
874
38b65761a7d5
TooltipWidget, SliderWidget, corrections in AnnotationList, CSS are now split
veltr
parents:
842
diff
changeset
|
99 |
_count += _polemic.length; |
|
38b65761a7d5
TooltipWidget, SliderWidget, corrections in AnnotationList, CSS are now split
veltr
parents:
842
diff
changeset
|
100 |
_res.polemicStacks.push(_polemic); |
|
38b65761a7d5
TooltipWidget, SliderWidget, corrections in AnnotationList, CSS are now split
veltr
parents:
842
diff
changeset
|
101 |
} |
| 880 | 102 |
for (var _j = 0; _j < this.polemics.length; _j++) { |
|
874
38b65761a7d5
TooltipWidget, SliderWidget, corrections in AnnotationList, CSS are now split
veltr
parents:
842
diff
changeset
|
103 |
_res.annotations.removeElements(_res.polemicStacks[_j]); |
| 207 | 104 |
} |
|
874
38b65761a7d5
TooltipWidget, SliderWidget, corrections in AnnotationList, CSS are now split
veltr
parents:
842
diff
changeset
|
105 |
_count += _res.annotations.length; |
|
38b65761a7d5
TooltipWidget, SliderWidget, corrections in AnnotationList, CSS are now split
veltr
parents:
842
diff
changeset
|
106 |
_max = Math.max(_max, _count); |
|
38b65761a7d5
TooltipWidget, SliderWidget, corrections in AnnotationList, CSS are now split
veltr
parents:
842
diff
changeset
|
107 |
_slices.push(_res); |
|
38b65761a7d5
TooltipWidget, SliderWidget, corrections in AnnotationList, CSS are now split
veltr
parents:
842
diff
changeset
|
108 |
} |
| 882 | 109 |
if (_max < this.max_elements) { |
110 |
this.is_stackgraph = false; |
|
111 |
if (_max) { |
|
112 |
|
|
113 |
this.height = (2 + _max) * this.element_height; |
|
114 |
this.$zone.css({ |
|
115 |
width: this.width + "px", |
|
116 |
height: this.height + "px", |
|
117 |
position: "relative" |
|
118 |
}); |
|
119 |
|
|
|
937
eb3c442cec50
Added events on annotation for inter widget communication
veltr
parents:
930
diff
changeset
|
120 |
var _x = 0; |
| 882 | 121 |
|
|
937
eb3c442cec50
Added events on annotation for inter widget communication
veltr
parents:
930
diff
changeset
|
122 |
function displayAnnotation(_elx, _ely, _pol, _col, _annotation) { |
|
eb3c442cec50
Added events on annotation for inter widget communication
veltr
parents:
930
diff
changeset
|
123 |
var _html = Mustache.to_html( |
|
996
c472984db275
refactored drag-and-drop interface (IE Compatibility)
veltr
parents:
994
diff
changeset
|
124 |
'<div class="Ldt-Polemic-TweetDiv Ldt-TraceMe" trace-info="annotation-id:{{id}}, media-id:{{media_id}}, polemic:{{polemic}}, time:{{time}}" polemic-color="{{color}}"' |
|
937
eb3c442cec50
Added events on annotation for inter widget communication
veltr
parents:
930
diff
changeset
|
125 |
+ ' tweet-title="{{title}}" annotation-id="{{id}}" style="width: {{width}}px; height: {{height}}px; top: {{top}}px; left: {{left}}px; background: {{color}}"></div>', |
| 882 | 126 |
{ |
|
937
eb3c442cec50
Added events on annotation for inter widget communication
veltr
parents:
930
diff
changeset
|
127 |
id: _annotation.id, |
| 930 | 128 |
media_id: _this.source.currentMedia.id, |
|
937
eb3c442cec50
Added events on annotation for inter widget communication
veltr
parents:
930
diff
changeset
|
129 |
polemic: _pol, |
|
eb3c442cec50
Added events on annotation for inter widget communication
veltr
parents:
930
diff
changeset
|
130 |
left: _elx, |
|
eb3c442cec50
Added events on annotation for inter widget communication
veltr
parents:
930
diff
changeset
|
131 |
top: _ely, |
|
eb3c442cec50
Added events on annotation for inter widget communication
veltr
parents:
930
diff
changeset
|
132 |
color: _col, |
| 882 | 133 |
width: (_this.element_width-1), |
|
937
eb3c442cec50
Added events on annotation for inter widget communication
veltr
parents:
930
diff
changeset
|
134 |
height: _this.element_height, |
| 990 | 135 |
title: _annotation.title, |
136 |
time: _annotation.begin.toString() |
|
|
937
eb3c442cec50
Added events on annotation for inter widget communication
veltr
parents:
930
diff
changeset
|
137 |
}); |
|
eb3c442cec50
Added events on annotation for inter widget communication
veltr
parents:
930
diff
changeset
|
138 |
var _el = IriSP.jQuery(_html); |
|
eb3c442cec50
Added events on annotation for inter widget communication
veltr
parents:
930
diff
changeset
|
139 |
_el.mouseover(function() { |
|
eb3c442cec50
Added events on annotation for inter widget communication
veltr
parents:
930
diff
changeset
|
140 |
_annotation.trigger("select"); |
|
eb3c442cec50
Added events on annotation for inter widget communication
veltr
parents:
930
diff
changeset
|
141 |
}).mouseout(function() { |
|
eb3c442cec50
Added events on annotation for inter widget communication
veltr
parents:
930
diff
changeset
|
142 |
_annotation.trigger("unselect"); |
|
eb3c442cec50
Added events on annotation for inter widget communication
veltr
parents:
930
diff
changeset
|
143 |
}).click(function() { |
| 964 | 144 |
_annotation.trigger("click"); |
| 1004 | 145 |
return false; |
|
996
c472984db275
refactored drag-and-drop interface (IE Compatibility)
veltr
parents:
994
diff
changeset
|
146 |
}); |
|
c472984db275
refactored drag-and-drop interface (IE Compatibility)
veltr
parents:
994
diff
changeset
|
147 |
IriSP.attachDndData(_el, { |
| 1017 | 148 |
title: _annotation.title, |
149 |
description: _annotation.description, |
|
150 |
image: _annotation.thumbnail, |
|
151 |
uri: (typeof _annotation.url !== "undefined" |
|
152 |
? _annotation.url |
|
153 |
: (document.location.href.replace(/#.*$/,'') + '#id=' + _annotation.id)) |
|
|
996
c472984db275
refactored drag-and-drop interface (IE Compatibility)
veltr
parents:
994
diff
changeset
|
154 |
}); |
|
937
eb3c442cec50
Added events on annotation for inter widget communication
veltr
parents:
930
diff
changeset
|
155 |
_annotation.on("select", function() { |
| 986 | 156 |
if (_this.tooltip) { |
157 |
_this.tooltip.show( |
|
| 987 | 158 |
+ Math.floor(_elx + (_this.element_width - 1) / 2), |
159 |
+ _ely, |
|
| 986 | 160 |
_annotation.title, |
161 |
_col |
|
162 |
); |
|
163 |
} |
|
|
937
eb3c442cec50
Added events on annotation for inter widget communication
veltr
parents:
930
diff
changeset
|
164 |
_this.$tweets.each(function() { |
|
eb3c442cec50
Added events on annotation for inter widget communication
veltr
parents:
930
diff
changeset
|
165 |
var _e = IriSP.jQuery(this); |
|
eb3c442cec50
Added events on annotation for inter widget communication
veltr
parents:
930
diff
changeset
|
166 |
_e.css( |
|
eb3c442cec50
Added events on annotation for inter widget communication
veltr
parents:
930
diff
changeset
|
167 |
"opacity", |
|
eb3c442cec50
Added events on annotation for inter widget communication
veltr
parents:
930
diff
changeset
|
168 |
( _e.attr("annotation-id") == _annotation.id ? 1 : .3 ) |
|
eb3c442cec50
Added events on annotation for inter widget communication
veltr
parents:
930
diff
changeset
|
169 |
); |
|
eb3c442cec50
Added events on annotation for inter widget communication
veltr
parents:
930
diff
changeset
|
170 |
}); |
|
eb3c442cec50
Added events on annotation for inter widget communication
veltr
parents:
930
diff
changeset
|
171 |
}); |
|
eb3c442cec50
Added events on annotation for inter widget communication
veltr
parents:
930
diff
changeset
|
172 |
_annotation.on("unselect", function() { |
| 986 | 173 |
if (_this.tooltip) { |
174 |
_this.tooltip.hide(); |
|
175 |
} |
|
|
937
eb3c442cec50
Added events on annotation for inter widget communication
veltr
parents:
930
diff
changeset
|
176 |
_this.$tweets.css("opacity",1); |
|
eb3c442cec50
Added events on annotation for inter widget communication
veltr
parents:
930
diff
changeset
|
177 |
}); |
| 983 | 178 |
_annotation.on("found", function() { |
179 |
_el.css({ |
|
180 |
"background" : _this.foundcolor, |
|
181 |
"opacity" : 1 |
|
182 |
}); |
|
183 |
}); |
|
184 |
_annotation.on("not-found", function() { |
|
185 |
_el.css({ |
|
186 |
"background" : _col, |
|
187 |
"opacity" : .3 |
|
188 |
}); |
|
189 |
}); |
|
|
937
eb3c442cec50
Added events on annotation for inter widget communication
veltr
parents:
930
diff
changeset
|
190 |
_this.$zone.append(_el); |
| 882 | 191 |
} |
192 |
|
|
193 |
IriSP._(_slices).forEach(function(_slice) { |
|
194 |
var _y = _this.height; |
|
195 |
_slice.annotations.forEach(function(_annotation) { |
|
196 |
_y -= _this.element_height; |
|
|
937
eb3c442cec50
Added events on annotation for inter widget communication
veltr
parents:
930
diff
changeset
|
197 |
displayAnnotation(_x, _y, "none", _this.defaultcolor, _annotation); |
| 882 | 198 |
}); |
199 |
IriSP._(_slice.polemicStacks).forEach(function(_annotations, _j) { |
|
| 930 | 200 |
var _color = _this.polemics[_j].color, |
201 |
_polemic = _this.polemics[_j].name; |
|
| 882 | 202 |
_annotations.forEach(function(_annotation) { |
203 |
_y -= _this.element_height; |
|
|
937
eb3c442cec50
Added events on annotation for inter widget communication
veltr
parents:
930
diff
changeset
|
204 |
displayAnnotation(_x, _y, _polemic, _color, _annotation); |
| 882 | 205 |
}); |
206 |
}); |
|
207 |
_x += _this.element_width; |
|
208 |
}); |
|
209 |
|
|
210 |
this.$zone.append(_html); |
|
211 |
|
|
212 |
this.$tweets = this.$.find(".Ldt-Polemic-TweetDiv"); |
|
213 |
|
|
| 983 | 214 |
this.source.getAnnotations().on("search-cleared", function() { |
215 |
_this.$tweets.each(function() { |
|
216 |
var _el = IriSP.jQuery(this); |
|
217 |
_el.css({ |
|
218 |
"background" : _el.attr("polemic-color"), |
|
219 |
"opacity" : 1 |
|
220 |
}); |
|
221 |
}); |
|
222 |
}); |
|
| 882 | 223 |
|
224 |
} else { |
|
225 |
this.$zone.hide(); |
|
226 |
} |
|
227 |
} else { |
|
228 |
this.is_stackgraph = true; |
|
229 |
|
|
230 |
this.height = (2 + this.max_elements) * this.element_height; |
|
231 |
this.$zone.css({ |
|
232 |
width: this.width + "px", |
|
233 |
height: this.height + "px", |
|
234 |
position: "relative" |
|
|
874
38b65761a7d5
TooltipWidget, SliderWidget, corrections in AnnotationList, CSS are now split
veltr
parents:
842
diff
changeset
|
235 |
}); |
|
38b65761a7d5
TooltipWidget, SliderWidget, corrections in AnnotationList, CSS are now split
veltr
parents:
842
diff
changeset
|
236 |
|
| 882 | 237 |
var _x = 0, |
238 |
_html = '', |
|
239 |
_scale = this.max_elements * this.element_height / _max; |
|
240 |
|
|
| 930 | 241 |
function displayStackElement(_x, _y, _h, _color, _nums, _begin, _end, _polemic) { |
| 882 | 242 |
_html += Mustache.to_html( |
| 930 | 243 |
'<div class="Ldt-Polemic-TweetDiv Ldt-TraceMe" trace-info="annotation-block, media-id={{media_id}}, polemic={{polemic}}, time:{{begin}}" pos-x="{{posx}}" pos-y="{{top}}" annotation-counts="{{nums}}" begin-time="{{begin}}" end-time="{{end}}"' |
| 882 | 244 |
+ ' style="width: {{width}}px; height: {{height}}px; top: {{top}}px; left: {{left}}px; background: {{color}}"></div>', |
245 |
{ |
|
246 |
nums: _nums, |
|
247 |
posx: Math.floor(_x + (_this.element_width - 1) / 2), |
|
| 930 | 248 |
media_id: _this.source.currentMedia.id, |
249 |
polemic: _polemic, |
|
| 882 | 250 |
left: _x, |
251 |
top: _y, |
|
252 |
color: _color, |
|
253 |
width: (_this.element_width-1), |
|
254 |
height: _h, |
|
255 |
begin: _begin, |
|
256 |
end: _end |
|
257 |
}); |
|
258 |
} |
|
259 |
|
|
260 |
IriSP._(_slices).forEach(function(_slice) { |
|
261 |
var _y = _this.height, |
|
262 |
_nums = _slice.annotations.length + "," + IriSP._(_slice.polemicStacks).map(function(_annotations) { |
|
| 1012 | 263 |
return _annotations.length; |
| 882 | 264 |
}).join(","); |
265 |
if (_slice.annotations.length) { |
|
266 |
var _h = Math.ceil(_scale * _slice.annotations.length); |
|
267 |
_y -= _h; |
|
| 930 | 268 |
displayStackElement(_x, _y, _h, _this.defaultcolor, _nums, _slice.begin, _slice.end, "none"); |
| 882 | 269 |
} |
270 |
IriSP._(_slice.polemicStacks).forEach(function(_annotations, _j) { |
|
271 |
if (_annotations.length) { |
|
272 |
var _color = _this.polemics[_j].color, |
|
| 930 | 273 |
_polemic = _this.polemics[_j].name, |
| 882 | 274 |
_h = Math.ceil(_scale * _annotations.length); |
275 |
_y -= _h; |
|
| 930 | 276 |
displayStackElement(_x, _y, _h, _color, _nums, _slice.begin, _slice.end, _polemic); |
| 882 | 277 |
} |
278 |
}); |
|
279 |
_x += _this.element_width; |
|
| 876 | 280 |
}); |
| 882 | 281 |
|
282 |
this.$zone.append(_html); |
|
283 |
|
|
284 |
this.$tweets = this.$.find(".Ldt-Polemic-TweetDiv"); |
|
285 |
|
|
286 |
this.$tweets |
|
287 |
.mouseover(function() { |
|
288 |
var _el = IriSP.jQuery(this), |
|
289 |
_nums = _el.attr("annotation-counts").split(","), |
|
290 |
_html = '<p>' + _this.l10n.from_ + _el.attr("begin-time") + _this.l10n._to_ + _el.attr("end-time") + '</p>'; |
|
291 |
for (var _i = 0; _i <= _this.polemics.length; _i++) { |
|
292 |
var _color = _i ? _this.polemics[_i - 1].color : _this.defaultcolor; |
|
| 1012 | 293 |
_html += '<div class="Ldt-Tooltip-AltColor" style="background: ' + _color + '"></div><p>' + _nums[_i] + _this.l10n._annotations + '</p>'; |
| 882 | 294 |
} |
| 986 | 295 |
if (_this.tooltip) { |
| 987 | 296 |
_this.tooltip.show(+ _el.attr("pos-x"), + _el.attr("pos-y"), _html); |
| 986 | 297 |
} |
| 882 | 298 |
}) |
299 |
.mouseout(function() { |
|
| 986 | 300 |
if (_this.tooltip) { |
301 |
_this.tooltip.hide(); |
|
302 |
} |
|
| 1012 | 303 |
}); |
| 882 | 304 |
|
| 1012 | 305 |
}; |
|
194
f5d86e5c4a56
some cleaning. Also added a progression indicator.
hamidouk
parents:
192
diff
changeset
|
306 |
|
|
875
43629caa77bc
Big refactoring of widget files + started migration of segmentwidget
veltr
parents:
874
diff
changeset
|
307 |
this.$position = IriSP.jQuery('<div>').addClass("Ldt-Polemic-Position"); |
|
874
38b65761a7d5
TooltipWidget, SliderWidget, corrections in AnnotationList, CSS are now split
veltr
parents:
842
diff
changeset
|
308 |
|
|
38b65761a7d5
TooltipWidget, SliderWidget, corrections in AnnotationList, CSS are now split
veltr
parents:
842
diff
changeset
|
309 |
this.$zone.append(this.$position); |
|
38b65761a7d5
TooltipWidget, SliderWidget, corrections in AnnotationList, CSS are now split
veltr
parents:
842
diff
changeset
|
310 |
|
|
38b65761a7d5
TooltipWidget, SliderWidget, corrections in AnnotationList, CSS are now split
veltr
parents:
842
diff
changeset
|
311 |
this.$zone.click(function(_e) { |
|
38b65761a7d5
TooltipWidget, SliderWidget, corrections in AnnotationList, CSS are now split
veltr
parents:
842
diff
changeset
|
312 |
var _x = _e.pageX - _this.$zone.offset().left; |
| 957 | 313 |
_this.media.setCurrentTime(_this.media.duration * _x / _this.width); |
|
874
38b65761a7d5
TooltipWidget, SliderWidget, corrections in AnnotationList, CSS are now split
veltr
parents:
842
diff
changeset
|
314 |
}); |
| 924 | 315 |
|
316 |
this.$.append('<div class="Ldt-Polemic-Tooltip"></div>'); |
|
317 |
|
|
| 986 | 318 |
this.insertSubwidget( |
319 |
this.$.find(".Ldt-Polemic-Tooltip"), |
|
320 |
{ |
|
321 |
type: "Tooltip", |
|
322 |
min_x: 0, |
|
323 |
max_x: this.width |
|
324 |
}, |
|
325 |
"tooltip" |
|
326 |
); |
|
| 1012 | 327 |
}; |
|
194
f5d86e5c4a56
some cleaning. Also added a progression indicator.
hamidouk
parents:
192
diff
changeset
|
328 |
|
| 957 | 329 |
IriSP.Widgets.Polemic.prototype.onTimeupdate = function(_time) { |
330 |
var _x = Math.floor( this.width * _time / this.media.duration); |
|
|
874
38b65761a7d5
TooltipWidget, SliderWidget, corrections in AnnotationList, CSS are now split
veltr
parents:
842
diff
changeset
|
331 |
this.$elapsed.css({ |
|
38b65761a7d5
TooltipWidget, SliderWidget, corrections in AnnotationList, CSS are now split
veltr
parents:
842
diff
changeset
|
332 |
width: _x + "px" |
|
38b65761a7d5
TooltipWidget, SliderWidget, corrections in AnnotationList, CSS are now split
veltr
parents:
842
diff
changeset
|
333 |
}); |
|
38b65761a7d5
TooltipWidget, SliderWidget, corrections in AnnotationList, CSS are now split
veltr
parents:
842
diff
changeset
|
334 |
this.$position.css({ |
|
875
43629caa77bc
Big refactoring of widget files + started migration of segmentwidget
veltr
parents:
874
diff
changeset
|
335 |
left: _x + "px" |
| 1012 | 336 |
}); |
337 |
}; |