| author | hamidouk |
| Mon, 19 Dec 2011 10:53:34 +0100 | |
| branch | popcorn-port |
| changeset 477 | 1e51d638e7ea |
| parent 474 | c1998d5d552e |
| child 478 | 1422ba0fc333 |
| permissions | -rw-r--r-- |
|
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 | 4 |
this._shown = false; |
| 477 | 5 |
this._displayedText = ""; |
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) { |
| 477 | 25 |
if (this._shown === true || this._displayedText == text) |
|
289
c0e399fbf3fb
due to a np++ crash, some files where created in with windows line endings.
hamidouk
parents:
231
diff
changeset
|
26 |
return; |
| 477 | 27 |
|
28 |
// cancel the timeout for the previously displayed element. |
|
29 |
if (this._hideTimeout != -1) { |
|
30 |
window.clearTimeout(this._hideTimeout); |
|
31 |
this._hideTimeout = -1; |
|
32 |
console.log(text === this._displayedText); |
|
33 |
} |
|
34 |
debugger; |
|
35 |
|
|
|
289
c0e399fbf3fb
due to a np++ crash, some files where created in with windows line endings.
hamidouk
parents:
231
diff
changeset
|
36 |
this.selector.find(".tipcolor").css("background-color", color); |
| 477 | 37 |
this._displayedText = text; |
|
289
c0e399fbf3fb
due to a np++ crash, some files where created in with windows line endings.
hamidouk
parents:
231
diff
changeset
|
38 |
this.selector.find(".tiptext").text(text); |
| 477 | 39 |
//this.selector.find(".tip").css("left", x).css("top", y); |
40 |
this.selector.find(".tip").css("left", x).css("top", "-160px"); |
|
41 |
this.selector.find(".tip").show(); |
|
| 474 | 42 |
this._shown = true; |
|
289
c0e399fbf3fb
due to a np++ crash, some files where created in with windows line endings.
hamidouk
parents:
231
diff
changeset
|
43 |
}; |
|
c0e399fbf3fb
due to a np++ crash, some files where created in with windows line endings.
hamidouk
parents:
231
diff
changeset
|
44 |
|
| 477 | 45 |
IriSP.TooltipWidget.prototype.hide = function() { |
46 |
this._hideTimeout = window.setTimeout(IriSP.wrap(this, function() { |
|
47 |
this.selector.find(".tip").hide(); |
|
48 |
this._shown = false; }), 1000); |
|
| 474 | 49 |
|
|
336
8da13562cfea
segmentsWidget now uses the TooltipWidget instead of the jQuerytools tooltip.
hamidouk
parents:
289
diff
changeset
|
50 |
}; |