1 /** 2 * 3 * jquery.binarytransport.js 4 * 5 * @description. jQuery ajax transport for making binary data type requests. 6 * @version 1.0 7 * @author Henry Algus <[email protected]> 8 * 9 */ 10jquery_binarytransform = 1; 11(function($, undefined) { 12 "use strict"; 13 14 // use this transport for "binary" data type 15 $.ajaxTransport("+binary", function(options, originalOptions, jqXHR) { 16 // check for conditions and support for blob / arraybuffer response type 17 if (window.FormData && ((options.dataType && (options.dataType == 'binary')) || (options.data && ((window.ArrayBuffer && options.data instanceof ArrayBuffer) || (window.Blob && options.data instanceof Blob))))) { 18 return { 19 // create new XMLHttpRequest 20 send: function(headers, callback) { 21 // setup all variables 22 var xhr = new XMLHttpRequest(), 23 url = options.url, 24 type = options.type, 25 async = options.async || true, 26 // blob or arraybuffer. Default is blob 27 dataType = options.responseType || "blob", 28 data = options.data || null, 29 username = options.username || null, 30 password = options.password || null; 31 32 xhr.addEventListener('load', function() { 33 var data = {}; 34 data[options.dataType] = xhr.response; 35 // make callback and send data 36 callback(xhr.status, xhr.statusText, data, xhr.getAllResponseHeaders()); 37 }); 38 39 xhr.open(type, url, async, username, password); 40 41 // setup custom headers 42 for (var i in headers) { 43 xhr.setRequestHeader(i, headers[i]); 44 } 45 46 xhr.responseType = dataType; 47 xhr.send(data); 48 }, 49 abort: function() {} 50 }; 51 } 52 }); 53})(window.jQuery);
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.