public/javascripts/ajax.js in ajax-1.1.5 vs public/javascripts/ajax.js in ajax-1.1.6
- old
+ new
@@ -336,11 +336,11 @@
* so we ignore that request if <tt>loaded_by_framwork</tt> is false.
*/
self.addressChanged = function() {
if (document.location.pathname != '/') { return false; }
if (self.disable_next_address_intercept) {
- console.log('skipping address intercept & resetting disable_next_address_intercept');
+ console.log('[ajax] skipping address intercept & resetting disable_next_address_intercept');
self.disable_next_address_intercept = false;
return false;
}
if (!self.loaded_by_framework) {
self.loaded_by_framework = true;
@@ -355,18 +355,18 @@
}
// Clean up the URL before making the request. If the URL changes
// as a result of this, update it, which will trigger this
// callback again.
- console.log('cleaning up the url');
+ //console.log('cleaning up the url');
var url = ($.address.value()).replace(/\/\//, '/');
if (url != $.address.value()) {
- console.log('reloading because encoded uri ' + url + ' differs from current uri ' + $.address.value());
+ console.log('[ajax] reloading because encoded uri ' + url + ' differs from current uri ' + $.address.value());
$.address.value(url);
return false;
} else {
- console.log('going ahead with load');
+ //console.log('going ahead with load');
self.loadPage({
url: url
});
}
return true;
@@ -499,17 +499,17 @@
if (ajax_url.match(/^https?:\/\//)) {
ajax_url = ajax_url.replace(/(https?:\/\/[^\/]*\/(.*))/, '$2');
}
if (document.location.pathname != '/') {
var url = ('/#/' + ajax_url).replace(/\/\//, '/');
- console.log('linkClicked 1: going to ' + url);
+ //console.log('linkClicked 1: going to ' + url);
document.location.href = url;
} else {
self.last_click_coords = { pageX: event.pageX, pageY: event.pageY };
encoded_url = ajax.safeURL(ajax_url);
- console.log('linkClicked 2: going to ' + ajax_url);
- console.log('untouched url is ' + ajax_url + ', encoded is ' + encoded_url);
+ //console.log('linkClicked 2: going to ' + ajax_url);
+ //console.log('untouched url is ' + ajax_url + ', encoded is ' + encoded_url);
if ($.browser.msie) {
$.address.value(encoded_url);
}
else {
$.address.value(ajax_url);
@@ -535,19 +535,19 @@
*
*/
self.responseHandler = function(responseText, textStatus, XMLHttpRequest) {
self.last_request_object = XMLHttpRequest;
- console.log("[AJAX] in response handler! status: " + self.last_request_object.status);
+ console.log("[ajax] in response handler! status: " + self.last_request_object.status);
if(self.last_request_object.status == 0) {
- console.log("[AJAX] aborting response handler! ");
+ console.log("[ajax] aborting response handler! ");
return;
}
var data = self.processResponseHeaders(XMLHttpRequest);
if (data.soft_redirect !== undefined) {
- console.log('**** data.soft_redirect is ' + data.soft_redirect);
+ console.log('[ajax] issuing soft redirect to ' + data.soft_redirect);
$.address.value(data.soft_redirect);
return;
};
var container = data.container === undefined ? $(self.default_container) : $(data.container);
@@ -559,11 +559,11 @@
if (responseText.search(/<\s*body[^>]*>/) != -1) {
var start = responseText.search(/<\s*body[^>]*>/);
start += responseText.match(/<\s*body[^>]*>/)[0].length;
var end = responseText.search(/<\s*\/\s*body\s*\>/);
- console.log('Extracting body ['+start+'..'+end+'] chars');
+ console.log('[ajax] extracted body ['+start+'..'+end+'] chars');
responseText = responseText.substr(start, end - start);
var body = $(responseText);
if (body.size() > 0 && body.find(container.selector).size() > 0) {
responseText = body.find(container.selector).html();
@@ -574,18 +574,18 @@
// title - set page title
// tab - activate a tab
// assets - load assets
// callbacks - execute one or an array of callbacks
if (data.title !== undefined) {
- console.log('Using page title '+data.title);
+ console.log('[ajax] set page title '+data.title);
// commenting this out until we fix ' char bug, removing % chars from page titles for now
// $.address.title(encodeURIComponent(data.title));
$.address.title(data.title);
}
if (data.tab !== undefined) {
- console.log('Activating tab '+data.tab);
+ console.log('[ajax] activated tab '+data.tab);
$(data.tab).trigger('activate');
}
/**
* Load stylesheets
@@ -603,12 +603,12 @@
}
/**
* Insert response
*/
- console.log('Using container ',container.selector);
- console.log('Set data ',data);
+ console.log('[ajax] using container ', container.selector);
+ console.log('[ajax] got ajax-info ', data);
container.data('ajax-info', data);
container.html(responseText);
/**
* Include callbacks from Ajax-Info
@@ -647,11 +647,11 @@
* Set cookies - browsers don't seem to allow this
*/
try {
var cookie = XMLHttpRequest.getResponseHeader('Set-Cookie');
if (cookie !== null) {
- console.log('Setting cookie');
+ console.log('[ajax] attempting to set cookie');
document.cookie = cookie;
}
} catch(e) {
}
};
@@ -664,11 +664,11 @@
self.processResponseHeaders = function(XMLHttpRequest) {
var data = XMLHttpRequest.getResponseHeader('Ajax-Info');
if (data !== null) {
try { data = jQuery.parseJSON(data); }
catch(e) {
- console.log('Failed to parse Ajax-Info header as JSON!', data);
+ console.log('[ajax] failed to parse Ajax-Info header as JSON!', data);
}
}
if (data === null || data === undefined) {
data = {};
}
@@ -681,10 +681,10 @@
* Stop watching the mouse position.
*/
self.hideLoadingImage = function() {
// check if a new request has already started
if (self.current_request && self.current_request.status == 0) {
- console.log("[AJAX] aborting hideLoadingImage.. ");
+ console.log("[ajax] aborting hideLoadingImage.. ");
return;
}
if (!self.show_loading_image) { return; }
if (!self.hide_loading_image_callback) {
$(document).unbind('mousemove', self.updateImagePosition);
\ No newline at end of file