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