diff options
Diffstat (limited to 'webAO/lib')
| -rw-r--r-- | webAO/lib/gify.min.js | 12 | ||||
| -rw-r--r-- | webAO/lib/jdataview.min.js | 168 | ||||
| -rw-r--r-- | webAO/lib/jquery.ui.touch-punch.min.js | 2 |
3 files changed, 130 insertions, 52 deletions
diff --git a/webAO/lib/gify.min.js b/webAO/lib/gify.min.js index 8656d4a..7afe02c 100644 --- a/webAO/lib/gify.min.js +++ b/webAO/lib/gify.min.js @@ -1 +1,11 @@ -var gify=function(){"use strict";function t(t){return 3*Math.pow(2,1+a(t.slice(5,8)))}function e(t){for(var e=[],i=7;i>=0;i--)e.push(t&1<<i?1:0);return e}function i(t){return t/100*1e3}function a(t){return t.reduce(function(t,e){return 2*t+e},0)}function r(t,e,i){for(var a={data:"",size:0};;){var r=t.getUint8(e+a.size,!0);if(0===r){a.size++;break}i&&(a.data+=t.getString(r,e+a.size+1)),a.size+=r+1}return a}function n(){return{identifier:"0",localPalette:!1,localPaletteSize:0,interlace:!1,comments:[],text:"",left:0,top:0,width:0,height:0,delay:0,disposal:0}}function o(a,o){var u=0,g=0,s={valid:!1,globalPalette:!1,globalPaletteSize:0,globalPaletteColorsRGB:[],loopCount:0,height:0,width:0,animated:!1,images:[],isBrowserDuration:!1,duration:0,durationIE:0,durationSafari:0,durationFirefox:0,durationChrome:0,durationOpera:0},d=new jDataView(a);if(a.byteLength<10)return s;if(18249!=d.getUint16(0)||17976!=d.getUint16(2))return s;s.width=d.getUint16(6,!0),s.height=d.getUint16(8,!0),s.valid=!0;var f=e(d.getUint8(10,!0));if(f[0]){var c=t(f);s.globalPalette=!0,s.globalPaletteSize=c/3,u+=c;for(var h=0;h<s.globalPaletteSize;h++){var v=13+3*h,U=d.getUint8(v,!0),b=d.getUint8(v+1,!0),m=d.getUint8(v+2,!0);s.globalPaletteColorsRGB.push({r:U,g:b,b:m})}}u+=13;for(var p=n();;){try{var w=d.getUint8(u,!0);switch(w){case 33:var z=d.getUint8(u+1,!0);if(249===z){var P=d.getUint8(u+2);if(4===P){var S=i(d.getUint16(u+4,!0));60>S&&!s.isBrowserDuration&&(s.isBrowserDuration=!0),p.delay=S,s.duration+=S,s.durationIE+=60>S?l:S,s.durationSafari+=20>S?l:S,s.durationChrome+=20>S?l:S,s.durationFirefox+=20>S?l:S,s.durationOpera+=20>S?l:S;var f=e(d.getUint8(u+3)),C=f.slice(3,6).join("");p.disposal=parseInt(C,2),u+=8}else u++}else{u+=2;var k=r(d,u,!0);switch(z){case 255:var y=d.getString(8,u+1);"NETSCAPE"===y&&(s.loopCount=d.getUint8(u+14,!0));break;case 206:p.identifier=k.data;break;case 254:p.comments.push(k.data);break;case 1:p.text=k.data}u+=k.size}break;case 44:p.left=d.getUint16(u+1,!0),p.top=d.getUint16(u+3,!0),p.width=d.getUint16(u+5,!0),p.height=d.getUint16(u+7,!0);var f=e(d.getUint8(u+9,!0));if(f[0]){var B=t(f);p.localPalette=!0,p.localPaletteSize=B/3,u+=B}if(f[1]&&(p.interlace=!0),s.images.push(p),g++,p=n(),p.identifier=g.toString(),s.images.length>1&&!s.animated&&(s.animated=!0,o))return s;u+=11;var k=r(d,u,!1);u+=k.size;break;case 59:return s;default:u++}}catch(x){return s.valid=!1,s}if(u>=a.byteLength)return s}return s}var l=100;return{isAnimated:function(t){var e=o(t,!0);return e.animated},getInfo:function(t){return o(t,!1)}}}();
\ No newline at end of file +const gify = (function () { + function t(t) { return 3 * 2 ** (1 + a(t.slice(5, 8))); } function e(t) { for (var e = [], i = 7; i >= 0; i--)e.push(t & 1 << i ? 1 : 0); return e; } function i(t) { return t / 100 * 1e3; } function a(t) { return t.reduce((t, e) => 2 * t + e, 0); } function r(t, e, i) { for (var a = { data: '', size: 0 }; ;) { const r = t.getUint8(e + a.size, !0); if (r === 0) { a.size++; break; }i && (a.data += t.getString(r, e + a.size + 1)), a.size += r + 1; } return a; } function n() { + return { + identifier: '0', localPalette: !1, localPaletteSize: 0, interlace: !1, comments: [], text: '', left: 0, top: 0, width: 0, height: 0, delay: 0, disposal: 0, + }; + } function o(a, o) { + let u = 0; let g = 0; const s = { + valid: !1, globalPalette: !1, globalPaletteSize: 0, globalPaletteColorsRGB: [], loopCount: 0, height: 0, width: 0, animated: !1, images: [], isBrowserDuration: !1, duration: 0, durationIE: 0, durationSafari: 0, durationFirefox: 0, durationChrome: 0, durationOpera: 0, + }; const d = new jDataView(a); if (a.byteLength < 10) return s; if (d.getUint16(0) != 18249 || d.getUint16(2) != 17976) return s; s.width = d.getUint16(6, !0), s.height = d.getUint16(8, !0), s.valid = !0; var f = e(d.getUint8(10, !0)); if (f[0]) { const c = t(f); s.globalPalette = !0, s.globalPaletteSize = c / 3, u += c; for (let h = 0; h < s.globalPaletteSize; h++) { const v = 13 + 3 * h; const U = d.getUint8(v, !0); const b = d.getUint8(v + 1, !0); const m = d.getUint8(v + 2, !0); s.globalPaletteColorsRGB.push({ r: U, g: b, b: m }); } }u += 13; for (let p = n(); ;) { try { const w = d.getUint8(u, !0); switch (w) { case 33: var z = d.getUint8(u + 1, !0); if (z === 249) { const P = d.getUint8(u + 2); if (P === 4) { const S = i(d.getUint16(u + 4, !0)); S < 60 && !s.isBrowserDuration && (s.isBrowserDuration = !0), p.delay = S, s.duration += S, s.durationIE += S < 60 ? l : S, s.durationSafari += S < 20 ? l : S, s.durationChrome += S < 20 ? l : S, s.durationFirefox += S < 20 ? l : S, s.durationOpera += S < 20 ? l : S; var f = e(d.getUint8(u + 3)); const C = f.slice(3, 6).join(''); p.disposal = parseInt(C, 2), u += 8; } else u++; } else { u += 2; var k = r(d, u, !0); switch (z) { case 255: var y = d.getString(8, u + 1); y === 'NETSCAPE' && (s.loopCount = d.getUint8(u + 14, !0)); break; case 206: p.identifier = k.data; break; case 254: p.comments.push(k.data); break; case 1: p.text = k.data; }u += k.size; } break; case 44: p.left = d.getUint16(u + 1, !0), p.top = d.getUint16(u + 3, !0), p.width = d.getUint16(u + 5, !0), p.height = d.getUint16(u + 7, !0); var f = e(d.getUint8(u + 9, !0)); if (f[0]) { const B = t(f); p.localPalette = !0, p.localPaletteSize = B / 3, u += B; } if (f[1] && (p.interlace = !0), s.images.push(p), g++, p = n(), p.identifier = g.toString(), s.images.length > 1 && !s.animated && (s.animated = !0, o)) return s; u += 11; var k = r(d, u, !1); u += k.size; break; case 59: return s; default: u++; } } catch (x) { return s.valid = !1, s; } if (u >= a.byteLength) return s; } return s; + } var l = 100; return { isAnimated(t) { const e = o(t, !0); return e.animated; }, getInfo(t) { return o(t, !1); } }; +}()); diff --git a/webAO/lib/jdataview.min.js b/webAO/lib/jdataview.min.js index 38e31b9..86f8794 100644 --- a/webAO/lib/jdataview.min.js +++ b/webAO/lib/jdataview.min.js @@ -1,50 +1,118 @@ -(function(global){var compatibility={ArrayBuffer:typeof ArrayBuffer!=='undefined',DataView:typeof DataView!=='undefined'&&('getFloat64'in DataView.prototype||'getFloat64'in new DataView(new ArrayBuffer(1))),NodeBuffer:typeof Buffer!=='undefined'&&'readInt16LE'in Buffer.prototype};var dataTypes={'Int8':1,'Int16':2,'Int32':4,'Uint8':1,'Uint16':2,'Uint32':4,'Float32':4,'Float64':8};var nodeNaming={'Int8':'Int8','Int16':'Int16','Int32':'Int32','Uint8':'UInt8','Uint16':'UInt16','Uint32':'UInt32','Float32':'Float','Float64':'Double'};var jDataView=function(buffer,byteOffset,byteLength,littleEndian){if(!(this instanceof jDataView)){throw new Error("jDataView constructor may not be called as a function");} -this.buffer=buffer;if(!(compatibility.NodeBuffer&&buffer instanceof Buffer)&&!(compatibility.ArrayBuffer&&buffer instanceof ArrayBuffer)&&typeof buffer!=='string'){throw new TypeError('jDataView buffer has an incompatible type');} -this._isArrayBuffer=compatibility.ArrayBuffer&&buffer instanceof ArrayBuffer;this._isDataView=compatibility.DataView&&this._isArrayBuffer;this._isNodeBuffer=compatibility.NodeBuffer&&buffer instanceof Buffer;this._littleEndian=littleEndian===undefined?false:littleEndian;var bufferLength=this._isArrayBuffer?buffer.byteLength:buffer.length;if(byteOffset===undefined){byteOffset=0;} -this.byteOffset=byteOffset;if(byteLength===undefined){byteLength=bufferLength-byteOffset;} -this.byteLength=byteLength;if(!this._isDataView){if(typeof byteOffset!=='number'){throw new TypeError('jDataView byteOffset is not a number');} -if(typeof byteLength!=='number'){throw new TypeError('jDataView byteLength is not a number');} -if(byteOffset<0){throw new Error('jDataView byteOffset is negative');} -if(byteLength<0){throw new Error('jDataView byteLength is negative');}} -if(this._isDataView){this._view=new DataView(buffer,byteOffset,byteLength);this._start=0;} -this._start=byteOffset;if(byteOffset+byteLength>bufferLength){throw new Error("jDataView (byteOffset + byteLength) value is out of bounds");} -this._offset=0;if(this._isDataView){for(var type in dataTypes){if(!dataTypes.hasOwnProperty(type)){continue;} -(function(type,view){var size=dataTypes[type];view['get'+type]=function(byteOffset,littleEndian){if(littleEndian===undefined){littleEndian=view._littleEndian;} -if(byteOffset===undefined){byteOffset=view._offset;} -view._offset=byteOffset+size;return view._view['get'+type](byteOffset,littleEndian);}})(type,this);}}else if(this._isNodeBuffer&&compatibility.NodeBuffer){for(var type in dataTypes){if(!dataTypes.hasOwnProperty(type)){continue;} -var name;if(type==='Int8'||type==='Uint8'){name='read'+nodeNaming[type];}else if(littleEndian){name='read'+nodeNaming[type]+'LE';}else{name='read'+nodeNaming[type]+'BE';} -(function(type,view,name){var size=dataTypes[type];view['get'+type]=function(byteOffset,littleEndian){if(littleEndian===undefined){littleEndian=view._littleEndian;} -if(byteOffset===undefined){byteOffset=view._offset;} -view._offset=byteOffset+size;return view.buffer[name](view._start+byteOffset);}})(type,this,name);}}else{for(var type in dataTypes){if(!dataTypes.hasOwnProperty(type)){continue;} -(function(type,view){var size=dataTypes[type];view['get'+type]=function(byteOffset,littleEndian){if(littleEndian===undefined){littleEndian=view._littleEndian;} -if(byteOffset===undefined){byteOffset=view._offset;} -view._offset=byteOffset+size;if(view._isArrayBuffer&&(view._start+byteOffset)%size===0&&(size===1||littleEndian)){return new global[type+'Array'](view.buffer,view._start+byteOffset,1)[0];}else{if(typeof byteOffset!=='number'){throw new TypeError('jDataView byteOffset is not a number');} -if(byteOffset+size>view.byteLength){throw new Error('jDataView (byteOffset + size) value is out of bounds');} -return view['_get'+type](view._start+byteOffset,littleEndian);}}})(type,this);}}};if(compatibility.NodeBuffer){jDataView.createBuffer=function(){var buffer=new Buffer(arguments.length);for(var i=0;i<arguments.length;++i){buffer[i]=arguments[i];} -return buffer;}}else if(compatibility.ArrayBuffer){jDataView.createBuffer=function(){var buffer=new ArrayBuffer(arguments.length);var view=new Int8Array(buffer);for(var i=0;i<arguments.length;++i){view[i]=arguments[i];} -return buffer;}}else{jDataView.createBuffer=function(){return String.fromCharCode.apply(null,arguments);}} -jDataView.prototype={compatibility:compatibility,getString:function(length,byteOffset){var value;if(byteOffset===undefined){byteOffset=this._offset;} -if(typeof byteOffset!=='number'){throw new TypeError('jDataView byteOffset is not a number');} -if(length<0||byteOffset+length>this.byteLength){throw new Error('jDataView length or (byteOffset+length) value is out of bounds');} -if(this._isNodeBuffer){value=this.buffer.toString('ascii',this._start+byteOffset,this._start+byteOffset+length);} -else{value='';for(var i=0;i<length;++i){var char=this.getUint8(byteOffset+i);value+=String.fromCharCode(char>127?65533:char);}} -this._offset=byteOffset+length;return value;},getChar:function(byteOffset){return this.getString(1,byteOffset);},tell:function(){return this._offset;},seek:function(byteOffset){if(typeof byteOffset!=='number'){throw new TypeError('jDataView byteOffset is not a number');} -if(byteOffset<0||byteOffset>this.byteLength){throw new Error('jDataView byteOffset value is out of bounds');} -return this._offset=byteOffset;},_endianness:function(byteOffset,pos,max,littleEndian){return byteOffset+(littleEndian?max-pos-1:pos);},_getFloat64:function(byteOffset,littleEndian){var b0=this._getUint8(this._endianness(byteOffset,0,8,littleEndian)),b1=this._getUint8(this._endianness(byteOffset,1,8,littleEndian)),b2=this._getUint8(this._endianness(byteOffset,2,8,littleEndian)),b3=this._getUint8(this._endianness(byteOffset,3,8,littleEndian)),b4=this._getUint8(this._endianness(byteOffset,4,8,littleEndian)),b5=this._getUint8(this._endianness(byteOffset,5,8,littleEndian)),b6=this._getUint8(this._endianness(byteOffset,6,8,littleEndian)),b7=this._getUint8(this._endianness(byteOffset,7,8,littleEndian)),sign=1-(2*(b0>>7)),exponent=((((b0<<1)&0xff)<<3)|(b1>>4))-(Math.pow(2,10)-1),mantissa=((b1&0x0f)*Math.pow(2,48))+(b2*Math.pow(2,40))+(b3*Math.pow(2,32))+ -(b4*Math.pow(2,24))+(b5*Math.pow(2,16))+(b6*Math.pow(2,8))+b7;if(exponent===1024){if(mantissa!==0){return NaN;}else{return sign*Infinity;}} -if(exponent===-1023){return sign*mantissa*Math.pow(2,-1022-52);} -return sign*(1+mantissa*Math.pow(2,-52))*Math.pow(2,exponent);},_getFloat32:function(byteOffset,littleEndian){var b0=this._getUint8(this._endianness(byteOffset,0,4,littleEndian)),b1=this._getUint8(this._endianness(byteOffset,1,4,littleEndian)),b2=this._getUint8(this._endianness(byteOffset,2,4,littleEndian)),b3=this._getUint8(this._endianness(byteOffset,3,4,littleEndian)),sign=1-(2*(b0>>7)),exponent=(((b0<<1)&0xff)|(b1>>7))-127,mantissa=((b1&0x7f)<<16)|(b2<<8)|b3;if(exponent===128){if(mantissa!==0){return NaN;}else{return sign*Infinity;}} -if(exponent===-127){return sign*mantissa*Math.pow(2,-126-23);} -return sign*(1+mantissa*Math.pow(2,-23))*Math.pow(2,exponent);},_getInt32:function(byteOffset,littleEndian){var b=this._getUint32(byteOffset,littleEndian);return b>Math.pow(2,31)-1?b-Math.pow(2,32):b;},_getUint32:function(byteOffset,littleEndian){var b3=this._getUint8(this._endianness(byteOffset,0,4,littleEndian)),b2=this._getUint8(this._endianness(byteOffset,1,4,littleEndian)),b1=this._getUint8(this._endianness(byteOffset,2,4,littleEndian)),b0=this._getUint8(this._endianness(byteOffset,3,4,littleEndian));return(b3*Math.pow(2,24))+(b2<<16)+(b1<<8)+b0;},_getInt16:function(byteOffset,littleEndian){var b=this._getUint16(byteOffset,littleEndian);return b>Math.pow(2,15)-1?b-Math.pow(2,16):b;},_getUint16:function(byteOffset,littleEndian){var b1=this._getUint8(this._endianness(byteOffset,0,2,littleEndian)),b0=this._getUint8(this._endianness(byteOffset,1,2,littleEndian));return(b1<<8)+b0;},_getInt8:function(byteOffset){var b=this._getUint8(byteOffset);return b>Math.pow(2,7)-1?b-Math.pow(2,8):b;},_getUint8:function(byteOffset){if(this._isArrayBuffer){return new Uint8Array(this.buffer,byteOffset,1)[0];} -else if(this._isNodeBuffer){return this.buffer[byteOffset];}else{return this.buffer.charCodeAt(byteOffset)&0xff;}}};if(typeof jQuery!=='undefined'&&jQuery.fn.jquery>="1.6.2"){var convertResponseBodyToText=function(byteArray){var scrambledStr;try{scrambledStr=IEBinaryToArray_ByteStr(byteArray);}catch(e){var IEBinaryToArray_ByteStr_Script="Function IEBinaryToArray_ByteStr(Binary)\r\n"+" IEBinaryToArray_ByteStr = CStr(Binary)\r\n"+"End Function\r\n"+"Function IEBinaryToArray_ByteStr_Last(Binary)\r\n"+" Dim lastIndex\r\n"+" lastIndex = LenB(Binary)\r\n"+" if lastIndex mod 2 Then\r\n"+" IEBinaryToArray_ByteStr_Last = AscB( MidB( Binary, lastIndex, 1 ) )\r\n"+" Else\r\n"+" IEBinaryToArray_ByteStr_Last = -1\r\n"+" End If\r\n"+"End Function\r\n";window.execScript(IEBinaryToArray_ByteStr_Script,'vbscript');scrambledStr=IEBinaryToArray_ByteStr(byteArray);} -var lastChr=IEBinaryToArray_ByteStr_Last(byteArray),result="",i=0,l=scrambledStr.length%8,thischar;while(i<l){thischar=scrambledStr.charCodeAt(i++);result+=String.fromCharCode(thischar&0xff,thischar>>8);} -l=scrambledStr.length -while(i<l){result+=String.fromCharCode((thischar=scrambledStr.charCodeAt(i++),thischar&0xff),thischar>>8,(thischar=scrambledStr.charCodeAt(i++),thischar&0xff),thischar>>8,(thischar=scrambledStr.charCodeAt(i++),thischar&0xff),thischar>>8,(thischar=scrambledStr.charCodeAt(i++),thischar&0xff),thischar>>8,(thischar=scrambledStr.charCodeAt(i++),thischar&0xff),thischar>>8,(thischar=scrambledStr.charCodeAt(i++),thischar&0xff),thischar>>8,(thischar=scrambledStr.charCodeAt(i++),thischar&0xff),thischar>>8,(thischar=scrambledStr.charCodeAt(i++),thischar&0xff),thischar>>8);} -if(lastChr>-1){result+=String.fromCharCode(lastChr);} -return result;};jQuery.ajaxSetup({converters:{'* dataview':function(data){return new jDataView(data);}},accepts:{dataview:"text/plain; charset=x-user-defined"},responseHandler:{dataview:function(responses,options,xhr){if('mozResponseArrayBuffer'in xhr){responses.text=xhr.mozResponseArrayBuffer;} -else if('responseType'in xhr&&xhr.responseType==='arraybuffer'&&xhr.response){responses.text=xhr.response;} -else if('responseBody'in xhr){responses.text=convertResponseBodyToText(xhr.responseBody);} -else{responses.text=xhr.responseText;}}}});jQuery.ajaxPrefilter('dataview',function(options,originalOptions,jqXHR){if(jQuery.support.ajaxResponseType){if(!options.hasOwnProperty('xhrFields')){options.xhrFields={};} -options.xhrFields.responseType='arraybuffer';} -options.mimeType='text/plain; charset=x-user-defined';});} -global.jDataView=(global.module||{}).exports=jDataView;if(typeof module!=='undefined'){module.exports=jDataView;}})(this);
\ No newline at end of file +(function (global) { + const compatibility = { ArrayBuffer: typeof ArrayBuffer !== 'undefined', DataView: typeof DataView !== 'undefined' && ('getFloat64' in DataView.prototype || 'getFloat64' in new DataView(new ArrayBuffer(1))), NodeBuffer: typeof Buffer !== 'undefined' && 'readInt16LE' in Buffer.prototype }; const dataTypes = { + Int8: 1, Int16: 2, Int32: 4, Uint8: 1, Uint16: 2, Uint32: 4, Float32: 4, Float64: 8, + }; const nodeNaming = { + Int8: 'Int8', Int16: 'Int16', Int32: 'Int32', Uint8: 'UInt8', Uint16: 'UInt16', Uint32: 'UInt32', Float32: 'Float', Float64: 'Double', + }; var jDataView = function (buffer, byteOffset, byteLength, littleEndian) { + if (!(this instanceof jDataView)) { throw new Error('jDataView constructor may not be called as a function'); } + this.buffer = buffer; if (!(compatibility.NodeBuffer && buffer instanceof Buffer) && !(compatibility.ArrayBuffer && buffer instanceof ArrayBuffer) && typeof buffer !== 'string') { throw new TypeError('jDataView buffer has an incompatible type'); } + this._isArrayBuffer = compatibility.ArrayBuffer && buffer instanceof ArrayBuffer; this._isDataView = compatibility.DataView && this._isArrayBuffer; this._isNodeBuffer = compatibility.NodeBuffer && buffer instanceof Buffer; this._littleEndian = littleEndian === undefined ? false : littleEndian; const bufferLength = this._isArrayBuffer ? buffer.byteLength : buffer.length; if (byteOffset === undefined) { byteOffset = 0; } + this.byteOffset = byteOffset; if (byteLength === undefined) { byteLength = bufferLength - byteOffset; } + this.byteLength = byteLength; if (!this._isDataView) { + if (typeof byteOffset !== 'number') { throw new TypeError('jDataView byteOffset is not a number'); } + if (typeof byteLength !== 'number') { throw new TypeError('jDataView byteLength is not a number'); } + if (byteOffset < 0) { throw new Error('jDataView byteOffset is negative'); } + if (byteLength < 0) { throw new Error('jDataView byteLength is negative'); } + } + if (this._isDataView) { this._view = new DataView(buffer, byteOffset, byteLength); this._start = 0; } + this._start = byteOffset; if (byteOffset + byteLength > bufferLength) { throw new Error('jDataView (byteOffset + byteLength) value is out of bounds'); } + this._offset = 0; if (this._isDataView) { + for (var type in dataTypes) { + if (!dataTypes.hasOwnProperty(type)) { continue; } + (function (type, view) { + const size = dataTypes[type]; view[`get${type}`] = function (byteOffset, littleEndian) { + if (littleEndian === undefined) { littleEndian = view._littleEndian; } + if (byteOffset === undefined) { byteOffset = view._offset; } + view._offset = byteOffset + size; return view._view[`get${type}`](byteOffset, littleEndian); + }; + }(type, this)); + } + } else if (this._isNodeBuffer && compatibility.NodeBuffer) { + for (var type in dataTypes) { + if (!dataTypes.hasOwnProperty(type)) { continue; } + var name; if (type === 'Int8' || type === 'Uint8') { name = `read${nodeNaming[type]}`; } else if (littleEndian) { name = `read${nodeNaming[type]}LE`; } else { name = `read${nodeNaming[type]}BE`; } + (function (type, view, name) { + const size = dataTypes[type]; view[`get${type}`] = function (byteOffset, littleEndian) { + if (littleEndian === undefined) { littleEndian = view._littleEndian; } + if (byteOffset === undefined) { byteOffset = view._offset; } + view._offset = byteOffset + size; return view.buffer[name](view._start + byteOffset); + }; + }(type, this, name)); + } + } else { + for (var type in dataTypes) { + if (!dataTypes.hasOwnProperty(type)) { continue; } + (function (type, view) { + const size = dataTypes[type]; view[`get${type}`] = function (byteOffset, littleEndian) { + if (littleEndian === undefined) { littleEndian = view._littleEndian; } + if (byteOffset === undefined) { byteOffset = view._offset; } + view._offset = byteOffset + size; if (view._isArrayBuffer && (view._start + byteOffset) % size === 0 && (size === 1 || littleEndian)) { return new global[`${type}Array`](view.buffer, view._start + byteOffset, 1)[0]; } if (typeof byteOffset !== 'number') { throw new TypeError('jDataView byteOffset is not a number'); } + if (byteOffset + size > view.byteLength) { throw new Error('jDataView (byteOffset + size) value is out of bounds'); } + return view[`_get${type}`](view._start + byteOffset, littleEndian); + }; + }(type, this)); + } + } + }; if (compatibility.NodeBuffer) { + jDataView.createBuffer = function () { + const buffer = new Buffer(arguments.length); for (let i = 0; i < arguments.length; ++i) { buffer[i] = arguments[i]; } + return buffer; + }; + } else if (compatibility.ArrayBuffer) { + jDataView.createBuffer = function () { + const buffer = new ArrayBuffer(arguments.length); const view = new Int8Array(buffer); for (let i = 0; i < arguments.length; ++i) { view[i] = arguments[i]; } + return buffer; + }; + } else { jDataView.createBuffer = function () { return String.fromCharCode.apply(null, arguments); }; } + jDataView.prototype = { + compatibility, + getString(length, byteOffset) { + let value; if (byteOffset === undefined) { byteOffset = this._offset; } + if (typeof byteOffset !== 'number') { throw new TypeError('jDataView byteOffset is not a number'); } + if (length < 0 || byteOffset + length > this.byteLength) { throw new Error('jDataView length or (byteOffset+length) value is out of bounds'); } + if (this._isNodeBuffer) { value = this.buffer.toString('ascii', this._start + byteOffset, this._start + byteOffset + length); } else { value = ''; for (let i = 0; i < length; ++i) { const char = this.getUint8(byteOffset + i); value += String.fromCharCode(char > 127 ? 65533 : char); } } + this._offset = byteOffset + length; return value; + }, + getChar(byteOffset) { return this.getString(1, byteOffset); }, + tell() { return this._offset; }, + seek(byteOffset) { + if (typeof byteOffset !== 'number') { throw new TypeError('jDataView byteOffset is not a number'); } + if (byteOffset < 0 || byteOffset > this.byteLength) { throw new Error('jDataView byteOffset value is out of bounds'); } + return this._offset = byteOffset; + }, + _endianness(byteOffset, pos, max, littleEndian) { return byteOffset + (littleEndian ? max - pos - 1 : pos); }, + _getFloat64(byteOffset, littleEndian) { + const b0 = this._getUint8(this._endianness(byteOffset, 0, 8, littleEndian)); const b1 = this._getUint8(this._endianness(byteOffset, 1, 8, littleEndian)); const b2 = this._getUint8(this._endianness(byteOffset, 2, 8, littleEndian)); const b3 = this._getUint8(this._endianness(byteOffset, 3, 8, littleEndian)); const b4 = this._getUint8(this._endianness(byteOffset, 4, 8, littleEndian)); const b5 = this._getUint8(this._endianness(byteOffset, 5, 8, littleEndian)); const b6 = this._getUint8(this._endianness(byteOffset, 6, 8, littleEndian)); const b7 = this._getUint8(this._endianness(byteOffset, 7, 8, littleEndian)); const sign = 1 - (2 * (b0 >> 7)); const exponent = ((((b0 << 1) & 0xff) << 3) | (b1 >> 4)) - (2 ** 10 - 1); const mantissa = ((b1 & 0x0f) * 2 ** 48) + (b2 * 2 ** 40) + (b3 * 2 ** 32) ++ (b4 * 2 ** 24) + (b5 * 2 ** 16) + (b6 * 2 ** 8) + b7; if (exponent === 1024) { if (mantissa !== 0) { return NaN; } return sign * Infinity; } + if (exponent === -1023) { return sign * mantissa * 2 ** (-1022 - 52); } + return sign * (1 + mantissa * 2 ** -52) * 2 ** exponent; + }, + _getFloat32(byteOffset, littleEndian) { + const b0 = this._getUint8(this._endianness(byteOffset, 0, 4, littleEndian)); const b1 = this._getUint8(this._endianness(byteOffset, 1, 4, littleEndian)); const b2 = this._getUint8(this._endianness(byteOffset, 2, 4, littleEndian)); const b3 = this._getUint8(this._endianness(byteOffset, 3, 4, littleEndian)); const sign = 1 - (2 * (b0 >> 7)); const exponent = (((b0 << 1) & 0xff) | (b1 >> 7)) - 127; const mantissa = ((b1 & 0x7f) << 16) | (b2 << 8) | b3; if (exponent === 128) { if (mantissa !== 0) { return NaN; } return sign * Infinity; } + if (exponent === -127) { return sign * mantissa * 2 ** (-126 - 23); } + return sign * (1 + mantissa * 2 ** -23) * 2 ** exponent; + }, + _getInt32(byteOffset, littleEndian) { const b = this._getUint32(byteOffset, littleEndian); return b > 2 ** 31 - 1 ? b - 2 ** 32 : b; }, + _getUint32(byteOffset, littleEndian) { const b3 = this._getUint8(this._endianness(byteOffset, 0, 4, littleEndian)); const b2 = this._getUint8(this._endianness(byteOffset, 1, 4, littleEndian)); const b1 = this._getUint8(this._endianness(byteOffset, 2, 4, littleEndian)); const b0 = this._getUint8(this._endianness(byteOffset, 3, 4, littleEndian)); return (b3 * 2 ** 24) + (b2 << 16) + (b1 << 8) + b0; }, + _getInt16(byteOffset, littleEndian) { const b = this._getUint16(byteOffset, littleEndian); return b > 2 ** 15 - 1 ? b - 2 ** 16 : b; }, + _getUint16(byteOffset, littleEndian) { const b1 = this._getUint8(this._endianness(byteOffset, 0, 2, littleEndian)); const b0 = this._getUint8(this._endianness(byteOffset, 1, 2, littleEndian)); return (b1 << 8) + b0; }, + _getInt8(byteOffset) { const b = this._getUint8(byteOffset); return b > 2 ** 7 - 1 ? b - 2 ** 8 : b; }, + _getUint8(byteOffset) { if (this._isArrayBuffer) { return new Uint8Array(this.buffer, byteOffset, 1)[0]; } if (this._isNodeBuffer) { return this.buffer[byteOffset]; } return this.buffer.charCodeAt(byteOffset) & 0xff; }, + }; if (typeof jQuery !== 'undefined' && jQuery.fn.jquery >= '1.6.2') { + const convertResponseBodyToText = function (byteArray) { + let scrambledStr; try { scrambledStr = IEBinaryToArray_ByteStr(byteArray); } catch (e) { const IEBinaryToArray_ByteStr_Script = 'Function IEBinaryToArray_ByteStr(Binary)\r\n' + ' IEBinaryToArray_ByteStr = CStr(Binary)\r\n' + 'End Function\r\n' + 'Function IEBinaryToArray_ByteStr_Last(Binary)\r\n' + ' Dim lastIndex\r\n' + ' lastIndex = LenB(Binary)\r\n' + ' if lastIndex mod 2 Then\r\n' + ' IEBinaryToArray_ByteStr_Last = AscB( MidB( Binary, lastIndex, 1 ) )\r\n' + ' Else\r\n' + ' IEBinaryToArray_ByteStr_Last = -1\r\n' + ' End If\r\n' + 'End Function\r\n'; window.execScript(IEBinaryToArray_ByteStr_Script, 'vbscript'); scrambledStr = IEBinaryToArray_ByteStr(byteArray); } + const lastChr = IEBinaryToArray_ByteStr_Last(byteArray); let result = ''; let i = 0; let l = scrambledStr.length % 8; let thischar; while (i < l) { thischar = scrambledStr.charCodeAt(i++); result += String.fromCharCode(thischar & 0xff, thischar >> 8); } + l = scrambledStr.length; + while (i < l) { result += String.fromCharCode((thischar = scrambledStr.charCodeAt(i++), thischar & 0xff), thischar >> 8, (thischar = scrambledStr.charCodeAt(i++), thischar & 0xff), thischar >> 8, (thischar = scrambledStr.charCodeAt(i++), thischar & 0xff), thischar >> 8, (thischar = scrambledStr.charCodeAt(i++), thischar & 0xff), thischar >> 8, (thischar = scrambledStr.charCodeAt(i++), thischar & 0xff), thischar >> 8, (thischar = scrambledStr.charCodeAt(i++), thischar & 0xff), thischar >> 8, (thischar = scrambledStr.charCodeAt(i++), thischar & 0xff), thischar >> 8, (thischar = scrambledStr.charCodeAt(i++), thischar & 0xff), thischar >> 8); } + if (lastChr > -1) { result += String.fromCharCode(lastChr); } + return result; + }; jQuery.ajaxSetup({ converters: { '* dataview': function (data) { return new jDataView(data); } }, accepts: { dataview: 'text/plain; charset=x-user-defined' }, responseHandler: { dataview(responses, options, xhr) { if ('mozResponseArrayBuffer' in xhr) { responses.text = xhr.mozResponseArrayBuffer; } else if ('responseType' in xhr && xhr.responseType === 'arraybuffer' && xhr.response) { responses.text = xhr.response; } else if ('responseBody' in xhr) { responses.text = convertResponseBodyToText(xhr.responseBody); } else { responses.text = xhr.responseText; } } } }); jQuery.ajaxPrefilter('dataview', (options, originalOptions, jqXHR) => { + if (jQuery.support.ajaxResponseType) { + if (!options.hasOwnProperty('xhrFields')) { options.xhrFields = {}; } + options.xhrFields.responseType = 'arraybuffer'; + } + options.mimeType = 'text/plain; charset=x-user-defined'; + }); + } + global.jDataView = (global.module || {}).exports = jDataView; if (typeof module !== 'undefined') { module.exports = jDataView; } +}(this)); diff --git a/webAO/lib/jquery.ui.touch-punch.min.js b/webAO/lib/jquery.ui.touch-punch.min.js index 31272ce..d572ab6 100644 --- a/webAO/lib/jquery.ui.touch-punch.min.js +++ b/webAO/lib/jquery.ui.touch-punch.min.js @@ -8,4 +8,4 @@ * jquery.ui.widget.js * jquery.ui.mouse.js */ -!function(a){function f(a,b){if(!(a.originalEvent.touches.length>1)){a.preventDefault();var c=a.originalEvent.changedTouches[0],d=document.createEvent("MouseEvents");d.initMouseEvent(b,!0,!0,window,1,c.screenX,c.screenY,c.clientX,c.clientY,!1,!1,!1,!1,0,null),a.target.dispatchEvent(d)}}if(a.support.touch="ontouchend"in document,a.support.touch){var e,b=a.ui.mouse.prototype,c=b._mouseInit,d=b._mouseDestroy;b._touchStart=function(a){var b=this;!e&&b._mouseCapture(a.originalEvent.changedTouches[0])&&(e=!0,b._touchMoved=!1,f(a,"mouseover"),f(a,"mousemove"),f(a,"mousedown"))},b._touchMove=function(a){e&&(this._touchMoved=!0,f(a,"mousemove"))},b._touchEnd=function(a){e&&(f(a,"mouseup"),f(a,"mouseout"),this._touchMoved||f(a,"click"),e=!1)},b._mouseInit=function(){var b=this;b.element.bind({touchstart:a.proxy(b,"_touchStart"),touchmove:a.proxy(b,"_touchMove"),touchend:a.proxy(b,"_touchEnd")}),c.call(b)},b._mouseDestroy=function(){var b=this;b.element.unbind({touchstart:a.proxy(b,"_touchStart"),touchmove:a.proxy(b,"_touchMove"),touchend:a.proxy(b,"_touchEnd")}),d.call(b)}}}(jQuery);
\ No newline at end of file +!(function (a) { function f(a, b) { if (!(a.originalEvent.touches.length > 1)) { a.preventDefault(); const c = a.originalEvent.changedTouches[0]; const d = document.createEvent('MouseEvents'); d.initMouseEvent(b, !0, !0, window, 1, c.screenX, c.screenY, c.clientX, c.clientY, !1, !1, !1, !1, 0, null), a.target.dispatchEvent(d); } } if (a.support.touch = 'ontouchend' in document, a.support.touch) { let e; const b = a.ui.mouse.prototype; const c = b._mouseInit; const d = b._mouseDestroy; b._touchStart = function (a) { const b = this; !e && b._mouseCapture(a.originalEvent.changedTouches[0]) && (e = !0, b._touchMoved = !1, f(a, 'mouseover'), f(a, 'mousemove'), f(a, 'mousedown')); }, b._touchMove = function (a) { e && (this._touchMoved = !0, f(a, 'mousemove')); }, b._touchEnd = function (a) { e && (f(a, 'mouseup'), f(a, 'mouseout'), this._touchMoved || f(a, 'click'), e = !1); }, b._mouseInit = function () { const b = this; b.element.bind({ touchstart: a.proxy(b, '_touchStart'), touchmove: a.proxy(b, '_touchMove'), touchend: a.proxy(b, '_touchEnd') }), c.call(b); }, b._mouseDestroy = function () { const b = this; b.element.unbind({ touchstart: a.proxy(b, '_touchStart'), touchmove: a.proxy(b, '_touchMove'), touchend: a.proxy(b, '_touchEnd') }), d.call(b); }; } }(jQuery)); |
