DotaNoobs main site.
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.
 
 
 
 

3 lines
3.2 KiB

/*! UIkit 2.5.0 | http://www.getuikit.com | (c) 2014 YOOtheme | MIT License */
(function(t){"function"==typeof define&&define.amd&&define(["uikit"],function(){return jQuery.UIkit||t(window.jQuery,window.jQuery.UIkit)}),window&&window.jQuery&&window.jQuery.UIkit&&t(window.jQuery,window.jQuery.UIkit)})(function(t,e){function i(s,o){function a(e,i){var n=new FormData,s=new XMLHttpRequest;if(i.before(i,e)!==!1){for(var o,a=0;o=e[a];a++)n.append(i.param,o);for(var r in i.params)n.append(r,i.params[r]);s.upload.addEventListener("progress",function(t){var e=100*(t.loaded/t.total);i.progress(e,t)},!1),s.addEventListener("loadstart",function(t){i.loadstart(t)},!1),s.addEventListener("load",function(t){i.load(t)},!1),s.addEventListener("loadend",function(t){i.loadend(t)},!1),s.addEventListener("error",function(t){i.error(t)},!1),s.addEventListener("abort",function(t){i.abort(t)},!1),s.open(i.method,i.action,!0),s.onreadystatechange=function(){if(i.readystatechange(s),4==s.readyState){var e=s.responseText;if("json"==i.type)try{e=t.parseJSON(e)}catch(n){e=!1}i.complete(e,s)}},s.send(n)}}if(!e.support.ajaxupload)return this;if(o=t.extend({},i.defaults,o),s.length){if("*.*"!==o.allow)for(var r,l=0;r=s[l];l++)if(!n(o.allow,r.name))return"string"==typeof o.notallowed?alert(o.notallowed):o.notallowed(r,o),void 0;var u=o.complete;if(o.single){var h=s.length,d=0;o.complete=function(t,e){d+=1,u(t,e),h>d?a([s[d]],o):o.allcomplete(t,e)},a([s[0]],o)}else o.complete=function(t,e){u(t,e),o.allcomplete(t,e)},a(s,o)}}function n(t,e){var i="^"+t.replace(/\//g,"\\/").replace(/\*\*/g,"(\\/[^\\/]+)*").replace(/\*/g,"[^\\/]+").replace(/((?!\\))\?/g,"$1.")+"$";return i="^"+i+"$",null!==e.match(RegExp(i))}var s=function(e,n){var o=this,a=t(e),n=t.extend({},i.defaults,s.defaults,n);a.data("uploadSelect")||(this.element=a.on("change",function(){i(o.element[0].files,n)}),a.data("uploadSelect",this))};s.defaults={};var o=function(e,n){var s=t(e),n=t.extend({},i.defaults,o.defaults,n),a=!1;s.data("uploadDrop")||(s.on("drop",function(t){t.dataTransfer&&t.dataTransfer.files&&(t.stopPropagation(),t.preventDefault(),s.removeClass(n.dragoverClass),i(t.dataTransfer.files,n))}).on("dragenter",function(t){t.stopPropagation(),t.preventDefault()}).on("dragover",function(t){t.stopPropagation(),t.preventDefault(),a||(s.addClass(n.dragoverClass),a=!0)}).on("dragleave",function(t){t.stopPropagation(),t.preventDefault(),s.removeClass(n.dragoverClass),a=!1}),s.data("uploadDrop",this))};return o.defaults={dragoverClass:"uk-dragover"},e.upload={select:s,drop:o},e.support.ajaxupload=function(){function t(){var t=document.createElement("INPUT");return t.type="file","files"in t}function e(){var t=new XMLHttpRequest;return!!(t&&"upload"in t&&"onprogress"in t.upload)}function i(){return!!window.FormData}return t()&&e()&&i()}(),e.support.ajaxupload&&t.event.props.push("dataTransfer"),i.defaults={action:"",single:!0,method:"POST",param:"files[]",params:{},allow:"*.*",type:"text",before:function(){},loadstart:function(){},load:function(){},loadend:function(){},error:function(){},abort:function(){},progress:function(){},complete:function(){},allcomplete:function(){},readystatechange:function(){},notallowed:function(t,e){alert("Only the following file types are allowed: "+e.allow)}},e.Utils.xhrupload=i,i});