markup/js/bootstrap.js in twitter_bootstrap_markup-0.0.2 vs markup/js/bootstrap.js in twitter_bootstrap_markup-0.0.3

- old
+ new

@@ -56,14 +56,15 @@ })() }) -}(window.jQuery);/* ========================================================== - * bootstrap-alert.js v2.0.4 - * http://twitter.github.com/bootstrap/javascript.html#alerts - * ========================================================== +}(window.jQuery); +/* ========================================================= + * bootstrap-modal.js v2.0.4 + * http://twitter.github.com/bootstrap/javascript.html#modals + * ========================================================= * Copyright 2012 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 @@ -73,502 +74,212 @@ * 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. - * ========================================================== */ + * ========================================================= */ !function ($) { "use strict"; // jshint ;_; - /* ALERT CLASS DEFINITION + /* MODAL CLASS DEFINITION * ====================== */ - var dismiss = '[data-dismiss="alert"]' - , Alert = function (el) { - $(el).on('click', dismiss, this.close) - } - - Alert.prototype.close = function (e) { - var $this = $(this) - , selector = $this.attr('data-target') - , $parent - - if (!selector) { - selector = $this.attr('href') - selector = selector && selector.replace(/.*(?=#[^\s]*$)/, '') //strip for ie7 - } - - $parent = $(selector) - - e && e.preventDefault() - - $parent.length || ($parent = $this.hasClass('alert') ? $this : $this.parent()) - - $parent.trigger(e = $.Event('close')) - - if (e.isDefaultPrevented()) return - - $parent.removeClass('in') - - function removeElement() { - $parent - .trigger('closed') - .remove() - } - - $.support.transition && $parent.hasClass('fade') ? - $parent.on($.support.transition.end, removeElement) : - removeElement() + var Modal = function (content, options) { + this.options = options + this.$element = $(content) + .delegate('[data-dismiss="modal"]', 'click.dismiss.modal', $.proxy(this.hide, this)) } + Modal.prototype = { - /* ALERT PLUGIN DEFINITION - * ======================= */ + constructor: Modal - $.fn.alert = function (option) { - return this.each(function () { - var $this = $(this) - , data = $this.data('alert') - if (!data) $this.data('alert', (data = new Alert(this))) - if (typeof option == 'string') data[option].call($this) - }) - } + , toggle: function () { + return this[!this.isShown ? 'show' : 'hide']() + } - $.fn.alert.Constructor = Alert + , show: function () { + var that = this + , e = $.Event('show') + this.$element.trigger(e) - /* ALERT DATA-API - * ============== */ + if (this.isShown || e.isDefaultPrevented()) return - $(function () { - $('body').on('click.alert.data-api', dismiss, Alert.prototype.close) - }) + $('body').addClass('modal-open') -}(window.jQuery);/* ============================================================ - * bootstrap-button.js v2.0.4 - * http://twitter.github.com/bootstrap/javascript.html#buttons - * ============================================================ - * Copyright 2012 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. - * ============================================================ */ + this.isShown = true + escape.call(this) + backdrop.call(this, function () { + var transition = $.support.transition && that.$element.hasClass('fade') -!function ($) { + if (!that.$element.parent().length) { + that.$element.appendTo(document.body) //don't move modals dom position + } - "use strict"; // jshint ;_; + that.$element + .show() + if (transition) { + that.$element[0].offsetWidth // force reflow + } - /* BUTTON PUBLIC CLASS DEFINITION - * ============================== */ + that.$element.addClass('in') - var Button = function (element, options) { - this.$element = $(element) - this.options = $.extend({}, $.fn.button.defaults, options) - } + transition ? + that.$element.one($.support.transition.end, function () { that.$element.trigger('shown') }) : + that.$element.trigger('shown') - Button.prototype.setState = function (state) { - var d = 'disabled' - , $el = this.$element - , data = $el.data() - , val = $el.is('input') ? 'val' : 'html' - - state = state + 'Text' - data.resetText || $el.data('resetText', $el[val]()) - - $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) - } - - Button.prototype.toggle = function () { - var $parent = this.$element.parent('[data-toggle="buttons-radio"]') - - $parent && $parent - .find('.active') - .removeClass('active') - - this.$element.toggleClass('active') - } - - - /* BUTTON PLUGIN DEFINITION - * ======================== */ - - $.fn.button = function (option) { - return this.each(function () { - var $this = $(this) - , data = $this.data('button') - , options = typeof option == 'object' && option - if (!data) $this.data('button', (data = new Button(this, options))) - if (option == 'toggle') data.toggle() - else if (option) data.setState(option) - }) - } - - $.fn.button.defaults = { - loadingText: 'loading...' - } - - $.fn.button.Constructor = Button - - - /* BUTTON DATA-API - * =============== */ - - $(function () { - $('body').on('click.button.data-api', '[data-toggle^=button]', function ( e ) { - var $btn = $(e.target) - if (!$btn.hasClass('btn')) $btn = $btn.closest('.btn') - $btn.button('toggle') - }) - }) - -}(window.jQuery);/* ========================================================== - * bootstrap-carousel.js v2.0.4 - * http://twitter.github.com/bootstrap/javascript.html#carousel - * ========================================================== - * Copyright 2012 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. - * ========================================================== */ - - -!function ($) { - - "use strict"; // jshint ;_; - - - /* CAROUSEL CLASS DEFINITION - * ========================= */ - - var Carousel = function (element, options) { - this.$element = $(element) - this.options = options - this.options.slide && this.slide(this.options.slide) - this.options.pause == 'hover' && this.$element - .on('mouseenter', $.proxy(this.pause, this)) - .on('mouseleave', $.proxy(this.cycle, this)) - } - - Carousel.prototype = { - - cycle: function (e) { - if (!e) this.paused = false - this.options.interval - && !this.paused - && (this.interval = setInterval($.proxy(this.next, this), this.options.interval)) - return this - } - - , to: function (pos) { - var $active = this.$element.find('.active') - , children = $active.parent().children() - , activePos = children.index($active) - , that = this - - if (pos > (children.length - 1) || pos < 0) return - - if (this.sliding) { - return this.$element.one('slid', function () { - that.to(pos) }) } - if (activePos == pos) { - return this.pause().cycle() - } + , hide: function (e) { + e && e.preventDefault() - return this.slide(pos > activePos ? 'next' : 'prev', $(children[pos])) - } + var that = this - , pause: function (e) { - if (!e) this.paused = true - clearInterval(this.interval) - this.interval = null - return this - } + e = $.Event('hide') - , next: function () { - if (this.sliding) return - return this.slide('next') - } + this.$element.trigger(e) - , prev: function () { - if (this.sliding) return - return this.slide('prev') - } + if (!this.isShown || e.isDefaultPrevented()) return - , slide: function (type, next) { - var $active = this.$element.find('.active') - , $next = next || $active[type]() - , isCycling = this.interval - , direction = type == 'next' ? 'left' : 'right' - , fallback = type == 'next' ? 'first' : 'last' - , that = this - , e = $.Event('slide') + this.isShown = false - this.sliding = true + $('body').removeClass('modal-open') - isCycling && this.pause() + escape.call(this) - $next = $next.length ? $next : this.$element.find('.item')[fallback]() + this.$element.removeClass('in') - if ($next.hasClass('active')) return - - 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) - $next.addClass(direction) - this.$element.one($.support.transition.end, function () { - $next.removeClass([type, direction].join(' ')).addClass('active') - $active.removeClass(['active', direction].join(' ')) - that.sliding = false - setTimeout(function () { that.$element.trigger('slid') }, 0) - }) - } else { - this.$element.trigger(e) - if (e.isDefaultPrevented()) return - $active.removeClass('active') - $next.addClass('active') - this.sliding = false - this.$element.trigger('slid') + $.support.transition && this.$element.hasClass('fade') ? + hideWithTransition.call(this) : + hideModal.call(this) } - isCycling && this.cycle() - - return this - } - } - /* CAROUSEL PLUGIN DEFINITION - * ========================== */ + /* MODAL PRIVATE METHODS + * ===================== */ - $.fn.carousel = function (option) { - return this.each(function () { - var $this = $(this) - , data = $this.data('carousel') - , options = $.extend({}, $.fn.carousel.defaults, typeof option == 'object' && option) - if (!data) $this.data('carousel', (data = new Carousel(this, options))) - if (typeof option == 'number') data.to(option) - else if (typeof option == 'string' || (option = options.slide)) data[option]() - else if (options.interval) data.cycle() + function hideWithTransition() { + var that = this + , timeout = setTimeout(function () { + that.$element.off($.support.transition.end) + hideModal.call(that) + }, 500) + + this.$element.one($.support.transition.end, function () { + clearTimeout(timeout) + hideModal.call(that) }) } - $.fn.carousel.defaults = { - interval: 5000 - , pause: 'hover' - } + function hideModal(that) { + this.$element + .hide() + .trigger('hidden') - $.fn.carousel.Constructor = Carousel - - - /* CAROUSEL DATA-API - * ================= */ - - $(function () { - $('body').on('click.carousel.data-api', '[data-slide]', function ( e ) { - var $this = $(this), href - , $target = $($this.attr('data-target') || (href = $this.attr('href')) && href.replace(/.*(?=#[^\s]+$)/, '')) //strip for ie7 - , options = !$target.data('modal') && $.extend({}, $target.data(), $this.data()) - $target.carousel(options) - e.preventDefault() - }) - }) - -}(window.jQuery);/* ============================================================= - * bootstrap-collapse.js v2.0.4 - * http://twitter.github.com/bootstrap/javascript.html#collapse - * ============================================================= - * Copyright 2012 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. - * ============================================================ */ - - -!function ($) { - - "use strict"; // jshint ;_; - - - /* COLLAPSE PUBLIC CLASS DEFINITION - * ================================ */ - - var Collapse = function (element, options) { - this.$element = $(element) - this.options = $.extend({}, $.fn.collapse.defaults, options) - - if (this.options.parent) { - this.$parent = $(this.options.parent) - } - - this.options.toggle && this.toggle() + backdrop.call(this) } - Collapse.prototype = { + function backdrop(callback) { + var that = this + , animate = this.$element.hasClass('fade') ? 'fade' : '' - constructor: Collapse + if (this.isShown && this.options.backdrop) { + var doAnimate = $.support.transition && animate - , dimension: function () { - var hasWidth = this.$element.hasClass('width') - return hasWidth ? 'width' : 'height' - } + this.$backdrop = $('<div class="modal-backdrop ' + animate + '" />') + .appendTo(document.body) - , show: function () { - var dimension - , scroll - , actives - , hasData - - if (this.transitioning) return - - dimension = this.dimension() - scroll = $.camelCase(['scroll', dimension].join('-')) - actives = this.$parent && this.$parent.find('> .accordion-group > .in') - - if (actives && actives.length) { - hasData = actives.data('collapse') - if (hasData && hasData.transitioning) return - actives.collapse('hide') - hasData || actives.data('collapse', null) + if (this.options.backdrop != 'static') { + this.$backdrop.click($.proxy(this.hide, this)) } - this.$element[dimension](0) - this.transition('addClass', $.Event('show'), 'shown') - this.$element[dimension](this.$element[0][scroll]) - } + if (doAnimate) this.$backdrop[0].offsetWidth // force reflow - , hide: function () { - var dimension - if (this.transitioning) return - dimension = this.dimension() - this.reset(this.$element[dimension]()) - this.transition('removeClass', $.Event('hide'), 'hidden') - this.$element[dimension](0) - } + this.$backdrop.addClass('in') - , reset: function (size) { - var dimension = this.dimension() + doAnimate ? + this.$backdrop.one($.support.transition.end, callback) : + callback() - this.$element - .removeClass('collapse') - [dimension](size || 'auto') - [0].offsetWidth + } else if (!this.isShown && this.$backdrop) { + this.$backdrop.removeClass('in') - this.$element[size !== null ? 'addClass' : 'removeClass']('collapse') + $.support.transition && this.$element.hasClass('fade')? + this.$backdrop.one($.support.transition.end, $.proxy(removeBackdrop, this)) : + removeBackdrop.call(this) - return this + } else if (callback) { + callback() } + } - , transition: function (method, startEvent, completeEvent) { - var that = this - , complete = function () { - if (startEvent.type == 'show') that.reset() - that.transitioning = 0 - that.$element.trigger(completeEvent) - } + function removeBackdrop() { + this.$backdrop.remove() + this.$backdrop = null + } - this.$element.trigger(startEvent) - - if (startEvent.isDefaultPrevented()) return - - this.transitioning = 1 - - this.$element[method]('in') - - $.support.transition && this.$element.hasClass('collapse') ? - this.$element.one($.support.transition.end, complete) : - complete() + function escape() { + var that = this + if (this.isShown && this.options.keyboard) { + $(document).on('keyup.dismiss.modal', function ( e ) { + e.which == 27 && that.hide() + }) + } else if (!this.isShown) { + $(document).off('keyup.dismiss.modal') } - - , toggle: function () { - this[this.$element.hasClass('in') ? 'hide' : 'show']() - } - } - /* COLLAPSIBLE PLUGIN DEFINITION - * ============================== */ + /* MODAL PLUGIN DEFINITION + * ======================= */ - $.fn.collapse = function (option) { + $.fn.modal = function (option) { return this.each(function () { var $this = $(this) - , data = $this.data('collapse') - , options = typeof option == 'object' && option - if (!data) $this.data('collapse', (data = new Collapse(this, options))) + , data = $this.data('modal') + , options = $.extend({}, $.fn.modal.defaults, $this.data(), typeof option == 'object' && option) + if (!data) $this.data('modal', (data = new Modal(this, options))) if (typeof option == 'string') data[option]() + else if (options.show) data.show() }) } - $.fn.collapse.defaults = { - toggle: true + $.fn.modal.defaults = { + backdrop: true + , keyboard: true + , show: true } - $.fn.collapse.Constructor = Collapse + $.fn.modal.Constructor = Modal - /* COLLAPSIBLE DATA-API - * ==================== */ + /* MODAL DATA-API + * ============== */ $(function () { - $('body').on('click.collapse.data-api', '[data-toggle=collapse]', function ( e ) { + $('body').on('click.modal.data-api', '[data-toggle="modal"]', function ( e ) { var $this = $(this), href - , target = $this.attr('data-target') - || e.preventDefault() - || (href = $this.attr('href')) && href.replace(/.*(?=#[^\s]+$)/, '') //strip for ie7 - , option = $(target).data('collapse') ? 'toggle' : $this.data() - $(target).collapse(option) + , $target = $($this.attr('data-target') || (href = $this.attr('href')) && href.replace(/.*(?=#[^\s]+$)/, '')) //strip for ie7 + , option = $target.data('modal') ? 'toggle' : $.extend({}, $target.data(), $this.data()) + + e.preventDefault() + $target.modal(option) }) }) -}(window.jQuery);/* ============================================================ +}(window.jQuery); +/* ============================================================ * bootstrap-dropdown.js v2.0.4 * http://twitter.github.com/bootstrap/javascript.html#dropdowns * ============================================================ * Copyright 2012 Twitter, Inc. * @@ -663,14 +374,15 @@ $('body') .on('click.dropdown', '.dropdown form', function (e) { e.stopPropagation() }) .on('click.dropdown.data-api', toggle, Dropdown.prototype.toggle) }) -}(window.jQuery);/* ========================================================= - * bootstrap-modal.js v2.0.4 - * http://twitter.github.com/bootstrap/javascript.html#modals - * ========================================================= +}(window.jQuery); +/* ============================================================= + * bootstrap-scrollspy.js v2.0.4 + * http://twitter.github.com/bootstrap/javascript.html#scrollspy + * ============================================================= * Copyright 2012 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 @@ -680,211 +392,280 @@ * 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. - * ========================================================= */ + * ============================================================== */ !function ($) { "use strict"; // jshint ;_; - /* MODAL CLASS DEFINITION - * ====================== */ + /* SCROLLSPY CLASS DEFINITION + * ========================== */ - var Modal = function (content, options) { - this.options = options - this.$element = $(content) - .delegate('[data-dismiss="modal"]', 'click.dismiss.modal', $.proxy(this.hide, this)) + function ScrollSpy( element, options) { + var process = $.proxy(this.process, this) + , $element = $(element).is('body') ? $(window) : $(element) + , href + this.options = $.extend({}, $.fn.scrollspy.defaults, options) + this.$scrollElement = $element.on('scroll.scroll.data-api', process) + this.selector = (this.options.target + || ((href = $(element).attr('href')) && href.replace(/.*(?=#[^\s]+$)/, '')) //strip for ie7 + || '') + ' .nav li > a' + this.$body = $('body') + this.refresh() + this.process() } - Modal.prototype = { + ScrollSpy.prototype = { - constructor: Modal + constructor: ScrollSpy - , toggle: function () { - return this[!this.isShown ? 'show' : 'hide']() - } + , refresh: function () { + var self = this + , $targets - , show: function () { - var that = this - , e = $.Event('show') + this.offsets = $([]) + this.targets = $([]) - this.$element.trigger(e) + $targets = this.$body + .find(this.selector) + .map(function () { + var $el = $(this) + , href = $el.data('target') || $el.attr('href') + , $href = /^#\w/.test(href) && $(href) + return ( $href + && href.length + && [[ $href.position().top, href ]] ) || null + }) + .sort(function (a, b) { return a[0] - b[0] }) + .each(function () { + self.offsets.push(this[0]) + self.targets.push(this[1]) + }) + } - if (this.isShown || e.isDefaultPrevented()) return + , process: function () { + var scrollTop = this.$scrollElement.scrollTop() + this.options.offset + , scrollHeight = this.$scrollElement[0].scrollHeight || this.$body[0].scrollHeight + , maxScroll = scrollHeight - this.$scrollElement.height() + , offsets = this.offsets + , targets = this.targets + , activeTarget = this.activeTarget + , i - $('body').addClass('modal-open') + if (scrollTop >= maxScroll) { + return activeTarget != (i = targets.last()[0]) + && this.activate ( i ) + } - this.isShown = true + for (i = offsets.length; i--;) { + activeTarget != targets[i] + && scrollTop >= offsets[i] + && (!offsets[i + 1] || scrollTop <= offsets[i + 1]) + && this.activate( targets[i] ) + } + } - escape.call(this) - backdrop.call(this, function () { - var transition = $.support.transition && that.$element.hasClass('fade') + , activate: function (target) { + var active + , selector - if (!that.$element.parent().length) { - that.$element.appendTo(document.body) //don't move modals dom position - } + this.activeTarget = target - that.$element - .show() + $(this.selector) + .parent('.active') + .removeClass('active') - if (transition) { - that.$element[0].offsetWidth // force reflow - } + selector = this.selector + + '[data-target="' + target + '"],' + + this.selector + '[href="' + target + '"]' - that.$element.addClass('in') + active = $(selector) + .parent('li') + .addClass('active') - transition ? - that.$element.one($.support.transition.end, function () { that.$element.trigger('shown') }) : - that.$element.trigger('shown') + if (active.parent('.dropdown-menu')) { + active = active.closest('li.dropdown').addClass('active') + } - }) + active.trigger('activate') } - , hide: function (e) { - e && e.preventDefault() + } - var that = this - e = $.Event('hide') + /* SCROLLSPY PLUGIN DEFINITION + * =========================== */ - this.$element.trigger(e) + $.fn.scrollspy = function ( option ) { + return this.each(function () { + var $this = $(this) + , data = $this.data('scrollspy') + , options = typeof option == 'object' && option + if (!data) $this.data('scrollspy', (data = new ScrollSpy(this, options))) + if (typeof option == 'string') data[option]() + }) + } - if (!this.isShown || e.isDefaultPrevented()) return + $.fn.scrollspy.Constructor = ScrollSpy - this.isShown = false + $.fn.scrollspy.defaults = { + offset: 10 + } - $('body').removeClass('modal-open') - escape.call(this) + /* SCROLLSPY DATA-API + * ================== */ - this.$element.removeClass('in') + $(function () { + $('[data-spy="scroll"]').each(function () { + var $spy = $(this) + $spy.scrollspy($spy.data()) + }) + }) - $.support.transition && this.$element.hasClass('fade') ? - hideWithTransition.call(this) : - hideModal.call(this) - } +}(window.jQuery); +/* ======================================================== + * bootstrap-tab.js v2.0.4 + * http://twitter.github.com/bootstrap/javascript.html#tabs + * ======================================================== + * Copyright 2012 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. + * ======================================================== */ - } +!function ($) { - /* MODAL PRIVATE METHODS - * ===================== */ + "use strict"; // jshint ;_; - function hideWithTransition() { - var that = this - , timeout = setTimeout(function () { - that.$element.off($.support.transition.end) - hideModal.call(that) - }, 500) - this.$element.one($.support.transition.end, function () { - clearTimeout(timeout) - hideModal.call(that) - }) - } + /* TAB CLASS DEFINITION + * ==================== */ - function hideModal(that) { - this.$element - .hide() - .trigger('hidden') - - backdrop.call(this) + var Tab = function ( element ) { + this.element = $(element) } - function backdrop(callback) { - var that = this - , animate = this.$element.hasClass('fade') ? 'fade' : '' + Tab.prototype = { - if (this.isShown && this.options.backdrop) { - var doAnimate = $.support.transition && animate + constructor: Tab - this.$backdrop = $('<div class="modal-backdrop ' + animate + '" />') - .appendTo(document.body) + , show: function () { + var $this = this.element + , $ul = $this.closest('ul:not(.dropdown-menu)') + , selector = $this.attr('data-target') + , previous + , $target + , e - if (this.options.backdrop != 'static') { - this.$backdrop.click($.proxy(this.hide, this)) + if (!selector) { + selector = $this.attr('href') + selector = selector && selector.replace(/.*(?=#[^\s]*$)/, '') //strip for ie7 } - if (doAnimate) this.$backdrop[0].offsetWidth // force reflow + if ( $this.parent('li').hasClass('active') ) return - this.$backdrop.addClass('in') + previous = $ul.find('.active a').last()[0] - doAnimate ? - this.$backdrop.one($.support.transition.end, callback) : - callback() + e = $.Event('show', { + relatedTarget: previous + }) - } else if (!this.isShown && this.$backdrop) { - this.$backdrop.removeClass('in') + $this.trigger(e) - $.support.transition && this.$element.hasClass('fade')? - this.$backdrop.one($.support.transition.end, $.proxy(removeBackdrop, this)) : - removeBackdrop.call(this) + if (e.isDefaultPrevented()) return - } else if (callback) { - callback() + $target = $(selector) + + this.activate($this.parent('li'), $ul) + this.activate($target, $target.parent(), function () { + $this.trigger({ + type: 'shown' + , relatedTarget: previous + }) + }) } - } - function removeBackdrop() { - this.$backdrop.remove() - this.$backdrop = null - } + , activate: function ( element, container, callback) { + var $active = container.find('> .active') + , transition = callback + && $.support.transition + && $active.hasClass('fade') - function escape() { - var that = this - if (this.isShown && this.options.keyboard) { - $(document).on('keyup.dismiss.modal', function ( e ) { - e.which == 27 && that.hide() - }) - } else if (!this.isShown) { - $(document).off('keyup.dismiss.modal') + function next() { + $active + .removeClass('active') + .find('> .dropdown-menu > .active') + .removeClass('active') + + element.addClass('active') + + if (transition) { + element[0].offsetWidth // reflow for transition + element.addClass('in') + } else { + element.removeClass('fade') + } + + if ( element.parent('.dropdown-menu') ) { + element.closest('li.dropdown').addClass('active') + } + + callback && callback() + } + + transition ? + $active.one($.support.transition.end, next) : + next() + + $active.removeClass('in') } } - /* MODAL PLUGIN DEFINITION - * ======================= */ + /* TAB PLUGIN DEFINITION + * ===================== */ - $.fn.modal = function (option) { + $.fn.tab = function ( option ) { return this.each(function () { var $this = $(this) - , data = $this.data('modal') - , options = $.extend({}, $.fn.modal.defaults, $this.data(), typeof option == 'object' && option) - if (!data) $this.data('modal', (data = new Modal(this, options))) + , data = $this.data('tab') + if (!data) $this.data('tab', (data = new Tab(this))) if (typeof option == 'string') data[option]() - else if (options.show) data.show() }) } - $.fn.modal.defaults = { - backdrop: true - , keyboard: true - , show: true - } + $.fn.tab.Constructor = Tab - $.fn.modal.Constructor = Modal + /* TAB DATA-API + * ============ */ - /* MODAL DATA-API - * ============== */ - $(function () { - $('body').on('click.modal.data-api', '[data-toggle="modal"]', function ( e ) { - var $this = $(this), href - , $target = $($this.attr('data-target') || (href = $this.attr('href')) && href.replace(/.*(?=#[^\s]+$)/, '')) //strip for ie7 - , option = $target.data('modal') ? 'toggle' : $.extend({}, $target.data(), $this.data()) - + $('body').on('click.tab.data-api', '[data-toggle="tab"], [data-toggle="pill"]', function (e) { e.preventDefault() - $target.modal(option) + $(this).tab('show') }) }) -}(window.jQuery);/* =========================================================== +}(window.jQuery); +/* =========================================================== * bootstrap-tooltip.js v2.0.4 * http://twitter.github.com/bootstrap/javascript.html#tooltips * Inspired by the original jQuery.tipsy by Jason Frame * =========================================================== * Copyright 2012 Twitter, Inc. @@ -1155,10 +936,11 @@ , title: '' , delay: 0 } }(window.jQuery); + /* =========================================================== * bootstrap-popover.js v2.0.4 * http://twitter.github.com/bootstrap/javascript.html#popovers * =========================================================== * Copyright 2012 Twitter, Inc. @@ -1252,14 +1034,15 @@ placement: 'right' , content: '' , template: '<div class="popover"><div class="arrow"></div><div class="popover-inner"><h3 class="popover-title"></h3><div class="popover-content"><p></p></div></div></div>' }) -}(window.jQuery);/* ============================================================= - * bootstrap-scrollspy.js v2.0.4 - * http://twitter.github.com/bootstrap/javascript.html#scrollspy - * ============================================================= +}(window.jQuery); +/* ========================================================== + * bootstrap-alert.js v2.0.4 + * http://twitter.github.com/bootstrap/javascript.html#alerts + * ========================================================== * Copyright 2012 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 @@ -1269,147 +1052,183 @@ * 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. - * ============================================================== */ + * ========================================================== */ !function ($) { "use strict"; // jshint ;_; - /* SCROLLSPY CLASS DEFINITION - * ========================== */ + /* ALERT CLASS DEFINITION + * ====================== */ - function ScrollSpy( element, options) { - var process = $.proxy(this.process, this) - , $element = $(element).is('body') ? $(window) : $(element) - , href - this.options = $.extend({}, $.fn.scrollspy.defaults, options) - this.$scrollElement = $element.on('scroll.scroll.data-api', process) - this.selector = (this.options.target - || ((href = $(element).attr('href')) && href.replace(/.*(?=#[^\s]+$)/, '')) //strip for ie7 - || '') + ' .nav li > a' - this.$body = $('body') - this.refresh() - this.process() + var dismiss = '[data-dismiss="alert"]' + , Alert = function (el) { + $(el).on('click', dismiss, this.close) + } + + Alert.prototype.close = function (e) { + var $this = $(this) + , selector = $this.attr('data-target') + , $parent + + if (!selector) { + selector = $this.attr('href') + selector = selector && selector.replace(/.*(?=#[^\s]*$)/, '') //strip for ie7 + } + + $parent = $(selector) + + e && e.preventDefault() + + $parent.length || ($parent = $this.hasClass('alert') ? $this : $this.parent()) + + $parent.trigger(e = $.Event('close')) + + if (e.isDefaultPrevented()) return + + $parent.removeClass('in') + + function removeElement() { + $parent + .trigger('closed') + .remove() + } + + $.support.transition && $parent.hasClass('fade') ? + $parent.on($.support.transition.end, removeElement) : + removeElement() } - ScrollSpy.prototype = { - constructor: ScrollSpy + /* ALERT PLUGIN DEFINITION + * ======================= */ - , refresh: function () { - var self = this - , $targets + $.fn.alert = function (option) { + return this.each(function () { + var $this = $(this) + , data = $this.data('alert') + if (!data) $this.data('alert', (data = new Alert(this))) + if (typeof option == 'string') data[option].call($this) + }) + } - this.offsets = $([]) - this.targets = $([]) + $.fn.alert.Constructor = Alert - $targets = this.$body - .find(this.selector) - .map(function () { - var $el = $(this) - , href = $el.data('target') || $el.attr('href') - , $href = /^#\w/.test(href) && $(href) - return ( $href - && href.length - && [[ $href.position().top, href ]] ) || null - }) - .sort(function (a, b) { return a[0] - b[0] }) - .each(function () { - self.offsets.push(this[0]) - self.targets.push(this[1]) - }) - } - , process: function () { - var scrollTop = this.$scrollElement.scrollTop() + this.options.offset - , scrollHeight = this.$scrollElement[0].scrollHeight || this.$body[0].scrollHeight - , maxScroll = scrollHeight - this.$scrollElement.height() - , offsets = this.offsets - , targets = this.targets - , activeTarget = this.activeTarget - , i + /* ALERT DATA-API + * ============== */ - if (scrollTop >= maxScroll) { - return activeTarget != (i = targets.last()[0]) - && this.activate ( i ) - } + $(function () { + $('body').on('click.alert.data-api', dismiss, Alert.prototype.close) + }) - for (i = offsets.length; i--;) { - activeTarget != targets[i] - && scrollTop >= offsets[i] - && (!offsets[i + 1] || scrollTop <= offsets[i + 1]) - && this.activate( targets[i] ) - } - } +}(window.jQuery); +/* ============================================================ + * bootstrap-button.js v2.0.4 + * http://twitter.github.com/bootstrap/javascript.html#buttons + * ============================================================ + * Copyright 2012 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. + * ============================================================ */ - , activate: function (target) { - var active - , selector - this.activeTarget = target +!function ($) { - $(this.selector) - .parent('.active') - .removeClass('active') + "use strict"; // jshint ;_; - selector = this.selector - + '[data-target="' + target + '"],' - + this.selector + '[href="' + target + '"]' - active = $(selector) - .parent('li') - .addClass('active') + /* BUTTON PUBLIC CLASS DEFINITION + * ============================== */ - if (active.parent('.dropdown-menu')) { - active = active.closest('li.dropdown').addClass('active') - } + var Button = function (element, options) { + this.$element = $(element) + this.options = $.extend({}, $.fn.button.defaults, options) + } - active.trigger('activate') - } + Button.prototype.setState = function (state) { + var d = 'disabled' + , $el = this.$element + , data = $el.data() + , val = $el.is('input') ? 'val' : 'html' + state = state + 'Text' + data.resetText || $el.data('resetText', $el[val]()) + + $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) } + Button.prototype.toggle = function () { + var $parent = this.$element.parent('[data-toggle="buttons-radio"]') - /* SCROLLSPY PLUGIN DEFINITION - * =========================== */ + $parent && $parent + .find('.active') + .removeClass('active') - $.fn.scrollspy = function ( option ) { + this.$element.toggleClass('active') + } + + + /* BUTTON PLUGIN DEFINITION + * ======================== */ + + $.fn.button = function (option) { return this.each(function () { var $this = $(this) - , data = $this.data('scrollspy') + , data = $this.data('button') , options = typeof option == 'object' && option - if (!data) $this.data('scrollspy', (data = new ScrollSpy(this, options))) - if (typeof option == 'string') data[option]() + if (!data) $this.data('button', (data = new Button(this, options))) + if (option == 'toggle') data.toggle() + else if (option) data.setState(option) }) } - $.fn.scrollspy.Constructor = ScrollSpy - - $.fn.scrollspy.defaults = { - offset: 10 + $.fn.button.defaults = { + loadingText: 'loading...' } + $.fn.button.Constructor = Button - /* SCROLLSPY DATA-API - * ================== */ + /* BUTTON DATA-API + * =============== */ + $(function () { - $('[data-spy="scroll"]').each(function () { - var $spy = $(this) - $spy.scrollspy($spy.data()) + $('body').on('click.button.data-api', '[data-toggle^=button]', function ( e ) { + var $btn = $(e.target) + if (!$btn.hasClass('btn')) $btn = $btn.closest('.btn') + $btn.button('toggle') }) }) -}(window.jQuery);/* ======================================================== - * bootstrap-tab.js v2.0.4 - * http://twitter.github.com/bootstrap/javascript.html#tabs - * ======================================================== +}(window.jQuery); +/* ============================================================= + * bootstrap-collapse.js v2.0.4 + * http://twitter.github.com/bootstrap/javascript.html#collapse + * ============================================================= * Copyright 2012 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 @@ -1419,127 +1238,319 @@ * 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. - * ======================================================== */ + * ============================================================ */ !function ($) { "use strict"; // jshint ;_; - /* TAB CLASS DEFINITION - * ==================== */ + /* COLLAPSE PUBLIC CLASS DEFINITION + * ================================ */ - var Tab = function ( element ) { - this.element = $(element) + var Collapse = function (element, options) { + this.$element = $(element) + this.options = $.extend({}, $.fn.collapse.defaults, options) + + if (this.options.parent) { + this.$parent = $(this.options.parent) + } + + this.options.toggle && this.toggle() } - Tab.prototype = { + Collapse.prototype = { - constructor: Tab + constructor: Collapse + , dimension: function () { + var hasWidth = this.$element.hasClass('width') + return hasWidth ? 'width' : 'height' + } + , show: function () { - var $this = this.element - , $ul = $this.closest('ul:not(.dropdown-menu)') - , selector = $this.attr('data-target') - , previous - , $target - , e + var dimension + , scroll + , actives + , hasData - if (!selector) { - selector = $this.attr('href') - selector = selector && selector.replace(/.*(?=#[^\s]*$)/, '') //strip for ie7 + if (this.transitioning) return + + dimension = this.dimension() + scroll = $.camelCase(['scroll', dimension].join('-')) + actives = this.$parent && this.$parent.find('> .accordion-group > .in') + + if (actives && actives.length) { + hasData = actives.data('collapse') + if (hasData && hasData.transitioning) return + actives.collapse('hide') + hasData || actives.data('collapse', null) } - if ( $this.parent('li').hasClass('active') ) return + this.$element[dimension](0) + this.transition('addClass', $.Event('show'), 'shown') + this.$element[dimension](this.$element[0][scroll]) + } - previous = $ul.find('.active a').last()[0] + , hide: function () { + var dimension + if (this.transitioning) return + dimension = this.dimension() + this.reset(this.$element[dimension]()) + this.transition('removeClass', $.Event('hide'), 'hidden') + this.$element[dimension](0) + } - e = $.Event('show', { - relatedTarget: previous - }) + , reset: function (size) { + var dimension = this.dimension() - $this.trigger(e) + this.$element + .removeClass('collapse') + [dimension](size || 'auto') + [0].offsetWidth - if (e.isDefaultPrevented()) return + this.$element[size !== null ? 'addClass' : 'removeClass']('collapse') - $target = $(selector) + return this + } - this.activate($this.parent('li'), $ul) - this.activate($target, $target.parent(), function () { - $this.trigger({ - type: 'shown' - , relatedTarget: previous + , transition: function (method, startEvent, completeEvent) { + var that = this + , complete = function () { + if (startEvent.type == 'show') that.reset() + that.transitioning = 0 + that.$element.trigger(completeEvent) + } + + this.$element.trigger(startEvent) + + if (startEvent.isDefaultPrevented()) return + + this.transitioning = 1 + + this.$element[method]('in') + + $.support.transition && this.$element.hasClass('collapse') ? + this.$element.one($.support.transition.end, complete) : + complete() + } + + , toggle: function () { + this[this.$element.hasClass('in') ? 'hide' : 'show']() + } + + } + + + /* COLLAPSIBLE PLUGIN DEFINITION + * ============================== */ + + $.fn.collapse = function (option) { + return this.each(function () { + var $this = $(this) + , data = $this.data('collapse') + , options = typeof option == 'object' && option + if (!data) $this.data('collapse', (data = new Collapse(this, options))) + if (typeof option == 'string') data[option]() + }) + } + + $.fn.collapse.defaults = { + toggle: true + } + + $.fn.collapse.Constructor = Collapse + + + /* COLLAPSIBLE DATA-API + * ==================== */ + + $(function () { + $('body').on('click.collapse.data-api', '[data-toggle=collapse]', function ( e ) { + var $this = $(this), href + , target = $this.attr('data-target') + || e.preventDefault() + || (href = $this.attr('href')) && href.replace(/.*(?=#[^\s]+$)/, '') //strip for ie7 + , option = $(target).data('collapse') ? 'toggle' : $this.data() + $(target).collapse(option) + }) + }) + +}(window.jQuery); +/* ========================================================== + * bootstrap-carousel.js v2.0.4 + * http://twitter.github.com/bootstrap/javascript.html#carousel + * ========================================================== + * Copyright 2012 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. + * ========================================================== */ + + +!function ($) { + + "use strict"; // jshint ;_; + + + /* CAROUSEL CLASS DEFINITION + * ========================= */ + + var Carousel = function (element, options) { + this.$element = $(element) + this.options = options + this.options.slide && this.slide(this.options.slide) + this.options.pause == 'hover' && this.$element + .on('mouseenter', $.proxy(this.pause, this)) + .on('mouseleave', $.proxy(this.cycle, this)) + } + + Carousel.prototype = { + + cycle: function (e) { + if (!e) this.paused = false + this.options.interval + && !this.paused + && (this.interval = setInterval($.proxy(this.next, this), this.options.interval)) + return this + } + + , to: function (pos) { + var $active = this.$element.find('.active') + , children = $active.parent().children() + , activePos = children.index($active) + , that = this + + if (pos > (children.length - 1) || pos < 0) return + + if (this.sliding) { + return this.$element.one('slid', function () { + that.to(pos) }) - }) + } + + if (activePos == pos) { + return this.pause().cycle() + } + + return this.slide(pos > activePos ? 'next' : 'prev', $(children[pos])) } - , activate: function ( element, container, callback) { - var $active = container.find('> .active') - , transition = callback - && $.support.transition - && $active.hasClass('fade') + , pause: function (e) { + if (!e) this.paused = true + clearInterval(this.interval) + this.interval = null + return this + } - function next() { - $active - .removeClass('active') - .find('> .dropdown-menu > .active') - .removeClass('active') + , next: function () { + if (this.sliding) return + return this.slide('next') + } - element.addClass('active') + , prev: function () { + if (this.sliding) return + return this.slide('prev') + } - if (transition) { - element[0].offsetWidth // reflow for transition - element.addClass('in') - } else { - element.removeClass('fade') - } + , slide: function (type, next) { + var $active = this.$element.find('.active') + , $next = next || $active[type]() + , isCycling = this.interval + , direction = type == 'next' ? 'left' : 'right' + , fallback = type == 'next' ? 'first' : 'last' + , that = this + , e = $.Event('slide') - if ( element.parent('.dropdown-menu') ) { - element.closest('li.dropdown').addClass('active') - } + this.sliding = true - callback && callback() + isCycling && this.pause() + + $next = $next.length ? $next : this.$element.find('.item')[fallback]() + + if ($next.hasClass('active')) return + + 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) + $next.addClass(direction) + this.$element.one($.support.transition.end, function () { + $next.removeClass([type, direction].join(' ')).addClass('active') + $active.removeClass(['active', direction].join(' ')) + that.sliding = false + setTimeout(function () { that.$element.trigger('slid') }, 0) + }) + } else { + this.$element.trigger(e) + if (e.isDefaultPrevented()) return + $active.removeClass('active') + $next.addClass('active') + this.sliding = false + this.$element.trigger('slid') } - transition ? - $active.one($.support.transition.end, next) : - next() + isCycling && this.cycle() - $active.removeClass('in') + return this } + } - /* TAB PLUGIN DEFINITION - * ===================== */ + /* CAROUSEL PLUGIN DEFINITION + * ========================== */ - $.fn.tab = function ( option ) { + $.fn.carousel = function (option) { return this.each(function () { var $this = $(this) - , data = $this.data('tab') - if (!data) $this.data('tab', (data = new Tab(this))) - if (typeof option == 'string') data[option]() + , data = $this.data('carousel') + , options = $.extend({}, $.fn.carousel.defaults, typeof option == 'object' && option) + if (!data) $this.data('carousel', (data = new Carousel(this, options))) + if (typeof option == 'number') data.to(option) + else if (typeof option == 'string' || (option = options.slide)) data[option]() + else if (options.interval) data.cycle() }) } - $.fn.tab.Constructor = Tab + $.fn.carousel.defaults = { + interval: 5000 + , pause: 'hover' + } + $.fn.carousel.Constructor = Carousel - /* TAB DATA-API - * ============ */ + /* CAROUSEL DATA-API + * ================= */ + $(function () { - $('body').on('click.tab.data-api', '[data-toggle="tab"], [data-toggle="pill"]', function (e) { + $('body').on('click.carousel.data-api', '[data-slide]', function ( e ) { + var $this = $(this), href + , $target = $($this.attr('data-target') || (href = $this.attr('href')) && href.replace(/.*(?=#[^\s]+$)/, '')) //strip for ie7 + , options = !$target.data('modal') && $.extend({}, $target.data(), $this.data()) + $target.carousel(options) e.preventDefault() - $(this).tab('show') }) }) -}(window.jQuery);/* ============================================================= +}(window.jQuery); +/* ============================================================= * bootstrap-typeahead.js v2.0.4 * http://twitter.github.com/bootstrap/javascript.html#typeahead * ============================================================= * Copyright 2012 Twitter, Inc. * \ No newline at end of file