diff options
| author | Jacob Thornton <[email protected]> | 2011-10-29 17:08:35 -0700 |
|---|---|---|
| committer | Jacob Thornton <[email protected]> | 2011-10-29 17:08:35 -0700 |
| commit | 9a30b8c05d26aa6c8e80c0b81f2fb3d979157a24 (patch) | |
| tree | b089f69bb5c31d47f9408f11935645a67e4cbd68 /js | |
| parent | 61937a803b96748377dd49d50439d96d68a9e40c (diff) | |
| parent | d3b8a96589ab6dd70fad89413e04c09008c7c133 (diff) | |
| download | bootstrap-9a30b8c05d26aa6c8e80c0b81f2fb3d979157a24.tar.xz bootstrap-9a30b8c05d26aa6c8e80c0b81f2fb3d979157a24.zip | |
Merge branch 'master' of github.com:twitter/bootstrap into dev
Conflicts:
bootstrap.css
bootstrap.min.css
lib/forms.less
Diffstat (limited to 'js')
| -rw-r--r-- | js/bootstrap-alerts.js | 15 | ||||
| -rw-r--r-- | js/bootstrap-modal.js | 4 | ||||
| -rw-r--r-- | js/bootstrap-tabs.js | 19 | ||||
| -rw-r--r-- | js/bootstrap-twipsy.js | 12 |
4 files changed, 30 insertions, 20 deletions
diff --git a/js/bootstrap-alerts.js b/js/bootstrap-alerts.js index 266029cc4..a8d15e24e 100644 --- a/js/bootstrap-alerts.js +++ b/js/bootstrap-alerts.js @@ -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,13 +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 );
\ No newline at end of file diff --git a/js/bootstrap-modal.js b/js/bootstrap-modal.js index 76c495259..2cc910989 100644 --- a/js/bootstrap-modal.js +++ b/js/bootstrap-modal.js @@ -53,12 +53,10 @@ * ============================= */ 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)) - $.extend( this.settings, options ) - if ( this.settings.show ) { this.show() } diff --git a/js/bootstrap-tabs.js b/js/bootstrap-tabs.js index e8e2dc622..9ccf85436 100644 --- a/js/bootstrap-tabs.js +++ b/js/bootstrap-tabs.js @@ -21,24 +21,33 @@ !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') + , $ul = $this.closest('ul:not(.dropdown-menu)') , href = $this.attr('href') , previous - if (/^#\w+/.test(href)) { + if ( /^#\w+/.test(href) ) { e.preventDefault() - if ($this.parent('li').hasClass('active')) { + if ( $this.parent('li').hasClass('active') ) { return } - previous = $ul.find('.active a')[0] + previous = $ul.find('.active a').last()[0] $href = $(href) activate($this.parent('li'), $ul) diff --git a/js/bootstrap-twipsy.js b/js/bootstrap-twipsy.js index 0144c4815..97cf47f46 100644 --- a/js/bootstrap-twipsy.js +++ b/js/bootstrap-twipsy.js @@ -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 * ======================== */ |
