芝麻web文件管理V1.00
编辑当前文件:/var/www/cognitio.in/wp-content/plugins/wp-event-manager/assets/js/ajax-file-upload.min.js
var AjaxFileUpload = function () { return { init: function () { Common.logInfo("AjaxFileUpload.init..."), jQuery(".wp-event-manager-file-upload").each(function () { jQuery(this).fileupload({ dataType: "json", dropZone: jQuery(this), url: event_manager_ajax_file_upload.ajax_url.toString().replace("%%endpoint%%", "upload_file"), maxNumberOfFiles: 1, formData: { script: !0 }, add: function (e, a) { var t = jQuery(this), n = t.closest("form"), i = t.parent().find(".event-manager-uploaded-files"), r = [], l = jQuery(this).data("file_types"); if (l) { var o = new RegExp("(.|/)(" + l + ")$", "i"); a.originalFiles[0].name.length && !o.test(a.originalFiles[0].name) && r.push(event_manager_ajax_file_upload.i18n_invalid_file_type + " " + l.replace(/\|/g, ", ")) } r.length > 0 ? alert(r.join("\n")) : (n.find(':input[type="submit"]').attr("disabled", "disabled"), a.context = jQuery('
').appendTo(i), a.submit()) }, progress: function (e, a) { jQuery(this).parent().find(".event-manager-uploaded-files"); var t = parseInt(a.loaded / a.total * 100, 10); a.context.val(t) }, fail: function (e, a) { jQuery(this).closest("form").find(':input[type="submit"]').removeAttr("disabled") }, done: function (e, a) { var t = jQuery(this), n = t.closest("form"), i = t.parent().find(".event-manager-uploaded-files"), r = t.attr("multiple") ? 1 : 0, l = ["jpg", "gif", "png", "jpeg", "jpe"]; a.context.remove(), jQuery.each(a.result.files, function (e, a) { if (a.error) alert(a.error); else { if (jQuery.inArray(a.extension, l) >= 0) { var n = jQuery.parseHTML(event_manager_ajax_file_upload.js_field_html_img); jQuery(n).find(".event-manager-uploaded-file-preview img").attr("src", a.url) } else { n = jQuery.parseHTML(event_manager_ajax_file_upload.js_field_html); jQuery(n).find(".event-manager-uploaded-file-name code").text(a.name) } jQuery(n).find(".input-text").val(a.url), jQuery(n).find(".input-text").attr("name", "current_" + t.attr("name")), r ? i.append(n) : i.html(n) } }), n.find(':input[type="submit"]').removeAttr("disabled") } }) }) } } }; AjaxFileUpload = AjaxFileUpload(), jQuery(document).ready(function (e) { AjaxFileUpload.init() });