')
+ .css({
+ background: '#cccccc',
+ position: "absolute",
+ top: 0,
+ left: 0,
+ width: 0,
+ height: "100%"
+ });
+
+ this.$zone.append(this.$elapsed);
+
+ var _x = 0,
+ _this = this;
+
+ function displayElement(_x, _y, _color, _id, _title) {
+ var _el = IriSP.jQuery('
')
+ .attr({
+ "tweet-title" : _title,
+ "pos-x" : Math.floor(_x + (_this.element_width - 1) / 2),
+ "pos-y" : _y,
+ "polemic-color" : _color,
+ "annotation-id" : _id
+ })
+ .css({
+ position: "absolute",
+ width: (_this.element_width-1) + "px",
+ height: _this.element_height + "px",
+ left: _x + "px",
+ top: _y + "px",
+ background: _color
+ })
+ .addClass("Ldt-Polemic-TweetDiv");
+ _this.$zone.append(_el);
+ return _el;
}
-
+ IriSP._(_slices).forEach(function(_slice) {
+ var _y = _this.height;
+ _slice.annotations.forEach(function(_annotation) {
+ _y -= _this.element_height;
+ displayElement(_x, _y, _this.defaultcolor, _annotation.namespacedId.name, _annotation.title);
+ });
+ IriSP._(_slice.polemicStacks).forEach(function(_annotations, _j) {
+ var _color = _this.tags[_j].color;
+ _annotations.forEach(function(_annotation) {
+ _y -= _this.element_height;
+ displayElement(_x, _y, _color, _annotation.namespacedId.name, _annotation.title);
+ });
+ });
+ _x += _this.element_width;
+ });
+
+ this.$tweets = this.$.find(".Ldt-Polemic-TweetDiv");
+
+ this.$position = IriSP.jQuery('
')
+ .css({
+ background: '#fc00ff',
+ position: "absolute",
+ top: 0,
+ left: "-1px",
+ width: "2px",
+ height: "100%"
+ });
+
+ this.$zone.append(this.$position);
+
+ this.$tweets
+ .mouseover(function() {
+ var _el = IriSP.jQuery(this);
+ _this.TooltipWidget.show(_el.attr("pos-x"), _el.attr("pos-y"), _el.attr("tweet-title"), _el.attr("polemic-color"));
+ })
+ .mouseout(function() {
+ _this.TooltipWidget.hide();
+ });
+
+ //TODO: Display Tweet in Tweet Widget on click
+
+ this.$zone.click(function(_e) {
+ var _x = _e.pageX - _this.$zone.offset().left;
+ _this.player.popcorn.currentTime(_this.source.getDuration().getSeconds() * _x / _this.width);
+ });
}
-/** update the positionMarker as time passes */
-IriSP.PolemicWidget.prototype.sliderUpdater = function() {
-
- var time = +this._Popcorn.currentTime();
- var duration = this.getDuration();
-
- this.paperSlider.attr("width", time * (this.width / (duration / 1000)));
-
- this.sliderTip.attr("x", time * (this.width / (duration / 1000)));
-};
-
-/** reacts to IriSP.search events */
-IriSP.PolemicWidget.prototype.searchHandler = function(searchString) {
- if (searchString == "")
- return;
-
- var matches = this._serializer.searchTweetsOccurences(searchString);
-
- if (IriSP.countProperties(matches) > 0) {
- this._Popcorn.trigger("IriSP.search.matchFound");
- } else {
- this._Popcorn.trigger("IriSP.search.noMatchFound");
- }
-
-
- // decrease the opacity of the other elements.
- for (var id in this.svgElements) {
- var e = this.svgElements[id];
- e.attr({fill: e.color, opacity: 0.4});
- }
-
-
- for (var id in matches) {
- if (this.svgElements.hasOwnProperty(id)) {
- var e = this.svgElements[id];
- this.svgElements[id].attr({fill: "#fc00ff", opacity: 1});
- }
- }
-
- this.oldSearchMatches = matches;
-};
-
-/** reacts to IriSP.search.cleared messages */
-IriSP.PolemicWidget.prototype.searchFieldClearedHandler = function() {
- for (var id in this.svgElements) {
- var e = this.svgElements[id];
- e.attr({fill: e.color, opacity: 1});
- }
-};
-
-/** reacts to IriSP.search.closed messages by clearing the highlighted elements */
-IriSP.PolemicWidget.prototype.searchFieldClosedHandler = function() {
- for (var id in this.svgElements) {
- var e = this.svgElements[id];
- e.attr({fill: e.color, opacity: 1});
- }
-
-};
-
-IriSP.PolemicWidget.prototype.showAnnotation = function(id) {
- if (this.svgElements.hasOwnProperty(id)) {
- var e = this.svgElements[id];
- this.TooltipWidget.show(e.title, e.attr("fill"), e.x - 103, e.y - 160);
- }
-};
+IriSP.PolemicWidget.prototype.onTimeupdate = function() {
+ var _x = Math.floor( this.width * this.player.popcorn.currentTime() / this.source.getDuration().getSeconds());
+ this.$elapsed.css({
+ width: _x + "px"
+ });
+ this.$position.css({
+ left: (_x - 1) + "px"
+ })
+}