vendor/assets/javascripts/noty/jquery.noty.js in noty-rails-2.3.5 vs vendor/assets/javascripts/noty/jquery.noty.js in noty-rails-2.3.7

- old
+ new

@@ -1,8 +1,8 @@ /*! @package noty - jQuery Notification Plugin - @version version: 2.3.5 + @version version: 2.3.7 @contributors https://github.com/needim/noty/graphs/contributors @documentation Examples and Documentation - http://needim.github.com/noty/ @license Licensed under the MIT licenses: http://www.opensource.org/licenses/mit-license.php @@ -71,10 +71,11 @@ var self = this; $.each(this.options.buttons, function(i, button) { var $button = $('<button/>').addClass((button.addClass) ? button.addClass : 'gray').html(button.text).attr('id', button.id ? button.id : 'button-' + i) + .attr('title', button.title) .appendTo(self.$bar.find('.noty_buttons')) .on('click', function(event) { if($.isFunction(button.onClick)) { button.onClick.call($button, self, event); } @@ -102,11 +103,11 @@ ($.type(self.options.layout.css) === 'function') ? this.options.layout.css.apply(self.$bar) : self.$bar.css(this.options.layout.css || {}); self.$bar.addClass(self.options.layout.addClass); - self.options.layout.container.style.apply($(self.options.layout.container.selector)); + self.options.layout.container.style.apply($(self.options.layout.container.selector), [self.options.within]); self.showing = true; if(self.options.theme && self.options.theme.style) self.options.theme.callback.onShow.apply(this); @@ -137,14 +138,23 @@ if(self.options.callback.onShow) self.options.callback.onShow.apply(self); if (typeof self.options.animation.open == 'string') { self.$bar.css('height', self.$bar.innerHeight()); + self.$bar.on('click',function(e){ + self.wasClicked = true; + }); self.$bar.show().addClass(self.options.animation.open).one('webkitAnimationEnd mozAnimationEnd MSAnimationEnd oanimationend animationend', function() { if(self.options.callback.afterShow) self.options.callback.afterShow.apply(self); self.showing = false; self.shown = true; + if(self.hasOwnProperty('wasClicked')){ + self.$bar.off('click',function(e){ + self.wasClicked = true; + }); + self.close(); + } }); } else { self.$bar.animate( self.options.animation.open, @@ -225,11 +235,11 @@ var self = this; // Modal Cleaning if(self.options.modal) { $.notyRenderer.setModalCount(-1); - if($.notyRenderer.getModalCount() == 0) $('.noty_modal').fadeOut('fast', function() { + if($.notyRenderer.getModalCount() == 0) $('.noty_modal').fadeOut(self.options.animation.fadeSpeed, function() { $(this).remove(); }); } // Layout Cleaning @@ -342,11 +352,11 @@ var instance = $.noty.queue[0]; if($.type(instance) === 'object') { if(instance.options.dismissQueue) { if(instance.options.maxVisible > 0) { - if($(instance.options.layout.container.selector + ' li').length < instance.options.maxVisible) { + if($(instance.options.layout.container.selector + ' > li').length < instance.options.maxVisible) { $.notyRenderer.show($.noty.queue.shift()); } else { } @@ -403,11 +413,11 @@ var modal = $('<div/>').addClass('noty_modal').addClass(notification.options.theme).data('noty_modal_count', 0); if(notification.options.theme.modal && notification.options.theme.modal.css) modal.css(notification.options.theme.modal.css); - modal.prependTo($('body')).fadeIn('fast'); + modal.prependTo($('body')).fadeIn(notification.options.animation.fadeSpeed); if($.inArray('backdrop', notification.options.closeWith) > -1) modal.on('click', function(e) { $.noty.closeAll(); }); @@ -497,10 +507,11 @@ template : '<div class="noty_message"><span class="noty_text"></span><div class="noty_close"></div></div>', animation : { open : {height: 'toggle'}, close : {height: 'toggle'}, easing: 'swing', - speed : 500 + speed : 500, + fadeSpeed: 'fast', }, timeout : false, force : false, modal : false, maxVisible : 5,