From 9473ddd576c9bc98d89b83f74c60e3c21423e9bc Mon Sep 17 00:00:00 2001 From: marijus Date: Fri, 21 Feb 2014 12:47:19 +0100 Subject: update to bootstrap version 3.1.1 which is now completely MIT licensed --- library/bootstrap/js/bootstrap.js | 517 +++++++++++++++------------------- library/bootstrap/js/bootstrap.min.js | 9 +- 2 files changed, 235 insertions(+), 291 deletions(-) (limited to 'library/bootstrap/js') diff --git a/library/bootstrap/js/bootstrap.js b/library/bootstrap/js/bootstrap.js index 850e6e53b..8ae571b6d 100644 --- a/library/bootstrap/js/bootstrap.js +++ b/library/bootstrap/js/bootstrap.js @@ -1,32 +1,22 @@ /*! - * Bootstrap v3.0.3 (http://getbootstrap.com) - * Copyright 2013 Twitter, Inc. - * Licensed under http://www.apache.org/licenses/LICENSE-2.0 + * Bootstrap v3.1.1 (http://getbootstrap.com) + * Copyright 2011-2014 Twitter, Inc. + * Licensed under MIT (https://github.com/twbs/bootstrap/blob/master/LICENSE) */ -if (typeof jQuery === "undefined") { throw new Error("Bootstrap requires jQuery") } +if (typeof jQuery === 'undefined') { throw new Error('Bootstrap\'s JavaScript requires jQuery') } /* ======================================================================== - * Bootstrap: transition.js v3.0.3 + * Bootstrap: transition.js v3.1.1 * http://getbootstrap.com/javascript/#transitions * ======================================================================== - * Copyright 2013 Twitter, Inc. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * Copyright 2011-2014 Twitter, Inc. + * Licensed under MIT (https://github.com/twbs/bootstrap/blob/master/LICENSE) * ======================================================================== */ -+function ($) { "use strict"; ++function ($) { + 'use strict'; // CSS TRANSITION SUPPORT (Shoutout: http://www.modernizr.com/) // ============================================================ @@ -35,10 +25,10 @@ if (typeof jQuery === "undefined") { throw new Error("Bootstrap requires jQuery" var el = document.createElement('bootstrap') var transEndEventNames = { - 'WebkitTransition' : 'webkitTransitionEnd' - , 'MozTransition' : 'transitionend' - , 'OTransition' : 'oTransitionEnd otransitionend' - , 'transition' : 'transitionend' + 'WebkitTransition' : 'webkitTransitionEnd', + 'MozTransition' : 'transitionend', + 'OTransition' : 'oTransitionEnd otransitionend', + 'transition' : 'transitionend' } for (var name in transEndEventNames) { @@ -46,6 +36,8 @@ if (typeof jQuery === "undefined") { throw new Error("Bootstrap requires jQuery" return { end: transEndEventNames[name] } } } + + return false // explicit for ie8 ( ._.) } // http://blog.alexmaccaw.com/css-transitions @@ -64,26 +56,16 @@ if (typeof jQuery === "undefined") { throw new Error("Bootstrap requires jQuery" }(jQuery); /* ======================================================================== - * Bootstrap: alert.js v3.0.3 + * Bootstrap: alert.js v3.1.1 * http://getbootstrap.com/javascript/#alerts * ======================================================================== - * Copyright 2013 Twitter, Inc. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * Copyright 2011-2014 Twitter, Inc. + * Licensed under MIT (https://github.com/twbs/bootstrap/blob/master/LICENSE) * ======================================================================== */ -+function ($) { "use strict"; ++function ($) { + 'use strict'; // ALERT CLASS DEFINITION // ====================== @@ -163,33 +145,24 @@ if (typeof jQuery === "undefined") { throw new Error("Bootstrap requires jQuery" }(jQuery); /* ======================================================================== - * Bootstrap: button.js v3.0.3 + * Bootstrap: button.js v3.1.1 * http://getbootstrap.com/javascript/#buttons * ======================================================================== - * Copyright 2013 Twitter, Inc. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * Copyright 2011-2014 Twitter, Inc. + * Licensed under MIT (https://github.com/twbs/bootstrap/blob/master/LICENSE) * ======================================================================== */ -+function ($) { "use strict"; ++function ($) { + 'use strict'; // BUTTON PUBLIC CLASS DEFINITION // ============================== var Button = function (element, options) { - this.$element = $(element) - this.options = $.extend({}, Button.DEFAULTS, options) + this.$element = $(element) + this.options = $.extend({}, Button.DEFAULTS, options) + this.isLoading = false } Button.DEFAULTS = { @@ -209,25 +182,26 @@ if (typeof jQuery === "undefined") { throw new Error("Bootstrap requires jQuery" $el[val](data[state] || this.options[state]) // push to event loop to allow forms to submit - setTimeout(function () { - state == 'loadingText' ? - $el.addClass(d).attr(d, d) : - $el.removeClass(d).removeAttr(d); - }, 0) + setTimeout($.proxy(function () { + if (state == 'loadingText') { + this.isLoading = true + $el.addClass(d).attr(d, d) + } else if (this.isLoading) { + this.isLoading = false + $el.removeClass(d).removeAttr(d) + } + }, this), 0) } Button.prototype.toggle = function () { - var $parent = this.$element.closest('[data-toggle="buttons"]') var changed = true + var $parent = this.$element.closest('[data-toggle="buttons"]') if ($parent.length) { var $input = this.$element.find('input') - if ($input.prop('type') === 'radio') { - // see if clicking on current one - if ($input.prop('checked') && this.$element.hasClass('active')) - changed = false - else - $parent.find('.active').removeClass('active') + if ($input.prop('type') == 'radio') { + if ($input.prop('checked') && this.$element.hasClass('active')) changed = false + else $parent.find('.active').removeClass('active') } if (changed) $input.prop('checked', !this.$element.hasClass('active')).trigger('change') } @@ -279,26 +253,16 @@ if (typeof jQuery === "undefined") { throw new Error("Bootstrap requires jQuery" }(jQuery); /* ======================================================================== - * Bootstrap: carousel.js v3.0.3 + * Bootstrap: carousel.js v3.1.1 * http://getbootstrap.com/javascript/#carousel * ======================================================================== - * Copyright 2013 Twitter, Inc. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * Copyright 2011-2014 Twitter, Inc. + * Licensed under MIT (https://github.com/twbs/bootstrap/blob/master/LICENSE) * ======================================================================== */ -+function ($) { "use strict"; ++function ($) { + 'use strict'; // CAROUSEL CLASS DEFINITION // ========================= @@ -319,9 +283,9 @@ if (typeof jQuery === "undefined") { throw new Error("Bootstrap requires jQuery" } Carousel.DEFAULTS = { - interval: 5000 - , pause: 'hover' - , wrap: true + interval: 5000, + pause: 'hover', + wrap: true } Carousel.prototype.cycle = function (e) { @@ -358,7 +322,7 @@ if (typeof jQuery === "undefined") { throw new Error("Bootstrap requires jQuery" Carousel.prototype.pause = function (e) { e || (this.paused = true) - if (this.$element.find('.next, .prev').length && $.support.transition.end) { + if (this.$element.find('.next, .prev').length && $.support.transition) { this.$element.trigger($.support.transition.end) this.cycle(true) } @@ -391,13 +355,15 @@ if (typeof jQuery === "undefined") { throw new Error("Bootstrap requires jQuery" $next = this.$element.find('.item')[fallback]() } - this.sliding = true - - isCycling && this.pause() + if ($next.hasClass('active')) return this.sliding = false var e = $.Event('slide.bs.carousel', { relatedTarget: $next[0], direction: direction }) + this.$element.trigger(e) + if (e.isDefaultPrevented()) return - if ($next.hasClass('active')) return + this.sliding = true + + isCycling && this.pause() if (this.$indicators.length) { this.$indicators.find('.active').removeClass('active') @@ -408,8 +374,6 @@ if (typeof jQuery === "undefined") { throw new Error("Bootstrap requires jQuery" } if ($.support.transition && this.$element.hasClass('slide')) { - this.$element.trigger(e) - if (e.isDefaultPrevented()) return $next.addClass(type) $next[0].offsetWidth // force reflow $active.addClass(direction) @@ -421,10 +385,8 @@ if (typeof jQuery === "undefined") { throw new Error("Bootstrap requires jQuery" that.sliding = false setTimeout(function () { that.$element.trigger('slid.bs.carousel') }, 0) }) - .emulateTransitionEnd(600) + .emulateTransitionEnd($active.css('transition-duration').slice(0, -1) * 1000) } else { - this.$element.trigger(e) - if (e.isDefaultPrevented()) return $active.removeClass('active') $next.addClass('active') this.sliding = false @@ -497,26 +459,16 @@ if (typeof jQuery === "undefined") { throw new Error("Bootstrap requires jQuery" }(jQuery); /* ======================================================================== - * Bootstrap: collapse.js v3.0.3 + * Bootstrap: collapse.js v3.1.1 * http://getbootstrap.com/javascript/#collapse * ======================================================================== - * Copyright 2013 Twitter, Inc. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * Copyright 2011-2014 Twitter, Inc. + * Licensed under MIT (https://github.com/twbs/bootstrap/blob/master/LICENSE) * ======================================================================== */ -+function ($) { "use strict"; ++function ($) { + 'use strict'; // COLLAPSE PUBLIC CLASS DEFINITION // ================================ @@ -567,7 +519,7 @@ if (typeof jQuery === "undefined") { throw new Error("Bootstrap requires jQuery" var complete = function () { this.$element .removeClass('collapsing') - .addClass('in') + .addClass('collapse in') [dimension]('auto') this.transitioning = 0 this.$element.trigger('shown.bs.collapse') @@ -635,6 +587,7 @@ if (typeof jQuery === "undefined") { throw new Error("Bootstrap requires jQuery" 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]() }) @@ -677,26 +630,16 @@ if (typeof jQuery === "undefined") { throw new Error("Bootstrap requires jQuery" }(jQuery); /* ======================================================================== - * Bootstrap: dropdown.js v3.0.3 + * Bootstrap: dropdown.js v3.1.1 * http://getbootstrap.com/javascript/#dropdowns * ======================================================================== - * Copyright 2013 Twitter, Inc. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * Copyright 2011-2014 Twitter, Inc. + * Licensed under MIT (https://github.com/twbs/bootstrap/blob/master/LICENSE) * ======================================================================== */ -+function ($) { "use strict"; ++function ($) { + 'use strict'; // DROPDOWN CLASS DEFINITION // ========================= @@ -723,13 +666,14 @@ if (typeof jQuery === "undefined") { throw new Error("Bootstrap requires jQuery" $('