diff options
| author | caleb.mabry.15@cnu.edu <caleb.mabry.15@cnu.edu> | 2022-03-07 12:43:33 -0500 |
|---|---|---|
| committer | caleb.mabry.15@cnu.edu <caleb.mabry.15@cnu.edu> | 2022-03-07 12:43:33 -0500 |
| commit | 4bd674c196c0e06b460dffee440c5d2a48061bcc (patch) | |
| tree | 2338cf231c8535280c283d8d08d91f4fa4018912 /webAO/lib/gify.min.js | |
| parent | 01a7239f8b18710ce1871c502fd8d10a782efcaf (diff) | |
| parent | 9c5fd198c11a0e2b976c6a2802eff9c4fef836f6 (diff) | |
Merge branch 'master' of https://github.com/AttorneyOnline/webAO into refactor-constants
Diffstat (limited to 'webAO/lib/gify.min.js')
| -rw-r--r-- | webAO/lib/gify.min.js | 12 |
1 files changed, 11 insertions, 1 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); } }; +}()); |
