throw { name: 'FatalError', message: 'Do not call this file. If you want to use it, remove this line.' }; /* * jQuery File Upload User Interface Plugin 1.1 * * Copyright 2010, Sebastian Tschan, AQUANTUM * Licensed under the MIT license: * http://creativecommons.org/licenses/MIT/ * * Heavily modified by Christian Koller, untermStrich * Modifications copyright 2010 untermStrich * license /_licenses/untermStrich/agb_normal.pdf * * https://blueimp.net * http://www.aquantum.de */ /*jslint browser: true */ /*global jQuery */ (function ($) { var UploadHandler = function (uploadField) { var uploadHandler = this; this.cssClassHighlight = 'file_upload_highlight'; this.progress = function (event, files, index, xhr, settings) { //console.log(parseInt(event.loaded / event.total * 100, 10)); }; this.load = function (event, files, index, xhr, settings) { var response, json; //Get response if (xhr) { response = xhr.responseText; } else { response = $(event.target).contents().text(); } //JSON decode try { json = $.parseJSON(response); } catch (exception) { } if (json) { if (typeof(json.file_entry) === 'undefined') { alert('Missing: Upload file name'); return; } uploadField.find('input:hidden').val(json.file_entry); if (typeof(json.file_html) !== 'undefined') { uploadField.siblings('span.preview').html(json.file_html); } if (typeof(json.call_action) !== 'undefined') { eval(json.call_action); } basicForm.initAll(); } else { alert(response); } }; this.dragEnter = this.dragLeave = function (event) { uploadField.toggleClass(uploadHandler.cssClassHighlight); }; $.extend(this); }, methods = { init : function () { return this.each(function () { $(this).fileUpload(new UploadHandler($(this))); //Drag and drop var file_target = $(this).find('.file_target'); file_target.html(file_target.html()+' (Drag and Drop)'); }); }, destroy : function (namespace) { return this.each(function () { $(this).fileUpload('destroy', namespace); }); } }; $.fn.fileUploadUI = function (method) { if (methods[method]) { return methods[method].apply(this, Array.prototype.slice.call(arguments, 1)); } else if (typeof method === 'object' || ! method) { return methods.init.apply(this, arguments); } else { $.error('Method ' + method + ' does not exist on jQuery.fileUploadUI'); } }; }(jQuery));