| author | veltr |
| Wed, 03 Apr 2013 15:44:17 +0200 | |
| changeset 996 | c472984db275 |
| parent 994 | d18d6b9e1078 |
| child 1004 | cf0f2339169e |
| 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, |
| 987 | 22 |
max_elements: 20, |
|
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( |
|
996
c472984db275
refactored drag-and-drop interface (IE Compatibility)
veltr
parents:
994
diff
changeset
|
116 |
'<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
|
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, |
| 990 | 127 |
title: _annotation.title, |
128 |
time: _annotation.begin.toString() |
|
|
937
eb3c442cec50
Added events on annotation for inter widget communication
veltr
parents:
930
diff
changeset
|
129 |
}); |
|
eb3c442cec50
Added events on annotation for inter widget communication
veltr
parents:
930
diff
changeset
|
130 |
var _el = IriSP.jQuery(_html); |
|
eb3c442cec50
Added events on annotation for inter widget communication
veltr
parents:
930
diff
changeset
|
131 |
_el.mouseover(function() { |
|
eb3c442cec50
Added events on annotation for inter widget communication
veltr
parents:
930
diff
changeset
|
132 |
_annotation.trigger("select"); |
|
eb3c442cec50
Added events on annotation for inter widget communication
veltr
parents:
930
diff
changeset
|
133 |
}).mouseout(function() { |
|
eb3c442cec50
Added events on annotation for inter widget communication
veltr
parents:
930
diff
changeset
|
134 |
_annotation.trigger("unselect"); |
|
eb3c442cec50
Added events on annotation for inter widget communication
veltr
parents:
930
diff
changeset
|
135 |
}).click(function() { |
| 964 | 136 |
_annotation.trigger("click"); |
|
996
c472984db275
refactored drag-and-drop interface (IE Compatibility)
veltr
parents:
994
diff
changeset
|
137 |
}); |
|
c472984db275
refactored drag-and-drop interface (IE Compatibility)
veltr
parents:
994
diff
changeset
|
138 |
IriSP.attachDndData(_el, { |
|
c472984db275
refactored drag-and-drop interface (IE Compatibility)
veltr
parents:
994
diff
changeset
|
139 |
title: _annotation.title, |
|
c472984db275
refactored drag-and-drop interface (IE Compatibility)
veltr
parents:
994
diff
changeset
|
140 |
description: _annotation.description, |
|
c472984db275
refactored drag-and-drop interface (IE Compatibility)
veltr
parents:
994
diff
changeset
|
141 |
image: _annotation.thumbnail, |
|
c472984db275
refactored drag-and-drop interface (IE Compatibility)
veltr
parents:
994
diff
changeset
|
142 |
uri: (typeof _annotation.url !== "undefined" |
|
c472984db275
refactored drag-and-drop interface (IE Compatibility)
veltr
parents:
994
diff
changeset
|
143 |
? _annotation.url |
|
c472984db275
refactored drag-and-drop interface (IE Compatibility)
veltr
parents:
994
diff
changeset
|
144 |
: (document.location.href.replace(/#.*$/,'') + '#id=' + _annotation.id)) |
|
c472984db275
refactored drag-and-drop interface (IE Compatibility)
veltr
parents:
994
diff
changeset
|
145 |
}); |
|
937
eb3c442cec50
Added events on annotation for inter widget communication
veltr
parents:
930
diff
changeset
|
146 |
_annotation.on("select", function() { |
| 986 | 147 |
if (_this.tooltip) { |
148 |
_this.tooltip.show( |
|
| 987 | 149 |
+ Math.floor(_elx + (_this.element_width - 1) / 2), |
150 |
+ _ely, |
|
| 986 | 151 |
_annotation.title, |
152 |
_col |
|
153 |
); |
|
154 |
} |
|
|
937
eb3c442cec50
Added events on annotation for inter widget communication
veltr
parents:
930
diff
changeset
|
155 |
_this.$tweets.each(function() { |
|
eb3c442cec50
Added events on annotation for inter widget communication
veltr
parents:
930
diff
changeset
|
156 |
var _e = IriSP.jQuery(this); |
|
eb3c442cec50
Added events on annotation for inter widget communication
veltr
parents:
930
diff
changeset
|
157 |
_e.css( |
|
eb3c442cec50
Added events on annotation for inter widget communication
veltr
parents:
930
diff
changeset
|
158 |
"opacity", |
|
eb3c442cec50
Added events on annotation for inter widget communication
veltr
parents:
930
diff
changeset
|
159 |
( _e.attr("annotation-id") == _annotation.id ? 1 : .3 ) |
|
eb3c442cec50
Added events on annotation for inter widget communication
veltr
parents:
930
diff
changeset
|
160 |
); |
|
eb3c442cec50
Added events on annotation for inter widget communication
veltr
parents:
930
diff
changeset
|
161 |
}); |
|
eb3c442cec50
Added events on annotation for inter widget communication
veltr
parents:
930
diff
changeset
|
162 |
}); |
|
eb3c442cec50
Added events on annotation for inter widget communication
veltr
parents:
930
diff
changeset
|
163 |
_annotation.on("unselect", function() { |
| 986 | 164 |
if (_this.tooltip) { |
165 |
_this.tooltip.hide(); |
|
166 |
} |
|
|
937
eb3c442cec50
Added events on annotation for inter widget communication
veltr
parents:
930
diff
changeset
|
167 |
_this.$tweets.css("opacity",1); |
|
eb3c442cec50
Added events on annotation for inter widget communication
veltr
parents:
930
diff
changeset
|
168 |
}); |
| 983 | 169 |
_annotation.on("found", function() { |
170 |
_el.css({ |
|
171 |
"background" : _this.foundcolor, |
|
172 |
"opacity" : 1 |
|
173 |
}); |
|
174 |
}); |
|
175 |
_annotation.on("not-found", function() { |
|
176 |
_el.css({ |
|
177 |
"background" : _col, |
|
178 |
"opacity" : .3 |
|
179 |
}); |
|
180 |
}); |
|
|
937
eb3c442cec50
Added events on annotation for inter widget communication
veltr
parents:
930
diff
changeset
|
181 |
_this.$zone.append(_el); |
| 882 | 182 |
} |
183 |
|
|
184 |
IriSP._(_slices).forEach(function(_slice) { |
|
185 |
var _y = _this.height; |
|
186 |
_slice.annotations.forEach(function(_annotation) { |
|
187 |
_y -= _this.element_height; |
|
|
937
eb3c442cec50
Added events on annotation for inter widget communication
veltr
parents:
930
diff
changeset
|
188 |
displayAnnotation(_x, _y, "none", _this.defaultcolor, _annotation); |
| 882 | 189 |
}); |
190 |
IriSP._(_slice.polemicStacks).forEach(function(_annotations, _j) { |
|
| 930 | 191 |
var _color = _this.polemics[_j].color, |
192 |
_polemic = _this.polemics[_j].name; |
|
| 882 | 193 |
_annotations.forEach(function(_annotation) { |
194 |
_y -= _this.element_height; |
|
|
937
eb3c442cec50
Added events on annotation for inter widget communication
veltr
parents:
930
diff
changeset
|
195 |
displayAnnotation(_x, _y, _polemic, _color, _annotation); |
| 882 | 196 |
}); |
197 |
}); |
|
198 |
_x += _this.element_width; |
|
199 |
}); |
|
200 |
|
|
201 |
this.$zone.append(_html); |
|
202 |
|
|
203 |
this.$tweets = this.$.find(".Ldt-Polemic-TweetDiv"); |
|
204 |
|
|
| 983 | 205 |
this.source.getAnnotations().on("search-cleared", function() { |
206 |
_this.$tweets.each(function() { |
|
207 |
var _el = IriSP.jQuery(this); |
|
208 |
_el.css({ |
|
209 |
"background" : _el.attr("polemic-color"), |
|
210 |
"opacity" : 1 |
|
211 |
}); |
|
212 |
}); |
|
213 |
}); |
|
| 882 | 214 |
|
215 |
} else { |
|
216 |
this.$zone.hide(); |
|
217 |
} |
|
218 |
} else { |
|
219 |
this.is_stackgraph = true; |
|
220 |
|
|
221 |
this.height = (2 + this.max_elements) * this.element_height; |
|
222 |
this.$zone.css({ |
|
223 |
width: this.width + "px", |
|
224 |
height: this.height + "px", |
|
225 |
position: "relative" |
|
|
874
38b65761a7d5
TooltipWidget, SliderWidget, corrections in AnnotationList, CSS are now split
veltr
parents:
842
diff
changeset
|
226 |
}); |
|
38b65761a7d5
TooltipWidget, SliderWidget, corrections in AnnotationList, CSS are now split
veltr
parents:
842
diff
changeset
|
227 |
|
| 882 | 228 |
var _x = 0, |
229 |
_html = '', |
|
230 |
_scale = this.max_elements * this.element_height / _max; |
|
231 |
|
|
| 930 | 232 |
function displayStackElement(_x, _y, _h, _color, _nums, _begin, _end, _polemic) { |
| 882 | 233 |
_html += Mustache.to_html( |
| 930 | 234 |
'<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 | 235 |
+ ' style="width: {{width}}px; height: {{height}}px; top: {{top}}px; left: {{left}}px; background: {{color}}"></div>', |
236 |
{ |
|
237 |
nums: _nums, |
|
238 |
posx: Math.floor(_x + (_this.element_width - 1) / 2), |
|
| 930 | 239 |
media_id: _this.source.currentMedia.id, |
240 |
polemic: _polemic, |
|
| 882 | 241 |
left: _x, |
242 |
top: _y, |
|
243 |
color: _color, |
|
244 |
width: (_this.element_width-1), |
|
245 |
height: _h, |
|
246 |
begin: _begin, |
|
247 |
end: _end |
|
248 |
}); |
|
249 |
} |
|
250 |
|
|
251 |
IriSP._(_slices).forEach(function(_slice) { |
|
252 |
var _y = _this.height, |
|
253 |
_nums = _slice.annotations.length + "," + IriSP._(_slice.polemicStacks).map(function(_annotations) { |
|
254 |
return _annotations.length |
|
255 |
}).join(","); |
|
256 |
if (_slice.annotations.length) { |
|
257 |
var _h = Math.ceil(_scale * _slice.annotations.length); |
|
258 |
_y -= _h; |
|
| 930 | 259 |
displayStackElement(_x, _y, _h, _this.defaultcolor, _nums, _slice.begin, _slice.end, "none"); |
| 882 | 260 |
} |
261 |
IriSP._(_slice.polemicStacks).forEach(function(_annotations, _j) { |
|
262 |
if (_annotations.length) { |
|
263 |
var _color = _this.polemics[_j].color, |
|
| 930 | 264 |
_polemic = _this.polemics[_j].name, |
| 882 | 265 |
_h = Math.ceil(_scale * _annotations.length); |
266 |
_y -= _h; |
|
| 930 | 267 |
displayStackElement(_x, _y, _h, _color, _nums, _slice.begin, _slice.end, _polemic); |
| 882 | 268 |
} |
269 |
}); |
|
270 |
_x += _this.element_width; |
|
| 876 | 271 |
}); |
| 882 | 272 |
|
273 |
this.$zone.append(_html); |
|
274 |
|
|
275 |
this.$tweets = this.$.find(".Ldt-Polemic-TweetDiv"); |
|
276 |
|
|
277 |
this.$tweets |
|
278 |
.mouseover(function() { |
|
279 |
var _el = IriSP.jQuery(this), |
|
280 |
_nums = _el.attr("annotation-counts").split(","), |
|
281 |
_html = '<p>' + _this.l10n.from_ + _el.attr("begin-time") + _this.l10n._to_ + _el.attr("end-time") + '</p>'; |
|
282 |
for (var _i = 0; _i <= _this.polemics.length; _i++) { |
|
283 |
var _color = _i ? _this.polemics[_i - 1].color : _this.defaultcolor; |
|
| 987 | 284 |
_html += '<div class="Ldt-Tooltip-AltColor" style="background: ' + _color + '"></div><p>' + _nums[_i] + _this.l10n._annotations + '</p>' |
| 882 | 285 |
} |
| 986 | 286 |
if (_this.tooltip) { |
| 987 | 287 |
_this.tooltip.show(+ _el.attr("pos-x"), + _el.attr("pos-y"), _html); |
| 986 | 288 |
} |
| 882 | 289 |
}) |
290 |
.mouseout(function() { |
|
| 986 | 291 |
if (_this.tooltip) { |
292 |
_this.tooltip.hide(); |
|
293 |
} |
|
| 882 | 294 |
}) |
295 |
|
|
| 207 | 296 |
} |
|
194
f5d86e5c4a56
some cleaning. Also added a progression indicator.
hamidouk
parents:
192
diff
changeset
|
297 |
|
|
875
43629caa77bc
Big refactoring of widget files + started migration of segmentwidget
veltr
parents:
874
diff
changeset
|
298 |
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
|
299 |
|
|
38b65761a7d5
TooltipWidget, SliderWidget, corrections in AnnotationList, CSS are now split
veltr
parents:
842
diff
changeset
|
300 |
this.$zone.append(this.$position); |
|
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.click(function(_e) { |
|
38b65761a7d5
TooltipWidget, SliderWidget, corrections in AnnotationList, CSS are now split
veltr
parents:
842
diff
changeset
|
303 |
var _x = _e.pageX - _this.$zone.offset().left; |
| 957 | 304 |
_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
|
305 |
}); |
| 924 | 306 |
|
307 |
this.$.append('<div class="Ldt-Polemic-Tooltip"></div>'); |
|
308 |
|
|
| 986 | 309 |
this.insertSubwidget( |
310 |
this.$.find(".Ldt-Polemic-Tooltip"), |
|
311 |
{ |
|
312 |
type: "Tooltip", |
|
313 |
min_x: 0, |
|
314 |
max_x: this.width |
|
315 |
}, |
|
316 |
"tooltip" |
|
317 |
); |
|
|
194
f5d86e5c4a56
some cleaning. Also added a progression indicator.
hamidouk
parents:
192
diff
changeset
|
318 |
} |
|
f5d86e5c4a56
some cleaning. Also added a progression indicator.
hamidouk
parents:
192
diff
changeset
|
319 |
|
| 957 | 320 |
IriSP.Widgets.Polemic.prototype.onTimeupdate = function(_time) { |
321 |
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
|
322 |
this.$elapsed.css({ |
|
38b65761a7d5
TooltipWidget, SliderWidget, corrections in AnnotationList, CSS are now split
veltr
parents:
842
diff
changeset
|
323 |
width: _x + "px" |
|
38b65761a7d5
TooltipWidget, SliderWidget, corrections in AnnotationList, CSS are now split
veltr
parents:
842
diff
changeset
|
324 |
}); |
|
38b65761a7d5
TooltipWidget, SliderWidget, corrections in AnnotationList, CSS are now split
veltr
parents:
842
diff
changeset
|
325 |
this.$position.css({ |
|
875
43629caa77bc
Big refactoring of widget files + started migration of segmentwidget
veltr
parents:
874
diff
changeset
|
326 |
left: _x + "px" |
|
874
38b65761a7d5
TooltipWidget, SliderWidget, corrections in AnnotationList, CSS are now split
veltr
parents:
842
diff
changeset
|
327 |
}) |
|
38b65761a7d5
TooltipWidget, SliderWidget, corrections in AnnotationList, CSS are now split
veltr
parents:
842
diff
changeset
|
328 |
} |