summaryrefslogtreecommitdiff
path: root/pomf.min.js
diff options
context:
space:
mode:
authornokonoko <neku@pomf.se>2013-10-29 16:43:17 +0100
committernokonoko <neku@pomf.se>2013-10-29 16:43:17 +0100
commitdf6cf936d7ef3a819c6ff484b24a8cb5946726a9 (patch)
treeb08744a7e5ee561b7c0f15d98d535d2dad2310c6 /pomf.min.js
parent9c8308bdfc8bd61880978b0455dfe78ea88fffeb (diff)
Shitty code
Diffstat (limited to 'pomf.min.js')
-rw-r--r--pomf.min.js1
1 files changed, 1 insertions, 0 deletions
diff --git a/pomf.min.js b/pomf.min.js
new file mode 100644
index 0000000..f60cbec
--- /dev/null
+++ b/pomf.min.js
@@ -0,0 +1 @@
+var Zepto=function(){function t(t){return null==t?String(t):G[J.call(t)]||"object"}function e(e){return"function"==t(e)}function n(t){return null!=t&&t==t.window}function i(t){return null!=t&&t.nodeType==t.DOCUMENT_NODE}function r(e){return"object"==t(e)}function o(t){return r(t)&&!n(t)&&t.__proto__==Object.prototype}function s(t){return t instanceof Array}function a(t){return"number"==typeof t.length}function u(t){return S.call(t,function(t){return null!=t})}function c(t){return t.length>0?N.fn.concat.apply([],t):t}function l(t){return t.replace(/::/g,"/").replace(/([A-Z]+)([A-Z][a-z])/g,"$1_$2").replace(/([a-z\d])([A-Z])/g,"$1_$2").replace(/_/g,"-").toLowerCase()}function f(t){return t in A?A[t]:A[t]=new RegExp("(^|\\s)"+t+"(\\s|$)")}function h(t,e){return"number"!=typeof e||j[l(t)]?e:e+"px"}function p(t){var e,n;return F[t]||(e=T.createElement(t),T.body.appendChild(e),n=_(e,"").getPropertyValue("display"),e.parentNode.removeChild(e),"none"==n&&(n="block"),F[t]=n),F[t]}function d(t){return"children"in t?L.call(t.children):N.map(t.childNodes,function(t){return 1==t.nodeType?t:void 0})}function v(t,e,n){for($ in e)n&&(o(e[$])||s(e[$]))?(o(e[$])&&!o(t[$])&&(t[$]={}),s(e[$])&&!s(t[$])&&(t[$]=[]),v(t[$],e[$],n)):e[$]!==x&&(t[$]=e[$])}function g(t,e){return null==e?N(t):N(t).filter(e)}function m(t,n,i,r){return e(n)?n.call(t,i,r):n}function y(t,e,n){null==n?t.removeAttribute(e):t.setAttribute(e,n)}function b(t,e){var n=t.className,i=n&&n.baseVal!==x;return e===x?i?n.baseVal:n:(i?n.baseVal=e:t.className=e,void 0)}function E(t){var e;try{return t?"true"==t||("false"==t?!1:"null"==t?null:isNaN(e=Number(t))?/^[\[\{]/.test(t)?N.parseJSON(t):t:e):t}catch(n){return t}}function w(t,e){e(t);for(var n in t.childNodes)w(t.childNodes[n],e)}var x,$,N,O,P,C,z=[],L=z.slice,S=z.filter,T=window.document,F={},A={},_=T.defaultView.getComputedStyle,j={"column-count":1,columns:1,"font-weight":1,"line-height":1,opacity:1,"z-index":1,zoom:1},M=/^\s*<(\w+|!)[^>]*>/,k=/<(?!area|br|col|embed|hr|img|input|link|meta|param)(([\w:]+)[^>]*)\/>/gi,B=/^(?:body|html)$/i,Z=["val","css","html","text","data","width","height","offset"],R=["after","prepend","before","append"],D=T.createElement("table"),U=T.createElement("tr"),q={tr:T.createElement("tbody"),tbody:D,thead:D,tfoot:D,td:U,th:U,"*":T.createElement("div")},I=/complete|loaded|interactive/,V=/^\.([\w-]+)$/,H=/^#([\w-]*)$/,Y=/^[\w-]+$/,G={},J=G.toString,K={},W=T.createElement("div");return K.matches=function(t,e){if(!t||1!==t.nodeType)return!1;var n=t.webkitMatchesSelector||t.mozMatchesSelector||t.oMatchesSelector||t.matchesSelector;if(n)return n.call(t,e);var i,r=t.parentNode,o=!r;return o&&(r=W).appendChild(t),i=~K.qsa(r,e).indexOf(t),o&&W.removeChild(t),i},P=function(t){return t.replace(/-+(.)?/g,function(t,e){return e?e.toUpperCase():""})},C=function(t){return S.call(t,function(e,n){return t.indexOf(e)==n})},K.fragment=function(t,e,n){t.replace&&(t=t.replace(k,"<$1></$2>")),e===x&&(e=M.test(t)&&RegExp.$1),e in q||(e="*");var i,r,s=q[e];return s.innerHTML=""+t,r=N.each(L.call(s.childNodes),function(){s.removeChild(this)}),o(n)&&(i=N(r),N.each(n,function(t,e){Z.indexOf(t)>-1?i[t](e):i.attr(t,e)})),r},K.Z=function(t,e){return t=t||[],t.__proto__=N.fn,t.selector=e||"",t},K.isZ=function(t){return t instanceof K.Z},K.init=function(t,n){if(t){if(e(t))return N(T).ready(t);if(K.isZ(t))return t;var i;if(s(t))i=u(t);else if(r(t))i=[o(t)?N.extend({},t):t],t=null;else if(M.test(t))i=K.fragment(t.trim(),RegExp.$1,n),t=null;else{if(n!==x)return N(n).find(t);i=K.qsa(T,t)}return K.Z(i,t)}return K.Z()},N=function(t,e){return K.init(t,e)},N.extend=function(t){var e,n=L.call(arguments,1);return"boolean"==typeof t&&(e=t,t=n.shift()),n.forEach(function(n){v(t,n,e)}),t},K.qsa=function(t,e){var n;return i(t)&&H.test(e)?(n=t.getElementById(RegExp.$1))?[n]:[]:1!==t.nodeType&&9!==t.nodeType?[]:L.call(V.test(e)?t.getElementsByClassName(RegExp.$1):Y.test(e)?t.getElementsByTagName(e):t.querySelectorAll(e))},N.contains=function(t,e){return t!==e&&t.contains(e)},N.type=t,N.isFunction=e,N.isWindow=n,N.isArray=s,N.isPlainObject=o,N.isEmptyObject=function(t){var e;for(e in t)return!1;return!0},N.inArray=function(t,e,n){return z.indexOf.call(e,t,n)},N.camelCase=P,N.trim=function(t){return null==t?"":String.prototype.trim.call(t)},N.uuid=0,N.support={},N.expr={},N.map=function(t,e){var n,i,r,o=[];if(a(t))for(i=0;i<t.length;i++)n=e(t[i],i),null!=n&&o.push(n);else for(r in t)n=e(t[r],r),null!=n&&o.push(n);return c(o)},N.each=function(t,e){var n,i;if(a(t)){for(n=0;n<t.length;n++)if(e.call(t[n],n,t[n])===!1)return t}else for(i in t)if(e.call(t[i],i,t[i])===!1)return t;return t},N.grep=function(t,e){return S.call(t,e)},window.JSON&&(N.parseJSON=JSON.parse),N.each("Boolean Number String Function Array Date RegExp Object Error".split(" "),function(t,e){G["[object "+e+"]"]=e.toLowerCase()}),N.fn={forEach:z.forEach,reduce:z.reduce,push:z.push,sort:z.sort,indexOf:z.indexOf,concat:z.concat,map:function(t){return N(N.map(this,function(e,n){return t.call(e,n,e)}))},slice:function(){return N(L.apply(this,arguments))},ready:function(t){return I.test(T.readyState)?t(N):T.addEventListener("DOMContentLoaded",function(){t(N)},!1),this},get:function(t){return t===x?L.call(this):this[t>=0?t:t+this.length]},toArray:function(){return this.get()},size:function(){return this.length},remove:function(){return this.each(function(){null!=this.parentNode&&this.parentNode.removeChild(this)})},each:function(t){return z.every.call(this,function(e,n){return t.call(e,n,e)!==!1}),this},filter:function(t){return e(t)?this.not(this.not(t)):N(S.call(this,function(e){return K.matches(e,t)}))},add:function(t,e){return N(C(this.concat(N(t,e))))},is:function(t){return this.length>0&&K.matches(this[0],t)},not:function(t){var n=[];if(e(t)&&t.call!==x)this.each(function(e){t.call(this,e)||n.push(this)});else{var i="string"==typeof t?this.filter(t):a(t)&&e(t.item)?L.call(t):N(t);this.forEach(function(t){i.indexOf(t)<0&&n.push(t)})}return N(n)},has:function(t){return this.filter(function(){return r(t)?N.contains(this,t):N(this).find(t).size()})},eq:function(t){return-1===t?this.slice(t):this.slice(t,+t+1)},first:function(){var t=this[0];return t&&!r(t)?t:N(t)},last:function(){var t=this[this.length-1];return t&&!r(t)?t:N(t)},find:function(t){var e,n=this;return e="object"==typeof t?N(t).filter(function(){var t=this;return z.some.call(n,function(e){return N.contains(e,t)})}):1==this.length?N(K.qsa(this[0],t)):this.map(function(){return K.qsa(this,t)})},closest:function(t,e){var n=this[0],r=!1;for("object"==typeof t&&(r=N(t));n&&!(r?r.indexOf(n)>=0:K.matches(n,t));)n=n!==e&&!i(n)&&n.parentNode;return N(n)},parents:function(t){for(var e=[],n=this;n.length>0;)n=N.map(n,function(t){return(t=t.parentNode)&&!i(t)&&e.indexOf(t)<0?(e.push(t),t):void 0});return g(e,t)},parent:function(t){return g(C(this.pluck("parentNode")),t)},children:function(t){return g(this.map(function(){return d(this)}),t)},contents:function(){return this.map(function(){return L.call(this.childNodes)})},siblings:function(t){return g(this.map(function(t,e){return S.call(d(e.parentNode),function(t){return t!==e})}),t)},empty:function(){return this.each(function(){this.innerHTML=""})},pluck:function(t){return N.map(this,function(e){return e[t]})},show:function(){return this.each(function(){"none"==this.style.display&&(this.style.display=null),"none"==_(this,"").getPropertyValue("display")&&(this.style.display=p(this.nodeName))})},replaceWith:function(t){return this.before(t).remove()},wrap:function(t){var n=e(t);if(this[0]&&!n)var i=N(t).get(0),r=i.parentNode||this.length>1;return this.each(function(e){N(this).wrapAll(n?t.call(this,e):r?i.cloneNode(!0):i)})},wrapAll:function(t){if(this[0]){N(this[0]).before(t=N(t));for(var e;(e=t.children()).length;)t=e.first();N(t).append(this)}return this},wrapInner:function(t){var n=e(t);return this.each(function(e){var i=N(this),r=i.contents(),o=n?t.call(this,e):t;r.length?r.wrapAll(o):i.append(o)})},unwrap:function(){return this.parent().each(function(){N(this).replaceWith(N(this).children())}),this},clone:function(){return this.map(function(){return this.cloneNode(!0)})},hide:function(){return this.css("display","none")},toggle:function(t){return this.each(function(){var e=N(this);(t===x?"none"==e.css("display"):t)?e.show():e.hide()})},prev:function(t){return N(this.pluck("previousElementSibling")).filter(t||"*")},next:function(t){return N(this.pluck("nextElementSibling")).filter(t||"*")},html:function(t){return t===x?this.length>0?this[0].innerHTML:null:this.each(function(e){var n=this.innerHTML;N(this).empty().append(m(this,t,e,n))})},text:function(t){return t===x?this.length>0?this[0].textContent:null:this.each(function(){this.textContent=t})},attr:function(t,e){var n;return"string"==typeof t&&e===x?0==this.length||1!==this[0].nodeType?x:"value"==t&&"INPUT"==this[0].nodeName?this.val():!(n=this[0].getAttribute(t))&&t in this[0]?this[0][t]:n:this.each(function(n){if(1===this.nodeType)if(r(t))for($ in t)y(this,$,t[$]);else y(this,t,m(this,e,n,this.getAttribute(t)))})},removeAttr:function(t){return this.each(function(){1===this.nodeType&&y(this,t)})},prop:function(t,e){return e===x?this[0]&&this[0][t]:this.each(function(n){this[t]=m(this,e,n,this[t])})},data:function(t,e){var n=this.attr("data-"+l(t),e);return null!==n?E(n):x},val:function(t){return t===x?this[0]&&(this[0].multiple?N(this[0]).find("option").filter(function(){return this.selected}).pluck("value"):this[0].value):this.each(function(e){this.value=m(this,t,e,this.value)})},offset:function(t){if(t)return this.each(function(e){var n=N(this),i=m(this,t,e,n.offset()),r=n.offsetParent().offset(),o={top:i.top-r.top,left:i.left-r.left};"static"==n.css("position")&&(o.position="relative"),n.css(o)});if(0==this.length)return null;var e=this[0].getBoundingClientRect();return{left:e.left+window.pageXOffset,top:e.top+window.pageYOffset,width:Math.round(e.width),height:Math.round(e.height)}},css:function(e,n){if(arguments.length<2&&"string"==typeof e)return this[0]&&(this[0].style[P(e)]||_(this[0],"").getPropertyValue(e));var i="";if("string"==t(e))n||0===n?i=l(e)+":"+h(e,n):this.each(function(){this.style.removeProperty(l(e))});else for($ in e)e[$]||0===e[$]?i+=l($)+":"+h($,e[$])+";":this.each(function(){this.style.removeProperty(l($))});return this.each(function(){this.style.cssText+=";"+i})},index:function(t){return t?this.indexOf(N(t)[0]):this.parent().children().indexOf(this[0])},hasClass:function(t){return z.some.call(this,function(t){return this.test(b(t))},f(t))},addClass:function(t){return this.each(function(e){O=[];var n=b(this),i=m(this,t,e,n);i.split(/\s+/g).forEach(function(t){N(this).hasClass(t)||O.push(t)},this),O.length&&b(this,n+(n?" ":"")+O.join(" "))})},removeClass:function(t){return this.each(function(e){return t===x?b(this,""):(O=b(this),m(this,t,e,O).split(/\s+/g).forEach(function(t){O=O.replace(f(t)," ")}),b(this,O.trim()),void 0)})},toggleClass:function(t,e){return this.each(function(n){var i=N(this),r=m(this,t,n,b(this));r.split(/\s+/g).forEach(function(t){(e===x?!i.hasClass(t):e)?i.addClass(t):i.removeClass(t)})})},scrollTop:function(){return this.length?"scrollTop"in this[0]?this[0].scrollTop:this[0].scrollY:void 0},position:function(){if(this.length){var t=this[0],e=this.offsetParent(),n=this.offset(),i=B.test(e[0].nodeName)?{top:0,left:0}:e.offset();return n.top-=parseFloat(N(t).css("margin-top"))||0,n.left-=parseFloat(N(t).css("margin-left"))||0,i.top+=parseFloat(N(e[0]).css("border-top-width"))||0,i.left+=parseFloat(N(e[0]).css("border-left-width"))||0,{top:n.top-i.top,left:n.left-i.left}}},offsetParent:function(){return this.map(function(){for(var t=this.offsetParent||T.body;t&&!B.test(t.nodeName)&&"static"==N(t).css("position");)t=t.offsetParent;return t})}},N.fn.detach=N.fn.remove,["width","height"].forEach(function(t){N.fn[t]=function(e){var r,o=this[0],s=t.replace(/./,function(t){return t[0].toUpperCase()});return e===x?n(o)?o["inner"+s]:i(o)?o.documentElement["offset"+s]:(r=this.offset())&&r[t]:this.each(function(n){o=N(this),o.css(t,m(this,e,n,o[t]()))})}}),R.forEach(function(e,n){var i=n%2;N.fn[e]=function(){var e,r,o=N.map(arguments,function(n){return e=t(n),"object"==e||"array"==e||null==n?n:K.fragment(n)}),s=this.length>1;return o.length<1?this:this.each(function(t,e){r=i?e:e.parentNode,e=0==n?e.nextSibling:1==n?e.firstChild:2==n?e:null,o.forEach(function(t){if(s)t=t.cloneNode(!0);else if(!r)return N(t).remove();w(r.insertBefore(t,e),function(t){null==t.nodeName||"SCRIPT"!==t.nodeName.toUpperCase()||t.type&&"text/javascript"!==t.type||t.src||window.eval.call(window,t.innerHTML)})})})},N.fn[i?e+"To":"insert"+(n?"Before":"After")]=function(t){return N(t)[e](this),this}}),K.Z.prototype=N.fn,K.uniq=C,K.deserializeValue=E,N.zepto=K,N}();window.Zepto=Zepto,"$"in window||(window.$=Zepto),function(t){function e(t){return t._zid||(t._zid=p++)}function n(t,n,o,s){if(n=i(n),n.ns)var a=r(n.ns);return(h[e(t)]||[]).filter(function(t){return!(!t||n.e&&t.e!=n.e||n.ns&&!a.test(t.ns)||o&&e(t.fn)!==e(o)||s&&t.sel!=s)})}function i(t){var e=(""+t).split(".");return{e:e[0],ns:e.slice(1).sort().join(" ")}}function r(t){return new RegExp("(?:^| )"+t.replace(" "," .* ?")+"(?: |$)")}function o(e,n,i){"string"!=t.type(e)?t.each(e,i):e.split(/\s/).forEach(function(t){i(t,n)})}function s(t,e){return t.del&&("focus"==t.e||"blur"==t.e)||!!e}function a(t){return v[t]||t}function u(n,r,u,c,l,f){var p=e(n),d=h[p]||(h[p]=[]);o(r,u,function(e,r){var o=i(e);o.fn=r,o.sel=c,o.e in v&&(r=function(e){var n=e.relatedTarget;return!n||n!==this&&!t.contains(this,n)?o.fn.apply(this,arguments):void 0}),o.del=l&&l(r,e);var u=o.del||r;o.proxy=function(t){var e=u.apply(n,[t].concat(t.data));return e===!1&&(t.preventDefault(),t.stopPropagation()),e},o.i=d.length,d.push(o),n.addEventListener(a(o.e),o.proxy,s(o,f))})}function c(t,i,r,u,c){var l=e(t);o(i||"",r,function(e,i){n(t,e,i,u).forEach(function(e){delete h[l][e.i],t.removeEventListener(a(e.e),e.proxy,s(e,c))})})}function l(e){var n,i={originalEvent:e};for(n in e)y.test(n)||void 0===e[n]||(i[n]=e[n]);return t.each(b,function(t,n){i[t]=function(){return this[n]=g,e[t].apply(e,arguments)},i[n]=m}),i}function f(t){if(!("defaultPrevented"in t)){t.defaultPrevented=!1;var e=t.preventDefault;t.preventDefault=function(){this.defaultPrevented=!0,e.call(this)}}}var h=(t.zepto.qsa,{}),p=1,d={},v={mouseenter:"mouseover",mouseleave:"mouseout"};d.click=d.mousedown=d.mouseup=d.mousemove="MouseEvents",t.event={add:u,remove:c},t.proxy=function(n,i){if(t.isFunction(n)){var r=function(){return n.apply(i,arguments)};return r._zid=e(n),r}if("string"==typeof i)return t.proxy(n[i],n);throw new TypeError("expected function")},t.fn.bind=function(t,e){return this.each(function(){u(this,t,e)})},t.fn.unbind=function(t,e){return this.each(function(){c(this,t,e)})},t.fn.one=function(t,e){return this.each(function(n,i){u(this,t,e,null,function(t,e){return function(){var n=t.apply(i,arguments);return c(i,e,t),n}})})};var g=function(){return!0},m=function(){return!1},y=/^([A-Z]|layer[XY]$)/,b={preventDefault:"isDefaultPrevented",stopImmediatePropagation:"isImmediatePropagationStopped",stopPropagation:"isPropagationStopped"};t.fn.delegate=function(e,n,i){return this.each(function(r,o){u(o,n,i,e,function(n){return function(i){var r,s=t(i.target).closest(e,o).get(0);return s?(r=t.extend(l(i),{currentTarget:s,liveFired:o}),n.apply(s,[r].concat([].slice.call(arguments,1)))):void 0}})})},t.fn.undelegate=function(t,e,n){return this.each(function(){c(this,e,n,t)})},t.fn.live=function(e,n){return t(document.body).delegate(this.selector,e,n),this},t.fn.die=function(e,n){return t(document.body).undelegate(this.selector,e,n),this},t.fn.on=function(e,n,i){return!n||t.isFunction(n)?this.bind(e,n||i):this.delegate(n,e,i)},t.fn.off=function(e,n,i){return!n||t.isFunction(n)?this.unbind(e,n||i):this.undelegate(n,e,i)},t.fn.trigger=function(e,n){return("string"==typeof e||t.isPlainObject(e))&&(e=t.Event(e)),f(e),e.data=n,this.each(function(){"dispatchEvent"in this&&this.dispatchEvent(e)})},t.fn.triggerHandler=function(e,i){var r,o;return this.each(function(s,a){r=l("string"==typeof e?t.Event(e):e),r.data=i,r.target=a,t.each(n(a,e.type||e),function(t,e){return o=e.proxy(r),r.isImmediatePropagationStopped()?!1:void 0})}),o},"focusin focusout load resize scroll unload click dblclick mousedown mouseup mousemove mouseover mouseout mouseenter mouseleave change select keydown keypress keyup error".split(" ").forEach(function(e){t.fn[e]=function(t){return t?this.bind(e,t):this.trigger(e)}}),["focus","blur"].forEach(function(e){t.fn[e]=function(t){return t?this.bind(e,t):this.each(function(){try{this[e]()}catch(t){}}),this}}),t.Event=function(t,e){"string"!=typeof t&&(e=t,t=e.type);var n=document.createEvent(d[t]||"Events"),i=!0;if(e)for(var r in e)"bubbles"==r?i=!!e[r]:n[r]=e[r];return n.initEvent(t,i,!0,null,null,null,null,null,null,null,null,null,null,null,null),n.isDefaultPrevented=function(){return this.defaultPrevented},n}}(Zepto),function(){EventEmitter=function(){},EventEmitter.prototype.on=function(t,e){this._events=this._events||{},this._events[t]=this._events[t]||[],this._events[t].push(e)},EventEmitter.prototype.off=function(t,e){this.hasOwnProperty("_events")&&t in this._events!=!1&&this._events[t].splice(this._events[t].indexOf(e),1)},EventEmitter.prototype.emit=function(t){if(this.hasOwnProperty("_events")&&t in this._events!=!1)for(var e=0,n=this._events[t].length;n>e;e++)this._events[t][e].apply(this,Array.prototype.slice.call(arguments,1))},FileList.prototype.forEach=Array.prototype.forEach,FileList.prototype.every=Array.prototype.every,FileList.prototype.some=Array.prototype.some,FileList.prototype.filter=Array.prototype.filter,FileList.prototype.map=Array.prototype.map,FileList.prototype.reduce=Array.prototype.reduce,FileList.prototype.reduceRight=Array.prototype.reduceRight,Object.defineProperty(FileList.prototype,"size",{get:function(){return this.reduce(function(t,e){return t+e.size},0)}});var t={get:function(){var t=["B","KiB","MiB","GiB","TiB","PiB","EiB","ZiB","YiB"],e=Math.floor(Math.log(this.size)/Math.log(1024));return(this.size/Math.pow(1024,e)).toFixed(2)+" "+t[e]}};Object.defineProperty(FileList.prototype,"humanSize",t),Object.defineProperty(File.prototype,"humanSize",t);var e={get:function(){return this.uploadedSize/this.size}};Object.defineProperty(FileList.prototype,"percentUploaded",e),Object.defineProperty(File.prototype,"percentUploaded",e),Object.defineProperty(FileList.prototype,"uploadedSize",{get:function(){return this.reduce(function(t,e){return t+(e.uploadedSize||0)},0)}}),Object.defineProperty(File.prototype,"url",{get:function(){return window.URL.createObjectURL(this)}}),File.revokeURL=function(t){window.URL.revokeObjectURL(t)};var n=function(t,e){var n={};for(var i in e)n[i]=void 0===t[i]?e[i]:t[i];return n},i=function(t,e,i){this.url=t,this.files=e,i=i||{},this.opts=n(i,{field:"files[]",method:"POST"})};i.prototype=Object.create(EventEmitter.prototype),i.prototype.upload=function(t){t&&this.on("uploadcomplete",t);var e=this.opts,n=this.files,i=this,r=new FormData;n.forEach(function(t){r.append(e.field,t)});var o=new XMLHttpRequest;o.open(e.method,this.url,!0),o.upload.addEventListener("loadstart",function(){for(var t=0,e=n.length;e>t;t++)n[t].uploadedSize=0}),o.upload.addEventListener("progress",function(t){if(t.lengthComputable){size=t.loaded;for(var e=0,r=n.length;r>e;e++)n[e].uploadedSize=Math.min(size,n[e].size),size-=n[e].uploadedSize,0>=size&&(n.current=n[e],size=0)}i.emit("uploadprogress",t,n)},!1),o.upload.addEventListener("loadstart",function(t){i.emit("uploadstart",t)}),o.upload.addEventListener("load",function(t){i.emit("uploadcomplete",t)}),o.addEventListener("progress",function(t){i.emit("progress",t)}),o.addEventListener("load",function(t){i.emit("load",t,o.responseText)}),o.send(r)},FileList.prototype.upload=function(t,e){return new i(t,this,e)}}(),function(t){t.hasFileAPI=function(){return void 0!==window.FormData},t.fn.cabinet=function(e){e=t(e);var n=this,i=function(t,i,r,o){n.on(t,function(t){"click"===i?e[0].click():e.trigger(i),r&&t.preventDefault(),o&&o(t)},!1)};e[0].filelist=Object.create(FileList),e.on("change",function(t){this.filelist=t.target.files,n.change()}),i("dragenter","dragenter",!0),i("dragover","dragover",!0),i("dragleave","dragleave",!0),i("click","click",!1),i("drop","dragleave",!0,function(t){e[0].filelist=t.dataTransfer.files,n.change()})}}($),$(function(){var t=$("#upload-input"),e=$("#upload-btn"),n=$("#upload-filelist"),i="";$.hasFileAPI()||($("#no-file-api").show(),e.hide()),e.cabinet(t),e.on("dragenter",function(t){this===t.target&&($(this).addClass("drop"),i=$(this).html(),$(this).html("Drop it here~"))}),e.on("drop",function(){$(this).trigger("dragleave")}),e.on("dragleave",function(t){node=t.target;do if(node===this){$(this).removeClass("drop"),$(this).html(i);break}while(node=node.parentNode)});var r=function(t){var e=t.attr("data-max-size")||"10MiB",n=parseInt(/([0-9,]+).*/.exec(e)[1].replace(",","")),i=/(?:([KMGTPEZY])(i)?B|([BKMGTPEZY]))/.exec(e)||["B","",""],r=Math.pow("i"===i[2]?1024:1e3,"BKMGTPEZY".indexOf(i[1]));return n*r}(t),o=function(t,e,n){var i=$("<li class=file>"),r=$("<span class=file-name>"),o=$('<div class="file-progress progress-outer">'),s=$("<span class=file-size>"),a=$("<span class=file-url>");return i.addClass(n||""),$("<div class=progress-inner>").appendTo(o),i.attr("data-filename",escape(t)),r.text(t),s.text(e),i.append(r,o,s,a),i};e.on("change",function(){n.empty().removeClass("error completed");var e=t[0].filelist;e.forEach(function(t){o(t.name,t.humanSize).appendTo(n)});var i=o("",e.humanSize,"total");if(i.appendTo(n),e.size>r)return n.addClass("error"),$(".file-name",i).text("onii-chan y-your upload is t-too big&hellip;"),void 0;var s=e.upload("upload.php"),a=function(t,e){var n={};t.forEach(function(i){++n[i.name]||(n[i.name]=0);var r=$($('li[data-filename="'+escape(i.name)+'"]')[n[i.name]||0]);e.call(r,r,i,t)})},u=$(".file-name",i);s.on("uploadprogress",function(t,e){a(e,function(t,e){$(".progress-inner",t).width(100*e.percentUploaded+"%")}),$(".progress-inner",i).width(100*e.percentUploaded+"%")}),s.on("uploadcomplete",function(){$(".progress-inner").width("100%"),u.text("Grabbing URLs...")}),s.on("load",function(t,e){switch(t.target.status){case 200:var e=JSON.parse(e);if(!e.success){n.addClass("error"),$(".file-name",i).text("Something went wrong; try again later.");break}a(e.files,function(t,e){var n=$("<a>");n.attr("href","http://a.pomf.se/"+e.url).attr("target","_BLANK").text("a.pomf.se/"+e.url),$(".file-url",t).append(n)}),n.addClass("completed"),u.text("Done!");break;case 413:n.addClass("error completed"),u.html("onii-chan, y-your upload is t-too big&hellip;");break;default:n.addClass("error completed"),u.text("Something went wrong; try again later.")}}),s.upload()})}); \ No newline at end of file