You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

jquery.transloadit2.js 19KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152
  1. /*
  2. jQuery Easing v1.3: Copyright (c) 2008 George McGinley Smith | BSD License: http://www.opensource.org/licenses/bsd-license.php
  3. jQuery JSONP Core Plugin 2.1.2: Copyright (c) 2010 Julian Aubourg | MIT License: http://www.opensource.org/licenses/mit-license.php
  4. json2: Douglas Crockford | Public domain
  5. jquery.transloadit2.js: Copyright (c) 2010 Felix Geisendörfer | MIT License: http://www.opensource.org/licenses/mit-license.php
  6. Fork this on Github: http://github.com/transloadit/jquery-sdk
  7. Transloadit servers allow browsers to cache jquery.transloadit2.js for 1 hour.
  8. keep this in mind when rolling out fixes.
  9. jQuery Tools 1.2.3: Tero Piirainen | Public domain
  10. */
  11. jQuery.easing.jswing=jQuery.easing.swing;
  12. jQuery.extend(jQuery.easing,{def:"easeOutQuad",swing:function(c,a,g,e,b){return jQuery.easing[jQuery.easing.def](c,a,g,e,b)},easeInQuad:function(c,a,g,e,b){return e*(a/=b)*a+g},easeOutQuad:function(c,a,g,e,b){return-e*(a/=b)*(a-2)+g},easeInOutQuad:function(c,a,g,e,b){return 1>(a/=b/2)?e/2*a*a+g:-e/2*(--a*(a-2)-1)+g},easeInCubic:function(c,a,g,e,b){return e*(a/=b)*a*a+g},easeOutCubic:function(c,a,g,e,b){return e*((a=a/b-1)*a*a+1)+g},easeInOutCubic:function(c,a,g,e,b){return 1>(a/=b/2)?e/2*a*a*a+g:
  13. e/2*((a-=2)*a*a+2)+g},easeInQuart:function(c,a,g,e,b){return e*(a/=b)*a*a*a+g},easeOutQuart:function(c,a,g,e,b){return-e*((a=a/b-1)*a*a*a-1)+g},easeInOutQuart:function(c,a,g,e,b){return 1>(a/=b/2)?e/2*a*a*a*a+g:-e/2*((a-=2)*a*a*a-2)+g},easeInQuint:function(c,a,g,e,b){return e*(a/=b)*a*a*a*a+g},easeOutQuint:function(c,a,g,e,b){return e*((a=a/b-1)*a*a*a*a+1)+g},easeInOutQuint:function(c,a,g,e,b){return 1>(a/=b/2)?e/2*a*a*a*a*a+g:e/2*((a-=2)*a*a*a*a+2)+g},easeInSine:function(c,a,g,e,b){return-e*Math.cos(a/
  14. b*(Math.PI/2))+e+g},easeOutSine:function(c,a,g,e,b){return e*Math.sin(a/b*(Math.PI/2))+g},easeInOutSine:function(c,a,g,e,b){return-e/2*(Math.cos(Math.PI*a/b)-1)+g},easeInExpo:function(c,a,g,e,b){return 0==a?g:e*Math.pow(2,10*(a/b-1))+g},easeOutExpo:function(c,a,g,e,b){return a==b?g+e:e*(-Math.pow(2,-10*a/b)+1)+g},easeInOutExpo:function(c,a,g,e,b){return 0==a?g:a==b?g+e:1>(a/=b/2)?e/2*Math.pow(2,10*(a-1))+g:e/2*(-Math.pow(2,-10*--a)+2)+g},easeInCirc:function(c,a,g,e,b){return-e*(Math.sqrt(1-(a/=b)*
  15. a)-1)+g},easeOutCirc:function(c,a,g,e,b){return e*Math.sqrt(1-(a=a/b-1)*a)+g},easeInOutCirc:function(c,a,g,e,b){return 1>(a/=b/2)?-e/2*(Math.sqrt(1-a*a)-1)+g:e/2*(Math.sqrt(1-(a-=2)*a)+1)+g},easeInElastic:function(c,a,g,e,b){var c=1.70158,d=0,f=e;if(0==a)return g;if(1==(a/=b))return g+e;d||(d=0.3*b);f<Math.abs(e)?(f=e,c=d/4):c=d/(2*Math.PI)*Math.asin(e/f);return-(f*Math.pow(2,10*(a-=1))*Math.sin((a*b-c)*2*Math.PI/d))+g},easeOutElastic:function(c,a,g,e,b){var c=1.70158,d=0,f=e;if(0==a)return g;if(1==
  16. (a/=b))return g+e;d||(d=0.3*b);f<Math.abs(e)?(f=e,c=d/4):c=d/(2*Math.PI)*Math.asin(e/f);return f*Math.pow(2,-10*a)*Math.sin((a*b-c)*2*Math.PI/d)+e+g},easeInOutElastic:function(c,a,g,e,b){var c=1.70158,d=0,f=e;if(0==a)return g;if(2==(a/=b/2))return g+e;d||(d=b*0.3*1.5);f<Math.abs(e)?(f=e,c=d/4):c=d/(2*Math.PI)*Math.asin(e/f);return 1>a?-0.5*f*Math.pow(2,10*(a-=1))*Math.sin((a*b-c)*2*Math.PI/d)+g:0.5*f*Math.pow(2,-10*(a-=1))*Math.sin((a*b-c)*2*Math.PI/d)+e+g},easeInBack:function(c,a,g,e,b,d){void 0==
  17. d&&(d=1.70158);return e*(a/=b)*a*((d+1)*a-d)+g},easeOutBack:function(c,a,g,e,b,d){void 0==d&&(d=1.70158);return e*((a=a/b-1)*a*((d+1)*a+d)+1)+g},easeInOutBack:function(c,a,g,e,b,d){void 0==d&&(d=1.70158);return 1>(a/=b/2)?e/2*a*a*(((d*=1.525)+1)*a-d)+g:e/2*((a-=2)*a*(((d*=1.525)+1)*a+d)+2)+g},easeInBounce:function(c,a,g,e,b){return e-jQuery.easing.easeOutBounce(c,b-a,0,e,b)+g},easeOutBounce:function(c,a,g,e,b){return(a/=b)<1/2.75?e*7.5625*a*a+g:a<2/2.75?e*(7.5625*(a-=1.5/2.75)*a+0.75)+g:a<2.5/2.75?
  18. e*(7.5625*(a-=2.25/2.75)*a+0.9375)+g:e*(7.5625*(a-=2.625/2.75)*a+0.984375)+g},easeInOutBounce:function(c,a,g,e,b){return a<b/2?0.5*jQuery.easing.easeInBounce(c,2*a,0,e,b)+g:0.5*jQuery.easing.easeOutBounce(c,2*a-b,0,e,b)+0.5*e+g}});
  19. (function(c,a){function g(){}function e(a){y=[a]}function b(a,d,f){return a&&a.apply(d.context||d,f)}function d(d){function C(f){!u++&&a(function(){v();w&&(A[l]={s:[f]});D&&(f=D.apply(d,[f]));b(d.success,d,[f,h]);b(E,d,[d,h])},0)}function z(f){!u++&&a(function(){v();w&&f!=F&&(A[l]=f);b(d.error,d,[d,f]);b(E,d,[d,f])},0)}var d=c.extend({},G,d),E=d.complete,D=d.dataFilter,H=d.callbackParameter,I=d.callback,M=d.cache,w=d.pageCache,J=d.charset,l=d.url,p=d.data,K=d.timeout,x,u=0,v=g;d.abort=function(){!u++&&
  20. v()};if(!1===b(d.beforeSend,d,[d])||u)return d;l=l||j;p=p?"string"==typeof p?p:c.param(p,d.traditional):j;l+=p?(/\?/.test(l)?"&":"?")+p:j;H&&(l+=(/\?/.test(l)?"&":"?")+escape(H)+"=?");!M&&!w&&(l+=(/\?/.test(l)?"&":"?")+"_"+(new Date).getTime()+"=");l=l.replace(/=\?(&|$)/,"="+I+"$1");w&&(x=A[l])?x.s?C(x.s[0]):z(x):a(function(d,b,h){if(!u){h=0<K&&a(function(){z(F)},K);v=function(){h&&clearTimeout(h);d[q]=d[s]=d[n]=d[B]=null;t[r](d);b&&t[r](b)};window[I]=e;d=c(m)[0];d.id=o+N++;J&&(d[k]=J);var j=function(a){(d[s]||
  21. g)();a=y;y=void 0;a?C(a[0]):z(i)};L.msie?(d.event=s,d.htmlFor=d.id,d[q]=function(){"loaded"==d.readyState&&j()}):(d[B]=d[n]=j,L.opera?(b=c(m)[0]).text="jQuery('#"+d.id+"')[0]."+B+"()":d[f]=f);d.src=l;t.insertBefore(d,t.firstChild);b&&t.insertBefore(b,t.firstChild)}},0);return d}var f="async",k="charset",j="",i="error",o="_jqjsp",s="onclick",B="on"+i,n="onload",q="onreadystatechange",r="removeChild",m="<script/>",h="success",F="timeout",L=c.browser,t=c("head")[0]||document.documentElement,A={},N=0,
  22. y,G={callback:o,url:location.href};d.setup=function(a){c.extend(G,a)};c.jsonp=d})(jQuery,setTimeout);if(!this.JSON)this.JSON={};
  23. (function(){function c(a){return 10>a?"0"+a:a}function a(a){b.lastIndex=0;return b.test(a)?'"'+a.replace(b,function(a){var d=k[a];return"string"===typeof d?d:"\\u"+("0000"+a.charCodeAt(0).toString(16)).slice(-4)})+'"':'"'+a+'"'}function g(c,b){var e,k,n,q,r=d,m,h=b[c];h&&"object"===typeof h&&"function"===typeof h.toJSON&&(h=h.toJSON(c));"function"===typeof j&&(h=j.call(b,c,h));switch(typeof h){case "string":return a(h);case "number":return isFinite(h)?""+h:"null";case "boolean":case "null":return""+
  24. h;case "object":if(!h)return"null";d+=f;m=[];if("[object Array]"===Object.prototype.toString.apply(h)){q=h.length;for(e=0;e<q;e+=1)m[e]=g(e,h)||"null";n=0===m.length?"[]":d?"[\n"+d+m.join(",\n"+d)+"\n"+r+"]":"["+m.join(",")+"]";d=r;return n}if(j&&"object"===typeof j){q=j.length;for(e=0;e<q;e+=1)k=j[e],"string"===typeof k&&(n=g(k,h))&&m.push(a(k)+(d?": ":":")+n)}else for(k in h)Object.hasOwnProperty.call(h,k)&&(n=g(k,h))&&m.push(a(k)+(d?": ":":")+n);n=0===m.length?"{}":d?"{\n"+d+m.join(",\n"+d)+"\n"+
  25. r+"}":"{"+m.join(",")+"}";d=r;return n}}if("function"!==typeof Date.prototype.toJSON)Date.prototype.toJSON=function(){return isFinite(this.valueOf())?this.getUTCFullYear()+"-"+c(this.getUTCMonth()+1)+"-"+c(this.getUTCDate())+"T"+c(this.getUTCHours())+":"+c(this.getUTCMinutes())+":"+c(this.getUTCSeconds())+"Z":null},String.prototype.toJSON=Number.prototype.toJSON=Boolean.prototype.toJSON=function(){return this.valueOf()};var e=/[\u0000\u00ad\u0600-\u0604\u070f\u17b4\u17b5\u200c-\u200f\u2028-\u202f\u2060-\u206f\ufeff\ufff0-\uffff]/g,
  26. b=/[\\\"\x00-\x1f\x7f-\x9f\u00ad\u0600-\u0604\u070f\u17b4\u17b5\u200c-\u200f\u2028-\u202f\u2060-\u206f\ufeff\ufff0-\uffff]/g,d,f,k={"\u0008":"\\b","\t":"\\t","\n":"\\n","\u000c":"\\f","\r":"\\r",'"':'\\"',"\\":"\\\\"},j;if("function"!==typeof JSON.stringify)JSON.stringify=function(a,c,e){var b;f=d="";if("number"===typeof e)for(b=0;b<e;b+=1)f+=" ";else"string"===typeof e&&(f=e);if((j=c)&&"function"!==typeof c&&("object"!==typeof c||"number"!==typeof c.length))throw Error("JSON.stringify");return g("",
  27. {"":a})};if("function"!==typeof JSON.parse)JSON.parse=function(a,d){function f(a,c){var e,b,g=a[c];if(g&&"object"===typeof g)for(e in g)Object.hasOwnProperty.call(g,e)&&(b=f(g,e),void 0!==b?g[e]=b:delete g[e]);return d.call(a,c,g)}var c,a=""+a;e.lastIndex=0;e.test(a)&&(a=a.replace(e,function(a){return"\\u"+("0000"+a.charCodeAt(0).toString(16)).slice(-4)}));if(/^[\],:{}\s]*$/.test(a.replace(/\\(?:["\\\/bfnrt]|u[0-9a-fA-F]{4})/g,"@").replace(/"[^"\\\n\r]*"|true|false|null|-?\d+(?:\.\d*)?(?:[eE][+\-]?\d+)?/g,
  28. "]").replace(/(?:^|:|,)(?:\s*\[)+/g,"")))return c=eval("("+a+")"),"function"===typeof d?f({"":c},""):c;throw new SyntaxError("JSON.parse");}})();
  29. (function(c){function a(){if(c.browser.msie){var a=c(document).height(),d=c(window).height();return[window.innerWidth||document.documentElement.clientWidth||document.body.clientWidth,20>a-d?d:a]}return[c(document).width(),c(document).height()]}function g(a){if(a)return a.call(c.mask)}c.tools=c.tools||{version:"1.2.3"};var e;e=c.tools.expose={conf:{maskId:"exposeMask",loadSpeed:"slow",closeSpeed:"fast",closeOnClick:!0,closeOnEsc:!0,zIndex:9998,opacity:0.8,startOpacity:0,color:"#fff",onLoad:null,onClose:null}};
  30. var b,d,f,k,j;c.mask={load:function(i,o){if(f)return this;"string"==typeof i&&(i={color:i});i=i||k;k=i=c.extend(c.extend({},e.conf),i);b=c("#"+i.maskId);b.length||(b=c("<div/>").attr("id",i.maskId),c("body").append(b));var s=a();b.css({position:"absolute",top:0,left:0,width:s[0],height:s[1],display:"none",opacity:i.startOpacity,zIndex:i.zIndex});i.color&&b.css("backgroundColor",i.color);if(!1===g(i.onBeforeLoad))return this;i.closeOnEsc&&c(document).bind("keydown.mask",function(a){27==a.keyCode&&
  31. c.mask.close(a)});i.closeOnClick&&b.bind("click.mask",function(a){c.mask.close(a)});c(window).bind("resize.mask",function(){c.mask.fit()});o&&o.length&&(j=o.eq(0).css("zIndex"),c.each(o,function(){var a=c(this);/relative|absolute|fixed/i.test(a.css("position"))||a.css("position","relative")}),d=o.css({zIndex:Math.max(i.zIndex+1,"auto"==j?0:j)}));b.css({display:"block"}).fadeTo(i.loadSpeed,i.opacity,function(){c.mask.fit();g(i.onLoad)});f=!0;return this},close:function(){if(f){if(!1===g(k.onBeforeClose))return this;
  32. b.fadeOut(k.closeSpeed,function(){g(k.onClose);d&&d.css({zIndex:j})});c(document).unbind("keydown.mask");b.unbind("click.mask");c(window).unbind("resize.mask");f=!1}return this},fit:function(){if(f){var d=a();b.css({width:d[0],height:d[1]})}},getMask:function(){return b},isLoaded:function(){return f},getConf:function(){return k},getExposed:function(){return d}};c.fn.mask=function(a){c.mask.load(a);return this};c.fn.expose=function(a){c.mask.load(a,this);return this}})(jQuery);
  33. (function(c){function a(){this.timer=this.documentTitle=this.instance=this.assemblyId=null;this._options={};this.uploads=[];this.results={};this.pollStarted=this.ended=null;this.seq=this.pollRetries=0;this.started=!1;this.params=this.assembly=null;this.lastPoll=this.bytesReceivedBefore=0;this.$modal=this.$iframe=this.$fileClones=this.$files=this.$form=this.$params=null}var g="https:"==document.location.protocol?"https://":"http://",e={service:g+"api2.transloadit.com/",assets:g+"assets.transloadit.com/",
  34. onStart:function(){},onProgress:function(){},onUpload:function(){},onResult:function(){},onCancel:function(){},onError:function(){},onSuccess:function(){},interval:2500,pollTimeout:8E3,poll404Retries:15,pollConnectionRetries:3,wait:!1,processZeroFiles:!0,autoSubmit:!0,modal:!0,exclude:"",fields:!1,debug:!0},b=!1;c.fn.transloadit=function(){var d=Array.prototype.slice.call(arguments),f,c;(1==d.length&&"object"==typeof d[0]||void 0===d[0])&&d.unshift("init");f=d.shift();"init"==f?(c=new a,d.unshift(this),
  35. this.data("transloadit.uploader",c)):c=this.data("transloadit.uploader");if(!c)throw Error("Element is not initialized for transloadit!");d=c[f].apply(c,d);return void 0===d?this:d};a.prototype.init=function(a,f){this.$form=a;this.options(c.extend({},e,f||{}));var b=this;a.bind("submit.transloadit",function(){b.validate();b.detectFileInputs();!b._options.processZeroFiles&&0===b.$files.length?b.submitForm():b.getBoredInstance();return!1});this.includeCss()};a.prototype.getBoredInstance=function(){var a=
  36. this;this.instance=null;c.jsonp({url:this._options.service+"instances/bored",timeout:a._options.pollTimeout,callbackParameter:"callback",success:function(f){f.error?(a.ended=!0,a.renderError(f),a._options.onError(f)):(a.instance=f.api2_host,a.start())},error:function(f,c){a.ended=!0;var e={error:"CONNECTION_ERROR",message:"There was a problem connecting to the upload server",reason:"JSONP request status: "+c};a.renderError(e);a._options.onError(e)}});this._options.modal&&this.showModal()};a.prototype.start=
  37. function(){var a=this;this.ended=this.started=!1;this.seq=this.pollRetries=this.bytesReceivedBefore=0;this.uploads=[];this.results={};this.assemblyId=this.uuid();this.$fileClones=c().not(document);this.$files.each(function(){var f=c(this).clone(!0);a.$fileClones=a.$fileClones.add(f);f.insertAfter(this)});this.$iframe=c('<iframe id="transloadit-'+this.assemblyId+'" name="transloadit-'+this.assemblyId+'"/>').appendTo("body").hide();this.$uploadForm=c('<form enctype="multipart/form-data" />').attr("action",
  38. g+this.instance+"/assemblies/"+this.assemblyId+"?redirect=false").attr("target","transloadit-"+this.assemblyId).attr("method","POST").append(this.$files).appendTo("body").hide();var f="[name=params], [name=signature]";!0===this._options.fields?f="*":"string"==typeof this._options.fields&&(f+=", "+this._options.fields);this.clone(this.$form.find(":input[type!=file]").filter(f)).prependTo(this.$uploadForm);this.$uploadForm.submit();this.lastPoll=+new Date;setTimeout(function(){a._poll()},300)};a.prototype.clone=
  39. function(a){for(var f=a.clone(),a=a.filter("textarea"),e=f.filter("textarea"),b=0,g=a.length;b<g;++b)c(e[b]).val(c(a[b]).val());return f};a.prototype.detectFileInputs=function(){var a=this.$form.find("input[type=file]").not(this._options.exclude);this._options.processZeroFiles||(a=a.filter(function(){return""!=this.value}));this.$files=a};a.prototype.validate=function(){var a=this.$form.find("input[name=params]");if(a.length){try{this.params=JSON.parse(a.val())}catch(f){alert("Error: input[name=params] seems to contain invalid JSON.");
  40. return}if(this.params.redirect_url)this.$form.attr("action",this.params.redirect_url);else if(this._options.autoSubmit&&this.$form.attr("action")==this._options.service+"assemblies"){alert("Error: input[name=params] does not include a redirect_url");return}this.$params=a}else alert("Could not find input[name=params] in your form.")};a.prototype._poll=function(a){var f=this;if(!this.ended){if(c.browser.mozilla&&!this.documentTitle)this.documentTitle=document.title,document.title="Loading...";this.pollStarted=
  41. +new Date;c.jsonp({url:g+this.instance+"/assemblies/"+this.assemblyId+(a||"?seq="+this.seq),timeout:f._options.pollTimeout,callbackParameter:"callback",success:function(a){if(!f.ended)if(f.assembly=a,"ASSEMBLY_NOT_FOUND"==a.error)f.pollRetries++,f.pollRetries>f._options.poll404Retries?(document.title=f.documentTitle,f.ended=!0,f.renderError(a),f._options.onError(a)):setTimeout(function(){f._poll()},400);else if(a.error)f.ended=!0,f.renderError(a),document.title=f.documentTitle,f._options.onError(a);
  42. else{f.seq=a.last_seq;if(!f.started)f.started=!0,f._options.onStart(a);f.pollRetries=0;var d="ASSEMBLY_EXECUTING"==a.ok,c="ASSEMBLY_CANCELED"==a.ok,e="ASSEMBLY_COMPLETED"==a.ok;f._options.onProgress(a.bytes_received,a.bytes_expected,a);for(var b=0;b<a.uploads.length;b++)f._options.onUpload(a.uploads[b],a),f.uploads.push(a.uploads[b]);for(var g in a.results){f.results[g]=f.results[g]||[];for(b=0;b<a.results[g].length;b++)f._options.onResult(g,a.results[g][b],a),f.results[g].push(a.results[g][b])}c?
  43. (f.ended=!0,document.title=f.documentTitle,f._options.onCancel(a)):(f.renderProgress(a),e||!f._options.wait&&d?(f.ended=!0,document.title=f.documentTitle,a.uploads=f.uploads,a.results=f.results,f._options.onSuccess(a),f._options.modal&&f.cancel(),f._options.autoSubmit&&f.submitForm()):(a=f.pollStarted-+new Date,f.timer=setTimeout(function(){f._poll()},a<f._options.interval?f._options.interval:a),f.lastPoll=+new Date))}},error:function(a,d){if(!f.ended)if(f.pollRetries++,f.pollRetries>f._options.pollConnectionRetries){document.title=
  44. f.documentTitle;f.ended=!0;var b={error:"CONNECTION_ERROR",message:"There was a problem connecting to the upload server",reason:"JSONP request status: "+d};f.renderError(b);f._options.onError(b)}else setTimeout(function(){f._poll()},350)}})}};a.prototype.stop=function(){document.title=this.documentTitle;this.ended=!0};a.prototype.cancel=function(){if(!this.ended){var a=this;this.$params.prependTo(this.$form);this.$fileClones.each(function(b){var b=c(a.$files[b]),e=c(this);b.insertAfter(e);e.remove()});
  45. clearTimeout(a.timer);this._poll("?method=delete");"Microsoft Internet Explorer"==navigator.appName&&this.$iframe[0].contentWindow.document.execCommand("Stop");setTimeout(function(){a.$iframe.remove()},500)}this._options.modal&&(c.mask.close(),this.$modal.remove())};a.prototype.submitForm=function(){this.$fileClones&&this.$fileClones.remove();null!==this.assembly&&c("<textarea/>").attr("name","transloadit").text(JSON.stringify(this.assembly)).prependTo(this.$form).hide();this.$form.unbind("submit.transloadit").submit()};
  46. a.prototype.showModal=function(){this.$modal=c('<div id="transloadit"><div class="content"><a href="#close" class="close"></a><p class="status"></p><div class="progress"><label>starting upload ...</label><span></span></div><p class="error"></p></div></div>').appendTo("body");c.extend(this.$modal,{$status:this.$modal.find(".status"),$content:this.$modal.find(".content"),$close:this.$modal.find(".close"),$label:this.$modal.find("label"),$progress:this.$modal.find(".progress"),$progressSpan:this.$modal.find(".progress span"),
  47. $error:this.$modal.find(".error")});var a=this;this.$modal.$close.click(function(){a.cancel()});this.$modal.$error.hide();a=this;this.$modal.expose({api:!0,maskId:"transloadit_expose",opacity:0.9,loadSpeed:250,closeOnEsc:!1,closeOnClick:!1});this.$modal.$close.click(function(){a.cancel();return!1})};a.prototype.renderError=function(a){this._options.modal&&(this.$modal.$content.addClass("content-error"),this.$modal.$progress.hide(),this.$modal.$error.html(this._options.debug?a.error+": "+a.message+
  48. "<br><br>"+(a.reason||""):"There was an internal error, please try your upload again.").show())};a.prototype.renderProgress=function(a){if(this._options.modal){var b=a.bytes_received/a.bytes_expected,c=a.bytes_received-this.bytesReceivedBefore,e=+new Date-this.lastPoll,g=1==b?1E3:2*this._options.interval,c=1==b?"processing ...":(a.bytes_received/1024/1024).toFixed(2)+" MB / "+(a.bytes_expected/1024/1024).toFixed(2)+" MB ("+(c/1024/(e/1E3)).toFixed(1)+" kB / sec)";this.bytesReceivedBefore=a.bytes_received;
  49. this.$modal.$label.text(c);this.$modal.$progressSpan.stop().animate({width:100*b+"%"},g,"easeOutCubic")}};a.prototype.includeCss=function(){!b&&this._options.modal&&(b=!0,c('<link rel="stylesheet" type="text/css" href="'+this._options.assets+'css/transloadit2.css" />').appendTo("head"))};a.prototype.uuid=function(){var a="",b;for(b=0;32>b;b++)a+=Math.floor(16*Math.random()).toString(16);return a};a.prototype.options=function(a){if(0==arguments.length)return this._options;c.extend(this._options,a)};
  50. a.prototype.option=function(a,b){if(1==arguments.length)return this._options[a];this._options[a]=b}})(jQuery);