Browse Source

publish muk_web_utils - 12.0

pull/115/head
MuK IT GmbH 6 years ago
parent
commit
d99e0f94e7
  1. 2
      muk_web_utils/__manifest__.py
  2. 41
      muk_web_utils/static/src/js/libs/jquery.js

2
muk_web_utils/__manifest__.py

@ -20,7 +20,7 @@
{
"name": "MuK Web Utils",
"summary": """Utility Features""",
"version": "12.0.2.8.22",
"version": "12.0.2.8.23",
"category": "Extra Tools",
"license": "AGPL-3",
"author": "MuK IT",

41
muk_web_utils/static/src/js/libs/jquery.js

@ -58,3 +58,44 @@ $.fn.dndHover = function(options) {
}
});
};
$.ajaxTransport("+binary", function(options, originalOptions, jqXHR) {
if (window.FormData && ((options.dataType && (options.dataType == 'binary')) ||
(options.data && ((window.ArrayBuffer && options.data instanceof ArrayBuffer) ||
(window.Blob && options.data instanceof Blob))))) {
return {
send: function(headers, callback){
var xhr = new XMLHttpRequest();
var url = options.url,
type = options.type,
async = options.async || true,
dataType = options.responseType || 'blob',
data = options.data || null,
username = options.username,
password = options.password;
xhr.addEventListener('load', function(){
var data = {};
data[options.dataType] = xhr.response;
callback(xhr.status, xhr.statusText, data, xhr.getAllResponseHeaders());
});
xhr.open(type, url, async, username, password);
for (var i in headers ) {
xhr.setRequestHeader(i, headers[i] );
}
if (options.xhrFields) {
for (var key in options.xhrFields) {
if (key in xhr) {
xhr[key] = options.xhrFields[key];
}
}
}
xhr.responseType = dataType;
xhr.send(data);
},
abort: function(){
jqXHR.abort();
}
};
}
});
Loading…
Cancel
Save