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

- old
+ new

@@ -1,8 +1,8 @@ /* ---------------------------------------------------------------------------- // Ezdz [izy-dizy] - // v0.4.2 - released 2014-10-20 13:45 + // v0.4.3 - released 2014-12-16 11:29 // Licensed under the MIT license. // https://github.com/jaysalvat/ezdz // ---------------------------------------------------------------------------- // Copyright (C) 2014 Jay Salvat // http://jaysalvat.com/ @@ -57,11 +57,10 @@ // Main plugin $.ezdz = function(element, options) { this.settings = $.extend(true, {}, defaults, $.ezdz.defaults, options); this.$input = $(element); - var self = this, settings = self.settings, $input = self.$input; if (!$input.is('input[type="file"]')) { @@ -163,10 +162,15 @@ var types = allowed.split(/[,|]/); $.each(types, function(i, type) { type = $.trim(type); + if ('.' + extension === type) { + accepted = true; + return false; + } + if (file.type === type) { accepted = true; return false; } @@ -366,16 +370,20 @@ $.ezdz.defaults = defaults; // jQuery plugin $.fn.ezdz = function(options) { var args = arguments, + plugin; + + return this.each(function () { plugin = $(this).data('ezdz'); - if (!plugin) { - return $(this).data('ezdz', new $.ezdz(this, options)); - } if (plugin[options]) { - return plugin[options].apply(plugin, Array.prototype.slice.call(args, 1)); - } else { - $.error('Ezdz error - Method ' + options + ' does not exist.'); - } + if (!plugin) { + return $(this).data('ezdz', new $.ezdz(this, options)); + } if (plugin[options]) { + return plugin[options].apply(plugin, Array.prototype.slice.call(args, 1)); + } else { + $.error('Ezdz error - Method ' + options + ' does not exist.'); + } + }); }; }));