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