2
* @author <a href="mailto:keith.hughitt@nasa.gov">Keith Hughitt</a>
3
* @fileOverview This class acts as a simple wrapper around the qTip library and helps
4
* to normalize behavior across the 1.0 and 1.1 series.
6
/*jslint browser: true, white: true, onevar: true, undef: true, nomen: false, eqeqeq: true, plusplus: true,
7
bitwise: true, regexp: true, strict: true, newcap: true, immed: true, maxlen: 120, sub: true */
8
/*global Class, $, window, loadCSS */
11
var TooltipHelper = Class.extend(
12
/** @lends TooltipHelper.prototype */
15
* @description Creates a new TooltipHelper.
16
* @param {Boolean} Enable legacy support
19
init: function (legacyMode) {
20
if (legacyMode === undefined) {
21
this.legacyMode = false;
24
this.legacyMode = legacyMode;
27
if (this.legacyMode) {
28
loadCSS("resources/css/tooltips-LEGACY.css");
29
this._setupTooltipStyles();
32
loadCSS("lib/jquery.qtip-nightly/jquery.qtip.css");
33
loadCSS("resources/css/tooltips.css");
38
* @description Creates a simple informative tooltip
40
createTooltip: function (selector, direction) {
41
if (direction === undefined) {
42
direction = 'topLeft';
45
if (this.legacyMode) {
46
this._createLegacyTooltip(selector, direction);
49
this._createTooltip(selector, direction);
54
* @description Creates a more complex dialog used for EvenMarker meta information
56
createDialog: function (container, title, text) {
57
if (this.legacyMode) {
58
this._createLegacyDialog(container, title, text);
61
this._createDialog(container, title, text);
66
* @description qTip 1.1x simple tooltips
67
* @param {Object} selector
68
* @param {Object} text
70
_createTooltip: function (selector, direction) {
71
// use e.attr('title') to manually retrieve and set title text
75
* @description qTip 1.1x dialogs
76
* @param {Object} container
77
* @param {Object} title
78
* @param {Object} text
80
_createDialog: function (container, title, text) {
85
target: 'bottomRight',
100
style: "qtip-helioviewer"
105
* @description Create a legacy (qTip 1.0) tooltip
106
* @param {Object} selector
107
* @param {Object} text
109
_createLegacyTooltip: function (selector, direction) {
112
// Decide on orientation
113
if (direction === "topLeft") {
115
target: "bottomRight",
122
target: "bottomLeft",
128
// Apply settings and create tooltip
142
effect: { length: 350 }
145
onRender: function () {
147
self.elements.target.click(function () {
157
* @description Create a legacy (qTip 1.0) dialog
158
* @param {Object} selector
159
* @param {Object} text
161
_createLegacyDialog: function (container, title, text) {
165
"container": container,
177
style: {name: "dialog"}
182
* @description Sets up old-style qTip style methods
184
_setupTooltipStyles: function () {
186
$.fn.qtip.styles.simple = {
198
// More advanced dialogs
199
$.fn.qtip.styles.dialog = {
207
"background-color": "#909A99"