src/js/widgets/tooltipWidget.js
author hamidouk
Tue, 08 Nov 2011 15:57:04 +0100
branchpopcorn-port
changeset 212 3a6e4089eef0
parent 177 69b14f35e900
child 231 accc7358d8b5
permissions -rw-r--r--
fixed teh segments display bug and another bug related to float positioning.
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
172
3ffa0e0c8803 added a "tooltip" widget. Made some changes to the css corresponding to this
hamidouk
parents:
diff changeset
     1
/* this widget displays a small tooltip */
3ffa0e0c8803 added a "tooltip" widget. Made some changes to the css corresponding to this
hamidouk
parents:
diff changeset
     2
IriSP.TooltipWidget = function(Popcorn, config, Serializer) {
3ffa0e0c8803 added a "tooltip" widget. Made some changes to the css corresponding to this
hamidouk
parents:
diff changeset
     3
  IriSP.Widget.call(this, Popcorn, config, Serializer);  
3ffa0e0c8803 added a "tooltip" widget. Made some changes to the css corresponding to this
hamidouk
parents:
diff changeset
     4
};
3ffa0e0c8803 added a "tooltip" widget. Made some changes to the css corresponding to this
hamidouk
parents:
diff changeset
     5
3ffa0e0c8803 added a "tooltip" widget. Made some changes to the css corresponding to this
hamidouk
parents:
diff changeset
     6
3ffa0e0c8803 added a "tooltip" widget. Made some changes to the css corresponding to this
hamidouk
parents:
diff changeset
     7
IriSP.TooltipWidget.prototype = new IriSP.Widget();
3ffa0e0c8803 added a "tooltip" widget. Made some changes to the css corresponding to this
hamidouk
parents:
diff changeset
     8
3ffa0e0c8803 added a "tooltip" widget. Made some changes to the css corresponding to this
hamidouk
parents:
diff changeset
     9
IriSP.TooltipWidget.prototype.draw = function() {
3ffa0e0c8803 added a "tooltip" widget. Made some changes to the css corresponding to this
hamidouk
parents:
diff changeset
    10
  var templ = Mustache.to_html(IriSP.tooltipWidget_template);
3ffa0e0c8803 added a "tooltip" widget. Made some changes to the css corresponding to this
hamidouk
parents:
diff changeset
    11
  this.selector.append(templ);
3ffa0e0c8803 added a "tooltip" widget. Made some changes to the css corresponding to this
hamidouk
parents:
diff changeset
    12
  this.hide();
3ffa0e0c8803 added a "tooltip" widget. Made some changes to the css corresponding to this
hamidouk
parents:
diff changeset
    13
  
3ffa0e0c8803 added a "tooltip" widget. Made some changes to the css corresponding to this
hamidouk
parents:
diff changeset
    14
};
3ffa0e0c8803 added a "tooltip" widget. Made some changes to the css corresponding to this
hamidouk
parents:
diff changeset
    15
3ffa0e0c8803 added a "tooltip" widget. Made some changes to the css corresponding to this
hamidouk
parents:
diff changeset
    16
IriSP.TooltipWidget.prototype.show = function(text, color, x, y) {
177
69b14f35e900 widget now checks so that it doesn't display again text that is already displayed.
hamidouk
parents: 172
diff changeset
    17
  if (this.selector.find(".tiptext").text() == text)
69b14f35e900 widget now checks so that it doesn't display again text that is already displayed.
hamidouk
parents: 172
diff changeset
    18
    return;
69b14f35e900 widget now checks so that it doesn't display again text that is already displayed.
hamidouk
parents: 172
diff changeset
    19
    
69b14f35e900 widget now checks so that it doesn't display again text that is already displayed.
hamidouk
parents: 172
diff changeset
    20
  this.selector.find(".tipcolor").css("background-color", color);  
69b14f35e900 widget now checks so that it doesn't display again text that is already displayed.
hamidouk
parents: 172
diff changeset
    21
	this.selector.find(".tiptext").text(text);  
69b14f35e900 widget now checks so that it doesn't display again text that is already displayed.
hamidouk
parents: 172
diff changeset
    22
  this.selector.find(".tip").css("left", x).css("top", y);
172
3ffa0e0c8803 added a "tooltip" widget. Made some changes to the css corresponding to this
hamidouk
parents:
diff changeset
    23
};
3ffa0e0c8803 added a "tooltip" widget. Made some changes to the css corresponding to this
hamidouk
parents:
diff changeset
    24
3ffa0e0c8803 added a "tooltip" widget. Made some changes to the css corresponding to this
hamidouk
parents:
diff changeset
    25
IriSP.TooltipWidget.prototype.hide = function() {
177
69b14f35e900 widget now checks so that it doesn't display again text that is already displayed.
hamidouk
parents: 172
diff changeset
    26
  this.selector.find(".tip").css("left", -10000).css("top", -100000);
172
3ffa0e0c8803 added a "tooltip" widget. Made some changes to the css corresponding to this
hamidouk
parents:
diff changeset
    27
};