Skip to content
This repository has been archived by the owner on Jun 14, 2020. It is now read-only.

Commit

Permalink
Fixed problem with render method causing ajax content to be retrieved…
Browse files Browse the repository at this point in the history
… twice.

Also added .qtip namespace to document mousemove
  • Loading branch information
Craga89 committed Sep 18, 2010
1 parent 8de63ed commit 42d1784
Show file tree
Hide file tree
Showing 7 changed files with 38 additions and 36 deletions.
2 changes: 1 addition & 1 deletion dist/jquery.qtip.css
Expand Up @@ -9,7 +9,7 @@
* http://en.wikipedia.org/wiki/MIT_License
* http://en.wikipedia.org/wiki/GNU_General_Public_License
*
* Date: Thu Sep 16 21:00:28 2010 +0100
* Date: Fri Sep 17 00:47:35 2010 +0100
*/

.ui-tooltip-accessible{
Expand Down
31 changes: 16 additions & 15 deletions dist/jquery.qtip.js
Expand Up @@ -9,7 +9,7 @@
* http://en.wikipedia.org/wiki/MIT_License
* http://en.wikipedia.org/wiki/GNU_General_Public_License
*
* Date: Thu Sep 16 21:00:28 2010 +0100
* Date: Fri Sep 17 00:47:35 2010 +0100
*/

"use strict"; // Enable ECMAScript "strict" operation for this function. See more: http://ejohn.org/blog/ecmascript-5-strict-mode-json-and-more/
Expand Down Expand Up @@ -317,7 +317,7 @@ function QTip(target, options, id)
}

function updateContent(content)
{
{
// Make sure tooltip is rendered and content is defined. If not return
if(!self.rendered || !content) { return FALSE; }

Expand Down Expand Up @@ -600,11 +600,16 @@ function QTip(target, options, id)
.appendTo(elements.wrapper);

// Setup content and title (if enabled)
updateContent(options.content.text, 0);
updateContent(options.content.text);
if(options.content.title.text) {
createTitle();
}

// Update tooltip position and show tooltip if needed
if(options.show.ready || show) {
self.show(self.cache.event);
}

// Initialize 'render' plugins
$.each($.fn.qtip.plugins, function() {
if(this.initialize === 'render') { this(self); }
Expand All @@ -619,11 +624,6 @@ function QTip(target, options, id)
elements.tooltip.bind('tooltip'+name, callback);
});

// Update tooltip position and show tooltip if needed
if(options.show.ready || show) {
self.show(self.cache.event);
}

// Call API method and if return value is FALSE, halt
elements.tooltip.trigger('tooltiprender', [self.hash()]);

Expand Down Expand Up @@ -1334,7 +1334,7 @@ function(name, func) {
$(document.body).attr('role', function(i, val) { return !val ? 'application' : val; });

// Cache mousemove events for positioning purposes
$(document).bind('mousemove', function(event) {
$(document).bind('mousemove.qtip', function(event) {
$.fn.qtip.mouse = { pageX: event.pageX, pageY: event.pageY };
});

Expand Down Expand Up @@ -1440,9 +1440,9 @@ function Ajax(qTip)

// Bind show event
qTip.elements.tooltip.bind('tooltipshow.ajax', function() {
// Update content if content.ajax.once is FALSE and the tooltip is rendered
if(ajax.once === FALSE && qTip.rendered === TRUE) { self.load(ajax); }
});
// Update content if content.ajax.once is FALSE and the tooltip is rendered
if(ajax.once === FALSE && qTip.rendered === TRUE) { self.load(ajax); }
});
},

load: function(ajax)
Expand Down Expand Up @@ -2278,10 +2278,11 @@ $.fn.qtip.plugins.modal = function(qTip)

// Plugin needs to be initialized on render
$.fn.qtip.plugins.modal.initialize = 'render';
$.fn.qtip.plugins.modal.sanitize = function(opts)
{

// Setup sanitiztion rules
$.fn.qtip.plugins.modal.sanitize = function(opts) {
if(opts.show && opts.show.modal !== undefined) {
if(typeof opts.show.modal !== 'object'){ opts.show.modal = { on: opts.show.modal }; }
if(typeof opts.show.modal !== 'object') { opts.show.modal = { on: !!opts.show.modal }; }
}
};

Expand Down
8 changes: 4 additions & 4 deletions dist/jquery.qtip.min.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions dist/jquery.qtip.pack.js

Large diffs are not rendered by default.

6 changes: 3 additions & 3 deletions src/ajax.js
Expand Up @@ -20,9 +20,9 @@ function Ajax(qTip)

// Bind show event
qTip.elements.tooltip.bind('tooltipshow.ajax', function() {
// Update content if content.ajax.once is FALSE and the tooltip is rendered
if(ajax.once === FALSE && qTip.rendered === TRUE) { self.load(ajax); }
});
// Update content if content.ajax.once is FALSE and the tooltip is rendered
if(ajax.once === FALSE && qTip.rendered === TRUE) { self.load(ajax); }
});
},

load: function(ajax)
Expand Down
16 changes: 8 additions & 8 deletions src/core.js
Expand Up @@ -292,7 +292,7 @@ function QTip(target, options, id)
}

function updateContent(content)
{
{
// Make sure tooltip is rendered and content is defined. If not return
if(!self.rendered || !content) { return FALSE; }

Expand Down Expand Up @@ -575,11 +575,16 @@ function QTip(target, options, id)
.appendTo(elements.wrapper);

// Setup content and title (if enabled)
updateContent(options.content.text, 0);
updateContent(options.content.text);
if(options.content.title.text) {
createTitle();
}

// Update tooltip position and show tooltip if needed
if(options.show.ready || show) {
self.show(self.cache.event);
}

// Initialize 'render' plugins
$.each($.fn.qtip.plugins, function() {
if(this.initialize === 'render') { this(self); }
Expand All @@ -594,11 +599,6 @@ function QTip(target, options, id)
elements.tooltip.bind('tooltip'+name, callback);
});

// Update tooltip position and show tooltip if needed
if(options.show.ready || show) {
self.show(self.cache.event);
}

// Call API method and if return value is FALSE, halt
elements.tooltip.trigger('tooltiprender', [self.hash()]);

Expand Down Expand Up @@ -1309,7 +1309,7 @@ function(name, func) {
$(document.body).attr('role', function(i, val) { return !val ? 'application' : val; });

// Cache mousemove events for positioning purposes
$(document).bind('mousemove', function(event) {
$(document).bind('mousemove.qtip', function(event) {
$.fn.qtip.mouse = { pageX: event.pageX, pageY: event.pageY };
});

Expand Down
7 changes: 4 additions & 3 deletions src/modal.js
Expand Up @@ -141,10 +141,11 @@ $.fn.qtip.plugins.modal = function(qTip)

// Plugin needs to be initialized on render
$.fn.qtip.plugins.modal.initialize = 'render';
$.fn.qtip.plugins.modal.sanitize = function(opts)
{

// Setup sanitiztion rules
$.fn.qtip.plugins.modal.sanitize = function(opts) {
if(opts.show && opts.show.modal !== undefined) {
if(typeof opts.show.modal !== 'object'){ opts.show.modal = { on: opts.show.modal }; }
if(typeof opts.show.modal !== 'object') { opts.show.modal = { on: !!opts.show.modal }; }
}
};

Expand Down

0 comments on commit 42d1784

Please sign in to comment.