src/js/widgets/tooltipWidget.js
author hamidouk
Mon, 19 Dec 2011 16:48:24 +0100
branchpopcorn-port
changeset 487 4c006b1dcc66
parent 480 043a159c75f0
child 489 0b84128f609b
permissions -rw-r--r--
temporary fix for demo player.
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
289
c0e399fbf3fb due to a np++ crash, some files where created in with windows line endings.
hamidouk
parents: 231
diff changeset
     1
/* this widget displays a small tooltip */
c0e399fbf3fb due to a np++ crash, some files where created in with windows line endings.
hamidouk
parents: 231
diff changeset
     2
IriSP.TooltipWidget = function(Popcorn, config, Serializer) {
c0e399fbf3fb due to a np++ crash, some files where created in with windows line endings.
hamidouk
parents: 231
diff changeset
     3
  IriSP.Widget.call(this, Popcorn, config, Serializer);
474
c1998d5d552e fixed a couple show-stoppers.
hamidouk
parents: 336
diff changeset
     4
  this._shown = false;
477
1e51d638e7ea fixes in a rush.
hamidouk
parents: 474
diff changeset
     5
  this._displayedText = "";
1e51d638e7ea fixes in a rush.
hamidouk
parents: 474
diff changeset
     6
  this._hideTimeout = -1;
289
c0e399fbf3fb due to a np++ crash, some files where created in with windows line endings.
hamidouk
parents: 231
diff changeset
     7
};
c0e399fbf3fb due to a np++ crash, some files where created in with windows line endings.
hamidouk
parents: 231
diff changeset
     8
c0e399fbf3fb due to a np++ crash, some files where created in with windows line endings.
hamidouk
parents: 231
diff changeset
     9
c0e399fbf3fb due to a np++ crash, some files where created in with windows line endings.
hamidouk
parents: 231
diff changeset
    10
IriSP.TooltipWidget.prototype = new IriSP.Widget();
c0e399fbf3fb due to a np++ crash, some files where created in with windows line endings.
hamidouk
parents: 231
diff changeset
    11
c0e399fbf3fb due to a np++ crash, some files where created in with windows line endings.
hamidouk
parents: 231
diff changeset
    12
IriSP.TooltipWidget.prototype.draw = function() {
c0e399fbf3fb due to a np++ crash, some files where created in with windows line endings.
hamidouk
parents: 231
diff changeset
    13
  var templ = Mustache.to_html(IriSP.tooltipWidget_template);
c0e399fbf3fb due to a np++ crash, some files where created in with windows line endings.
hamidouk
parents: 231
diff changeset
    14
c0e399fbf3fb due to a np++ crash, some files where created in with windows line endings.
hamidouk
parents: 231
diff changeset
    15
  this.selector.append(templ);
c0e399fbf3fb due to a np++ crash, some files where created in with windows line endings.
hamidouk
parents: 231
diff changeset
    16
  this.hide();
c0e399fbf3fb due to a np++ crash, some files where created in with windows line endings.
hamidouk
parents: 231
diff changeset
    17
c0e399fbf3fb due to a np++ crash, some files where created in with windows line endings.
hamidouk
parents: 231
diff changeset
    18
};
c0e399fbf3fb due to a np++ crash, some files where created in with windows line endings.
hamidouk
parents: 231
diff changeset
    19
336
8da13562cfea segmentsWidget now uses the TooltipWidget instead of the jQuerytools tooltip.
hamidouk
parents: 289
diff changeset
    20
IriSP.TooltipWidget.prototype.clear = function() {
8da13562cfea segmentsWidget now uses the TooltipWidget instead of the jQuerytools tooltip.
hamidouk
parents: 289
diff changeset
    21
	this.selector.find(".tiptext").text("");
8da13562cfea segmentsWidget now uses the TooltipWidget instead of the jQuerytools tooltip.
hamidouk
parents: 289
diff changeset
    22
};
8da13562cfea segmentsWidget now uses the TooltipWidget instead of the jQuerytools tooltip.
hamidouk
parents: 289
diff changeset
    23
289
c0e399fbf3fb due to a np++ crash, some files where created in with windows line endings.
hamidouk
parents: 231
diff changeset
    24
IriSP.TooltipWidget.prototype.show = function(text, color, x, y) {
478
1422ba0fc333 fixed annoying tooltip flicker bug.
hamidouk
parents: 477
diff changeset
    25
1422ba0fc333 fixed annoying tooltip flicker bug.
hamidouk
parents: 477
diff changeset
    26
  if (this._displayedText == text)
289
c0e399fbf3fb due to a np++ crash, some files where created in with windows line endings.
hamidouk
parents: 231
diff changeset
    27
    return;
477
1e51d638e7ea fixes in a rush.
hamidouk
parents: 474
diff changeset
    28
  
289
c0e399fbf3fb due to a np++ crash, some files where created in with windows line endings.
hamidouk
parents: 231
diff changeset
    29
  this.selector.find(".tipcolor").css("background-color", color);
477
1e51d638e7ea fixes in a rush.
hamidouk
parents: 474
diff changeset
    30
  this._displayedText = text;
289
c0e399fbf3fb due to a np++ crash, some files where created in with windows line endings.
hamidouk
parents: 231
diff changeset
    31
	this.selector.find(".tiptext").text(text);
477
1e51d638e7ea fixes in a rush.
hamidouk
parents: 474
diff changeset
    32
  //this.selector.find(".tip").css("left", x).css("top", y);  
487
4c006b1dcc66 temporary fix for demo player.
hamidouk
parents: 480
diff changeset
    33
  this.selector.find(".tip").css("left", x).css("top", y - 160);
477
1e51d638e7ea fixes in a rush.
hamidouk
parents: 474
diff changeset
    34
  this.selector.find(".tip").show();
474
c1998d5d552e fixed a couple show-stoppers.
hamidouk
parents: 336
diff changeset
    35
  this._shown = true;
289
c0e399fbf3fb due to a np++ crash, some files where created in with windows line endings.
hamidouk
parents: 231
diff changeset
    36
};
c0e399fbf3fb due to a np++ crash, some files where created in with windows line endings.
hamidouk
parents: 231
diff changeset
    37
478
1422ba0fc333 fixed annoying tooltip flicker bug.
hamidouk
parents: 477
diff changeset
    38
IriSP.TooltipWidget.prototype.hide = function() {                                                   
1422ba0fc333 fixed annoying tooltip flicker bug.
hamidouk
parents: 477
diff changeset
    39
  this.selector.find(".tip").hide();
1422ba0fc333 fixed annoying tooltip flicker bug.
hamidouk
parents: 477
diff changeset
    40
  this._shown = false;  
487
4c006b1dcc66 temporary fix for demo player.
hamidouk
parents: 480
diff changeset
    41
};