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

- old
+ new

@@ -1,24 +1,30 @@ /* ---------------------------------------------------------------------------- // Ezdz [izy-dizy] - // v0.4.1 - released 2014-07-15 12:58 + // v0.4.2 - released 2014-10-20 13:45 // Licensed under the MIT license. // https://github.com/jaysalvat/ezdz // ---------------------------------------------------------------------------- // Copyright (C) 2014 Jay Salvat // http://jaysalvat.com/ // ---------------------------------------------------------------------------*/ +/* global define: true, require: true, jQuery */ + (function (factory) { + "use strict"; + if (typeof define === 'function' && define.amd) { define(['jquery'], factory); } else if (typeof exports === 'object') { factory(require('jquery')); } else { factory(jQuery); } }(function ($) { + "use strict"; + // Default settings var defaults = { className: '', text: 'Drop a file', previewImage: true, @@ -137,12 +143,12 @@ file.extension = extension; // Mime-Types var allowed = $input.attr('accept'), - accepted = false; - valid = true; + accepted = false, + valid = true, errors = { 'mimeType': false, 'maxSize': false, 'width': false, 'minWidth': false, @@ -157,11 +163,11 @@ var types = allowed.split(/[,|]/); $.each(types, function(i, type) { type = $.trim(type); - if (file.type == type) { + if (file.type === type) { accepted = true; return false; } // Mime-Type with wildcards ex. image/* @@ -222,11 +228,11 @@ if (isImage) { file.width = img.width; file.height = img.height; - if (settings.validators.width && img.width != settings.validators.width) { + if (settings.validators.width && img.width !== settings.validators.width) { valid = false; errors.width = true; } if (settings.validators.maxWidth && img.width > settings.validators.maxWidth) { @@ -237,11 +243,11 @@ if (settings.validators.minWidth && img.width < settings.validators.minWidth) { valid = false; errors.minWidth = true; } - if (settings.validators.height && img.height != settings.validators.height) { + if (settings.validators.height && img.height !== settings.validators.height) { valid = false; errors.height = true; } if (settings.validators.maxHeight && img.height > settings.validators.maxHeight) { @@ -292,10 +298,10 @@ // 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); + $ezdz = $input.parent('.' + settings.classes.main), basename = path.replace(/\\/g,'/').replace( /.*\//, ''), formatted = settings.format(basename); var img = new Image(); img.src = path;