src/js/widgets/tooltipWidget.js
branchpopcorn-port
changeset 289 c0e399fbf3fb
parent 231 accc7358d8b5
child 336 8da13562cfea
equal deleted inserted replaced
288:25fe0c8831de 289:c0e399fbf3fb
     1 /* this widget displays a small tooltip */
     1 /* this widget displays a small tooltip */
     2 IriSP.TooltipWidget = function(Popcorn, config, Serializer) {
     2 IriSP.TooltipWidget = function(Popcorn, config, Serializer) {
     3   IriSP.Widget.call(this, Popcorn, config, Serializer);  
     3   IriSP.Widget.call(this, Popcorn, config, Serializer);
     4 };
     4 };
     5 
     5 
     6 
     6 
     7 IriSP.TooltipWidget.prototype = new IriSP.Widget();
     7 IriSP.TooltipWidget.prototype = new IriSP.Widget();
     8 
     8 
     9 IriSP.TooltipWidget.prototype.draw = function() {
     9 IriSP.TooltipWidget.prototype.draw = function() {
    10   var templ = Mustache.to_html(IriSP.tooltipWidget_template);
    10   var templ = Mustache.to_html(IriSP.tooltipWidget_template);
    11     
    11 
    12   this.selector.append(templ);
    12   this.selector.append(templ);
    13   this.hide();
    13   this.hide();
    14   
    14 
    15 };
    15 };
    16 
    16 
    17 IriSP.TooltipWidget.prototype.show = function(text, color, x, y) {
    17 IriSP.TooltipWidget.prototype.show = function(text, color, x, y) {
    18   if (this.selector.find(".tiptext").text() == text)
    18   if (this.selector.find(".tiptext").text() == text)
    19     return;
    19     return;
    20     
    20 
    21   this.selector.find(".tipcolor").css("background-color", color);  
    21   this.selector.find(".tipcolor").css("background-color", color);
    22 	this.selector.find(".tiptext").text(text);  
    22 	this.selector.find(".tiptext").text(text);
    23   this.selector.find(".tip").css("left", x).css("top", y);
    23   this.selector.find(".tip").css("left", x).css("top", y);
    24 };
    24 };
    25 
    25 
    26 IriSP.TooltipWidget.prototype.hide = function() {
    26 IriSP.TooltipWidget.prototype.hide = function() {
    27   this.selector.find(".tip").css("left", -10000).css("top", -100000);
    27   this.selector.find(".tip").css("left", -10000).css("top", -100000);