1Image.prototype.load = function( url, onLoadStartCallback, onProgressCallback, onLoadEndCallback ) { 2 var thisImg = this, 3 xmlHTTP = new XMLHttpRequest(); 4 5 thisImg.completedPercentage = 0; 6 7 xmlHTTP.open( 'GET', url , true ); 8 xmlHTTP.responseType = 'arraybuffer'; 9 10 xmlHTTP.onload = function( e ) { 11 var h = xmlHTTP.getAllResponseHeaders(), 12 m = h.match( /^Content-Type\:\s*(.*?)$/mi ), 13 mimeType = m[ 1 ] || 'image/png'; 14 15 var blob = new Blob( [ this.response ], { type: mimeType } ); 16 thisImg.src = window.URL.createObjectURL( blob ); 17 }; 18 19 xmlHTTP.onprogress = function( e ) { 20 if ( e.lengthComputable ) 21 thisImg.completedPercentage = parseInt( ( e.loaded / e.total ) * 100 ); 22 if ( onProgressCallback ) onProgressCallback( thisImg ); 23 }; 24 25 xmlHTTP.onloadstart = function() { 26 thisImg.completedPercentage = 0; 27 if ( onLoadStartCallback ) onLoadStartCallback( thisImg ); 28 }; 29 30 xmlHTTP.onloadend = function() { 31 thisImg.completedPercentage = 100; 32 if ( onLoadEndCallback ) onLoadEndCallback( thisImg ); 33 } 34 35 xmlHTTP.send(); 36};
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.