if (!("ace" in window)) { window.ace = {} } jQuery(function() { window.ace.click_event = $.fn.tap ? "tap" : "click" }); (function(e, c) { var d = "multiple" in document.createElement("INPUT"); var j = "FileList" in window; var b = "FileReader" in window; var f = function(l, m) { var k = this; this.settings = e.extend({}, e.fn.ace_file_input.defaults, m); this.$element = e(l); this.element = l; this.disabled = false; this.can_reset = true; this.$element.on("change.ace_inner_call", function(o, n) { if (n === true) { return } return a.call(k) }); this.$element.wrap('
'); this.apply_settings() }; f.error = { FILE_LOAD_FAILED : 1, IMAGE_LOAD_FAILED : 2, THUMBNAIL_FAILED : 3 }; f.prototype.apply_settings = function() { var l = this; var k = !!this.settings.icon_remove; this.multi = this.$element.attr("multiple") && d; this.well_style = this.settings.style == "well"; if (this.well_style) { this.$element.parent().addClass("ace-file-multiple") } else { this.$element.parent().removeClass("ace-file-multiple") } this.$element.parent().find(":not(input[type=file])").remove(); this.$element.after('" + (k ? '' : "")); this.$label = this.$element.next(); this.$label.on("click", function() { if (!this.disabled && !l.element.disabled && !l.$element.attr("readonly")) { l.$element.click() } }); if (k) { this.$label.next("a").on(ace.click_event, function() { if (!l.can_reset) { return false } var m = true; if (l.settings.before_remove) { m = l.settings.before_remove.call(l.element) } if (!m) { return false } return l.reset_input() }) } if (this.settings.droppable && j) { g.call(this) } }; f.prototype.show_file_list = function(k) { var n = typeof k === "undefined" ? this.$element .data("ace_input_files") : k; if (!n || n.length == 0) { return } if (this.well_style) { this.$label.find(".file-name").remove(); if (!this.settings.btn_change) { this.$label.addClass("hide-placeholder") } } this.$label.attr("data-title", this.settings.btn_change).addClass( "selected"); for ( var p = 0; p < n.length; p++) { var l = typeof n[p] === "string" ? n[p] : e.trim(n[p].name); var q = l.lastIndexOf("\\") + 1; if (q == 0) { q = l.lastIndexOf("/") + 1 } l = l.substr(q); var m = "icon-file"; if ((/\.(jpe?g|png|gif|svg|bmp|tiff?)$/i).test(l)) { m = "icon-picture fa fa-picture-o" } else { if ((/\.(mpe?g|flv|mov|avi|swf|mp4|mkv|webm|wmv|3gp)$/i) .test(l)) { m = "icon-film" } else { if ((/\.(mp3|ogg|wav|wma|amr|aac)$/i).test(l)) { m = "icon-music" } } } if (!this.well_style) { this.$label.find(".file-name").attr({ "data-title" : l }).find('[class*="icon-"]').attr("class", m) } else { this.$label.append(''); var r = e.trim(n[p].type); var o = b && this.settings.thumbnail && ((r.length > 0 && r.match("image")) || (r.length == 0 && m == "icon-picture")); if (o) { var s = this; e.when(i.call(this, n[p])).fail(function(t) { if (s.settings.preview_error) { s.settings.preview_error.call(s, l, t.code) } }) } } } return true }; f.prototype.reset_input = function() { this.$label.attr({ "data-title" : this.settings.btn_choose, "class" : "file-label" }).find(".file-name:first").attr({ "data-title" : this.settings.no_file, "class" : "file-name" }).find('[class*="icon-"]').attr("class", this.settings.no_icon).prev( "img").remove(); if (!this.settings.no_icon) { this.$label.find('[class*="icon-"]').remove() } this.$label.find(".file-name").not(":first").remove(); if (this.$element.data("ace_input_files")) { this.$element.removeData("ace_input_files"); this.$element.removeData("ace_input_method") } this.reset_input_field(); return false }; f.prototype.reset_input_field = function() { this.$element.wrap("