diff --git a/vendor/assets/javascripts/bootstrap-alerts.js b/vendor/assets/javascripts/bootstrap-alerts.js index c38b2333..a8d15e24 100644 --- a/vendor/assets/javascripts/bootstrap-alerts.js +++ b/vendor/assets/javascripts/bootstrap-alerts.js @@ -18,7 +18,7 @@ * ========================================================== */ -(function( $ ){ +!function( $ ){ /* CSS TRANSITION SUPPORT (https://gist.github.com/373874) * ======================================================= */ @@ -51,9 +51,10 @@ /* ALERT CLASS DEFINITION * ====================== */ - var Alert = function ( content, selector ) { + var Alert = function ( content, options ) { + this.settings = $.extend({}, $.fn.alert.defaults, options) this.$element = $(content) - .delegate(selector || '.close', 'click', this.close) + .delegate(this.settings.selector, 'click', this.close) } Alert.prototype = { @@ -92,14 +93,19 @@ return $this.data('alert')[options]() } - $(this).data('alert', new Alert( this )) + $(this).data('alert', new Alert( this, options )) }) } + $.fn.alert.defaults = { + selector: '.close' + } + $(document).ready(function () { - new Alert($('body'), '.alert-message[data-alert] .close') + new Alert($('body'), { + selector: '.alert-message[data-alert] .close' + }) }) -})( window.jQuery || window.ender ) - +}( window.jQuery || window.ender ); \ No newline at end of file diff --git a/vendor/assets/javascripts/bootstrap-dropdown.js b/vendor/assets/javascripts/bootstrap-dropdown.js index 22046f09..68a3db5f 100644 --- a/vendor/assets/javascripts/bootstrap-dropdown.js +++ b/vendor/assets/javascripts/bootstrap-dropdown.js @@ -18,18 +18,7 @@ * ============================================================ */ -(function( $ ){ - - var d = 'a.menu, .dropdown-toggle' - - function clearMenus() { - $(d).parent('li').removeClass('open') - } - - $(function () { - $('html').bind("click", clearMenus) - $('body').dropdown( '[data-dropdown] a.menu, [data-dropdown] .dropdown-toggle' ) - }) +!function( $ ){ /* DROPDOWN PLUGIN DEFINITION * ========================== */ @@ -47,5 +36,18 @@ }) } -})( window.jQuery || window.ender ) + /* APPLY TO STANDARD DROPDOWN ELEMENTS + * =================================== */ + var d = 'a.menu, .dropdown-toggle' + + function clearMenus() { + $(d).parent('li').removeClass('open') + } + + $(function () { + $('html').bind("click", clearMenus) + $('body').dropdown( '[data-dropdown] a.menu, [data-dropdown] .dropdown-toggle' ) + }) + +}( window.jQuery || window.ender ); diff --git a/vendor/assets/javascripts/bootstrap-modal.js b/vendor/assets/javascripts/bootstrap-modal.js index 24a610a9..2cc91098 100644 --- a/vendor/assets/javascripts/bootstrap-modal.js +++ b/vendor/assets/javascripts/bootstrap-modal.js @@ -18,7 +18,7 @@ * ========================================================= */ -(function( $ ){ +!function( $ ){ /* CSS TRANSITION SUPPORT (https://gist.github.com/373874) * ======================================================= */ @@ -53,16 +53,12 @@ * ============================= */ var Modal = function ( content, options ) { - this.settings = $.extend({}, $.fn.modal.defaults) + this.settings = $.extend({}, $.fn.modal.defaults, options) this.$element = $(content) .delegate('.close', 'click.modal', $.proxy(this.hide, this)) - if ( options ) { - $.extend( this.settings, options ) - - if ( options.show ) { - this.show() - } + if ( this.settings.show ) { + this.show() } return this @@ -81,15 +77,23 @@ escape.call(this) backdrop.call(this, function () { + var transition = $.support.transition && that.$element.hasClass('fade') + that.$element .appendTo(document.body) .show() - setTimeout(function () { - that.$element - .addClass('in') - .trigger('shown') - }, 0) + if (transition) { + that.$element[0].offsetWidth // force reflow + } + + that.$element + .addClass('in') + + transition ? + that.$element.one(transitionEnd, function () { that.$element.trigger('shown') }) : + that.$element.trigger('shown') + }) return this @@ -98,6 +102,10 @@ , hide: function (e) { e && e.preventDefault() + if ( !this.isShown ) { + return this + } + var that = this this.isShown = false @@ -132,6 +140,8 @@ var that = this , animate = this.$element.hasClass('fade') ? 'fade' : '' if ( this.isShown && this.settings.backdrop ) { + var doAnimate = $.support.transition && animate + this.$backdrop = $('