vendor/assets/javascripts/jquery.ezdz.js in ezdz-rails-0.2.1 vs vendor/assets/javascripts/jquery.ezdz.js in ezdz-rails-0.4.0

- old
+ new

@@ -1,8 +1,8 @@ /* ---------------------------------------------------------------------------- // Ezdz [izy-dizy] - // v0.2.1 - released 2013-10-16 00:41 + // v0.4.0 - released 2013-10-22 14:08 // Licensed under the MIT license. // https://github.com/jaysalvat/ezdz // ---------------------------------------------------------------------------- // Copyright (C) 2013 Jay Salvat // http://jaysalvat.com/ @@ -57,16 +57,15 @@ var self = this, settings = self.settings, $input = self.$input; if (!$input.is('input[type="file"]')) { - $.error('Ezdz error - Must be apply to inputs type file.'); return; } // Stop if not compatible with HTML5 file API - if (!(window.File && window.FileList && window.FileReader)) { + if (!$.ezdz.isBrowserCompatible()) { return; } // private: Init the plugin var init = function() { @@ -281,11 +280,11 @@ // Trigger the reject callback if ($.isFunction(settings.reject)) { settings.reject.apply($input, [ file, errors ]); } } - }, 1); + }, 250); }; }); }; init(); @@ -350,11 +349,16 @@ $input = this.$input; return $input.parent('.' + settings.classes.main); }; + // Is browser compatible + $.ezdz.isBrowserCompatible = function() { + return !!(window.File && window.FileList && window.FileReader); + }; + // Default options - $.ezdz.prototype.defaults = defaults; + $.ezdz.defaults = defaults; // jQuery plugin $.fn.ezdz = function(options) { var args = arguments, plugin = $(this).data('ezdz');