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