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

Commit

Permalink
Prevent navigating away from the page causing tooltip contents being …
Browse files Browse the repository at this point in the history
…updated in AJAX request
  • Loading branch information
Craga89 committed Sep 19, 2011
1 parent 2c2921f commit 2a67050
Show file tree
Hide file tree
Showing 5 changed files with 17 additions and 17 deletions.
2 changes: 1 addition & 1 deletion dist/jquery.qtip.basic.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
* http://en.wikipedia.org/wiki/MIT_License
* http://en.wikipedia.org/wiki/GNU_General_Public_License
*
* Date: Wed Sep 14 01:09:26 2011 +0100
* Date: Mon Sep 19 17:45:44 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
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
* http://en.wikipedia.org/wiki/MIT_License
* http://en.wikipedia.org/wiki/GNU_General_Public_License
*
* Date: Wed Sep 14 01:09:26 2011 +0100
* Date: Mon Sep 19 17:45:44 2011 +0100
*/

/* Core qTip styles */
Expand Down
14 changes: 7 additions & 7 deletions dist/jquery.qtip.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
* http://en.wikipedia.org/wiki/MIT_License
* http://en.wikipedia.org/wiki/GNU_General_Public_License
*
* Date: Wed Sep 14 01:09:26 2011 +0100
* Date: Mon Sep 19 17:45:44 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 @@ -1980,8 +1980,7 @@ function Ajax(api)
};

$.extend(self, {
init: function()
{
init: function() {
// Make sure ajax options are enabled and bind event
if(opts && opts.url) {
tooltip.unbind(namespace)[ opts.once ? 'one' : 'bind' ]('tooltipshow'+namespace, self.load);
Expand All @@ -1990,9 +1989,7 @@ function Ajax(api)
return self;
},

load: function(event, first)
{

load: function(event, first) {
var hasSelector = opts.url.indexOf(' '),
url = opts.url,
selector,
Expand Down Expand Up @@ -2037,7 +2034,10 @@ function Ajax(api)
}

// Error handler
function errorHandler(xh, status, error){ api.set('content.text', status + ': ' + error); }
function errorHandler(xh, status, error) {
if (xh.status === 0) { return; }
api.set('content.text', status + ': ' + error);
}

// Setup $.ajax option object and process the request
$.ajax( $.extend({ success: successHandler, error: errorHandler, context: api }, opts, { url: url, complete: after }) );
Expand Down
4 changes: 2 additions & 2 deletions dist/jquery.qtip.min.js

Large diffs are not rendered by default.

12 changes: 6 additions & 6 deletions src/ajax/ajax.js
Original file line number Diff line number Diff line change
Expand Up @@ -25,8 +25,7 @@ function Ajax(api)
};

$.extend(self, {
init: function()
{
init: function() {
// Make sure ajax options are enabled and bind event
if(opts && opts.url) {
tooltip.unbind(namespace)[ opts.once ? 'one' : 'bind' ]('tooltipshow'+namespace, self.load);
Expand All @@ -35,9 +34,7 @@ function Ajax(api)
return self;
},

load: function(event, first)
{

load: function(event, first) {
var hasSelector = opts.url.indexOf(' '),
url = opts.url,
selector,
Expand Down Expand Up @@ -82,7 +79,10 @@ function Ajax(api)
}

// Error handler
function errorHandler(xh, status, error){ api.set('content.text', status + ': ' + error); }
function errorHandler(xh, status, error) {
if (xh.status === 0) { return; }
api.set('content.text', status + ': ' + error);
}

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

0 comments on commit 2a67050

Please sign in to comment.