fileapi 0.0.1 → 0.0.2

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml ADDED
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA1:
3
+ metadata.gz: 0f67454d567309074af8fe05dd172bc01ffe84a6
4
+ data.tar.gz: d2b0d7cfdfc34e27f544f1f02543ddc85bb51767
5
+ SHA512:
6
+ metadata.gz: 42404ed20dcefbf645a38d0912caf2d3488b9a44bfc5b0e73e86721d075f23d0975ecc4e9383d1b904f3dbc181c512cff33309ba0824d2d445e703f7a3a77d9c
7
+ data.tar.gz: 1f99885aa1eba0091264389a335640a5e0c56bfbefe4bbbcc0424edd9756a0ccf7b14368536b401e29f02e3494e37d095f7b1c6f0347578d38d85c1c97e810d2
@@ -0,0 +1,59 @@
1
+ (function (){
2
+ /**!
3
+ * Binary Ajax 0.1.10
4
+ * Copyright (c) 2008 Jacob Seidelin, cupboy@gmail.com, http://blog.nihilogic.dk/
5
+ * Licensed under the MPL License [http://www.nihilogic.dk/licenses/mpl-license.txt]
6
+ *
7
+ *
8
+ * Javascript EXIF Reader 0.1.4
9
+ * Copyright (c) 2008 Jacob Seidelin, cupboy@gmail.com, http://blog.nihilogic.dk/
10
+ * Licensed under the MPL License [http://www.nihilogic.dk/licenses/mpl-license.txt]
11
+ */
12
+
13
+
14
+ var BinaryFile=function(j,k,l){var h=j,i=k||0,b=0;this.getRawData=function(){return h};"string"==typeof j&&(b=l||h.length,this.getByteAt=function(a){return h.charCodeAt(a+i)&255},this.getBytesAt=function(a,b){for(var c=[],f=0;f<b;f++)c[f]=h.charCodeAt(a+f+i)&255;return c});this.getLength=function(){return b};this.getSByteAt=function(a){a=this.getByteAt(a);return 127<a?a-256:a};this.getShortAt=function(a,b){var c=b?(this.getByteAt(a)<<8)+this.getByteAt(a+1):(this.getByteAt(a+1)<<8)+this.getByteAt(a);
15
+ 0>c&&(c+=65536);return c};this.getSShortAt=function(a,b){var c=this.getShortAt(a,b);return 32767<c?c-65536:c};this.getLongAt=function(a,b){var c=this.getByteAt(a),f=this.getByteAt(a+1),e=this.getByteAt(a+2),g=this.getByteAt(a+3),c=b?(((c<<8)+f<<8)+e<<8)+g:(((g<<8)+e<<8)+f<<8)+c;0>c&&(c+=4294967296);return c};this.getSLongAt=function(a,b){var c=this.getLongAt(a,b);return 2147483647<c?c-4294967296:c};this.getStringAt=function(a,b){for(var c=[],f=this.getBytesAt(a,b),e=0;e<b;e++)c[e]=String.fromCharCode(f[e]);
16
+ return c.join("")};this.getCharAt=function(a){return String.fromCharCode(this.getByteAt(a))};this.toBase64=function(){return window.btoa(h)};this.fromBase64=function(a){h=window.atob(a)}},EXIF={};
17
+ (function(){function j(b){if(255!=b.getByteAt(0)||216!=b.getByteAt(1))return!1;for(var a=2,d=b.getLength();a<d;){if(255!=b.getByteAt(a))return i&&console.log("Not a valid marker at offset "+a+", found: "+b.getByteAt(a)),!1;var c=b.getByteAt(a+1);if(22400==c||225==c)return i&&console.log("Found 0xFFE1 marker"),h(b,a+4,b.getShortAt(a+2,!0)-2);a+=2+b.getShortAt(a+2,!0)}}function k(b,a,d,c,f){for(var e=b.getShortAt(d,f),g={},h=0;h<e;h++){var j=d+12*h+2,k=c[b.getShortAt(j,f)];!k&&i&&console.log("Unknown tag: "+
18
+ b.getShortAt(j,f));g[k]=l(b,j,a,d,f)}return g}function l(b,a,d,c,f){var e=b.getShortAt(a+2,f),c=b.getLongAt(a+4,f),d=b.getLongAt(a+8,f)+d;switch(e){case 1:case 7:if(1==c)return b.getByteAt(a+8,f);d=4<c?d:a+8;a=[];for(e=0;e<c;e++)a[e]=b.getByteAt(d+e);return a;case 2:return b.getStringAt(4<c?d:a+8,c-1);case 3:if(1==c)return b.getShortAt(a+8,f);d=2<c?d:a+8;a=[];for(e=0;e<c;e++)a[e]=b.getShortAt(d+2*e,f);return a;case 4:if(1==c)return b.getLongAt(a+8,f);a=[];for(e=0;e<c;e++)a[e]=b.getLongAt(d+4*e,f);
19
+ return a;case 5:if(1==c)return b.getLongAt(d,f)/b.getLongAt(d+4,f);a=[];for(e=0;e<c;e++)a[e]=b.getLongAt(d+8*e,f)/b.getLongAt(d+4+8*e,f);return a;case 9:if(1==c)return b.getSLongAt(a+8,f);a=[];for(e=0;e<c;e++)a[e]=b.getSLongAt(d+4*e,f);return a;case 10:if(1==c)return b.getSLongAt(d,f)/b.getSLongAt(d+4,f);a=[];for(e=0;e<c;e++)a[e]=b.getSLongAt(d+8*e,f)/b.getSLongAt(d+4+8*e,f);return a}}function h(b,a){if("Exif"!=b.getStringAt(a,4))return i&&console.log("Not valid EXIF data! "+b.getStringAt(a,4)),!1;
20
+ var d,c=a+6;if(18761==b.getShortAt(c))d=!1;else if(19789==b.getShortAt(c))d=!0;else return i&&console.log("Not valid TIFF data! (no 0x4949 or 0x4D4D)"),!1;if(42!=b.getShortAt(c+2,d))return i&&console.log("Not valid TIFF data! (no 0x002A)"),!1;if(8!=b.getLongAt(c+4,d))return i&&console.log("Not valid TIFF data! (First offset not 8)",b.getShortAt(c+4,d)),!1;var f=k(b,c,c+8,EXIF.TiffTags,d);if(f.ExifIFDPointer){var e=k(b,c,c+f.ExifIFDPointer,EXIF.Tags,d),g;for(g in e){switch(g){case "LightSource":case "Flash":case "MeteringMode":case "ExposureProgram":case "SensingMethod":case "SceneCaptureType":case "SceneType":case "CustomRendered":case "WhiteBalance":case "GainControl":case "Contrast":case "Saturation":case "Sharpness":case "SubjectDistanceRange":case "FileSource":e[g]=
21
+ EXIF.StringValues[g][e[g]];break;case "ExifVersion":case "FlashpixVersion":e[g]=String.fromCharCode(e[g][0],e[g][1],e[g][2],e[g][3]);break;case "ComponentsConfiguration":e[g]=EXIF.StringValues.Components[e[g][0]]+EXIF.StringValues.Components[e[g][1]]+EXIF.StringValues.Components[e[g][2]]+EXIF.StringValues.Components[e[g][3]]}f[g]=e[g]}}if(f.GPSInfoIFDPointer)for(g in d=k(b,c,c+f.GPSInfoIFDPointer,EXIF.GPSTags,d),d){switch(g){case "GPSVersionID":d[g]=d[g][0]+"."+d[g][1]+"."+d[g][2]+"."+d[g][3]}f[g]=
22
+ d[g]}return f}var i=!1;EXIF.Tags={36864:"ExifVersion",40960:"FlashpixVersion",40961:"ColorSpace",40962:"PixelXDimension",40963:"PixelYDimension",37121:"ComponentsConfiguration",37122:"CompressedBitsPerPixel",37500:"MakerNote",37510:"UserComment",40964:"RelatedSoundFile",36867:"DateTimeOriginal",36868:"DateTimeDigitized",37520:"SubsecTime",37521:"SubsecTimeOriginal",37522:"SubsecTimeDigitized",33434:"ExposureTime",33437:"FNumber",34850:"ExposureProgram",34852:"SpectralSensitivity",34855:"ISOSpeedRatings",
23
+ 34856:"OECF",37377:"ShutterSpeedValue",37378:"ApertureValue",37379:"BrightnessValue",37380:"ExposureBias",37381:"MaxApertureValue",37382:"SubjectDistance",37383:"MeteringMode",37384:"LightSource",37385:"Flash",37396:"SubjectArea",37386:"FocalLength",41483:"FlashEnergy",41484:"SpatialFrequencyResponse",41486:"FocalPlaneXResolution",41487:"FocalPlaneYResolution",41488:"FocalPlaneResolutionUnit",41492:"SubjectLocation",41493:"ExposureIndex",41495:"SensingMethod",41728:"FileSource",41729:"SceneType",
24
+ 41730:"CFAPattern",41985:"CustomRendered",41986:"ExposureMode",41987:"WhiteBalance",41988:"DigitalZoomRation",41989:"FocalLengthIn35mmFilm",41990:"SceneCaptureType",41991:"GainControl",41992:"Contrast",41993:"Saturation",41994:"Sharpness",41995:"DeviceSettingDescription",41996:"SubjectDistanceRange",40965:"InteroperabilityIFDPointer",42016:"ImageUniqueID"};EXIF.TiffTags={256:"ImageWidth",257:"ImageHeight",34665:"ExifIFDPointer",34853:"GPSInfoIFDPointer",40965:"InteroperabilityIFDPointer",258:"BitsPerSample",
25
+ 259:"Compression",262:"PhotometricInterpretation",274:"Orientation",277:"SamplesPerPixel",284:"PlanarConfiguration",530:"YCbCrSubSampling",531:"YCbCrPositioning",282:"XResolution",283:"YResolution",296:"ResolutionUnit",273:"StripOffsets",278:"RowsPerStrip",279:"StripByteCounts",513:"JPEGInterchangeFormat",514:"JPEGInterchangeFormatLength",301:"TransferFunction",318:"WhitePoint",319:"PrimaryChromaticities",529:"YCbCrCoefficients",532:"ReferenceBlackWhite",306:"DateTime",270:"ImageDescription",271:"Make",
26
+ 272:"Model",305:"Software",315:"Artist",33432:"Copyright"};EXIF.GPSTags={"0":"GPSVersionID",1:"GPSLatitudeRef",2:"GPSLatitude",3:"GPSLongitudeRef",4:"GPSLongitude",5:"GPSAltitudeRef",6:"GPSAltitude",7:"GPSTimeStamp",8:"GPSSatellites",9:"GPSStatus",10:"GPSMeasureMode",11:"GPSDOP",12:"GPSSpeedRef",13:"GPSSpeed",14:"GPSTrackRef",15:"GPSTrack",16:"GPSImgDirectionRef",17:"GPSImgDirection",18:"GPSMapDatum",19:"GPSDestLatitudeRef",20:"GPSDestLatitude",21:"GPSDestLongitudeRef",22:"GPSDestLongitude",23:"GPSDestBearingRef",
27
+ 24:"GPSDestBearing",25:"GPSDestDistanceRef",26:"GPSDestDistance",27:"GPSProcessingMethod",28:"GPSAreaInformation",29:"GPSDateStamp",30:"GPSDifferential"};EXIF.StringValues={ExposureProgram:{"0":"Not defined",1:"Manual",2:"Normal program",3:"Aperture priority",4:"Shutter priority",5:"Creative program",6:"Action program",7:"Portrait mode",8:"Landscape mode"},MeteringMode:{"0":"Unknown",1:"Average",2:"CenterWeightedAverage",3:"Spot",4:"MultiSpot",5:"Pattern",6:"Partial",255:"Other"},LightSource:{"0":"Unknown",
28
+ 1:"Daylight",2:"Fluorescent",3:"Tungsten (incandescent light)",4:"Flash",9:"Fine weather",10:"Cloudy weather",11:"Shade",12:"Daylight fluorescent (D 5700 - 7100K)",13:"Day white fluorescent (N 4600 - 5400K)",14:"Cool white fluorescent (W 3900 - 4500K)",15:"White fluorescent (WW 3200 - 3700K)",17:"Standard light A",18:"Standard light B",19:"Standard light C",20:"D55",21:"D65",22:"D75",23:"D50",24:"ISO studio tungsten",255:"Other"},Flash:{"0":"Flash did not fire",1:"Flash fired",5:"Strobe return light not detected",
29
+ 7:"Strobe return light detected",9:"Flash fired, compulsory flash mode",13:"Flash fired, compulsory flash mode, return light not detected",15:"Flash fired, compulsory flash mode, return light detected",16:"Flash did not fire, compulsory flash mode",24:"Flash did not fire, auto mode",25:"Flash fired, auto mode",29:"Flash fired, auto mode, return light not detected",31:"Flash fired, auto mode, return light detected",32:"No flash function",65:"Flash fired, red-eye reduction mode",69:"Flash fired, red-eye reduction mode, return light not detected",
30
+ 71:"Flash fired, red-eye reduction mode, return light detected",73:"Flash fired, compulsory flash mode, red-eye reduction mode",77:"Flash fired, compulsory flash mode, red-eye reduction mode, return light not detected",79:"Flash fired, compulsory flash mode, red-eye reduction mode, return light detected",89:"Flash fired, auto mode, red-eye reduction mode",93:"Flash fired, auto mode, return light not detected, red-eye reduction mode",95:"Flash fired, auto mode, return light detected, red-eye reduction mode"},
31
+ SensingMethod:{1:"Not defined",2:"One-chip color area sensor",3:"Two-chip color area sensor",4:"Three-chip color area sensor",5:"Color sequential area sensor",7:"Trilinear sensor",8:"Color sequential linear sensor"},SceneCaptureType:{"0":"Standard",1:"Landscape",2:"Portrait",3:"Night scene"},SceneType:{1:"Directly photographed"},CustomRendered:{"0":"Normal process",1:"Custom process"},WhiteBalance:{"0":"Auto white balance",1:"Manual white balance"},GainControl:{"0":"None",1:"Low gain up",2:"High gain up",
32
+ 3:"Low gain down",4:"High gain down"},Contrast:{"0":"Normal",1:"Soft",2:"Hard"},Saturation:{"0":"Normal",1:"Low saturation",2:"High saturation"},Sharpness:{"0":"Normal",1:"Soft",2:"Hard"},SubjectDistanceRange:{"0":"Unknown",1:"Macro",2:"Close view",3:"Distant view"},FileSource:{3:"DSC"},Components:{"0":"",1:"Y",2:"Cb",3:"Cr",4:"R",5:"G",6:"B"}};EXIF.getData=function(b,a){if(!b.complete)return!1;b.exifdata?a&&a():BinaryAjax(b.src,function(d){d=j(d.binaryResponse);b.exifdata=d||{};a&&a()});return!0};
33
+ EXIF.getTag=function(b,a){if(b.exifdata)return b.exifdata[a]};EXIF.getAllTags=function(b){if(!b.exifdata)return{};var b=b.exifdata,a={},d;for(d in b)b.hasOwnProperty(d)&&(a[d]=b[d]);return a};EXIF.pretty=function(b){if(!b.exifdata)return"";var b=b.exifdata,a="",d;for(d in b)b.hasOwnProperty(d)&&(a="object"==typeof b[d]?a+(d+" : ["+b[d].length+" values]\r\n"):a+(d+" : "+b[d]+"\r\n"));return a};EXIF.readFromBinaryFile=function(b){return j(b)}})();
34
+
35
+
36
+ FileAPI.support.exif = true;
37
+
38
+
39
+ FileAPI.addInfoReader(/^image/, function (file/**File*/, callback/**Function*/){
40
+ if( !file.__exif ){
41
+ var defer = file.__exif = FileAPI.defer();
42
+
43
+ FileAPI.readAsBinaryString(file, function (evt){
44
+ if( evt.type == 'load' ){
45
+ var binaryString = evt.result;
46
+ var oFile = new BinaryFile(binaryString, 0, file.size);
47
+ var exif = EXIF.readFromBinaryFile(oFile);
48
+
49
+ defer.resolve(false, { 'exif': exif || {} });
50
+ }
51
+ else if( evt.type == 'error' ){
52
+ defer.resolve('read_as_binary_string_exif');
53
+ }
54
+ });
55
+ }
56
+
57
+ file.__exif.then(callback);
58
+ });
59
+ })();
@@ -0,0 +1,67 @@
1
+ (function (){
2
+ /**
3
+ * JavaScript ID3 Reader
4
+ * https://github.com/aadsm/JavaScript-ID3-Reader
5
+ *
6
+ * Authors
7
+ * Jacob Seidelin
8
+ * António Afonso
9
+ * Joshua Kifer
10
+ */
11
+
12
+ var x=!0,y=null;function z(a,b,d){function e(c){c=parseInt(c.getResponseHeader("Content-Length"),10)||-1;b(new h(a,c))}function f(){var c=y;window.XMLHttpRequest?c=new XMLHttpRequest:window.ActiveXObject&&(c=new ActiveXObject("Microsoft.XMLHTTP"));return c}function h(c,a){var b,g;function e(c){var a=~~(c[0]/b)-g,c=~~(c[1]/b)+1+g;0>a&&(a=0);c>=blockTotal&&(c=blockTotal-1);return[a,c]}function h(e,g){function m(c){parseInt(c.getResponseHeader("Content-Length"),10)==a&&(e[0]=0,e[1]=blockTotal-1,i[0]=0,i[1]=a-1);for(var c=
13
+ {data:c.U||c.responseText,offset:i[0]},b=e[0];b<=e[1];b++)A[b]=c;l+=i[1]-i[0]+1;g&&g()}for(;A[e[0]];)if(e[0]++,e[0]>e[1]){g&&g();return}for(;A[e[1]];)if(e[1]--,e[0]>e[1]){g&&g();return}var i=[e[0]*b,(e[1]+1)*b-1],w=c,r=d,L=q,I=!!g,n=f();n?("undefined"===typeof I&&(I=x),m&&("undefined"!=typeof n.onload?n.onload=function(){"200"==n.status||"206"==n.status?(n.fileSize=L||n.getResponseHeader("Content-Length"),m(n)):r&&r();n=y}:n.onreadystatechange=function(){4==n.readyState&&("200"==n.status||"206"==
14
+ n.status?(n.fileSize=L||n.getResponseHeader("Content-Length"),m(n)):r&&r(),n=y)}),n.open("GET",w,I),n.overrideMimeType&&n.overrideMimeType("text/plain; charset=x-user-defined"),i&&n.setRequestHeader("Range","bytes="+i[0]+"-"+i[1]),n.setRequestHeader("If-Modified-Since","Sat, 1 Jan 1970 00:00:00 GMT"),n.send(y)):r&&r()}var q,l=0,w=new B("",0,a),A=[];b=b||2048;g="undefined"===typeof g?0:g;blockTotal=~~((a-1)/b)+1;for(var r in w)w.hasOwnProperty(r)&&"function"===typeof w[r]&&(this[r]=w[r]);this.a=function(c){var a;
15
+ h(e([c,c]));a=A[~~(c/b)];if("string"==typeof a.data)return a.data.charCodeAt(c-a.offset)&255;if("unknown"==typeof a.data)return IEBinary_getByteAt(a.data,c-a.offset)};this.L=function(){return l};this.g=function(c,a){h(e(c),a)}}var c=f();c&&(e&&("undefined"!=typeof c.onload?c.onload=function(){"200"==c.status&&e(this);c=y}:c.onreadystatechange=function(){4==c.readyState&&("200"==c.status&&e(this),c=y)}),c.open("HEAD",a,x),c.send(y))}
16
+ function B(a,b,d){var e=a,f=b||0,h=0;this.N=function(){return e};"string"==typeof a?(h=d||e.length,this.a=function(c){return e.charCodeAt(c+f)&255}):"unknown"==typeof a&&(h=d||IEBinary_getLength(e),this.a=function(c){return IEBinary_getByteAt(e,c+f)});this.m=function(c,a){for(var b=Array(a),d=0;d<a;d++)b[d]=this.a(c+d);return b};this.o=function(){return h};this.c=function(c,a){return 0!=(this.a(c)&1<<a)};this.O=function(c){c=this.a(c);return 127<c?c-256:c};this.p=function(c,a){var b=a?(this.a(c)<<
17
+ 8)+this.a(c+1):(this.a(c+1)<<8)+this.a(c);0>b&&(b+=65536);return b};this.Q=function(c,a){var b=this.p(c,a);return 32767<b?b-65536:b};this.h=function(c,a){var b=this.a(c),d=this.a(c+1),e=this.a(c+2),f=this.a(c+3),b=a?(((b<<8)+d<<8)+e<<8)+f:(((f<<8)+e<<8)+d<<8)+b;0>b&&(b+=4294967296);return b};this.P=function(c,a){var b=this.h(c,a);return 2147483647<b?b-4294967296:b};this.n=function(c){var a=this.a(c),b=this.a(c+1),c=this.a(c+2),a=((a<<8)+b<<8)+c;0>a&&(a+=16777216);return a};this.d=function(a,b){for(var d=
18
+ [],e=a,g=0;e<a+b;e++,g++)d[g]=String.fromCharCode(this.a(e));return d.join("")};this.e=function(a,b,d){a=this.m(a,b);switch(d.toLowerCase()){case "utf-16":case "utf-16le":case "utf-16be":var b=d,e,g=0,f=1,d=0;e=Math.min(e||a.length,a.length);254==a[0]&&255==a[1]?(b=x,g=2):255==a[0]&&254==a[1]&&(b=!1,g=2);b&&(f=0,d=1);for(var b=[],h=0;g<e;h++){var q=a[g+f],l=(q<<8)+a[g+d],g=g+2;if(0==l)break;else 216>q||224<=q?b[h]=String.fromCharCode(l):(q=(a[g+f]<<8)+a[g+d],g+=2,b[h]=String.fromCharCode(l,q))}a=
19
+ new String(b.join(""));a.f=g;break;case "utf-8":e=0;g=Math.min(g||a.length,a.length);239==a[0]&&(187==a[1]&&191==a[2])&&(e=3);f=[];for(d=0;e<g&&!(b=a[e++],0==b);d++)128>b?f[d]=String.fromCharCode(b):194<=b&&224>b?(h=a[e++],f[d]=String.fromCharCode(((b&31)<<6)+(h&63))):224<=b&&240>b?(h=a[e++],l=a[e++],f[d]=String.fromCharCode(((b&255)<<12)+((h&63)<<6)+(l&63))):240<=b&&245>b&&(h=a[e++],l=a[e++],q=a[e++],b=((b&7)<<18)+((h&63)<<12)+((l&63)<<6)+(q&63)-65536,f[d]=String.fromCharCode((b>>10)+55296,(b&1023)+
20
+ 56320));a=new String(f.join(""));a.f=e;break;default:g=[];f=f||a.length;for(e=0;e<f;){d=a[e++];if(0==d)break;g[e-1]=String.fromCharCode(d)}a=new String(g.join(""));a.f=e}return a};this.K=function(a){return String.fromCharCode(this.a(a))};this.X=function(){return window.btoa(e)};this.J=function(a){e=window.atob(a)};this.g=function(a,b){b()}}document.write("<script type='text/vbscript'>\r\nFunction IEBinary_getByteAt(strBinary, iOffset)\r\n\tIEBinary_getByteAt = AscB(MidB(strBinary,iOffset+1,1))\r\nEnd Function\r\nFunction IEBinary_getLength(strBinary)\r\n\tIEBinary_getLength = LenB(strBinary)\r\nEnd Function\r\n<\/script>\r\n");this.FileAPIReader=function(a){return function(b,d){var e=new FileReader;e.onload=function(a){d(new B(a.target.result))};e.readAsBinaryString(a)}};this.Base64=this.j={i:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=",w:function(a){for(var b="",d,e,f,h,c,k,v=0;v<a.length;)d=a[v++],e=a[v++],f=a[v++],h=d>>2,d=(d&3)<<4|e>>4,c=(e&15)<<2|f>>6,k=f&63,isNaN(e)?c=k=64:isNaN(f)&&(k=64),b=b+Base64.i.charAt(h)+Base64.i.charAt(d)+Base64.i.charAt(c)+Base64.i.charAt(k);return b}};this.j.encodeBytes=this.j.w;var C=this.s={},E={},F=[0,7];C.B=function(a,b,d){d=d||{};(d.dataReader||z)(a,function(e){e.g(F,function(){var f="ftypM4A"==e.d(4,7)?ID4:"ID3"==e.d(0,3)?ID3v2:ID3v1;f.q(e,function(){var h=d.tags,c=f.r(e,h),h=E[a]||{},k;for(k in c)c.hasOwnProperty(k)&&(h[k]=c[k]);E[a]=h;b&&b()})})})};C.z=function(a){if(!E[a])return y;var b={},d;for(d in E[a])E[a].hasOwnProperty(d)&&(b[d]=E[a][d]);return b};C.A=function(a,b){return!E[a]?y:E[a][b]};this.ID3=this.s;C.loadTags=C.B;C.getAllTags=C.z;C.getTag=C.A;
21
+ C.BinaryFile=B;this.ID3v1=this.t={};function G(a,b){var d=b.a(a),e=b.a(a+1),f=b.a(a+2);return b.a(a+3)&127|(f&127)<<7|(e&127)<<14|(d&127)<<21}var H=this.D={};H.b={};
22
+ H.frames={BUF:"Recommended buffer size",CNT:"Play counter",COM:"Comments",CRA:"Audio encryption",CRM:"Encrypted meta frame",ETC:"Event timing codes",EQU:"Equalization",GEO:"General encapsulated object",IPL:"Involved people list",LNK:"Linked information",MCI:"Music CD Identifier",MLL:"MPEG location lookup table",PIC:"Attached picture",POP:"Popularimeter",REV:"Reverb",RVA:"Relative volume adjustment",SLT:"Synchronized lyric/text",STC:"Synced tempo codes",TAL:"Album/Movie/Show title",TBP:"BPM (Beats Per Minute)",
23
+ TCM:"Composer",TCO:"Content type",TCR:"Copyright message",TDA:"Date",TDY:"Playlist delay",TEN:"Encoded by",TFT:"File type",TIM:"Time",TKE:"Initial key",TLA:"Language(s)",TLE:"Length",TMT:"Media type",TOA:"Original artist(s)/performer(s)",TOF:"Original filename",TOL:"Original Lyricist(s)/text writer(s)",TOR:"Original release year",TOT:"Original album/Movie/Show title",TP1:"Lead artist(s)/Lead performer(s)/Soloist(s)/Performing group",TP2:"Band/Orchestra/Accompaniment",TP3:"Conductor/Performer refinement",
24
+ TP4:"Interpreted, remixed, or otherwise modified by",TPA:"Part of a set",TPB:"Publisher",TRC:"ISRC (International Standard Recording Code)",TRD:"Recording dates",TRK:"Track number/Position in set",TSI:"Size",TSS:"Software/hardware and settings used for encoding",TT1:"Content group description",TT2:"Title/Songname/Content description",TT3:"Subtitle/Description refinement",TXT:"Lyricist/text writer",TXX:"User defined text information frame",TYE:"Year",UFI:"Unique file identifier",ULT:"Unsychronized lyric/text transcription",
25
+ WAF:"Official audio file webpage",WAR:"Official artist/performer webpage",WAS:"Official audio source webpage",WCM:"Commercial information",WCP:"Copyright/Legal information",WPB:"Publishers official webpage",WXX:"User defined URL link frame",AENC:"Audio encryption",APIC:"Attached picture",COMM:"Comments",COMR:"Commercial frame",ENCR:"Encryption method registration",EQUA:"Equalization",ETCO:"Event timing codes",GEOB:"General encapsulated object",GRID:"Group identification registration",IPLS:"Involved people list",
26
+ LINK:"Linked information",MCDI:"Music CD identifier",MLLT:"MPEG location lookup table",OWNE:"Ownership frame",PRIV:"Private frame",PCNT:"Play counter",POPM:"Popularimeter",POSS:"Position synchronisation frame",RBUF:"Recommended buffer size",RVAD:"Relative volume adjustment",RVRB:"Reverb",SYLT:"Synchronized lyric/text",SYTC:"Synchronized tempo codes",TALB:"Album/Movie/Show title",TBPM:"BPM (beats per minute)",TCOM:"Composer",TCON:"Content type",TCOP:"Copyright message",TDAT:"Date",TDLY:"Playlist delay",
27
+ TENC:"Encoded by",TEXT:"Lyricist/Text writer",TFLT:"File type",TIME:"Time",TIT1:"Content group description",TIT2:"Title/songname/content description",TIT3:"Subtitle/Description refinement",TKEY:"Initial key",TLAN:"Language(s)",TLEN:"Length",TMED:"Media type",TOAL:"Original album/movie/show title",TOFN:"Original filename",TOLY:"Original lyricist(s)/text writer(s)",TOPE:"Original artist(s)/performer(s)",TORY:"Original release year",TOWN:"File owner/licensee",TPE1:"Lead performer(s)/Soloist(s)",TPE2:"Band/orchestra/accompaniment",
28
+ TPE3:"Conductor/performer refinement",TPE4:"Interpreted, remixed, or otherwise modified by",TPOS:"Part of a set",TPUB:"Publisher",TRCK:"Track number/Position in set",TRDA:"Recording dates",TRSN:"Internet radio station name",TRSO:"Internet radio station owner",TSIZ:"Size",TSRC:"ISRC (international standard recording code)",TSSE:"Software/Hardware and settings used for encoding",TYER:"Year",TXXX:"User defined text information frame",UFID:"Unique file identifier",USER:"Terms of use",USLT:"Unsychronized lyric/text transcription",
29
+ WCOM:"Commercial information",WCOP:"Copyright/Legal information",WOAF:"Official audio file webpage",WOAR:"Official artist/performer webpage",WOAS:"Official audio source webpage",WORS:"Official internet radio station homepage",WPAY:"Payment",WPUB:"Publishers official webpage",WXXX:"User defined URL link frame"};
30
+ var J={title:["TIT2","TT2"],artist:["TPE1","TP1"],album:["TALB","TAL"],year:["TYER","TYE"],comment:["COMM","COM"],track:["TRCK","TRK"],genre:["TCON","TCO"],picture:["APIC","PIC"],lyrics:["USLT","ULT"]},K=["title","artist","album","track"];H.q=function(a,b){a.g([0,G(6,a)],b)};
31
+ H.r=function(a,b){var d=0,e=a.a(d+3);if(4<e)return{version:">2.4"};var f=a.a(d+4),h=a.c(d+5,7),c=a.c(d+5,6),k=a.c(d+5,5),v=G(d+6,a),d=d+10;if(c)var p=a.h(d,x),d=d+(p+4);var e={version:"2."+e+"."+f,major:e,revision:f,flags:{unsynchronisation:h,extended_header:c,experimental_indicator:k},size:v},g;if(h)g={};else{for(var v=v-10,h=a,f=b,c={},k=e.major,p=[],m=0,i;i=(f||K)[m];m++)p=p.concat(J[i]||[i]);for(f=p;d<v;){p=y;m=h;i=d;var q=y;switch(k){case 2:g=m.d(i,3);var l=m.n(i+3),w=6;break;case 3:g=m.d(i,
32
+ 4);l=m.h(i+4,x);w=10;break;case 4:g=m.d(i,4),l=G(i+4,m),w=10}if(""==g)break;d+=w+l;if(!(0>f.indexOf(g))&&(2<k&&(q={message:{W:m.c(i+8,6),I:m.c(i+8,5),T:m.c(i+8,4)},l:{R:m.c(i+8+1,7),F:m.c(i+8+1,3),H:m.c(i+8+1,2),C:m.c(i+8+1,1),v:m.c(i+8+1,0)}}),i+=w,q&&q.l.v&&(G(i,m),i+=4,l-=4),!q||!q.l.C))g in H.b?p=H.b[g]:"T"==g[0]&&(p=H.b["T*"]),p=p?p(i,l,m,q):void 0,p={id:g,size:l,description:g in H.frames?H.frames[g]:"Unknown",data:p},g in c?(c[g].id&&(c[g]=[c[g]]),c[g].push(p)):c[g]=p}g=c}for(var A in J)if(J.hasOwnProperty(A)){a:{l=
33
+ J[A];"string"==typeof l&&(l=[l]);w=0;for(d=void 0;d=l[w];w++)if(d in g){a=g[d].data;break a}a=void 0}a&&(e[A]=a)}for(var r in g)g.hasOwnProperty(r)&&(e[r]=g[r]);return e};this.ID3v2=H;function M(a){var b;switch(a){case 0:b="iso-8859-1";break;case 1:b="utf-16";break;case 2:b="utf-16be";break;case 3:b="utf-8"}return b}var N="32x32 pixels 'file icon' (PNG only);Other file icon;Cover (front);Cover (back);Leaflet page;Media (e.g. lable side of CD);Lead artist/lead performer/soloist;Artist/performer;Conductor;Band/Orchestra;Composer;Lyricist/text writer;Recording Location;During recording;During performance;Movie/video screen capture;A bright coloured fish;Illustration;Band/artist logotype;Publisher/Studio logotype".split(";");
34
+ ID3v2.b.APIC=function(a,b,d,e,f){var f=f||"3",e=a,h=M(d.a(a));switch(f){case "2":var c=d.d(a+1,3),a=a+4;break;case "3":case "4":c=d.e(a+1,b-(a-e),h),a+=1+c.f}f=d.a(a,1);f=N[f];h=d.e(a+1,b-(a-e),h);a+=1+h.f;return{format:c.toString(),type:f,description:h.toString(),data:d.m(a,e+b-a)}};ID3v2.b.COMM=function(a,b,d){var e=a,f=M(d.a(a)),h=d.d(a+1,3),c=d.e(a+4,b-4,f),a=a+(4+c.f),a=d.e(a,e+b-a,f);return{language:h,V:c.toString(),text:a.toString()}};ID3v2.b.COM=ID3v2.b.COMM;
35
+ ID3v2.b.PIC=function(a,b,d,e){return ID3v2.b.APIC(a,b,d,e,"2")};ID3v2.b.PCNT=function(a,b,d){return d.M(a)};ID3v2.b.CNT=ID3v2.b.PCNT;ID3v2.b["T*"]=function(a,b,d){var e=M(d.a(a));return d.e(a+1,b-1,e).toString()};ID3v2.b.TCON=function(a,b,d){return ID3v2.b["T*"].apply(this,arguments).replace(/^\(\d+\)/,"")};ID3v2.b.TCO=ID3v2.b.TCON;ID3v2.b.USLT=function(a,b,d){var e=a,f=M(d.a(a)),h=d.d(a+1,3),c=d.e(a+4,b-4,f),a=a+(4+c.f),a=d.e(a,e+b-a,f);return{language:h,G:c.toString(),S:a.toString()}};
36
+ ID3v2.b.ULT=ID3v2.b.USLT;function O(a,b,d,e){var f=a.h(b,x);if(0==f)e();else{var h=a.d(b+4,4);-1<["moov","udta","meta","ilst"].indexOf(h)?("meta"==h&&(b+=4),a.g([b+8,b+8+8],function(){O(a,b+8,f-8,e)})):a.g([b+(h in P.k?0:f),b+f+8],function(){O(a,b+f,d,e)})}}
37
+ function Q(a,b,d,e,f){for(var f=void 0===f?"":f+" ",h=d;h<d+e;){var c=b.h(h,x);if(0==c)break;var k=b.d(h+4,4);if(-1<["moov","udta","meta","ilst"].indexOf(k)){"meta"==k&&(h+=4);Q(a,b,h+8,c-8,f);break}if(P.k[k]){var v=b.n(h+16+1),p=P.k[k],v=P.types[v];if("trkn"==k)a[p[0]]=b.a(h+16+11),a.count=b.a(h+16+13);else{var k=h+16+4+4,g=c-16-4-4;switch(v){case "text":a[p[0]]=b.e(k,g,"UTF-8");break;case "uint8":a[p[0]]=b.p(k);break;case "jpeg":case "png":a[p[0]]={l:"image/"+v,data:b.m(k,g)}}}}h+=c}}
38
+ var P=this.u={};P.types={"0":"uint8",1:"text",13:"jpeg",14:"png",21:"uint8"};P.k={"\u00a9alb":["album"],"\u00a9art":["artist"],"\u00a9ART":["artist"],aART:["artist"],"\u00a9day":["year"],"\u00a9nam":["title"],"\u00a9gen":["genre"],trkn:["track"],"\u00a9wrt":["composer"],"\u00a9too":["encoder"],cprt:["copyright"],covr:["picture"],"\u00a9grp":["grouping"],keyw:["keyword"],"\u00a9lyr":["lyrics"],"\u00a9gen":["genre"]};P.q=function(a,b){a.g([0,7],function(){O(a,0,a.o(),b)})};
39
+ P.r=function(a){var b={};Q(b,a,0,a.o());return b};this.ID4=this.u;
40
+
41
+
42
+ FileAPI.support.id3 = true;
43
+
44
+
45
+ FileAPI.addInfoReader(/^audio/i, function (file, callback){
46
+ if( !file.__id3 ){
47
+ var defer = file.__id3 = FileAPI.defer();
48
+
49
+ FileAPI.readAsBinaryString(file, function (evt){
50
+ if( evt.type == 'load' ){
51
+ ID3.loadTags(file.name, function (){
52
+ defer.resolve(false, file.__id3 = ID3.getAllTags(file.name));
53
+ }, {
54
+ dataReader: function (url, fn){
55
+ var oFile = new ID3.BinaryFile(evt.result, 0, file.size);
56
+ fn(oFile)
57
+ }
58
+ });
59
+ } else if( evt.type == 'error' ){
60
+ callback('read_as_binary_string_id3');
61
+ }
62
+ });
63
+ }
64
+
65
+ file.__id3.then(callback);
66
+ });
67
+ })();
@@ -0,0 +1,73 @@
1
+ /**!
2
+ * FileAPI — a set of tools for working with files
3
+ *
4
+ * @author RubaXa <trash@rubaxa.org>
5
+ * @build lib/canvas-to-blob lib/FileAPI.core lib/FileAPI.Image lib/FileAPI.Form lib/FileAPI.XHR lib/FileAPI.Flash
6
+ */
7
+ (function(a){var m=a.HTMLCanvasElement&&a.HTMLCanvasElement.prototype,g;if(g=a.Blob)try{g=Boolean(new Blob)}catch(s){g=!1}var p=g;if(g=p)if(g=a.Uint8Array)try{g=100===(new Blob([new Uint8Array(100)])).size}catch(f){g=!1}var c=g,e=a.BlobBuilder||a.WebKitBlobBuilder||a.MozBlobBuilder||a.MSBlobBuilder,n=(p||e)&&a.atob&&a.ArrayBuffer&&a.Uint8Array&&function(a){var r,f,g,n;r=0<=a.split(",")[0].indexOf("base64")?atob(a.split(",")[1]):decodeURIComponent(a.split(",")[1]);f=new ArrayBuffer(r.length);g=new Uint8Array(f);
8
+ for(n=0;n<r.length;n+=1)g[n]=r.charCodeAt(n);a=a.split(",")[0].split(":")[1].split(";")[0];if(p)return new Blob([c?g:f],{type:a});g=new e;g.append(f);return g.getBlob(a)};a.HTMLCanvasElement&&!m.toBlob&&(m.mozGetAsFile?m.toBlob=function(a,c){a(this.mozGetAsFile("blob",c))}:m.toDataURL&&n&&(m.toBlob=function(a,c){a(n(this.toDataURL(c)))}));a.dataURLtoBlob=n})(this);
9
+ (function(a,m){function g(b,t,d){if(b)if(w(b))for(var a=0,c=b.length;a<c;a++)a in b&&t.call(d,b[a],a,b);else for(a in b)b.hasOwnProperty(a)&&t.call(d,b[a],a,b)}function s(b,t,d){if(b){var a=k.uid(b);B[a]||(B[a]={});g(t.split(/\s+/),function(t){x?x.event.add(b,t,d):(B[a][t]||(B[a][t]=[]),B[a][t].push(d),b.addEventListener?b.addEventListener(t,d,!1):b.attachEvent?b.attachEvent("on"+t,d):b["on"+t]=d)})}}function p(b,t,d){if(b){var a=k.uid(b),c=B[a]||{};g(t.split(/\s+/),function(t){if(x)x.event.remove(b,
10
+ t,d);else{for(var a=c[t]||[],h=a.length;h--;)if(a[h]===d){a.splice(h,1);break}b.addEventListener?b.removeEventListener(t,d,!1):b.detachEvent?b.detachEvent("on"+t,d):b["on"+t]=null}})}}function f(b,t,d){s(b,t,function R(a){p(b,t,R);d(a)})}function c(b,t,d,a,c){b={type:d.type||d,target:b,result:a};k.extend(b,c);t(b)}function e(b,t,d,a){if(k.isFile(b)&&v&&v.prototype["readAs"+d]){var h=new v;s(h,K,function S(d){var a=d.type;"progress"==a?c(b,t,d,d.target.result,{loaded:d.loaded,total:d.total}):"loadend"==
11
+ a?(p(h,K,S),h=null):c(b,t,d,d.target.result)});try{if(a)h["readAs"+d](a,b);else h["readAs"+d](b)}catch(e){c(b,t,"error",m,{error:e.toString()})}}else c(b,t,"error",m,{error:"filreader_not_support_"+d})}function n(b,d){if(!b.type&&0==b.size%4096&&102400>=b.size)if(v)try{var a=new v;f(a,K,function(b){b="error"!=b.type;d(b);b&&a.abort()});a.readAsDataURL(b)}catch(c){d(!1)}else d(null);else d(!0)}function q(b){var d;b.getAsEntry?d=b.getAsEntry():b.webkitGetAsEntry&&(d=b.webkitGetAsEntry());return d}function r(b,
12
+ d){if(b)if(b.isFile)b.file(function(a){a.fullPath=b.fullPath;d(!1,[a])},function(){d("entry_file")});else if(b.isDirectory){var a=[];b.createReader().readEntries(function(b){k.afor(b,function(b,c){r(c,function(c,h){c||(a=a.concat(h));b?b():d(!1,a)})})},function(){d("directory_reader")})}else r(q(b),d);else d("empty_entry")}function w(b){return"object"==typeof b&&b&&"length"in b}function A(b){var d={};g(b,function(b,a){b&&"object"===typeof b&&(b=k.extend({},b));d[a]=b});return d}function C(b){b.target||
13
+ (b.target=a.event&&a.event.srcElement||L);3===b.target.nodeType&&(b.target=event.target.parentNode);return b}var l=1,d=function(){},h=navigator.userAgent,u=a.createObjectURL&&a||a.URL&&URL.revokeObjectURL&&URL||a.webkitURL&&webkitURL,D=a.Blob,E=a.File,v=a.FileReader,F=a.FormData,I=a.XMLHttpRequest,x=a.jQuery,y=!!(E&&v&&(a.Uint8Array||F||I.prototype.sendAsBinary))&&!(/safari\//i.test(h)&&!/chrome\//i.test(h)&&/windows/i.test(h)),h=y&&"withCredentials"in new I,D=y&&!!D&&!!(D.prototype.webkitSlice||
14
+ D.prototype.mozSlice||D.prototype.slice),L=a.document,N=a.dataURLtoBlob,V=/img/i,W=/canvas/i,X=/img|canvas/,M=/input/i,Y=/^data:[^,]+,/,G=Math.pow,Z=Math.round,J=Number,F=function(b){return Z(b*this)},H=new J(1024),O=new J(G(H,2)),P=new J(G(H,3)),G=new J(G(H,4)),B={},Q=[],K="abort progress error load loadend",$="status statusText readyState response responseXML responseText responseBody".split(" "),k={version:"1.2.6",cors:!1,html5:!0,debug:!1,pingUrl:!1,flashAbortTimeout:0,withCredentials:!0,staticPath:"./",
15
+ flashUrl:0,flashImageUrl:0,ext2mime:{jpg:"image/jpeg",tif:"image/tiff"},accept:{"image/*":"art bm bmp dwg dxf cbr cbz fif fpx gif ico iefs jfif jpe jpeg jpg jps jut mcf nap nif pbm pcx pgm pict pm png pnm qif qtif ras rast rf rp svf tga tif tiff xbm xbm xpm xwd","audio/*":"m4a flac aac rm mpa wav wma ogg mp3 mp2 m3u mod amf dmf dsm far gdm imf it m15 med okt s3m stm sfx ult uni xm sid ac3 dts cue aif aiff wpl ape mac mpc mpp shn wv nsf spc gym adplug adx dsp adp ymf ast afc hps xs","video/*":"m4v 3gp nsv ts ty strm rm rmvb m3u ifo mov qt divx xvid bivx vob nrg img iso pva wmv asf asx ogm m2v avi bin dat dvr-ms mpg mpeg mp4 mkv avc vp3 svq3 nuv viv dv fli flv wpl"},
16
+ chunkSize:0,chunkUploadRetry:0,chunkNetworkDownRetryTimeout:2E3,KB:(H.from=F,H),MB:(O.from=F,O),GB:(P.from=F,P),TB:(G.from=F,G),expando:"fileapi"+(new Date).getTime(),uid:function(b){return b?b[k.expando]=b[k.expando]||k.uid():(++l,k.expando+l)},log:function(){k.debug&&(a.console&&console.log)&&(console.log.apply?console.log.apply(console,arguments):console.log([].join.call(arguments," ")))},newImage:function(b,d){var a=L.createElement("img");if(d)k.event.one(a,"error load",function(b){d("error"==
17
+ b.type,a);a=null});a.src=b;return a},getXHR:function(){var b;if(I)b=new I;else if(a.ActiveXObject)try{b=new ActiveXObject("MSXML2.XMLHttp.3.0")}catch(d){b=new ActiveXObject("Microsoft.XMLHTTP")}return b},isArray:w,support:{dnd:h&&"ondrop"in L.createElement("div"),cors:h,html5:y,chunked:D,dataURI:!0},event:{on:s,off:p,one:f,fix:C},throttle:function(b,d){var c,h;return function(){h=arguments;c||(b.apply(a,h),c=setTimeout(function(){c=0;b.apply(a,h)},d))}},F:function(){},parseJSON:function(b){return a.JSON&&
18
+ JSON.parse?JSON.parse(b):(new Function("return ("+b.replace(/([\r\n])/g,"\\$1")+");"))()},trim:function(b){b=String(b);return b.trim?b.trim():b.replace(/^\s+|\s+$/g,"")},defer:function(){var b=[],a,c,h={resolve:function(e,f){h.resolve=d;c=e||!1;for(a=f;f=b.shift();)f(c,a)},then:function(d){c!==m?d(c,a):b.push(d)}};return h},queue:function(b){var d=0,a=0,c=!1,h=!1,e={inc:function(){a++},next:function(){d++;setTimeout(e.check,0)},check:function(){d>=a&&!c&&e.end()},isFail:function(){return c},fail:function(){!c&&
19
+ b(c=!0)},end:function(){h||(h=!0,b())}};return e},each:g,afor:function(b,d){var a=0,c=b.length;w(b)&&c--?function z(){d(c!=a&&z,b[a],a++)}():d(!1)},extend:function(b){g(arguments,function(d){g(d,function(d,a){b[a]=d})});return b},isFile:function(b){return y&&b&&b instanceof E},isCanvas:function(b){return b&&W.test(b.nodeName)},getFilesFilter:function(b){return(b="string"==typeof b?b:b.getAttribute&&b.getAttribute("accept")||"")?RegExp("("+b.replace(/\./g,"\\.").replace(/,/g,"|")+")$","i"):/./},readAsDataURL:function(b,
20
+ d){k.isCanvas(b)?c(b,d,"load",k.toDataURL(b)):e(b,d,"DataURL")},readAsBinaryString:function(b,d){v&&v.prototype.readAsBinaryString?e(b,d,"BinaryString"):e(b,function(b){if("load"==b.type)try{b.result=k.toBinaryString(b.result)}catch(a){b.type="error",b.message=a.toString()}d(b)},"DataURL")},readAsArrayBuffer:function(b,d){e(b,d,"ArrayBuffer")},readAsText:function(b,d,a){a||(a=d,d="utf-8");e(b,a,"Text",d)},toDataURL:function(b){if("string"==typeof b)return b;if(b.toDataURL)return b.toDataURL("image/png")},
21
+ toBinaryString:function(b){return a.atob(k.toDataURL(b).replace(Y,""))},readAsImage:function(b,d,a){if(k.isFile(b))if(u){var h=u.createObjectURL(b);h===m?c(b,d,"error"):k.readAsImage(h,d,a)}else k.readAsDataURL(b,function(h){"load"==h.type?k.readAsImage(h.result,d,a):(a||"error"==h.type)&&c(b,d,h,null,{loaded:h.loaded,total:h.total})});else k.isCanvas(b)?c(b,d,"load",b):V.test(b.nodeName)?b.complete?c(b,d,"load",b):f(b,"error abort load",function z(a){"load"==a.type&&u&&u.revokeObjectURL(b.src);p(b,
22
+ "error abort load",z);c(b,d,a,b)}):b.iframe?c(b,d,{type:"error"}):(h=k.newImage(b.dataURL||b),k.readAsImage(h,d,a))},checkFileObj:function(b){var d={},a=k.accept;"object"==typeof b?d=b:d.name=(b+"").split(/\\|\//g).pop();null==d.type&&(d.type=d.name.split(".").pop());g(a,function(b,a){b=RegExp(b.replace(/\s/g,"|"),"i");b.test(d.type)&&(d.type=k.ext2mime[d.type]||a.split("/")[0]+"/"+d.type)});return d},getDropFiles:function(b,d){var a=[],c=(b.originalEvent||b||"").dataTransfer||{},h=w(c.items)&&c.items[0]&&
23
+ q(c.items[0]),e=k.queue(function(){d(a)});g((h?c.items:c.files)||[],function(b){e.inc();try{h?r(b,function(b,d){!b&&a.push.apply(a,d);e.next()}):n(b,function(d){d&&a.push(b);e.next()})}catch(d){e.next(),k.log("getDropFiles.error:",d.toString())}});e.check()},getFiles:function(b,d,a){var c=[];if(a)return k.filterFiles(k.getFiles(b),d,a),null;b.jquery&&(b.each(function(){c=c.concat(k.getFiles(this))}),b=c,c=[]);"string"==typeof d&&(d=k.getFilesFilter(d));b.originalEvent?b=C(b.originalEvent):b.srcElement&&
24
+ (b=C(b));b.dataTransfer?b=b.dataTransfer:b.target&&(b=b.target);b.files?(c=b.files,y||(c[0].blob=b,c[0].iframe=!0)):!y&&M.test(b&&b.tagName)?k.trim(b.value)&&(c=[k.checkFileObj(b.value)],c[0].blob=b,c[0].iframe=!0):w(b)&&(c=b);return k.filter(c,function(b){return!d||d.test(b.name)})},getInfo:function(b,d){var a={},c=Q.concat();k.isFile(b)?function z(){var h=c.shift();h?h.test(b.type)?h(b,function(b,c){b?d(b):(k.extend(a,c),z())}):z():d(!1,a)}():d("not_support",a)},addInfoReader:function(b,d){d.test=
25
+ function(d){return b.test(d)};Q.push(d)},filter:function(b,d){for(var a=[],c=0,h=b.length,e;c<h;c++)c in b&&(e=b[c],d.call(e,e,c,b)&&a.push(e));return a},filterFiles:function(b,d,a){if(b.length){var c=b.concat(),h,e=[],f=[];(function T(){c.length?(h=c.shift(),k.getInfo(h,function(b,a){(d(h,b?!1:a)?e:f).push(h);T()})):a(e,f)})()}else a([],b)},upload:function(b){b=k.extend({prepare:k.F,beforeupload:k.F,upload:k.F,fileupload:k.F,fileprogress:k.F,filecomplete:k.F,progress:k.F,complete:k.F,pause:k.F,chunkSize:k.chunkSize,
26
+ chunkUpoloadRetry:k.chunkUploadRetry},b);b.imageAutoOrientation&&!b.imageTransform&&(b.imageTransform={rotate:"auto"});var a=new k.XHR(b),c=this._getFilesDataArray(b.files),h=0,e=0,f=this,u,r=!1;g(c,function(b){h+=b.size});a.files=[];g(c,function(b){a.files.push(b.file)});a.total=h;a.loaded=0;a.filesLeft=c.length;b.beforeupload(a,b);(u=function U(){var u=c.shift(),q=u&&u.file,l=!1,w=A(b);a.filesLeft=c.length;q&&q.name===k.expando&&(q=null,k.log("[warn] FileAPI.upload() \u2014 called without files"));
27
+ ("abort"!=a.statusText||a.current)&&u?(r=!1,(a.currentFile=q)&&b.prepare(q,w),this._getFormData(w,u,function(r){e||b.upload(a,b);var p=new k.XHR(k.extend({},w,{upload:q?function(){b.fileupload(q,p,w)}:d,progress:q?function(d){l||(b.fileprogress({type:"progress",total:u.total=d.total,loaded:u.loaded=d.loaded},q,p,w),b.progress({type:"progress",total:h,loaded:a.loaded=e+u.size*(d.loaded/d.total)|0},q,p,w))}:d,complete:function(d){l=!0;g($,function(b){a[b]=p[b]});q&&(u.loaded=u.total,this.progress(u),
28
+ e+=u.size,a.loaded=e,b.filecomplete(d,p,q,w));U.call(f)}}));a.abort=function(b){b||(c.length=0);this.current=b;p.abort()};p.send(r)})):(b.complete(200==a.status||201==a.status?!1:a.statusText||"error",a,b),r=!0)}).call(this);a.append=function(b,d){b=k._getFilesDataArray([].concat(b));g(b,function(b){h+=b.size;a.files.push(b.file);d?c.unshift(b):c.push(b)});a.statusText="";r&&u.call(f)};a.remove=function(b){var d=-1;g(c,function(a){d++;if(a.file==b)return c.splice(d,1)})};return a},_getFilesDataArray:function(b){var d=
29
+ [],a={};if(M.test(b&&b.tagName)){var c=k.getFiles(b);a[b.name||"file"]=null!==b.getAttribute("multiple")?c:c[0]}else w(b)&&M.test(b[0]&&b[0].tagName)?g(b,function(b){a[b.name||"file"]=k.getFiles(b)}):a=b;g(a,function z(b,a){w(b)?g(b,function(b,d){z(b,a)}):b&&b.name&&d.push({name:a,file:b,size:b.size,total:b.size,loaded:0})});d.length||d.push({file:{name:k.expando}});return d},_getFormData:function(b,d,a){var c=d.file,h=d.name,e=c.name,u=c.type;d=k.support.transform&&b.imageTransform;var f=new k.Form,
30
+ q=k.queue(function(){a(f)}),r=d&&(0<parseInt(d.maxWidth||d.minWidth||d.width,10)||d.rotate);k.Image&&d&&(/image/.test(c.type)||X.test(c.nodeType))?(q.inc(),r&&(d=[d]),k.Image.transform(c,d,b.imageAutoOrientation,function(d,a){r&&!d?(N||k.flashEngine||(a[0]=k.toBinaryString(a[0]),f.multipart=!0),f.append(h,a[0],e,u)):(d||(g(a,function(b,d){N||k.flashEngine||(b=k.toBinaryString(b),f.multipart=!0);f.append(h+"["+d+"]",b,e,u)}),h+="[original]"),(d||b.imageOriginal)&&f.append(h,c,e,u));q.next()})):e!==
31
+ k.expando&&f.append(h,c,e);g(b.data,function aa(b,d){"object"==typeof b?g(b,function(b,a){aa(b,d+"["+a+"]")}):f.append(d,b)});q.check()},reset:function(b,d){var a,c;x?(c=x(b).clone(!0).insertBefore(b).val("")[0],d||x(b).remove()):(a=b.parentNode,c=a.insertBefore(b.cloneNode(!0),b),c.value="",d||a.removeChild(b),g(B[k.uid(b)],function(d,a){g(d,function(d){p(b,a,d);s(c,a,d)})}));return c},load:function(b,d){var a=k.getXHR();a?(a.open("GET",b,!0),a.overrideMimeType&&a.overrideMimeType("text/plain; charset=x-user-defined"),
32
+ s(a,"progress",function(b){b.lengthComputable&&d({type:b.type,loaded:b.loaded,total:b.total},a)}),a.onreadystatechange=function(){if(4==a.readyState)if(a.onreadystatechange=null,200==a.status){b=b.split("/");var c={name:b[b.length-1],size:a.getResponseHeader("Content-Length"),type:a.getResponseHeader("Content-Type")};c.dataURL="data:"+c.type+";base64,"+k.encode64(a.responseBody||a.responseText);d({type:"load",result:c})}else d({type:"error"})},a.send(null)):d({type:"error"});return a},encode64:function(b){var d=
33
+ "",a=0;for("string"!==typeof b&&(b=String(b));a<b.length;){var c=b.charCodeAt(a++)&255,h=b.charCodeAt(a++)&255,e=b.charCodeAt(a++)&255,f=c>>2,c=(c&3)<<4|h>>4;isNaN(h)?h=e=64:(h=(h&15)<<2|e>>6,e=isNaN(e)?64:e&63);d+="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=".charAt(f)+"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=".charAt(c)+"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=".charAt(h)+"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=".charAt(e)}return d}};
34
+ k.addInfoReader(/^image/,function(b,d){if(!b.__dimensions){var a=b.__dimensions=k.defer();k.readAsImage(b,function(b){var d=b.target;a.resolve("load"==b.type?!1:"error",{width:d.width,height:d.height})})}b.__dimensions.then(d)});k.event.dnd=function(b,d,a){var c,h;a||(a=d,d=k.F);v?(s(b,"dragenter dragleave dragover",function(b){for(var a=((b.originalEvent||b||"").dataTransfer||{}).types,e=a&&a.length;e--;)~a[e].indexOf("File")&&(b.preventDefault(),h!==b.type&&(h=b.type,"dragleave"!=h&&d.call(b.currentTarget,
35
+ !0,b),clearTimeout(c),c=setTimeout(function(){d.call(b.currentTarget,"dragleave"!=h,b)},50)))}),s(b,"drop",function(b){b.preventDefault();h=0;d.call(b.currentTarget,!1,b);k.getDropFiles(b,function(d){a.call(b.currentTarget,d,b)})})):k.log("Drag'n'Drop -- not supported")};x&&!x.fn.dnd&&(x.fn.dnd=function(b,d){return this.each(function(){k.event.dnd(this,b,d)})});a.FileAPI=k.extend(k,a.FileAPI);k.flashUrl||(k.flashUrl=k.staticPath+"FileAPI.flash.swf");k.flashImageUrl||(k.flashImageUrl=k.staticPath+
36
+ "FileAPI.flash.image.swf")})(window);
37
+ (function(a,m,g){function s(a,c){if(!(this instanceof s))return new s(a);this.file=a;this.better=!c;this.matrix={sx:0,sy:0,sw:0,sh:0,dx:0,dy:0,dw:0,dh:0,resize:0,deg:0}}var p=Math.min,f=Math.round,c=!1,e={8:270,3:180,6:90};try{c=-1<m.createElement("canvas").toDataURL("image/png").indexOf("data:image/png")}catch(n){}s.prototype={constructor:s,set:function(c){a.extend(this.matrix,c);return this},crop:function(a,c,e,f){e===g&&(e=a,f=c,a=c=0);return this.set({sx:a,sy:c,sw:e,sh:f||e})},resize:function(a,
38
+ c,e){"string"==typeof c&&(e=c,c=a);return this.set({dw:a,dh:c,resize:e})},preview:function(a,c){return this.set({dw:a,dh:c||a,resize:"preview"})},rotate:function(a){return this.set({deg:a})},_load:function(c,e){var f=this;a.readAsImage(c,function(a){e.call(f,"load"!=a.type,a.result)})},_apply:function(a,c){var e=m.createElement("canvas"),f=this.getMatrix(a),g=e.getContext("2d"),l=f.deg,d=f.dw,h=f.dh,u=a.width,p=a.height,n,v=a;if(this.better)for(;2<Math.min(u/d,p/h);)u=~~(u/2+0.5),p=~~(p/2+0.5),n=
39
+ m.createElement("canvas"),n.width=u,n.height=p,v!==a?(n.getContext("2d").drawImage(v,0,0,v.width,v.height,0,0,u,p),v=n):(v=n,v.getContext("2d").drawImage(a,f.sx,f.sy,f.sw,f.sh,0,0,u,p),f.sx=f.sy=f.sw=f.sh=0);e.width=l%180?h:d;e.height=l%180?d:h;g.rotate(l*Math.PI/180);g.drawImage(v,f.sx,f.sy,f.sw||v.width,f.sh||v.height,180==l||270==l?-d:0,90==l||180==l?-h:0,d,h);c.call(this,!1,e)},getMatrix:function(c){var e=a.extend({},this.matrix),g=e.sw=e.sw||c.width;c=e.sh=e.sh||c.height;var n=e.dw=e.dw||e.sw,
40
+ m=e.dh=e.dh||e.sh,l=g/c,d=n/m,h=e.resize;if("preview"==h){if(n!=g||m!=c)if(d>=l?(l=g,h=l/d):(h=c,l=h*d),l!=g||h!=c)e.sx=~~((g-l)/2),e.sy=~~((c-h)/2),g=l,c=h}else h&&(g>n||c>m?"min"==h?(n=f(l<d?p(g,n):m*l),m=f(l<d?n/l:p(c,m))):(n=f(l>=d?p(g,n):m*l),m=f(l>=d?n/l:p(c,m))):(n=g,m=c));e.sw=g;e.sh=c;e.dw=n;e.dh=m;return e},_trans:function(a){this._load(this.file,function(c,e){c?a(c):this._apply(e,a)})},get:function(c){if(a.support.transform){var f=this;"auto"==f.matrix.deg?a.getInfo(this.file,function(a,
41
+ g){f.matrix.deg=e[g&&g.exif&&g.exif.Orientation]||0;f._trans(c)}):f._trans(c)}else c("not_support")},toData:function(a){this.get(a)}};s.exifOrientation=e;s.transform=function(c,e,f,n){a.getInfo(c,function(p,l){var d={},h=a.queue(function(a){n(a,d)});p?h.fail():a.each(e,function(a,e){if(!h.isFail()){var n=s(l.nodeType?l:c);if("function"==typeof a)a(l,n);else if(a.width)n[a.preview?"preview":"resize"](a.width,a.height,a.type);else a.maxWidth&&(l.width>a.maxWidth||l.height>a.maxHeight)&&n.resize(a.maxWidth,
42
+ a.maxHeight,"max");a.rotate===g&&f&&(a.rotate="auto");n.rotate(a.rotate);h.inc();n.toData(function(a,c){a?h.fail():(d[e]=c,h.next())})}})})};a.support.canvas=a.support.transform=c;a.Image=s})(FileAPI,document);
43
+ (function(a,m,g){var s=m.encodeURIComponent,p=m.FormData;m=function(){this.items=[]};m.prototype={append:function(a,c,e,g){this.items.push({name:a,blob:c&&c.blob||(void 0==c?"":c),file:c&&(e||c.name),type:c&&(g||c.type)})},each:function(a){for(var c=0,e=this.items.length;c<e;c++)a.call(this,this.items[c])},toData:function(f,c){c._chunked=a.support.chunked&&0<c.chunkSize&&1==a.filter(this.items,function(a){return a.file}).length;a.support.html5?this.multipart||!p?(a.log("FileAPI.Form.toMultipartData"),
44
+ this.toMultipartData(f)):c._chunked?(a.log("FileAPI.Form.toPlainData"),this.toPlainData(f)):(a.log("FileAPI.Form.toFormData"),this.toFormData(f)):(a.log("FileAPI.Form.toHtmlData"),this.toHtmlData(f))},_to:function(f,c,e,g){var p=a.queue(function(){c(f)});this.each(function(a){e(a,f,p,g)});p.check()},toHtmlData:function(f){this._to(g.createDocumentFragment(),f,function(c,e){var f=c.blob,p;c.file?(a.reset(f,!0),f.name=c.name,e.appendChild(f)):(p=g.createElement("input"),p.name=c.name,p.type="hidden",
45
+ p.value=f,e.appendChild(p))})},toPlainData:function(a){this._to({},a,function(a,e,f){a.file&&(e.type=a.file);a.blob.toBlob?(f.inc(),a.blob.toBlob(function(g){e.name=a.name;e.file=g;e.size=g.length;e.type=a.type;f.next()},"image/png")):a.file?(e.name=a.blob.name,e.file=a.blob,e.size=a.blob.size,e.type=a.type):(e.params||(e.params=[]),e.params.push(encodeURIComponent(a.name)+"="+encodeURIComponent(a.blob)));e.start=-1;e.end=e.file.FileAPIReadPosition||-1;e.retry=0})},toFormData:function(a){this._to(new p,
46
+ a,function(a,e,f){a.file&&e.append("_"+a.name,a.file);a.blob&&a.blob.toBlob?(f.inc(),a.blob.toBlob(function(g){e.append(a.name,g,a.file);f.next()},"image/png")):a.file?e.append(a.name,a.blob,a.file):e.append(a.name,a.blob)})},toMultipartData:function(f){this._to([],f,function(c,e,f,g){var p=!!c.file,m=c.blob,A=function(a){e.push("--_"+g+('\r\nContent-Disposition: form-data; name="'+c.name+'"'+(p?'; filename="'+s(c.file)+'"':"")+(p?"\r\nContent-Type: "+(c.type||"application/octet-stream"):"")+"\r\n\r\n"+
47
+ (p?a:s(a))+"\r\n"));f.next()};f.inc();a.isFile(m)?a.readAsBinaryString(m,function(a){"load"==a.type&&A(a.result)}):A(m)},a.expando)}};a.Form=m})(FileAPI,window,document);
48
+ (function(a,m){var g=function(){},s=function(a){this.uid=m.uid();this.xhr={abort:g,getResponseHeader:g,getAllResponseHeaders:g};this.options=a};s.prototype={status:0,statusText:"",getResponseHeader:function(a){return this.xhr.getResponseHeader(a)},getAllResponseHeaders:function(){return this.xhr.getAllResponseHeaders()||{}},end:function(p,f){var c=this,e=c.options;c.end=c.abort=g;c.status=p;f&&(c.statusText=f);m.log("xhr.end:",p,f);e.complete(200==p||201==p?!1:c.statusText||"unknown",c);c.xhr&&c.xhr.node&&
49
+ setTimeout(function(){var e=c.xhr.node;try{e.parentNode.removeChild(e)}catch(f){}try{delete a[c.uid]}catch(g){}a[c.uid]=c.xhr.node=null},9)},abort:function(){this.end(0,"abort");this.xhr&&(this.xhr.aborted=!0,this.xhr.abort())},send:function(a){var f=this,c=this.options;a.toData(function(a){c.upload(c,f);f._send.call(f,c,a)},c)},_send:function(g,f){var c=this,e,n=c.uid,q=g.url;m.log("XHR._send:",f);q+=(~q.indexOf("?")?"&":"?")+m.uid();f.nodeName?(g.upload(g,c),e=document.createElement("div"),e.innerHTML=
50
+ '<form target="'+n+'" action="'+q+'" method="POST" enctype="multipart/form-data" style="position: absolute; top: -1000px; overflow: hidden; width: 1px; height: 1px;"><iframe name="'+n+'" src="javascript:false;"></iframe><input value="'+n+'" name="callback" type="hidden"/></form>',c.xhr.abort=function(){var a=e.getElementsByName("iframe")[0];if(a)try{a.stop?a.stop():a.contentWindow.stop?a.contentWindow.stop():a.contentWindow.document.execCommand("Stop")}catch(c){}e=null},q=e.getElementsByTagName("form")[0],
51
+ q.appendChild(f),m.log(q.parentNode.innerHTML),document.body.appendChild(e),c.xhr.node=e,a[n]=function(a,f,g){c.readyState=4;c.responseText=g;c.end(a,f);e=null},c.readyState=2,q.submit(),q=null):this.xhr&&this.xhr.aborted?m.log("Error: already aborted"):(e=c.xhr=m.getXHR(),f.params&&(q+=(0>q.indexOf("?")?"?":"&")+f.params.join("&")),e.open("POST",q,!0),m.withCredentials&&(e.withCredentials="true"),g.headers&&g.headers["X-Requested-With"]||e.setRequestHeader("X-Requested-With","XMLHttpRequest"),m.each(g.headers,
52
+ function(a,c){e.setRequestHeader(c,a)}),g._chunked?(e.upload&&e.upload.addEventListener("progress",function(a){f.retry||g.progress({type:a.type,total:f.size,loaded:f.start+a.loaded,totalSize:f.size},c,g)},!1),e.onreadystatechange=function(){c.status=e.status;c.statusText=e.statusText;c.readyState=e.readyState;if(4==e.readyState){for(var a in{"":1,XML:1,Text:1,Body:1})c["response"+a]=e["response"+a];e.onreadystatechange=null;if(!e.status||0<e.status-201)if(m.log("Error: "+e.status),(!e.status&&!e.aborted||
53
+ 500==e.status||416==e.status)&&++f.retry<=g.chunkUploadRetry){a=e.status?0:m.chunkNetworkDownRetryTimeout;g.pause(f.file,g);var n=parseInt(e.getResponseHeader("X-Last-Known-Byte"),10);m.log("X-Last-Known-Byte: "+n);f.end=n?n:f.start-1;setTimeout(function(){c._send(g,f)},a)}else c.end(e.status);else f.retry=0,f.end==f.size-1?c.end(e.status):(n=parseInt(e.getResponseHeader("X-Last-Known-Byte"),10),m.log("X-Last-Known-Byte: "+n),n&&(f.end=n),f.file.FileAPIReadPosition=f.end,setTimeout(function(){c._send(g,
54
+ f)},0));e=null}},f.start=f.end+1,f.end=Math.max(Math.min(f.start+g.chunkSize,f.size)-1,f.start),(n="slice")in f.file||(n="mozSlice")in f.file||(n="webkitSlice"),e.setRequestHeader("Content-Range","bytes "+f.start+"-"+f.end+"/"+f.size),e.setRequestHeader("Content-Disposition","attachment; filename="+encodeURIComponent(f.name)),e.setRequestHeader("Content-Type",f.type||"application/octet-stream"),n=f.file[n](f.start,f.end+1),e.send(n),n=null):(e.upload&&e.upload.addEventListener("progress",m.throttle(function(a){g.progress(a,
55
+ c,g)},100),!1),e.onreadystatechange=function(){c.status=e.status;c.statusText=e.statusText;c.readyState=e.readyState;if(4==e.readyState){for(var a in{"":1,XML:1,Text:1,Body:1})c["response"+a]=e["response"+a];e.onreadystatechange=null;c.end(e.status);e=null}},m.isArray(f)?(e.setRequestHeader("Content-Type","multipart/form-data; boundary=_"+m.expando),f=f.join("")+"--_"+m.expando+"--",e.sendAsBinary?e.sendAsBinary(f):(n=Array.prototype.map.call(f,function(a){return a.charCodeAt(0)&255}),e.send((new Uint8Array(n)).buffer))):
56
+ e.send(f)))}};m.XHR=s})(window,FileAPI);
57
+ (function(a,m,g){a.support.flash=function(){var g=m.navigator,p=g.mimeTypes,f=!1;if(g.plugins&&"object"==typeof g.plugins["Shockwave Flash"])f=g.plugins["Shockwave Flash"].description&&!(p&&p["application/x-shockwave-flash"]&&!p["application/x-shockwave-flash"].enabledPlugin);else try{f=!(!m.ActiveXObject||!new ActiveXObject("ShockwaveFlash.ShockwaveFlash"))}catch(c){a.log("ShockwaveFlash.ShockwaveFlash -- does not supported.")}return f}();!a.support.flash||a.html5&&a.support.html5&&(!a.cors||a.support.cors)||
58
+ function(){function s(a){return('<object id="#id#" classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" width="'+(a.width||"100%")+'" height="'+(a.height||"100%")+'"><param name="movie" value="#src#" /><param name="flashvars" value="#flashvars#" /><param name="swliveconnect" value="true" /><param name="allowscriptaccess" value="always" /><param name="allownetworking" value="all" /><param name="menu" value="false" /><param name="wmode" value="#wmode#" /><embed flashvars="#flashvars#" swliveconnect="true" allownetworking="all" allowscriptaccess="always" name="#id#" src="#src#" width="'+
59
+ (a.width||"100%")+'" height="'+(a.height||"100%")+'" menu="false" wmode="transparent" type="application/x-shockwave-flash"></embed></object>').replace(/#(\w+)#/ig,function(c,e){return a[e]})}function p(a,c){if(a&&a.style){var e,f;for(e in c){f=c[e];"number"==typeof f&&(f+="px");try{a.style[e]=f}catch(g){}}}}function f(d,c){a.each(c,function(a,c){var e=d[c];d[c]=function(){this.parent=e;return a.apply(this,arguments)}})}function c(d){var c=d.wid=a.uid();l._fn[c]=d;return"FileAPI.Flash._fn."+c}function e(a){try{l._fn[a.wid]=
60
+ null,delete l._fn[a.wid]}catch(c){}}function n(a,c){if(!C.test(a)){if(/^\.\//.test(a)||"/"!=a.charAt(0)){var e=location.pathname,e=e.substr(0,e.lastIndexOf("/"));a=(e+"/"+a).replace("/./","/")}"//"!=a.substr(0,2)&&(a="//"+location.host+a);C.test(a)||(a=location.protocol+a)}c&&(a+=(/\?/.test(a)?"&":"?")+c);return a}function q(d,h,f){function m(){try{l.get(v).setImage(h)}catch(d){a.log('flash.setImage -- can not set "base64":',d)}}var q,v=a.uid(),r=g.createElement("div");for(q in d)r.setAttribute("data-img-"+
61
+ q,d[q]);p(r,d);r.innerHTML=s(a.extend({id:v,src:n(a.flashImageUrl,"r="+a.uid()),wmode:"opaque",flashvars:"scale="+d.scale+"&callback="+c(function x(){e(x);setTimeout(m,99);return!0})},d));f(!1,r);r=null}var r=a.uid(),w=0,A={},C=/^https?:/i,l={_fn:{},init:function(){var d=g.body&&g.body.firstChild;if(d){do if(1==d.nodeType){a.log("FlashAPI.Flash.init...");var c=g.createElement("div");p(c,{top:1,right:1,width:5,height:5,position:"absolute"});d.parentNode.insertBefore(c,d);l.publish(c,r);return}while(d=
62
+ d.nextSibling)}10>w&&setTimeout(l.init,50*++w)},publish:function(d,c){d.innerHTML=s({id:c,src:n(a.flashUrl,"r="+a.version),wmode:"transparent",flashvars:"callback=FileAPI.Flash.event&flashId="+c+"&storeKey="+navigator.userAgent.match(/\d/ig).join("")+"_"+a.version+(l.isReady||(a.pingUrl?"&ping="+a.pingUrl:""))+"&timeout="+a.flashAbortTimeout})},ready:function(){l.ready=a.F;l.isReady=!0;l.patch();a.event.on(g,"mouseover",l.mouseover);a.event.on(g,"click",function(a){l.mouseover(a)&&(a.preventDefault?
63
+ a.preventDefault():a.returnValue=!0)})},getWrapper:function(a){do if(/js-fileapi-wrapper/.test(a.className))return a;while((a=a.parentNode)&&a!==g.body)},mouseover:function(d){d=a.event.fix(d).target;if(/input/i.test(d.nodeName)&&"file"==d.type){var c=d.getAttribute(r);if("i"==c||"r"==c)return!1;if("p"!=c){d.setAttribute(r,"i");var c=g.createElement("div"),e=l.getWrapper(d);if(!e){a.log("flash.mouseover.error: js-fileapi-wrapper not found");return}p(c,{top:0,left:0,width:d.offsetWidth+100,height:d.offsetHeight+
64
+ 100,zIndex:"1000000",position:"absolute"});e.appendChild(c);l.publish(c,a.uid());d.setAttribute(r,"p")}return!0}},event:function(d){var c=d.type;if("ready"==c){try{l.getInput(d.flashId).setAttribute(r,"r")}catch(e){}l.ready();setTimeout(function(){l.mouseenter(d)},50);return!0}"ping"===c?a.log("(flash -> js).ping:",[d.status,d.savedStatus],d.error):"log"===c?a.log("(flash -> js).log:",d.target):c in l&&setTimeout(function(){a.log("Flash.event."+d.type+":",d);l[c](d)},1)},mouseenter:function(d){var c=
65
+ l.getInput(d.flashId);if(c){l.cmd(d,"multiple",null!=c.getAttribute("multiple"));var e=[],f={};a.each((c.getAttribute("accept")||"").split(/,\s*/),function(d){a.accept[d]&&a.each(a.accept[d].split(" "),function(a){f[a]=1})});a.each(f,function(a,d){e.push(d)});l.cmd(d,"accept",e.length?e.join(",")+","+e.join(",").toUpperCase():"*")}},get:function(a){return g[a]||m[a]||g.embeds[a]},getInput:function(d){try{var c=l.getWrapper(l.get(d));if(c)return c.getElementsByTagName("input")[0]}catch(e){a.log('Can not find "input" by flashId:',
66
+ d,e)}},select:function(d){var c=l.getInput(d.flashId),e=a.uid(c);d=d.target.files;a.each(d,function(d){a.checkFileObj(d)});A[e]=d;g.createEvent?(e=g.createEvent("Event"),e.initEvent("change",!0,!1),c.dispatchEvent(e)):g.createEventObject&&(e=g.createEventObject(),c.fireEvent("onchange",e))},cmd:function(d,c,e,f){try{return a.log("(js -> flash)."+c+":",e),l.get(d.flashId||d).cmd(c,e)}catch(g){a.log("(js -> flash).onError:",g),f||setTimeout(function(){l.cmd(d,c,e,!0)},50)}},patch:function(){a.flashEngine=
67
+ a.support.transform=!0;f(a,{getFiles:function(d,c,e){if(e)return a.filterFiles(a.getFiles(d),c,e),null;var f=a.isArray(d)?d:A[a.uid(d.target||d.srcElement||d)];if(!f)return this.parent.apply(this,arguments);c&&(c=a.getFilesFilter(c),f=a.filter(f,function(a){return c.test(a.name)}));return f},getInfo:function(d,f){if(d&&!d.flashId)this.parent.apply(this,arguments);else{if(!d.__info){var g=d.__info=a.defer();l.cmd(d,"getFileInfo",{id:d.id,callback:c(function E(a,c){e(E);g.resolve(a,d.info=c)})})}d.__info.then(f)}}});
68
+ a.support.transform=!0;a.Image&&f(a.Image.prototype,{get:function(a,c){this.set({scaleMode:c||"noScale"});this.parent(a)},_load:function(d,c){a.log("FileAPI.Image._load:",d);if(d&&!d.flashId)this.parent.apply(this,arguments);else{var e=this;a.getInfo(d,function(a,f){c.call(e,a,d)})}},_apply:function(d,f){a.log("FileAPI.Image._apply:",d);if(d&&!d.flashId)this.parent.apply(this,arguments);else{var g=this.getMatrix(d.info);l.cmd(d,"imageTransform",{id:d.id,matrix:g,callback:c(function E(c,l){a.log("FileAPI.Image._apply.callback:",
69
+ c);e(E);c?f(c):!a.support.dataURI||3E4<l.length?q({width:g.deg%180?g.dh:g.dw,height:g.deg%180?g.dw:g.dh,scale:g.scaleMode},l,f):a.newImage("data:"+d.type+";base64,"+l,f)})})}},toData:function(d){var c=this.file,e=c.info,f=this.getMatrix(e);c&&!c.flashId?this.parent.apply(this,arguments):("auto"==f.deg&&(f.deg=a.Image.exifOrientation[e&&e.exif&&e.exif.Orientation]||0),d.call(this,!c.info,{id:c.id,flashId:c.flashId,name:c.name,type:c.type,matrix:f}))}});f(a.Form.prototype,{toData:function(d){for(var c=
70
+ this.items,e=c.length;e--;)if(c[e].file&&c[e].blob&&!c[e].blob.flashId)return this.parent.apply(this,arguments);a.log("flash.Form.toData");d(c)}});f(a.XHR.prototype,{_send:function(d,f){if(f.nodeName||f.append&&a.support.html5||a.isArray(f)&&"string"===typeof f[0])return this.parent.apply(this,arguments);var g={},m={},p=this,q,r;a.each(f,function(a){a.file?(m[a.name]=a={id:a.blob.id,name:a.blob.name,matrix:a.blob.matrix,flashId:a.blob.flashId},r=a.id,q=a.flashId):g[a.name]=a.blob});if(r||q)a.log("flash.XHR._send:",
71
+ q,r,m);else return this.parent.apply(this,arguments);p.xhr={headers:{},abort:function(){l.cmd(q,"abort",{id:r})},getResponseHeader:function(a){return this.headers[a]},getAllResponseHeaders:function(){return this.headers}};var s=a.queue(function(){l.cmd(q,"upload",{url:n(d.url),data:g,files:m,headers:d.headers,callback:c(function y(c){var f=c.type,g=c.result;a.log("flash.upload."+f+":",c);if("progress"==f)c.loaded=Math.min(c.loaded,c.total),c.lengthComputable=!0,d.progress(c);else if("complete"==f)e(y),
72
+ "string"==typeof g&&(p.responseText=g.replace(/%22/g,'"').replace(/%5c/g,"\\").replace(/%26/g,"&").replace(/%25/g,"%")),p.end(c.status||200);else if("abort"==f||"error"==f)p.end(c.status||0,c.message),e(y)})})});a.each(m,function(c){s.inc();a.getInfo(c,s.next)});s.check()}})}};a.Flash=l;a.newImage("data:image/gif;base64,R0lGODlhAQABAIAAAAAAAP///ywAAAAAAQABAAACAUwAOw==",function(c,e){a.support.dataURI=!(1!=e.width||1!=e.height);l.init()})}()})(FileAPI,window,document);
73
+ "undefined"!==typeof ajs&&ajs.loaded&&ajs.loaded("{fileapi}FileAPI.min");"function"===typeof define&&define.amd&&define("FileAPI",[],function(){return window.FileAPI||{}});
@@ -0,0 +1,5 @@
1
+ window.FileAPI =
2
+ debug: false
3
+ pingUrl: false
4
+ flashUrl: '<%= asset_path 'fileapi/FileAPI.flash.swf' %>'
5
+ flashImageUrl: '<%= asset_path 'fileapi/FileAPI.flash.image.swf' %>'
@@ -0,0 +1,35 @@
1
+ // Simple JavaScript Templating
2
+ // John Resig - http://ejohn.org/ - MIT Licensed
3
+ (function (){
4
+ var cache = {};
5
+
6
+ this.tmpl = function tmpl(str, data){
7
+ // Figure out if we're getting a template, or if we need to
8
+ // load the template - and be sure to cache the result.
9
+ var fn = !/\W/.test(str) ?
10
+ cache[str] = cache[str] ||
11
+ tmpl(document.getElementById(str).innerHTML) :
12
+
13
+ // Generate a reusable function that will serve as a template
14
+ // generator (and which will be cached).
15
+ new Function("obj",
16
+ "var p=[],print=function(){p.push.apply(p,arguments);};" +
17
+
18
+ // Introduce the data as local variables using with(){}
19
+ "with(obj){p.push('" +
20
+
21
+ // Convert the template into pure JavaScript
22
+ str
23
+ .replace(/[\r\t\n]/g, " ")
24
+ .split("<%").join("\t")
25
+ .replace(/((^|%>)[^\t]*)'/g, "$1\r")
26
+ .replace(/\t=(.*?)%>/g, "',$1,'")
27
+ .split("\t").join("');")
28
+ .split("%>").join("p.push('")
29
+ .split("\r").join("\\'")
30
+ + "');}return p.join('');");
31
+
32
+ // Provide some basic currying to the user
33
+ return data ? fn(data) : fn;
34
+ };
35
+ })();
@@ -0,0 +1,5 @@
1
+ //= require fileapi/config
2
+ //= require fileapi/FileAPI.min
3
+ //= require fileapi/FileAPI.id3.js
4
+ //= require fileapi/FileAPI.exif.js
5
+ //= require fileapi/tmpl
@@ -0,0 +1,175 @@
1
+ #oooops {
2
+ // уведомления о том что ничего не поддерживается кроме фрейма
3
+ display: none;
4
+ border-radius: 4px;
5
+ padding: 10px;
6
+ margin: 10px 0; border: 2px solid #f60;
7
+ }
8
+
9
+ #buttons-panel {
10
+ font-size: 15px;
11
+ font-family: "Helvetica Neue";
12
+ }
13
+
14
+ .b-button {
15
+ display: inline-block;
16
+ *display: inline;
17
+ *zoom: 1;
18
+ position: relative;
19
+ overflow: hidden;
20
+ cursor: pointer;
21
+ padding: 4px 15px;
22
+ vertical-align: middle;
23
+ border: 1px solid #ccc;
24
+ border-radius: 3px;
25
+ background-color: #f5f5f5;
26
+ -webkit-background: linear-gradient(top, #fff 0%, #f5f5f5 49%, #ececec 50%, #eee 100%);
27
+ background: linear-gradient(to bottom, #fff 0%, #f5f5f5 49%, #ececec 50%, #eee 100%);
28
+ -webkit-user-select: none;
29
+ -moz-user-select: none;
30
+ user-select: none;
31
+ &:hover {
32
+ border-color: #fa0;
33
+ box-shadow: 0 0 2px #fa0;
34
+ };
35
+ .b-button__input {
36
+ cursor: pointer;
37
+ filter: progid:DXImageTransform.Microsoft.Alpha(Opacity=0);
38
+ opacity: 0;
39
+ top: -10px;
40
+ right: -40px;
41
+ font-size: 50px;
42
+ position: absolute;
43
+ padding: 50px;
44
+ }
45
+ }
46
+
47
+
48
+
49
+
50
+ #preview {
51
+ box-shadow: 0 1px 3px rgba(0,0,0,.4);
52
+ border-radius: 3px;
53
+ }
54
+
55
+ .b-file {
56
+ padding: 5px;
57
+ position: relative;
58
+ overflow: hidden;
59
+ border-radius: 3px;
60
+ background-color: #fcfcfc;
61
+ background: -webkit-linear-gradient(top, #fcfcfc 0%, #f6f6f6 100%);
62
+ background: -moz-linear-gradient(top, #fcfcfc 0%, #f6f6f6 100%);
63
+ background: -o-linear-gradient(top, #fcfcfc 0%, #f6f6f6 100%);
64
+ background: linear-gradient(to bottom, #fcfcfc 0%, #f6f6f6 100%);
65
+ clear: both;
66
+ }
67
+ .b-file__left {
68
+ float: left;
69
+ margin: 1px 0 0 2px;
70
+ line-height: 0;
71
+ }
72
+ .b-file__left_border {
73
+ border: 2px solid #fff;
74
+ border-radius: 4px;
75
+ }
76
+
77
+ .b-file__right {
78
+ margin-left: 45px;
79
+ }
80
+
81
+ .b-file__name {
82
+ color: #36c;
83
+ }
84
+
85
+ .b-file__info {
86
+ color: #666;
87
+ position: relative;
88
+ font-size: 12px;
89
+ margin-top: 3px;
90
+ }
91
+
92
+ .b-file__bar {
93
+ padding-top: 4px;
94
+ }
95
+
96
+ .b-file__error {
97
+ color: #c00;
98
+ }
99
+ .b-file__done {
100
+ color: #458383;
101
+ }
102
+ .b-file__abort {
103
+ top: 10px;
104
+ right: 20px;
105
+ width: 15px;
106
+ height: 15px;
107
+ position: absolute;
108
+ color: #c00;
109
+ cursor: pointer;
110
+ font-size: 20px;
111
+ display: none;
112
+ }
113
+ .b-file_upload .b-file__abort { display: block; }
114
+
115
+ .b-progress {
116
+ max-width: 200px;
117
+ clear: both;
118
+ height: 10px;
119
+ border: 2px solid #E2E4E2;
120
+ border-radius: 10px;
121
+ box-shadow: inset 0 1px 1px rgba(0,0,0,.2);
122
+ background-color: #d3d3d3;
123
+ position: relative;
124
+ }
125
+ .b-progress__bar {
126
+ width: 0;
127
+ height: 10px;
128
+ border-radius: 10px;
129
+ background-color: #2D9DD7;
130
+ -webkit-background: linear-gradient(top, #2D9DD7 0%, #1C81C7 100%);
131
+ background: linear-gradient(to bottom, #2D9DD7 0%, #1C81C7 100%);
132
+ -webkit-transition: width .5s ease-out;
133
+ -moz-transition: width .5s ease-out;
134
+ -ms-transition: width .5s ease-out;
135
+ transition: width .5s ease-out;
136
+ }
137
+
138
+ .b-dropzone {
139
+ position: relative; margin-bottom: 10px;
140
+ &.active {
141
+ }
142
+ }
143
+
144
+ .b-dropzone__bg, .b-dropzone__txt {
145
+ position: absolute;
146
+ .b-dropzone.active & {display: block;}
147
+ }
148
+
149
+ .b-dropzone__bg {
150
+ top: 0;
151
+ left: 0;
152
+ right: 0;
153
+ bottom: 0;
154
+ z-index: 30000;
155
+ opacity: .2;
156
+ background:#EEDA7C;
157
+ .active & {
158
+ background-color: #2D9DD7;
159
+
160
+ }
161
+ }
162
+
163
+ .b-dropzone__txt {
164
+ color: rgb(168, 162, 94);
165
+ .active & {color: #1C81C7;}
166
+ font-size: 16px;
167
+ font-weight: bold;
168
+ text-align: center;
169
+ width: 500px;
170
+ top: 50%;
171
+ left: 50%;
172
+ margin: -50px 0 0 -250px;
173
+ z-index: 30001;
174
+ line-height: 100px;
175
+ }
data/fileapi.gemspec CHANGED
@@ -18,6 +18,8 @@ Gem::Specification.new do |spec|
18
18
  spec.test_files = spec.files.grep(%r{^(test|spec|features)/})
19
19
  spec.require_paths = ["lib"]
20
20
 
21
+ spec.add_dependency "railties"
22
+
21
23
  spec.add_development_dependency "bundler", "~> 1.3"
22
24
  spec.add_development_dependency "rake"
23
25
  end
@@ -1,3 +1,5 @@
1
+ # coding: utf-8
2
+
1
3
  module Fileapi
2
- VERSION = "0.0.1"
4
+ VERSION = "0.0.2"
3
5
  end
data/lib/fileapi.rb CHANGED
@@ -1,5 +1,10 @@
1
+ # coding: utf-8
2
+
1
3
  require "fileapi/version"
2
4
 
3
5
  module Fileapi
4
- # Your code goes here...
6
+ module Rails
7
+ class Engine < ::Rails::Engine
8
+ end
9
+ end
5
10
  end
metadata CHANGED
@@ -1,20 +1,32 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: fileapi
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.1
5
- prerelease:
4
+ version: 0.0.2
6
5
  platform: ruby
7
6
  authors:
8
7
  - Oleg Bovykin
9
8
  autorequire:
10
9
  bindir: bin
11
10
  cert_chain: []
12
- date: 2013-09-23 00:00:00.000000000 Z
11
+ date: 2013-10-29 00:00:00.000000000 Z
13
12
  dependencies:
13
+ - !ruby/object:Gem::Dependency
14
+ name: railties
15
+ requirement: !ruby/object:Gem::Requirement
16
+ requirements:
17
+ - - '>='
18
+ - !ruby/object:Gem::Version
19
+ version: '0'
20
+ type: :runtime
21
+ prerelease: false
22
+ version_requirements: !ruby/object:Gem::Requirement
23
+ requirements:
24
+ - - '>='
25
+ - !ruby/object:Gem::Version
26
+ version: '0'
14
27
  - !ruby/object:Gem::Dependency
15
28
  name: bundler
16
29
  requirement: !ruby/object:Gem::Requirement
17
- none: false
18
30
  requirements:
19
31
  - - ~>
20
32
  - !ruby/object:Gem::Version
@@ -22,7 +34,6 @@ dependencies:
22
34
  type: :development
23
35
  prerelease: false
24
36
  version_requirements: !ruby/object:Gem::Requirement
25
- none: false
26
37
  requirements:
27
38
  - - ~>
28
39
  - !ruby/object:Gem::Version
@@ -30,17 +41,15 @@ dependencies:
30
41
  - !ruby/object:Gem::Dependency
31
42
  name: rake
32
43
  requirement: !ruby/object:Gem::Requirement
33
- none: false
34
44
  requirements:
35
- - - ! '>='
45
+ - - '>='
36
46
  - !ruby/object:Gem::Version
37
47
  version: '0'
38
48
  type: :development
39
49
  prerelease: false
40
50
  version_requirements: !ruby/object:Gem::Requirement
41
- none: false
42
51
  requirements:
43
- - - ! '>='
52
+ - - '>='
44
53
  - !ruby/object:Gem::Version
45
54
  version: '0'
46
55
  description: FileAPI
@@ -55,32 +64,40 @@ files:
55
64
  - LICENSE.txt
56
65
  - README.md
57
66
  - Rakefile
67
+ - app/assets/javascripts/fileapi.js
68
+ - app/assets/javascripts/fileapi/FileAPI.exif.js
69
+ - app/assets/javascripts/fileapi/FileAPI.id3.js
70
+ - app/assets/javascripts/fileapi/FileAPI.min.js
71
+ - app/assets/javascripts/fileapi/config.js.coffee.erb
72
+ - app/assets/javascripts/fileapi/tmpl.js
73
+ - app/assets/stylesheets/fileapi.css.scss
74
+ - app/assets/swfs/fileapi/FileAPI.flash.image.swf
75
+ - app/assets/swfs/fileapi/FileAPI.flash.swf
58
76
  - fileapi.gemspec
59
77
  - lib/fileapi.rb
60
78
  - lib/fileapi/version.rb
61
79
  homepage: ''
62
80
  licenses:
63
81
  - MIT
82
+ metadata: {}
64
83
  post_install_message:
65
84
  rdoc_options: []
66
85
  require_paths:
67
86
  - lib
68
87
  required_ruby_version: !ruby/object:Gem::Requirement
69
- none: false
70
88
  requirements:
71
- - - ! '>='
89
+ - - '>='
72
90
  - !ruby/object:Gem::Version
73
91
  version: '0'
74
92
  required_rubygems_version: !ruby/object:Gem::Requirement
75
- none: false
76
93
  requirements:
77
- - - ! '>='
94
+ - - '>='
78
95
  - !ruby/object:Gem::Version
79
96
  version: '0'
80
97
  requirements: []
81
98
  rubyforge_project:
82
- rubygems_version: 1.8.25
99
+ rubygems_version: 2.0.3
83
100
  signing_key:
84
- specification_version: 3
101
+ specification_version: 4
85
102
  summary: FileaAPI js api from mail ru for rails
86
103
  test_files: []