From 2653f6a943a6ed74e2b72246ba8211c5fb699a7f Mon Sep 17 00:00:00 2001 From: erdgeist Date: Sun, 7 Aug 2016 02:17:47 +0200 Subject: restructured ;) --- js/components/upload.js | 257 ------------------------------------------------ 1 file changed, 257 deletions(-) delete mode 100755 js/components/upload.js (limited to 'js/components/upload.js') diff --git a/js/components/upload.js b/js/components/upload.js deleted file mode 100755 index f80f26e..0000000 --- a/js/components/upload.js +++ /dev/null @@ -1,257 +0,0 @@ -/*! UIkit 2.26.4 | http://www.getuikit.com | (c) 2014 YOOtheme | MIT License */ -(function(addon) { - - var component; - - if (window.UIkit) { - component = addon(UIkit); - } - - if (typeof define == "function" && define.amd) { - define("uikit-upload", ["uikit"], function(){ - return component || addon(UIkit); - }); - } - -})(function(UI){ - - "use strict"; - - UI.component('uploadSelect', { - - init: function() { - - var $this = this; - - this.on("change", function() { - xhrupload($this.element[0].files, $this.options); - var twin = $this.element.clone(true).data('uploadSelect', $this); - $this.element.replaceWith(twin); - $this.element = twin; - }); - } - }); - - UI.component('uploadDrop', { - - defaults: { - 'dragoverClass': 'uk-dragover' - }, - - init: function() { - - var $this = this, hasdragCls = false; - - this.on("drop", function(e){ - - if (e.originalEvent.dataTransfer && e.originalEvent.dataTransfer.files) { - - e.stopPropagation(); - e.preventDefault(); - - $this.element.removeClass($this.options.dragoverClass); - $this.element.trigger('dropped.uk.upload', [e.originalEvent.dataTransfer.files]); - - xhrupload(e.originalEvent.dataTransfer.files, $this.options); - } - - }).on("dragenter", function(e){ - e.stopPropagation(); - e.preventDefault(); - }).on("dragover", function(e){ - e.stopPropagation(); - e.preventDefault(); - - if (!hasdragCls) { - $this.element.addClass($this.options.dragoverClass); - hasdragCls = true; - } - }).on("dragleave", function(e){ - e.stopPropagation(); - e.preventDefault(); - $this.element.removeClass($this.options.dragoverClass); - hasdragCls = false; - }); - } - }); - - - UI.support.ajaxupload = (function() { - - function supportFileAPI() { - var fi = document.createElement('INPUT'); fi.type = 'file'; return 'files' in fi; - } - - function supportAjaxUploadProgressEvents() { - var xhr = new XMLHttpRequest(); return !! (xhr && ('upload' in xhr) && ('onprogress' in xhr.upload)); - } - - function supportFormData() { - return !! window.FormData; - } - - return supportFileAPI() && supportAjaxUploadProgressEvents() && supportFormData(); - })(); - - - function xhrupload(files, settings) { - - if (!UI.support.ajaxupload){ - return this; - } - - settings = UI.$.extend({}, xhrupload.defaults, settings); - - if (!files.length){ - return; - } - - if (settings.allow !== '*.*') { - - for(var i=0,file;file=files[i];i++) { - - if(!matchName(settings.allow, file.name)) { - - if(typeof(settings.notallowed) == 'string') { - alert(settings.notallowed); - } else { - settings.notallowed(file, settings); - } - return; - } - } - } - - var complete = settings.complete; - - if (settings.single){ - - var count = files.length, - uploaded = 0, - allow = true; - - settings.beforeAll(files); - - settings.complete = function(response, xhr){ - - uploaded = uploaded + 1; - - complete(response, xhr); - - if (settings.filelimit && uploaded >= settings.filelimit){ - allow = false; - } - - if (allow && uploaded