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

Commit

Permalink
Small fix to the ajax.loading functionality to ensure there's no prob…
Browse files Browse the repository at this point in the history
…lem with custom effects
  • Loading branch information
Craga89 committed Sep 14, 2011
1 parent 437b5af commit 0d36d3e
Show file tree
Hide file tree
Showing 5 changed files with 19 additions and 21 deletions.
2 changes: 1 addition & 1 deletion dist/jquery.qtip.basic.js
Expand Up @@ -9,7 +9,7 @@
* http://en.wikipedia.org/wiki/MIT_License
* http://en.wikipedia.org/wiki/GNU_General_Public_License
*
* Date: Tue Sep 13 17:05:46 2011 +0100
* Date: Wed Sep 14 00:29:45 2011 +0100
*/

/*jslint browser: true, onevar: true, undef: true, nomen: true, bitwise: true, regexp: true, newcap: true, immed: true, strict: true */
Expand Down
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: Tue Sep 13 17:05:46 2011 +0100
* Date: Wed Sep 14 00:29:45 2011 +0100
*/

/* Core qTip styles */
Expand Down
17 changes: 8 additions & 9 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: Tue Sep 13 17:05:46 2011 +0100
* Date: Wed Sep 14 00:29:45 2011 +0100
*/

/*jslint browser: true, onevar: true, undef: true, nomen: true, bitwise: true, regexp: true, newcap: true, immed: true, strict: true */
Expand Down Expand Up @@ -1990,17 +1990,18 @@ function Ajax(api)

load: function(event, first)
{
// Make sure default event hasn't been prevented
if(event && event.isDefaultPrevented()) { return self; }


var hasSelector = opts.url.indexOf(' '),
url = opts.url,
selector,
hideFirst = opts.once && !opts.loading && first;

// If loading option is disabled, hide the tooltip until content is retrieved (first time only)
if(hideFirst) { tooltip.css('visibility', 'hidden'); }
// If loading option is disabled, prevent the tooltip showing until we've completed the request
if(hideFirst) { try{ event.preventDefault(); } catch(e) {} }

// Make sure default event hasn't been prevented
else if(event && event.isDefaultPrevented()) { return self; }

// Check if user delcared a content selector like in .load()
if(hasSelector > -1) {
selector = url.substr(hasSelector);
Expand All @@ -2010,7 +2011,7 @@ function Ajax(api)
// Define common after callback for both success/error handlers
function after() {
// Re-display tip if loading and first time, and reset first flag
if(hideFirst) { tooltip.css('visibility', ''); first = FALSE; }
if(hideFirst) { api.show(event.originalEvent); first = FALSE; }

// Call users complete if it was defined
if($.isFunction(opts.complete)) { opts.complete.apply(this, arguments); }
Expand Down Expand Up @@ -2038,8 +2039,6 @@ function Ajax(api)

// Setup $.ajax option object and process the request
$.ajax( $.extend({ success: successHandler, error: errorHandler, context: api }, opts, { url: url, complete: after }) );

return self;
}
});

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

Large diffs are not rendered by default.

15 changes: 7 additions & 8 deletions src/ajax/ajax.js
Expand Up @@ -37,17 +37,18 @@ function Ajax(api)

load: function(event, first)
{
// Make sure default event hasn't been prevented
if(event && event.isDefaultPrevented()) { return self; }


var hasSelector = opts.url.indexOf(' '),
url = opts.url,
selector,
hideFirst = opts.once && !opts.loading && first;

// If loading option is disabled, hide the tooltip until content is retrieved (first time only)
if(hideFirst) { tooltip.css('visibility', 'hidden'); }
// If loading option is disabled, prevent the tooltip showing until we've completed the request
if(hideFirst) { try{ event.preventDefault(); } catch(e) {} }

// Make sure default event hasn't been prevented
else if(event && event.isDefaultPrevented()) { return self; }

// Check if user delcared a content selector like in .load()
if(hasSelector > -1) {
selector = url.substr(hasSelector);
Expand All @@ -57,7 +58,7 @@ function Ajax(api)
// Define common after callback for both success/error handlers
function after() {
// Re-display tip if loading and first time, and reset first flag
if(hideFirst) { tooltip.css('visibility', ''); first = FALSE; }
if(hideFirst) { api.show(event.originalEvent); first = FALSE; }

// Call users complete if it was defined
if($.isFunction(opts.complete)) { opts.complete.apply(this, arguments); }
Expand Down Expand Up @@ -85,8 +86,6 @@ function Ajax(api)

// Setup $.ajax option object and process the request
$.ajax( $.extend({ success: successHandler, error: errorHandler, context: api }, opts, { url: url, complete: after }) );

return self;
}
});

Expand Down

0 comments on commit 0d36d3e

Please sign in to comment.