From 587451ad9a2b288ed54857c6ac291609a6394c6f Mon Sep 17 00:00:00 2001 From: Heinrich Fenkart Date: Thu, 19 Jun 2014 11:41:23 +0200 Subject: Update a few source files to comply to new JSCS rules --- js/collapse.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'js/collapse.js') diff --git a/js/collapse.js b/js/collapse.js index d37b8898c..c67939a7d 100644 --- a/js/collapse.js +++ b/js/collapse.js @@ -156,7 +156,7 @@ var $this = $(this) var target = $this.attr('data-target') || e.preventDefault() - || (href = $this.attr('href')) && href.replace(/.*(?=#[^\s]+$)/, '') //strip for ie7 + || (href = $this.attr('href')) && href.replace(/.*(?=#[^\s]+$)/, '') // strip for ie7 var $target = $(target) var data = $target.data('bs.collapse') var option = data ? 'toggle' : $this.data() -- cgit v1.2.3 From c2c19a4d2d45d8ccb5c84d293dea35a94148c9a4 Mon Sep 17 00:00:00 2001 From: Chris Rebert Date: Mon, 23 Jun 2014 11:07:18 -0700 Subject: Revert UMD (#13772 & friends) for now, due to #13812. Will hopefully revert this reversion and land a fully-working version of UMD in v3.3.0. Revert "some changes from #13801 - add strict mode back and ==" This reverts commit 2b302f69eea416bc85e7827b7d7a74d49f879662. Revert "Fix regression of #10038 introduced by #13772" This reverts commit e9d6756a1ac76a9db31a41e8e03f663bedc41b70. Revert "MD/CommonJS/Globals #12909" This reverts commit 1c6fa9010daf0d0c21de9e20fe6ac4dba1788d90. Revert "address #13811" This reverts commit f347d7d955bbb17234b8e12c68efae7d516ce62c. Conflicts: js/carousel.js js/collapse.js js/dropdown.js js/modal.js js/tab.js js/tooltip.js --- js/collapse.js | 240 ++++++++++++++++++++++++++++----------------------------- 1 file changed, 117 insertions(+), 123 deletions(-) (limited to 'js/collapse.js') diff --git a/js/collapse.js b/js/collapse.js index c67939a7d..eb688f480 100644 --- a/js/collapse.js +++ b/js/collapse.js @@ -7,170 +7,164 @@ * ======================================================================== */ -+function () { 'use strict'; ++function ($) { + 'use strict'; - (function (o_o) { - typeof define == 'function' && define.amd ? define(['jquery'], o_o) : - typeof exports == 'object' ? o_o(require('jquery')) : o_o(jQuery) - })(function ($) { + // COLLAPSE PUBLIC CLASS DEFINITION + // ================================ - // COLLAPSE PUBLIC CLASS DEFINITION - // ================================ + var Collapse = function (element, options) { + this.$element = $(element) + this.options = $.extend({}, Collapse.DEFAULTS, options) + this.transitioning = null - var Collapse = function (element, options) { - this.$element = $(element) - this.options = $.extend({}, Collapse.DEFAULTS, options) - this.transitioning = null + if (this.options.parent) this.$parent = $(this.options.parent) + if (this.options.toggle) this.toggle() + } - if (this.options.parent) this.$parent = $(this.options.parent) - if (this.options.toggle) this.toggle() - } + Collapse.VERSION = '3.1.1' - Collapse.VERSION = '3.1.1' + Collapse.DEFAULTS = { + toggle: true + } - Collapse.DEFAULTS = { - toggle: true - } + Collapse.prototype.dimension = function () { + var hasWidth = this.$element.hasClass('width') + return hasWidth ? 'width' : 'height' + } - Collapse.prototype.dimension = function () { - var hasWidth = this.$element.hasClass('width') - return hasWidth ? 'width' : 'height' - } + Collapse.prototype.show = function () { + if (this.transitioning || this.$element.hasClass('in')) return - Collapse.prototype.show = function () { - if (this.transitioning || this.$element.hasClass('in')) return + var startEvent = $.Event('show.bs.collapse') + this.$element.trigger(startEvent) + if (startEvent.isDefaultPrevented()) return - var startEvent = $.Event('show.bs.collapse') - this.$element.trigger(startEvent) - if (startEvent.isDefaultPrevented()) return + var actives = this.$parent && this.$parent.find('> .panel > .in') - var actives = this.$parent && this.$parent.find('> .panel > .in') + if (actives && actives.length) { + var hasData = actives.data('bs.collapse') + if (hasData && hasData.transitioning) return + Plugin.call(actives, 'hide') + hasData || actives.data('bs.collapse', null) + } + + var dimension = this.dimension() - if (actives && actives.length) { - var hasData = actives.data('bs.collapse') - if (hasData && hasData.transitioning) return - Plugin.call(actives, 'hide') - hasData || actives.data('bs.collapse', null) - } + this.$element + .removeClass('collapse') + .addClass('collapsing')[dimension](0) - var dimension = this.dimension() + this.transitioning = 1 + var complete = function () { + this.$element + .removeClass('collapsing') + .addClass('collapse in')[dimension]('') + this.transitioning = 0 this.$element - .removeClass('collapse') - .addClass('collapsing')[dimension](0) + .trigger('shown.bs.collapse') + } - this.transitioning = 1 + if (!$.support.transition) return complete.call(this) - var complete = function () { - this.$element - .removeClass('collapsing') - .addClass('collapse in')[dimension]('') - this.transitioning = 0 - this.$element - .trigger('shown.bs.collapse') - } + var scrollSize = $.camelCase(['scroll', dimension].join('-')) - if (!$.support.transition) return complete.call(this) + this.$element + .one('bsTransitionEnd', $.proxy(complete, this)) + .emulateTransitionEnd(350)[dimension](this.$element[0][scrollSize]) + } - var scrollSize = $.camelCase(['scroll', dimension].join('-')) + Collapse.prototype.hide = function () { + if (this.transitioning || !this.$element.hasClass('in')) return - this.$element - .one('bsTransitionEnd', $.proxy(complete, this)) - .emulateTransitionEnd(350)[dimension](this.$element[0][scrollSize]) - } + var startEvent = $.Event('hide.bs.collapse') + this.$element.trigger(startEvent) + if (startEvent.isDefaultPrevented()) return - Collapse.prototype.hide = function () { - if (this.transitioning || !this.$element.hasClass('in')) return + var dimension = this.dimension() - var startEvent = $.Event('hide.bs.collapse') - this.$element.trigger(startEvent) - if (startEvent.isDefaultPrevented()) return + this.$element[dimension](this.$element[dimension]())[0].offsetHeight - var dimension = this.dimension() + this.$element + .addClass('collapsing') + .removeClass('collapse') + .removeClass('in') - this.$element[dimension](this.$element[dimension]())[0].offsetHeight + this.transitioning = 1 + var complete = function () { + this.transitioning = 0 this.$element - .addClass('collapsing') - .removeClass('collapse') - .removeClass('in') + .trigger('hidden.bs.collapse') + .removeClass('collapsing') + .addClass('collapse') + } - this.transitioning = 1 + if (!$.support.transition) return complete.call(this) - var complete = function () { - this.transitioning = 0 - this.$element - .trigger('hidden.bs.collapse') - .removeClass('collapsing') - .addClass('collapse') - } + this.$element + [dimension](0) + .one('bsTransitionEnd', $.proxy(complete, this)) + .emulateTransitionEnd(350) + } - if (!$.support.transition) return complete.call(this) + Collapse.prototype.toggle = function () { + this[this.$element.hasClass('in') ? 'hide' : 'show']() + } - this.$element - [dimension](0) - .one('bsTransitionEnd', $.proxy(complete, this)) - .emulateTransitionEnd(350) - } - - Collapse.prototype.toggle = function () { - this[this.$element.hasClass('in') ? 'hide' : 'show']() - } + // COLLAPSE PLUGIN DEFINITION + // ========================== - // COLLAPSE PLUGIN DEFINITION - // ========================== + function Plugin(option) { + return this.each(function () { + var $this = $(this) + var data = $this.data('bs.collapse') + var options = $.extend({}, Collapse.DEFAULTS, $this.data(), typeof option == 'object' && option) - function Plugin(option) { - return this.each(function () { - var $this = $(this) - var data = $this.data('bs.collapse') - var options = $.extend({}, Collapse.DEFAULTS, $this.data(), typeof option == 'object' && option) + if (!data && options.toggle && option == 'show') option = !option + if (!data) $this.data('bs.collapse', (data = new Collapse(this, options))) + if (typeof option == 'string') data[option]() + }) + } - if (!data && options.toggle && option == 'show') option = !option - if (!data) $this.data('bs.collapse', (data = new Collapse(this, options))) - if (typeof option == 'string') data[option]() - }) - } + var old = $.fn.collapse - var old = $.fn.collapse + $.fn.collapse = Plugin + $.fn.collapse.Constructor = Collapse - $.fn.collapse = Plugin - $.fn.collapse.Constructor = Collapse + // COLLAPSE NO CONFLICT + // ==================== - // COLLAPSE NO CONFLICT - // ==================== + $.fn.collapse.noConflict = function () { + $.fn.collapse = old + return this + } - $.fn.collapse.noConflict = function () { - $.fn.collapse = old - return this - } + // COLLAPSE DATA-API + // ================= - // COLLAPSE DATA-API - // ================= + $(document).on('click.bs.collapse.data-api', '[data-toggle="collapse"]', function (e) { + var href + var $this = $(this) + var target = $this.attr('data-target') + || e.preventDefault() + || (href = $this.attr('href')) && href.replace(/.*(?=#[^\s]+$)/, '') // strip for ie7 + var $target = $(target) + var data = $target.data('bs.collapse') + var option = data ? 'toggle' : $this.data() + var parent = $this.attr('data-parent') + var $parent = parent && $(parent) - $(document).on('click.bs.collapse.data-api', '[data-toggle="collapse"]', function (e) { - var href - var $this = $(this) - var target = $this.attr('data-target') - || e.preventDefault() - || (href = $this.attr('href')) && href.replace(/.*(?=#[^\s]+$)/, '') // strip for ie7 - var $target = $(target) - var data = $target.data('bs.collapse') - var option = data ? 'toggle' : $this.data() - var parent = $this.attr('data-parent') - var $parent = parent && $(parent) - - if (!data || !data.transitioning) { - if ($parent) $parent.find('[data-toggle="collapse"][data-parent="' + parent + '"]').not($this).addClass('collapsed') - $this[$target.hasClass('in') ? 'addClass' : 'removeClass']('collapsed') - } - - Plugin.call($target, option) - }) + if (!data || !data.transitioning) { + if ($parent) $parent.find('[data-toggle="collapse"][data-parent="' + parent + '"]').not($this).addClass('collapsed') + $this[$target.hasClass('in') ? 'addClass' : 'removeClass']('collapsed') + } + Plugin.call($target, option) }) -}(); +}(jQuery); -- cgit v1.2.3 From ff6b279b3cd37e7e4e6bd93535afd016f6957afc Mon Sep 17 00:00:00 2001 From: Mark Otto Date: Thu, 26 Jun 2014 09:13:24 -0700 Subject: bump to v3.2.0 --- js/collapse.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'js/collapse.js') diff --git a/js/collapse.js b/js/collapse.js index eb688f480..e4e6d7933 100644 --- a/js/collapse.js +++ b/js/collapse.js @@ -1,5 +1,5 @@ /* ======================================================================== - * Bootstrap: collapse.js v3.1.1 + * Bootstrap: collapse.js v3.2.0 * http://getbootstrap.com/javascript/#collapse * ======================================================================== * Copyright 2011-2014 Twitter, Inc. @@ -22,7 +22,7 @@ if (this.options.toggle) this.toggle() } - Collapse.VERSION = '3.1.1' + Collapse.VERSION = '3.2.0' Collapse.DEFAULTS = { toggle: true -- cgit v1.2.3 From 22f851fa6232b2db2efedbabcc5b532e424525f3 Mon Sep 17 00:00:00 2001 From: fat Date: Sat, 5 Jul 2014 23:28:44 -0700 Subject: =?UTF-8?q?apply=20#14022=20without=20semicolon=20=E2=80=93=20clea?= =?UTF-8?q?ns=20up=20some=20jquery=20class=20usage?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- js/collapse.js | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) (limited to 'js/collapse.js') diff --git a/js/collapse.js b/js/collapse.js index e4e6d7933..e6aa66286 100644 --- a/js/collapse.js +++ b/js/collapse.js @@ -88,8 +88,7 @@ this.$element .addClass('collapsing') - .removeClass('collapse') - .removeClass('in') + .removeClass('collapse in') this.transitioning = 1 @@ -110,7 +109,7 @@ } Collapse.prototype.toggle = function () { - this[this.$element.hasClass('in') ? 'hide' : 'show']() + $this.toggleClass('collapsed', $target.hasClass('in')) } -- cgit v1.2.3 From c08e275000330db6d8883de6af2243216cc79837 Mon Sep 17 00:00:00 2001 From: fat Date: Sat, 5 Jul 2014 23:49:45 -0700 Subject: fix build --- js/collapse.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'js/collapse.js') diff --git a/js/collapse.js b/js/collapse.js index e6aa66286..5a524241d 100644 --- a/js/collapse.js +++ b/js/collapse.js @@ -109,7 +109,7 @@ } Collapse.prototype.toggle = function () { - $this.toggleClass('collapsed', $target.hasClass('in')) + this[this.$element.hasClass('in') ? 'hide' : 'show']() } @@ -160,7 +160,7 @@ if (!data || !data.transitioning) { if ($parent) $parent.find('[data-toggle="collapse"][data-parent="' + parent + '"]').not($this).addClass('collapsed') - $this[$target.hasClass('in') ? 'addClass' : 'removeClass']('collapsed') + $this.toggleClass('collapsed', $target.hasClass('in')) } Plugin.call($target, option) -- cgit v1.2.3 From 231744d628f4857d631e9e9e8554d0a29a1b9556 Mon Sep 17 00:00:00 2001 From: Heinrich Fenkart Date: Mon, 7 Jul 2014 13:03:56 +0200 Subject: Expose transition durations on plugin constructors; closes #13656 --- js/collapse.js | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) (limited to 'js/collapse.js') diff --git a/js/collapse.js b/js/collapse.js index 5a524241d..a265344f4 100644 --- a/js/collapse.js +++ b/js/collapse.js @@ -24,6 +24,8 @@ Collapse.VERSION = '3.2.0' + Collapse.TRANSITION_DURATION = 350 + Collapse.DEFAULTS = { toggle: true } @@ -72,7 +74,7 @@ this.$element .one('bsTransitionEnd', $.proxy(complete, this)) - .emulateTransitionEnd(350)[dimension](this.$element[0][scrollSize]) + .emulateTransitionEnd(Collapse.TRANSITION_DURATION)[dimension](this.$element[0][scrollSize]) } Collapse.prototype.hide = function () { @@ -105,7 +107,7 @@ this.$element [dimension](0) .one('bsTransitionEnd', $.proxy(complete, this)) - .emulateTransitionEnd(350) + .emulateTransitionEnd(Collapse.TRANSITION_DURATION) } Collapse.prototype.toggle = function () { -- cgit v1.2.3 From 9c2e54bfeca744ca3d2ab811b23d9a083502c53d Mon Sep 17 00:00:00 2001 From: fat Date: Mon, 18 Aug 2014 19:58:19 -0700 Subject: fixes #14282 - Already Visible collapse gets closed when .collapse('show') is called --- js/collapse.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'js/collapse.js') diff --git a/js/collapse.js b/js/collapse.js index a265344f4..db89804cb 100644 --- a/js/collapse.js +++ b/js/collapse.js @@ -124,7 +124,7 @@ var data = $this.data('bs.collapse') var options = $.extend({}, Collapse.DEFAULTS, $this.data(), typeof option == 'object' && option) - if (!data && options.toggle && option == 'show') option = !option + if (!data && options.toggle && option == 'show') options.toggle = false if (!data) $this.data('bs.collapse', (data = new Collapse(this, options))) if (typeof option == 'string') data[option]() }) -- cgit v1.2.3