Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
37 changes: 37 additions & 0 deletions couchapp/_attachments/jquery.extensions.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
(function($) {
// https://issues.apache.org/jira/browse/COUCHDB-1239
// fixes IE8 couchapp auth
$.ajaxSetup({ cache: false });

// adds the jQuery httpData function if it is not available
// fixes jquery.couch and jquery.form calling the obsolete internal function
$.httpData = $.httpData || function( xhr, type, s ) {
var ct = xhr.getResponseHeader("content-type") || "",
xml = type === "xml" || !type && ct.indexOf("xml") >= 0,
data = xml ? xhr.responseXML : xhr.responseText;

if ( xml && data.documentElement.nodeName === "parsererror" ) {
jQuery.error( "parsererror" );
}

// Allow a pre-filtering function to sanitize the response
// s is checked to keep backwards compatibility
if ( s && s.dataFilter ) {
data = s.dataFilter( data, type );
}

// The filter can actually parse the response
if ( typeof data === "string" ) {
// Get the JavaScript object, if JSON is used.
if ( type === "json" || !type && ct.indexOf("json") >= 0 ) {
data = jQuery.parseJSON( data );

// If the type is "script", eval it in global context
} else if ( type === "script" || !type && ct.indexOf("javascript") >= 0 ) {
jQuery.globalEval( data );
}
}

return data;
}
})(jQuery);
1 change: 1 addition & 0 deletions couchapp/_attachments/loader.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ couchapp_load([
"/_utils/script/sha1.js",
"/_utils/script/json2.js",
"/_utils/script/jquery.js",
"vendor/couchapp/jquery.extensions.js",
"/_utils/script/jquery.couch.js",
"vendor/couchapp/jquery.couch.app.js",
"vendor/couchapp/jquery.couch.app.util.js",
Expand Down