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 = $('
') .appendTo(document.body) @@ -139,12 +149,15 @@ this.$backdrop.click($.proxy(this.hide, this)) } - setTimeout(function () { - that.$backdrop && that.$backdrop.addClass('in') - $.support.transition && that.$backdrop.hasClass('fade') ? - that.$backdrop.one(transitionEnd, callback) : - callback() - }, 0) + if ( doAnimate ) { + this.$backdrop[0].offsetWidth // force reflow + } + + this.$backdrop.addClass('in') + + doAnimate ? + this.$backdrop.one(transitionEnd, callback) : + callback() } else if ( !this.isShown && this.$backdrop ) { this.$backdrop.removeClass('in') @@ -165,13 +178,13 @@ function escape() { var that = this if ( this.isShown && this.settings.keyboard ) { - $('body').bind('keyup.modal', function ( e ) { + $(document).bind('keyup.modal', function ( e ) { if ( e.which == 27 ) { that.hide() } }) } else if ( !this.isShown ) { - $('body').unbind('keyup.modal') + $(document).unbind('keyup.modal') } } @@ -213,7 +226,7 @@ $.fn.modal.defaults = { backdrop: false , keyboard: false - , show: true + , show: false } @@ -228,5 +241,4 @@ }) }) -})( window.jQuery || window.ender ) - +}( window.jQuery || window.ender ); diff --git a/vendor/assets/javascripts/bootstrap-popover.js b/vendor/assets/javascripts/bootstrap-popover.js index 5d755ca8..1cf4b891 100644 --- a/vendor/assets/javascripts/bootstrap-popover.js +++ b/vendor/assets/javascripts/bootstrap-popover.js @@ -18,7 +18,7 @@ * =========================================================== */ -(function( $ ) { +!function( $ ) { var Popover = function ( element, options ) { this.$element = $(element) @@ -40,7 +40,7 @@ } , getContent: function () { - var contentvar + var content , $e = this.$element , o = this.options @@ -74,5 +74,4 @@ $.fn.popover.defaults = $.extend({} , $.fn.twipsy.defaults, { content: 'data-content', placement: 'right'}) -})( window.jQuery || window.ender ) - +}( window.jQuery || window.ender ); \ No newline at end of file diff --git a/vendor/assets/javascripts/bootstrap-scrollspy.js b/vendor/assets/javascripts/bootstrap-scrollspy.js index fbf56f33..5226d9df 100644 --- a/vendor/assets/javascripts/bootstrap-scrollspy.js +++ b/vendor/assets/javascripts/bootstrap-scrollspy.js @@ -102,5 +102,4 @@ $('body').scrollSpy('[data-scrollspy] li > a') }) -}( window.jQuery || window.ender ) - +}( window.jQuery || window.ender ); \ No newline at end of file diff --git a/vendor/assets/javascripts/bootstrap-tabs.js b/vendor/assets/javascripts/bootstrap-tabs.js index 9d7c8d43..9ccf8543 100644 --- a/vendor/assets/javascripts/bootstrap-tabs.js +++ b/vendor/assets/javascripts/bootstrap-tabs.js @@ -18,30 +18,45 @@ * ======================================================== */ -(function( $ ){ +!function( $ ){ function activate ( element, container ) { - container.find('.active').removeClass('active') + container + .find('> .active') + .removeClass('active') + .find('> .dropdown-menu > .active') + .removeClass('active') + element.addClass('active') + + if ( element.parent('.dropdown-menu') ) { + element.closest('li.dropdown').addClass('active') + } } function tab( e ) { var $this = $(this) + , $ul = $this.closest('ul:not(.dropdown-menu)') , href = $this.attr('href') - , $ul = $(e.liveFired) - , $controlled + , previous - if (/^#\w+/.test(href)) { + if ( /^#\w+/.test(href) ) { e.preventDefault() - if ($this.hasClass('active')) { + if ( $this.parent('li').hasClass('active') ) { return } + previous = $ul.find('.active a').last()[0] $href = $(href) activate($this.parent('li'), $ul) activate($href, $href.parent()) + + $this.trigger({ + type: 'change' + , relatedTarget: previous + }) } } @@ -59,5 +74,4 @@ $('body').tabs('ul[data-tabs] li > a, ul[data-pills] > li > a') }) -})( window.jQuery || window.ender ) - +}( window.jQuery || window.ender ); diff --git a/vendor/assets/javascripts/bootstrap-twipsy.js b/vendor/assets/javascripts/bootstrap-twipsy.js index a577f229..97cf47f4 100644 --- a/vendor/assets/javascripts/bootstrap-twipsy.js +++ b/vendor/assets/javascripts/bootstrap-twipsy.js @@ -19,7 +19,7 @@ * ========================================================== */ -(function( $ ) { +!function( $ ) { /* CSS TRANSITION SUPPORT (https://gist.github.com/373874) * ======================================================= */ @@ -90,7 +90,8 @@ actualWidth = $tip[0].offsetWidth actualHeight = $tip[0].offsetHeight - placement = _.maybeCall(this.options.placement, this.$element[0]) + + placement = maybeCall(this.options.placement, this, [ $tip[0], this.$element[0] ]) switch (placement) { case 'below': @@ -193,15 +194,10 @@ /* TWIPSY PRIVATE METHODS * ====================== */ - var _ = { - - maybeCall: function ( thing, ctx ) { - return (typeof thing == 'function') ? (thing.call(ctx)) : thing - } - + function maybeCall ( thing, ctx, args ) { + return typeof thing == 'function' ? thing.apply(ctx, args) : thing } - /* TWIPSY PLUGIN DEFINITION * ======================== */ @@ -304,5 +300,4 @@ return $.metadata ? $.extend({}, options, $(ele).metadata()) : options } -})( window.jQuery || window.ender ) - +}( window.jQuery || window.ender ); \ No newline at end of file