133 _annotation.trigger("unselect"); |
133 _annotation.trigger("unselect"); |
134 }).click(function() { |
134 }).click(function() { |
135 _annotation.trigger("click"); |
135 _annotation.trigger("click"); |
136 }); |
136 }); |
137 _annotation.on("select", function() { |
137 _annotation.on("select", function() { |
138 _this.tooltip.show( |
138 if (_this.tooltip) { |
139 Math.floor(_elx + (_this.element_width - 1) / 2), |
139 _this.tooltip.show( |
140 _ely, |
140 Math.floor(_elx + (_this.element_width - 1) / 2), |
141 _annotation.title, |
141 _ely, |
142 _col |
142 _annotation.title, |
143 ); |
143 _col |
|
144 ); |
|
145 } |
144 _this.$tweets.each(function() { |
146 _this.$tweets.each(function() { |
145 var _e = IriSP.jQuery(this); |
147 var _e = IriSP.jQuery(this); |
146 _e.css( |
148 _e.css( |
147 "opacity", |
149 "opacity", |
148 ( _e.attr("annotation-id") == _annotation.id ? 1 : .3 ) |
150 ( _e.attr("annotation-id") == _annotation.id ? 1 : .3 ) |
149 ); |
151 ); |
150 }); |
152 }); |
151 }); |
153 }); |
152 _annotation.on("unselect", function() { |
154 _annotation.on("unselect", function() { |
153 _this.tooltip.hide(); |
155 if (_this.tooltip) { |
|
156 _this.tooltip.hide(); |
|
157 } |
154 _this.$tweets.css("opacity",1); |
158 _this.$tweets.css("opacity",1); |
155 }); |
159 }); |
156 _annotation.on("found", function() { |
160 _annotation.on("found", function() { |
157 _el.css({ |
161 _el.css({ |
158 "background" : _this.foundcolor, |
162 "background" : _this.foundcolor, |
268 _html = '<p>' + _this.l10n.from_ + _el.attr("begin-time") + _this.l10n._to_ + _el.attr("end-time") + '</p>'; |
272 _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++) { |
273 for (var _i = 0; _i <= _this.polemics.length; _i++) { |
270 var _color = _i ? _this.polemics[_i - 1].color : _this.defaultcolor; |
274 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>' |
275 _html += '<div class="Ldt-Tooltip-Color" style="background: ' + _color + '"></div><p>' + _nums[_i] + _this.l10n._annotations + '</p>' |
272 } |
276 } |
273 _this.tooltip.show(_el.attr("pos-x"), _el.attr("pos-y"), _html); |
277 if (_this.tooltip) { |
|
278 _this.tooltip.show(_el.attr("pos-x"), _el.attr("pos-y"), _html); |
|
279 } |
274 }) |
280 }) |
275 .mouseout(function() { |
281 .mouseout(function() { |
276 _this.tooltip.hide(); |
282 if (_this.tooltip) { |
|
283 _this.tooltip.hide(); |
|
284 } |
277 }) |
285 }) |
278 |
286 |
279 } |
287 } |
280 |
288 |
281 this.$position = IriSP.jQuery('<div>').addClass("Ldt-Polemic-Position"); |
289 this.$position = IriSP.jQuery('<div>').addClass("Ldt-Polemic-Position"); |
287 _this.media.setCurrentTime(_this.media.duration * _x / _this.width); |
295 _this.media.setCurrentTime(_this.media.duration * _x / _this.width); |
288 }); |
296 }); |
289 |
297 |
290 this.$.append('<div class="Ldt-Polemic-Tooltip"></div>'); |
298 this.$.append('<div class="Ldt-Polemic-Tooltip"></div>'); |
291 |
299 |
292 this.insertSubwidget(this.$.find(".Ldt-Polemic-Tooltip"), { type: "Tooltip" }, "tooltip"); |
300 this.insertSubwidget( |
|
301 this.$.find(".Ldt-Polemic-Tooltip"), |
|
302 { |
|
303 type: "Tooltip", |
|
304 min_x: 0, |
|
305 max_x: this.width |
|
306 }, |
|
307 "tooltip" |
|
308 ); |
293 } |
309 } |
294 |
310 |
295 IriSP.Widgets.Polemic.prototype.onTimeupdate = function(_time) { |
311 IriSP.Widgets.Polemic.prototype.onTimeupdate = function(_time) { |
296 var _x = Math.floor( this.width * _time / this.media.duration); |
312 var _x = Math.floor( this.width * _time / this.media.duration); |
297 this.$elapsed.css({ |
313 this.$elapsed.css({ |