vendor/assets/javascripts/jquery.ezdz.js in ezdz-rails-0.4.3 vs vendor/assets/javascripts/jquery.ezdz.js in ezdz-rails-0.5.0

- old
+ new

@@ -1,12 +1,12 @@ /* ---------------------------------------------------------------------------- // Ezdz [izy-dizy] - // v0.4.3 - released 2014-12-16 11:29 + // v0.5.0 - released 2016-04-30 17:30 // Licensed under the MIT license. // https://github.com/jaysalvat/ezdz // ---------------------------------------------------------------------------- - // Copyright (C) 2014 Jay Salvat + // Copyright (C) 2016 Jay Salvat // http://jaysalvat.com/ // ---------------------------------------------------------------------------*/ /* global define: true, require: true, jQuery */ @@ -303,11 +303,24 @@ // Inject a file or image in the preview $.ezdz.prototype.preview = function(path, callback) { var settings = this.settings, $input = this.$input, $ezdz = $input.parent('.' + settings.classes.main), - basename = path.replace(/\\/g,'/').replace( /.*\//, ''), + basename = (path || '').replace(/\\/g,'/').replace( /.*\//, ''), formatted = settings.format(basename); + + if (!path) { + $ezdz + .removeClass([ + settings.classes.enter, + settings.classes.reject, + settings.classes.accept + ].join(' ')) + .find('div').html(settings.text); + + $input.val(''); + return; + } var img = new Image(); img.src = path; // Is an image