1 /* NUGET: BEGIN LICENSE TEXT
3 * Microsoft grants you the right to use these script files for the sole
4 * purpose of either: (i) interacting through your browser with the Microsoft
5 * website or online service, subject to the applicable licensing or use
6 * terms; or (ii) using the files as included with a Microsoft product subject
7 * to that product's license terms. Microsoft reserves all other rights to the
8 * files not expressly granted by Microsoft, whether by implication, estoppel
9 * or otherwise. Insofar as a script file is dual licensed under GPL,
10 * Microsoft neither took the code under GPL nor distributes it thereunder but
11 * under the terms set out in this paragraph. All notices and licenses
12 * below are for informational purposes only.
14 * NUGET: END LICENSE TEXT */
17 * bootstrap.js v3.0.0 by @fat and @mdo
18 * Copyright 2013 Twitter Inc.
19 * http://www.apache.org/licenses/LICENSE-2.0
21 if (!jQuery) { throw new Error("Bootstrap requires jQuery") }
23 /* ========================================================================
24 * Bootstrap: transition.js v3.0.0
25 * http://twbs.github.com/bootstrap/javascript.html#transitions
26 * ========================================================================
27 * Copyright 2013 Twitter, Inc.
29 * Licensed under the Apache License, Version 2.0 (the "License");
30 * you may not use this file except in compliance with the License.
31 * You may obtain a copy of the License at
33 * http://www.apache.org/licenses/LICENSE-2.0
35 * Unless required by applicable law or agreed to in writing, software
36 * distributed under the License is distributed on an "AS IS" BASIS,
37 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
38 * See the License for the specific language governing permissions and
39 * limitations under the License.
40 * ======================================================================== */
43 +function ($) { "use strict";
45 // CSS TRANSITION SUPPORT (Shoutout: http://www.modernizr.com/)
46 // ============================================================
48 function transitionEnd() {
49 var el = document.createElement('bootstrap')
51 var transEndEventNames = {
52 'WebkitTransition' : 'webkitTransitionEnd'
53 , 'MozTransition' : 'transitionend'
54 , 'OTransition' : 'oTransitionEnd otransitionend'
55 , 'transition' : 'transitionend'
58 for (var name in transEndEventNames) {
59 if (el.style[name] !== undefined) {
60 return { end: transEndEventNames[name] }
65 // http://blog.alexmaccaw.com/css-transitions
66 $.fn.emulateTransitionEnd = function (duration) {
67 var called = false, $el = this
68 $(this).one($.support.transition.end, function () { called = true })
69 var callback = function () { if (!called) $($el).trigger($.support.transition.end) }
70 setTimeout(callback, duration)
75 $.support.transition = transitionEnd()
80 /* ========================================================================
81 * Bootstrap: alert.js v3.0.0
82 * http://twbs.github.com/bootstrap/javascript.html#alerts
83 * ========================================================================
84 * Copyright 2013 Twitter, Inc.
86 * Licensed under the Apache License, Version 2.0 (the "License");
87 * you may not use this file except in compliance with the License.
88 * You may obtain a copy of the License at
90 * http://www.apache.org/licenses/LICENSE-2.0
92 * Unless required by applicable law or agreed to in writing, software
93 * distributed under the License is distributed on an "AS IS" BASIS,
94 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
95 * See the License for the specific language governing permissions and
96 * limitations under the License.
97 * ======================================================================== */
100 +function ($) { "use strict";
102 // ALERT CLASS DEFINITION
103 // ======================
105 var dismiss = '[data-dismiss="alert"]'
106 var Alert = function (el) {
107 $(el).on('click', dismiss, this.close)
110 Alert.prototype.close = function (e) {
112 var selector = $this.attr('data-target')
115 selector = $this.attr('href')
116 selector = selector && selector.replace(/.*(?=#[^\s]*$)/, '') // strip for ie7
119 var $parent = $(selector)
121 if (e) e.preventDefault()
123 if (!$parent.length) {
124 $parent = $this.hasClass('alert') ? $this : $this.parent()
127 $parent.trigger(e = $.Event('close.bs.alert'))
129 if (e.isDefaultPrevented()) return
131 $parent.removeClass('in')
133 function removeElement() {
134 $parent.trigger('closed.bs.alert').remove()
137 $.support.transition && $parent.hasClass('fade') ?
139 .one($.support.transition.end, removeElement)
140 .emulateTransitionEnd(150) :
145 // ALERT PLUGIN DEFINITION
146 // =======================
150 $.fn.alert = function (option) {
151 return this.each(function () {
153 var data = $this.data('bs.alert')
155 if (!data) $this.data('bs.alert', (data = new Alert(this)))
156 if (typeof option == 'string') data[option].call($this)
160 $.fn.alert.Constructor = Alert
166 $.fn.alert.noConflict = function () {
175 $(document).on('click.bs.alert.data-api', dismiss, Alert.prototype.close)
179 /* ========================================================================
180 * Bootstrap: button.js v3.0.0
181 * http://twbs.github.com/bootstrap/javascript.html#buttons
182 * ========================================================================
183 * Copyright 2013 Twitter, Inc.
185 * Licensed under the Apache License, Version 2.0 (the "License");
186 * you may not use this file except in compliance with the License.
187 * You may obtain a copy of the License at
189 * http://www.apache.org/licenses/LICENSE-2.0
191 * Unless required by applicable law or agreed to in writing, software
192 * distributed under the License is distributed on an "AS IS" BASIS,
193 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
194 * See the License for the specific language governing permissions and
195 * limitations under the License.
196 * ======================================================================== */
199 +function ($) { "use strict";
201 // BUTTON PUBLIC CLASS DEFINITION
202 // ==============================
204 var Button = function (element, options) {
205 this.$element = $(element)
206 this.options = $.extend({}, Button.DEFAULTS, options)
210 loadingText: 'loading...'
213 Button.prototype.setState = function (state) {
215 var $el = this.$element
216 var val = $el.is('input') ? 'val' : 'html'
217 var data = $el.data()
219 state = state + 'Text'
221 if (!data.resetText) $el.data('resetText', $el[val]())
223 $el[val](data[state] || this.options[state])
225 // push to event loop to allow forms to submit
226 setTimeout(function () {
227 state == 'loadingText' ?
228 $el.addClass(d).attr(d, d) :
229 $el.removeClass(d).removeAttr(d);
233 Button.prototype.toggle = function () {
234 var $parent = this.$element.closest('[data-toggle="buttons"]')
236 if ($parent.length) {
237 var $input = this.$element.find('input')
238 .prop('checked', !this.$element.hasClass('active'))
240 if ($input.prop('type') === 'radio') $parent.find('.active').removeClass('active')
243 this.$element.toggleClass('active')
247 // BUTTON PLUGIN DEFINITION
248 // ========================
250 var old = $.fn.button
252 $.fn.button = function (option) {
253 return this.each(function () {
255 var data = $this.data('bs.button')
256 var options = typeof option == 'object' && option
258 if (!data) $this.data('bs.button', (data = new Button(this, options)))
260 if (option == 'toggle') data.toggle()
261 else if (option) data.setState(option)
265 $.fn.button.Constructor = Button
268 // BUTTON NO CONFLICT
269 // ==================
271 $.fn.button.noConflict = function () {
280 $(document).on('click.bs.button.data-api', '[data-toggle^=button]', function (e) {
281 var $btn = $(e.target)
282 if (!$btn.hasClass('btn')) $btn = $btn.closest('.btn')
283 $btn.button('toggle')
289 /* ========================================================================
290 * Bootstrap: carousel.js v3.0.0
291 * http://twbs.github.com/bootstrap/javascript.html#carousel
292 * ========================================================================
293 * Copyright 2012 Twitter, Inc.
295 * Licensed under the Apache License, Version 2.0 (the "License");
296 * you may not use this file except in compliance with the License.
297 * You may obtain a copy of the License at
299 * http://www.apache.org/licenses/LICENSE-2.0
301 * Unless required by applicable law or agreed to in writing, software
302 * distributed under the License is distributed on an "AS IS" BASIS,
303 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
304 * See the License for the specific language governing permissions and
305 * limitations under the License.
306 * ======================================================================== */
309 +function ($) { "use strict";
311 // CAROUSEL CLASS DEFINITION
312 // =========================
314 var Carousel = function (element, options) {
315 this.$element = $(element)
316 this.$indicators = this.$element.find('.carousel-indicators')
317 this.options = options
324 this.options.pause == 'hover' && this.$element
325 .on('mouseenter', $.proxy(this.pause, this))
326 .on('mouseleave', $.proxy(this.cycle, this))
329 Carousel.DEFAULTS = {
335 Carousel.prototype.cycle = function (e) {
336 e || (this.paused = false)
338 this.interval && clearInterval(this.interval)
340 this.options.interval
342 && (this.interval = setInterval($.proxy(this.next, this), this.options.interval))
347 Carousel.prototype.getActiveIndex = function () {
348 this.$active = this.$element.find('.item.active')
349 this.$items = this.$active.parent().children()
351 return this.$items.index(this.$active)
354 Carousel.prototype.to = function (pos) {
356 var activeIndex = this.getActiveIndex()
358 if (pos > (this.$items.length - 1) || pos < 0) return
360 if (this.sliding) return this.$element.one('slid', function () { that.to(pos) })
361 if (activeIndex == pos) return this.pause().cycle()
363 return this.slide(pos > activeIndex ? 'next' : 'prev', $(this.$items[pos]))
366 Carousel.prototype.pause = function (e) {
367 e || (this.paused = true)
369 if (this.$element.find('.next, .prev').length && $.support.transition.end) {
370 this.$element.trigger($.support.transition.end)
374 this.interval = clearInterval(this.interval)
379 Carousel.prototype.next = function () {
380 if (this.sliding) return
381 return this.slide('next')
384 Carousel.prototype.prev = function () {
385 if (this.sliding) return
386 return this.slide('prev')
389 Carousel.prototype.slide = function (type, next) {
390 var $active = this.$element.find('.item.active')
391 var $next = next || $active[type]()
392 var isCycling = this.interval
393 var direction = type == 'next' ? 'left' : 'right'
394 var fallback = type == 'next' ? 'first' : 'last'
398 if (!this.options.wrap) return
399 $next = this.$element.find('.item')[fallback]()
404 isCycling && this.pause()
406 var e = $.Event('slide.bs.carousel', { relatedTarget: $next[0], direction: direction })
408 if ($next.hasClass('active')) return
410 if (this.$indicators.length) {
411 this.$indicators.find('.active').removeClass('active')
412 this.$element.one('slid', function () {
413 var $nextIndicator = $(that.$indicators.children()[that.getActiveIndex()])
414 $nextIndicator && $nextIndicator.addClass('active')
418 if ($.support.transition && this.$element.hasClass('slide')) {
419 this.$element.trigger(e)
420 if (e.isDefaultPrevented()) return
422 $next[0].offsetWidth // force reflow
423 $active.addClass(direction)
424 $next.addClass(direction)
426 .one($.support.transition.end, function () {
427 $next.removeClass([type, direction].join(' ')).addClass('active')
428 $active.removeClass(['active', direction].join(' '))
430 setTimeout(function () { that.$element.trigger('slid') }, 0)
432 .emulateTransitionEnd(600)
434 this.$element.trigger(e)
435 if (e.isDefaultPrevented()) return
436 $active.removeClass('active')
437 $next.addClass('active')
439 this.$element.trigger('slid')
442 isCycling && this.cycle()
448 // CAROUSEL PLUGIN DEFINITION
449 // ==========================
451 var old = $.fn.carousel
453 $.fn.carousel = function (option) {
454 return this.each(function () {
456 var data = $this.data('bs.carousel')
457 var options = $.extend({}, Carousel.DEFAULTS, $this.data(), typeof option == 'object' && option)
458 var action = typeof option == 'string' ? option : options.slide
460 if (!data) $this.data('bs.carousel', (data = new Carousel(this, options)))
461 if (typeof option == 'number') data.to(option)
462 else if (action) data[action]()
463 else if (options.interval) data.pause().cycle()
467 $.fn.carousel.Constructor = Carousel
470 // CAROUSEL NO CONFLICT
471 // ====================
473 $.fn.carousel.noConflict = function () {
482 $(document).on('click.bs.carousel.data-api', '[data-slide], [data-slide-to]', function (e) {
483 var $this = $(this), href
484 var $target = $($this.attr('data-target') || (href = $this.attr('href')) && href.replace(/.*(?=#[^\s]+$)/, '')) //strip for ie7
485 var options = $.extend({}, $target.data(), $this.data())
486 var slideIndex = $this.attr('data-slide-to')
487 if (slideIndex) options.interval = false
489 $target.carousel(options)
491 if (slideIndex = $this.attr('data-slide-to')) {
492 $target.data('bs.carousel').to(slideIndex)
498 $(window).on('load', function () {
499 $('[data-ride="carousel"]').each(function () {
500 var $carousel = $(this)
501 $carousel.carousel($carousel.data())
507 /* ========================================================================
508 * Bootstrap: collapse.js v3.0.0
509 * http://twbs.github.com/bootstrap/javascript.html#collapse
510 * ========================================================================
511 * Copyright 2012 Twitter, Inc.
513 * Licensed under the Apache License, Version 2.0 (the "License");
514 * you may not use this file except in compliance with the License.
515 * You may obtain a copy of the License at
517 * http://www.apache.org/licenses/LICENSE-2.0
519 * Unless required by applicable law or agreed to in writing, software
520 * distributed under the License is distributed on an "AS IS" BASIS,
521 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
522 * See the License for the specific language governing permissions and
523 * limitations under the License.
524 * ======================================================================== */
527 +function ($) { "use strict";
529 // COLLAPSE PUBLIC CLASS DEFINITION
530 // ================================
532 var Collapse = function (element, options) {
533 this.$element = $(element)
534 this.options = $.extend({}, Collapse.DEFAULTS, options)
535 this.transitioning = null
537 if (this.options.parent) this.$parent = $(this.options.parent)
538 if (this.options.toggle) this.toggle()
541 Collapse.DEFAULTS = {
545 Collapse.prototype.dimension = function () {
546 var hasWidth = this.$element.hasClass('width')
547 return hasWidth ? 'width' : 'height'
550 Collapse.prototype.show = function () {
551 if (this.transitioning || this.$element.hasClass('in')) return
553 var startEvent = $.Event('show.bs.collapse')
554 this.$element.trigger(startEvent)
555 if (startEvent.isDefaultPrevented()) return
557 var actives = this.$parent && this.$parent.find('> .panel > .in')
559 if (actives && actives.length) {
560 var hasData = actives.data('bs.collapse')
561 if (hasData && hasData.transitioning) return
562 actives.collapse('hide')
563 hasData || actives.data('bs.collapse', null)
566 var dimension = this.dimension()
569 .removeClass('collapse')
570 .addClass('collapsing')
573 this.transitioning = 1
575 var complete = function () {
577 .removeClass('collapsing')
580 this.transitioning = 0
581 this.$element.trigger('shown.bs.collapse')
584 if (!$.support.transition) return complete.call(this)
586 var scrollSize = $.camelCase(['scroll', dimension].join('-'))
589 .one($.support.transition.end, $.proxy(complete, this))
590 .emulateTransitionEnd(350)
591 [dimension](this.$element[0][scrollSize])
594 Collapse.prototype.hide = function () {
595 if (this.transitioning || !this.$element.hasClass('in')) return
597 var startEvent = $.Event('hide.bs.collapse')
598 this.$element.trigger(startEvent)
599 if (startEvent.isDefaultPrevented()) return
601 var dimension = this.dimension()
604 [dimension](this.$element[dimension]())
608 .addClass('collapsing')
609 .removeClass('collapse')
612 this.transitioning = 1
614 var complete = function () {
615 this.transitioning = 0
617 .trigger('hidden.bs.collapse')
618 .removeClass('collapsing')
619 .addClass('collapse')
622 if (!$.support.transition) return complete.call(this)
626 .one($.support.transition.end, $.proxy(complete, this))
627 .emulateTransitionEnd(350)
630 Collapse.prototype.toggle = function () {
631 this[this.$element.hasClass('in') ? 'hide' : 'show']()
635 // COLLAPSE PLUGIN DEFINITION
636 // ==========================
638 var old = $.fn.collapse
640 $.fn.collapse = function (option) {
641 return this.each(function () {
643 var data = $this.data('bs.collapse')
644 var options = $.extend({}, Collapse.DEFAULTS, $this.data(), typeof option == 'object' && option)
646 if (!data) $this.data('bs.collapse', (data = new Collapse(this, options)))
647 if (typeof option == 'string') data[option]()
651 $.fn.collapse.Constructor = Collapse
654 // COLLAPSE NO CONFLICT
655 // ====================
657 $.fn.collapse.noConflict = function () {
666 $(document).on('click.bs.collapse.data-api', '[data-toggle=collapse]', function (e) {
667 var $this = $(this), href
668 var target = $this.attr('data-target')
669 || e.preventDefault()
670 || (href = $this.attr('href')) && href.replace(/.*(?=#[^\s]+$)/, '') //strip for ie7
671 var $target = $(target)
672 var data = $target.data('bs.collapse')
673 var option = data ? 'toggle' : $this.data()
674 var parent = $this.attr('data-parent')
675 var $parent = parent && $(parent)
677 if (!data || !data.transitioning) {
678 if ($parent) $parent.find('[data-toggle=collapse][data-parent="' + parent + '"]').not($this).addClass('collapsed')
679 $this[$target.hasClass('in') ? 'addClass' : 'removeClass']('collapsed')
682 $target.collapse(option)
687 /* ========================================================================
688 * Bootstrap: dropdown.js v3.0.0
689 * http://twbs.github.com/bootstrap/javascript.html#dropdowns
690 * ========================================================================
691 * Copyright 2012 Twitter, Inc.
693 * Licensed under the Apache License, Version 2.0 (the "License");
694 * you may not use this file except in compliance with the License.
695 * You may obtain a copy of the License at
697 * http://www.apache.org/licenses/LICENSE-2.0
699 * Unless required by applicable law or agreed to in writing, software
700 * distributed under the License is distributed on an "AS IS" BASIS,
701 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
702 * See the License for the specific language governing permissions and
703 * limitations under the License.
704 * ======================================================================== */
707 +function ($) { "use strict";
709 // DROPDOWN CLASS DEFINITION
710 // =========================
712 var backdrop = '.dropdown-backdrop'
713 var toggle = '[data-toggle=dropdown]'
714 var Dropdown = function (element) {
715 var $el = $(element).on('click.bs.dropdown', this.toggle)
718 Dropdown.prototype.toggle = function (e) {
721 if ($this.is('.disabled, :disabled')) return
723 var $parent = getParent($this)
724 var isActive = $parent.hasClass('open')
729 if ('ontouchstart' in document.documentElement && !$parent.closest('.navbar-nav').length) {
730 // if mobile we we use a backdrop because click events don't delegate
731 $('<div class="dropdown-backdrop"/>').insertAfter($(this)).on('click', clearMenus)
734 $parent.trigger(e = $.Event('show.bs.dropdown'))
736 if (e.isDefaultPrevented()) return
740 .trigger('shown.bs.dropdown')
748 Dropdown.prototype.keydown = function (e) {
749 if (!/(38|40|27)/.test(e.keyCode)) return
756 if ($this.is('.disabled, :disabled')) return
758 var $parent = getParent($this)
759 var isActive = $parent.hasClass('open')
761 if (!isActive || (isActive && e.keyCode == 27)) {
762 if (e.which == 27) $parent.find(toggle).focus()
766 var $items = $('[role=menu] li:not(.divider):visible a', $parent)
768 if (!$items.length) return
770 var index = $items.index($items.filter(':focus'))
772 if (e.keyCode == 38 && index > 0) index-- // up
773 if (e.keyCode == 40 && index < $items.length - 1) index++ // down
776 $items.eq(index).focus()
779 function clearMenus() {
781 $(toggle).each(function (e) {
782 var $parent = getParent($(this))
783 if (!$parent.hasClass('open')) return
784 $parent.trigger(e = $.Event('hide.bs.dropdown'))
785 if (e.isDefaultPrevented()) return
786 $parent.removeClass('open').trigger('hidden.bs.dropdown')
790 function getParent($this) {
791 var selector = $this.attr('data-target')
794 selector = $this.attr('href')
795 selector = selector && /#/.test(selector) && selector.replace(/.*(?=#[^\s]*$)/, '') //strip for ie7
798 var $parent = selector && $(selector)
800 return $parent && $parent.length ? $parent : $this.parent()
804 // DROPDOWN PLUGIN DEFINITION
805 // ==========================
807 var old = $.fn.dropdown
809 $.fn.dropdown = function (option) {
810 return this.each(function () {
812 var data = $this.data('dropdown')
814 if (!data) $this.data('dropdown', (data = new Dropdown(this)))
815 if (typeof option == 'string') data[option].call($this)
819 $.fn.dropdown.Constructor = Dropdown
822 // DROPDOWN NO CONFLICT
823 // ====================
825 $.fn.dropdown.noConflict = function () {
831 // APPLY TO STANDARD DROPDOWN ELEMENTS
832 // ===================================
835 .on('click.bs.dropdown.data-api', clearMenus)
836 .on('click.bs.dropdown.data-api', '.dropdown form', function (e) { e.stopPropagation() })
837 .on('click.bs.dropdown.data-api' , toggle, Dropdown.prototype.toggle)
838 .on('keydown.bs.dropdown.data-api', toggle + ', [role=menu]' , Dropdown.prototype.keydown)
842 /* ========================================================================
843 * Bootstrap: modal.js v3.0.0
844 * http://twbs.github.com/bootstrap/javascript.html#modals
845 * ========================================================================
846 * Copyright 2012 Twitter, Inc.
848 * Licensed under the Apache License, Version 2.0 (the "License");
849 * you may not use this file except in compliance with the License.
850 * You may obtain a copy of the License at
852 * http://www.apache.org/licenses/LICENSE-2.0
854 * Unless required by applicable law or agreed to in writing, software
855 * distributed under the License is distributed on an "AS IS" BASIS,
856 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
857 * See the License for the specific language governing permissions and
858 * limitations under the License.
859 * ======================================================================== */
862 +function ($) { "use strict";
864 // MODAL CLASS DEFINITION
865 // ======================
867 var Modal = function (element, options) {
868 this.options = options
869 this.$element = $(element)
873 if (this.options.remote) this.$element.load(this.options.remote)
882 Modal.prototype.toggle = function (_relatedTarget) {
883 return this[!this.isShown ? 'show' : 'hide'](_relatedTarget)
886 Modal.prototype.show = function (_relatedTarget) {
888 var e = $.Event('show.bs.modal', { relatedTarget: _relatedTarget })
890 this.$element.trigger(e)
892 if (this.isShown || e.isDefaultPrevented()) return
898 this.$element.on('click.dismiss.modal', '[data-dismiss="modal"]', $.proxy(this.hide, this))
900 this.backdrop(function () {
901 var transition = $.support.transition && that.$element.hasClass('fade')
903 if (!that.$element.parent().length) {
904 that.$element.appendTo(document.body) // don't move modals dom position
910 that.$element[0].offsetWidth // force reflow
915 .attr('aria-hidden', false)
919 var e = $.Event('shown.bs.modal', { relatedTarget: _relatedTarget })
922 that.$element.find('.modal-dialog') // wait for modal to slide in
923 .one($.support.transition.end, function () {
924 that.$element.focus().trigger(e)
926 .emulateTransitionEnd(300) :
927 that.$element.focus().trigger(e)
931 Modal.prototype.hide = function (e) {
932 if (e) e.preventDefault()
934 e = $.Event('hide.bs.modal')
936 this.$element.trigger(e)
938 if (!this.isShown || e.isDefaultPrevented()) return
944 $(document).off('focusin.bs.modal')
948 .attr('aria-hidden', true)
949 .off('click.dismiss.modal')
951 $.support.transition && this.$element.hasClass('fade') ?
953 .one($.support.transition.end, $.proxy(this.hideModal, this))
954 .emulateTransitionEnd(300) :
958 Modal.prototype.enforceFocus = function () {
960 .off('focusin.bs.modal') // guard against infinite focus loop
961 .on('focusin.bs.modal', $.proxy(function (e) {
962 if (this.$element[0] !== e.target && !this.$element.has(e.target).length) {
963 this.$element.focus()
968 Modal.prototype.escape = function () {
969 if (this.isShown && this.options.keyboard) {
970 this.$element.on('keyup.dismiss.bs.modal', $.proxy(function (e) {
971 e.which == 27 && this.hide()
973 } else if (!this.isShown) {
974 this.$element.off('keyup.dismiss.bs.modal')
978 Modal.prototype.hideModal = function () {
981 this.backdrop(function () {
982 that.removeBackdrop()
983 that.$element.trigger('hidden.bs.modal')
987 Modal.prototype.removeBackdrop = function () {
988 this.$backdrop && this.$backdrop.remove()
989 this.$backdrop = null
992 Modal.prototype.backdrop = function (callback) {
994 var animate = this.$element.hasClass('fade') ? 'fade' : ''
996 if (this.isShown && this.options.backdrop) {
997 var doAnimate = $.support.transition && animate
999 this.$backdrop = $('<div class="modal-backdrop ' + animate + '" />')
1000 .appendTo(document.body)
1002 this.$element.on('click.dismiss.modal', $.proxy(function (e) {
1003 if (e.target !== e.currentTarget) return
1004 this.options.backdrop == 'static'
1005 ? this.$element[0].focus.call(this.$element[0])
1006 : this.hide.call(this)
1009 if (doAnimate) this.$backdrop[0].offsetWidth // force reflow
1011 this.$backdrop.addClass('in')
1013 if (!callback) return
1017 .one($.support.transition.end, callback)
1018 .emulateTransitionEnd(150) :
1021 } else if (!this.isShown && this.$backdrop) {
1022 this.$backdrop.removeClass('in')
1024 $.support.transition && this.$element.hasClass('fade')?
1026 .one($.support.transition.end, callback)
1027 .emulateTransitionEnd(150) :
1030 } else if (callback) {
1036 // MODAL PLUGIN DEFINITION
1037 // =======================
1039 var old = $.fn.modal
1041 $.fn.modal = function (option, _relatedTarget) {
1042 return this.each(function () {
1044 var data = $this.data('bs.modal')
1045 var options = $.extend({}, Modal.DEFAULTS, $this.data(), typeof option == 'object' && option)
1047 if (!data) $this.data('bs.modal', (data = new Modal(this, options)))
1048 if (typeof option == 'string') data[option](_relatedTarget)
1049 else if (options.show) data.show(_relatedTarget)
1053 $.fn.modal.Constructor = Modal
1056 // MODAL NO CONFLICT
1057 // =================
1059 $.fn.modal.noConflict = function () {
1068 $(document).on('click.bs.modal.data-api', '[data-toggle="modal"]', function (e) {
1070 var href = $this.attr('href')
1071 var $target = $($this.attr('data-target') || (href && href.replace(/.*(?=#[^\s]+$)/, ''))) //strip for ie7
1072 var option = $target.data('modal') ? 'toggle' : $.extend({ remote: !/#/.test(href) && href }, $target.data(), $this.data())
1077 .modal(option, this)
1078 .one('hide', function () {
1079 $this.is(':visible') && $this.focus()
1084 .on('show.bs.modal', '.modal', function () { $(document.body).addClass('modal-open') })
1085 .on('hidden.bs.modal', '.modal', function () { $(document.body).removeClass('modal-open') })
1089 /* ========================================================================
1090 * Bootstrap: tooltip.js v3.0.0
1091 * http://twbs.github.com/bootstrap/javascript.html#tooltip
1092 * Inspired by the original jQuery.tipsy by Jason Frame
1093 * ========================================================================
1094 * Copyright 2012 Twitter, Inc.
1096 * Licensed under the Apache License, Version 2.0 (the "License");
1097 * you may not use this file except in compliance with the License.
1098 * You may obtain a copy of the License at
1100 * http://www.apache.org/licenses/LICENSE-2.0
1102 * Unless required by applicable law or agreed to in writing, software
1103 * distributed under the License is distributed on an "AS IS" BASIS,
1104 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
1105 * See the License for the specific language governing permissions and
1106 * limitations under the License.
1107 * ======================================================================== */
1110 +function ($) { "use strict";
1112 // TOOLTIP PUBLIC CLASS DEFINITION
1113 // ===============================
1115 var Tooltip = function (element, options) {
1121 this.$element = null
1123 this.init('tooltip', element, options)
1126 Tooltip.DEFAULTS = {
1130 , template: '<div class="tooltip"><div class="tooltip-arrow"></div><div class="tooltip-inner"></div></div>'
1131 , trigger: 'hover focus'
1138 Tooltip.prototype.init = function (type, element, options) {
1141 this.$element = $(element)
1142 this.options = this.getOptions(options)
1144 var triggers = this.options.trigger.split(' ')
1146 for (var i = triggers.length; i--;) {
1147 var trigger = triggers[i]
1149 if (trigger == 'click') {
1150 this.$element.on('click.' + this.type, this.options.selector, $.proxy(this.toggle, this))
1151 } else if (trigger != 'manual') {
1152 var eventIn = trigger == 'hover' ? 'mouseenter' : 'focus'
1153 var eventOut = trigger == 'hover' ? 'mouseleave' : 'blur'
1155 this.$element.on(eventIn + '.' + this.type, this.options.selector, $.proxy(this.enter, this))
1156 this.$element.on(eventOut + '.' + this.type, this.options.selector, $.proxy(this.leave, this))
1160 this.options.selector ?
1161 (this._options = $.extend({}, this.options, { trigger: 'manual', selector: '' })) :
1165 Tooltip.prototype.getDefaults = function () {
1166 return Tooltip.DEFAULTS
1169 Tooltip.prototype.getOptions = function (options) {
1170 options = $.extend({}, this.getDefaults(), this.$element.data(), options)
1172 if (options.delay && typeof options.delay == 'number') {
1175 , hide: options.delay
1182 Tooltip.prototype.getDelegateOptions = function () {
1184 var defaults = this.getDefaults()
1186 this._options && $.each(this._options, function (key, value) {
1187 if (defaults[key] != value) options[key] = value
1193 Tooltip.prototype.enter = function (obj) {
1194 var self = obj instanceof this.constructor ?
1195 obj : $(obj.currentTarget)[this.type](this.getDelegateOptions()).data('bs.' + this.type)
1197 clearTimeout(self.timeout)
1199 self.hoverState = 'in'
1201 if (!self.options.delay || !self.options.delay.show) return self.show()
1203 self.timeout = setTimeout(function () {
1204 if (self.hoverState == 'in') self.show()
1205 }, self.options.delay.show)
1208 Tooltip.prototype.leave = function (obj) {
1209 var self = obj instanceof this.constructor ?
1210 obj : $(obj.currentTarget)[this.type](this.getDelegateOptions()).data('bs.' + this.type)
1212 clearTimeout(self.timeout)
1214 self.hoverState = 'out'
1216 if (!self.options.delay || !self.options.delay.hide) return self.hide()
1218 self.timeout = setTimeout(function () {
1219 if (self.hoverState == 'out') self.hide()
1220 }, self.options.delay.hide)
1223 Tooltip.prototype.show = function () {
1224 var e = $.Event('show.bs.'+ this.type)
1226 if (this.hasContent() && this.enabled) {
1227 this.$element.trigger(e)
1229 if (e.isDefaultPrevented()) return
1231 var $tip = this.tip()
1235 if (this.options.animation) $tip.addClass('fade')
1237 var placement = typeof this.options.placement == 'function' ?
1238 this.options.placement.call(this, $tip[0], this.$element[0]) :
1239 this.options.placement
1241 var autoToken = /\s?auto?\s?/i
1242 var autoPlace = autoToken.test(placement)
1243 if (autoPlace) placement = placement.replace(autoToken, '') || 'top'
1247 .css({ top: 0, left: 0, display: 'block' })
1248 .addClass(placement)
1250 this.options.container ? $tip.appendTo(this.options.container) : $tip.insertAfter(this.$element)
1252 var pos = this.getPosition()
1253 var actualWidth = $tip[0].offsetWidth
1254 var actualHeight = $tip[0].offsetHeight
1257 var $parent = this.$element.parent()
1259 var orgPlacement = placement
1260 var docScroll = document.documentElement.scrollTop || document.body.scrollTop
1261 var parentWidth = this.options.container == 'body' ? window.innerWidth : $parent.outerWidth()
1262 var parentHeight = this.options.container == 'body' ? window.innerHeight : $parent.outerHeight()
1263 var parentLeft = this.options.container == 'body' ? 0 : $parent.offset().left
1265 placement = placement == 'bottom' && pos.top + pos.height + actualHeight - docScroll > parentHeight ? 'top' :
1266 placement == 'top' && pos.top - docScroll - actualHeight < 0 ? 'bottom' :
1267 placement == 'right' && pos.right + actualWidth > parentWidth ? 'left' :
1268 placement == 'left' && pos.left - actualWidth < parentLeft ? 'right' :
1272 .removeClass(orgPlacement)
1273 .addClass(placement)
1276 var calculatedOffset = this.getCalculatedOffset(placement, pos, actualWidth, actualHeight)
1278 this.applyPlacement(calculatedOffset, placement)
1279 this.$element.trigger('shown.bs.' + this.type)
1283 Tooltip.prototype.applyPlacement = function(offset, placement) {
1285 var $tip = this.tip()
1286 var width = $tip[0].offsetWidth
1287 var height = $tip[0].offsetHeight
1289 // manually read margins because getBoundingClientRect includes difference
1290 var marginTop = parseInt($tip.css('margin-top'), 10)
1291 var marginLeft = parseInt($tip.css('margin-left'), 10)
1293 // we must check for NaN for ie 8/9
1294 if (isNaN(marginTop)) marginTop = 0
1295 if (isNaN(marginLeft)) marginLeft = 0
1297 offset.top = offset.top + marginTop
1298 offset.left = offset.left + marginLeft
1304 // check to see if placing tip in new offset caused the tip to resize itself
1305 var actualWidth = $tip[0].offsetWidth
1306 var actualHeight = $tip[0].offsetHeight
1308 if (placement == 'top' && actualHeight != height) {
1310 offset.top = offset.top + height - actualHeight
1313 if (/bottom|top/.test(placement)) {
1316 if (offset.left < 0) {
1317 delta = offset.left * -2
1322 actualWidth = $tip[0].offsetWidth
1323 actualHeight = $tip[0].offsetHeight
1326 this.replaceArrow(delta - width + actualWidth, actualWidth, 'left')
1328 this.replaceArrow(actualHeight - height, actualHeight, 'top')
1331 if (replace) $tip.offset(offset)
1334 Tooltip.prototype.replaceArrow = function(delta, dimension, position) {
1335 this.arrow().css(position, delta ? (50 * (1 - delta / dimension) + "%") : '')
1338 Tooltip.prototype.setContent = function () {
1339 var $tip = this.tip()
1340 var title = this.getTitle()
1342 $tip.find('.tooltip-inner')[this.options.html ? 'html' : 'text'](title)
1343 $tip.removeClass('fade in top bottom left right')
1346 Tooltip.prototype.hide = function () {
1348 var $tip = this.tip()
1349 var e = $.Event('hide.bs.' + this.type)
1351 function complete() {
1352 if (that.hoverState != 'in') $tip.detach()
1355 this.$element.trigger(e)
1357 if (e.isDefaultPrevented()) return
1359 $tip.removeClass('in')
1361 $.support.transition && this.$tip.hasClass('fade') ?
1363 .one($.support.transition.end, complete)
1364 .emulateTransitionEnd(150) :
1367 this.$element.trigger('hidden.bs.' + this.type)
1372 Tooltip.prototype.fixTitle = function () {
1373 var $e = this.$element
1374 if ($e.attr('title') || typeof($e.attr('data-original-title')) != 'string') {
1375 $e.attr('data-original-title', $e.attr('title') || '').attr('title', '')
1379 Tooltip.prototype.hasContent = function () {
1380 return this.getTitle()
1383 Tooltip.prototype.getPosition = function () {
1384 var el = this.$element[0]
1385 return $.extend({}, (typeof el.getBoundingClientRect == 'function') ? el.getBoundingClientRect() : {
1386 width: el.offsetWidth
1387 , height: el.offsetHeight
1388 }, this.$element.offset())
1391 Tooltip.prototype.getCalculatedOffset = function (placement, pos, actualWidth, actualHeight) {
1392 return placement == 'bottom' ? { top: pos.top + pos.height, left: pos.left + pos.width / 2 - actualWidth / 2 } :
1393 placement == 'top' ? { top: pos.top - actualHeight, left: pos.left + pos.width / 2 - actualWidth / 2 } :
1394 placement == 'left' ? { top: pos.top + pos.height / 2 - actualHeight / 2, left: pos.left - actualWidth } :
1395 /* placement == 'right' */ { top: pos.top + pos.height / 2 - actualHeight / 2, left: pos.left + pos.width }
1398 Tooltip.prototype.getTitle = function () {
1400 var $e = this.$element
1401 var o = this.options
1403 title = $e.attr('data-original-title')
1404 || (typeof o.title == 'function' ? o.title.call($e[0]) : o.title)
1409 Tooltip.prototype.tip = function () {
1410 return this.$tip = this.$tip || $(this.options.template)
1413 Tooltip.prototype.arrow = function () {
1414 return this.$arrow = this.$arrow || this.tip().find('.tooltip-arrow')
1417 Tooltip.prototype.validate = function () {
1418 if (!this.$element[0].parentNode) {
1420 this.$element = null
1425 Tooltip.prototype.enable = function () {
1429 Tooltip.prototype.disable = function () {
1430 this.enabled = false
1433 Tooltip.prototype.toggleEnabled = function () {
1434 this.enabled = !this.enabled
1437 Tooltip.prototype.toggle = function (e) {
1438 var self = e ? $(e.currentTarget)[this.type](this.getDelegateOptions()).data('bs.' + this.type) : this
1439 self.tip().hasClass('in') ? self.leave(self) : self.enter(self)
1442 Tooltip.prototype.destroy = function () {
1443 this.hide().$element.off('.' + this.type).removeData('bs.' + this.type)
1447 // TOOLTIP PLUGIN DEFINITION
1448 // =========================
1450 var old = $.fn.tooltip
1452 $.fn.tooltip = function (option) {
1453 return this.each(function () {
1455 var data = $this.data('bs.tooltip')
1456 var options = typeof option == 'object' && option
1458 if (!data) $this.data('bs.tooltip', (data = new Tooltip(this, options)))
1459 if (typeof option == 'string') data[option]()
1463 $.fn.tooltip.Constructor = Tooltip
1466 // TOOLTIP NO CONFLICT
1467 // ===================
1469 $.fn.tooltip.noConflict = function () {
1476 /* ========================================================================
1477 * Bootstrap: popover.js v3.0.0
1478 * http://twbs.github.com/bootstrap/javascript.html#popovers
1479 * ========================================================================
1480 * Copyright 2012 Twitter, Inc.
1482 * Licensed under the Apache License, Version 2.0 (the "License");
1483 * you may not use this file except in compliance with the License.
1484 * You may obtain a copy of the License at
1486 * http://www.apache.org/licenses/LICENSE-2.0
1488 * Unless required by applicable law or agreed to in writing, software
1489 * distributed under the License is distributed on an "AS IS" BASIS,
1490 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
1491 * See the License for the specific language governing permissions and
1492 * limitations under the License.
1493 * ======================================================================== */
1496 +function ($) { "use strict";
1498 // POPOVER PUBLIC CLASS DEFINITION
1499 // ===============================
1501 var Popover = function (element, options) {
1502 this.init('popover', element, options)
1505 if (!$.fn.tooltip) throw new Error('Popover requires tooltip.js')
1507 Popover.DEFAULTS = $.extend({} , $.fn.tooltip.Constructor.DEFAULTS, {
1511 , template: '<div class="popover"><div class="arrow"></div><h3 class="popover-title"></h3><div class="popover-content"></div></div>'
1515 // NOTE: POPOVER EXTENDS tooltip.js
1516 // ================================
1518 Popover.prototype = $.extend({}, $.fn.tooltip.Constructor.prototype)
1520 Popover.prototype.constructor = Popover
1522 Popover.prototype.getDefaults = function () {
1523 return Popover.DEFAULTS
1526 Popover.prototype.setContent = function () {
1527 var $tip = this.tip()
1528 var title = this.getTitle()
1529 var content = this.getContent()
1531 $tip.find('.popover-title')[this.options.html ? 'html' : 'text'](title)
1532 $tip.find('.popover-content')[this.options.html ? 'html' : 'text'](content)
1534 $tip.removeClass('fade top bottom left right in')
1536 // IE8 doesn't accept hiding via the `:empty` pseudo selector, we have to do
1537 // this manually by checking the contents.
1538 if (!$tip.find('.popover-title').html()) $tip.find('.popover-title').hide()
1541 Popover.prototype.hasContent = function () {
1542 return this.getTitle() || this.getContent()
1545 Popover.prototype.getContent = function () {
1546 var $e = this.$element
1547 var o = this.options
1549 return $e.attr('data-content')
1550 || (typeof o.content == 'function' ?
1551 o.content.call($e[0]) :
1555 Popover.prototype.arrow = function () {
1556 return this.$arrow = this.$arrow || this.tip().find('.arrow')
1559 Popover.prototype.tip = function () {
1560 if (!this.$tip) this.$tip = $(this.options.template)
1565 // POPOVER PLUGIN DEFINITION
1566 // =========================
1568 var old = $.fn.popover
1570 $.fn.popover = function (option) {
1571 return this.each(function () {
1573 var data = $this.data('bs.popover')
1574 var options = typeof option == 'object' && option
1576 if (!data) $this.data('bs.popover', (data = new Popover(this, options)))
1577 if (typeof option == 'string') data[option]()
1581 $.fn.popover.Constructor = Popover
1584 // POPOVER NO CONFLICT
1585 // ===================
1587 $.fn.popover.noConflict = function () {
1594 /* ========================================================================
1595 * Bootstrap: scrollspy.js v3.0.0
1596 * http://twbs.github.com/bootstrap/javascript.html#scrollspy
1597 * ========================================================================
1598 * Copyright 2012 Twitter, Inc.
1600 * Licensed under the Apache License, Version 2.0 (the "License");
1601 * you may not use this file except in compliance with the License.
1602 * You may obtain a copy of the License at
1604 * http://www.apache.org/licenses/LICENSE-2.0
1606 * Unless required by applicable law or agreed to in writing, software
1607 * distributed under the License is distributed on an "AS IS" BASIS,
1608 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
1609 * See the License for the specific language governing permissions and
1610 * limitations under the License.
1611 * ======================================================================== */
1614 +function ($) { "use strict";
1616 // SCROLLSPY CLASS DEFINITION
1617 // ==========================
1619 function ScrollSpy(element, options) {
1621 var process = $.proxy(this.process, this)
1623 this.$element = $(element).is('body') ? $(window) : $(element)
1624 this.$body = $('body')
1625 this.$scrollElement = this.$element.on('scroll.bs.scroll-spy.data-api', process)
1626 this.options = $.extend({}, ScrollSpy.DEFAULTS, options)
1627 this.selector = (this.options.target
1628 || ((href = $(element).attr('href')) && href.replace(/.*(?=#[^\s]+$)/, '')) //strip for ie7
1629 || '') + ' .nav li > a'
1630 this.offsets = $([])
1631 this.targets = $([])
1632 this.activeTarget = null
1638 ScrollSpy.DEFAULTS = {
1642 ScrollSpy.prototype.refresh = function () {
1643 var offsetMethod = this.$element[0] == window ? 'offset' : 'position'
1645 this.offsets = $([])
1646 this.targets = $([])
1649 var $targets = this.$body
1650 .find(this.selector)
1653 var href = $el.data('target') || $el.attr('href')
1654 var $href = /^#\w/.test(href) && $(href)
1658 && [[ $href[offsetMethod]().top + (!$.isWindow(self.$scrollElement.get(0)) && self.$scrollElement.scrollTop()), href ]]) || null
1660 .sort(function (a, b) { return a[0] - b[0] })
1662 self.offsets.push(this[0])
1663 self.targets.push(this[1])
1667 ScrollSpy.prototype.process = function () {
1668 var scrollTop = this.$scrollElement.scrollTop() + this.options.offset
1669 var scrollHeight = this.$scrollElement[0].scrollHeight || this.$body[0].scrollHeight
1670 var maxScroll = scrollHeight - this.$scrollElement.height()
1671 var offsets = this.offsets
1672 var targets = this.targets
1673 var activeTarget = this.activeTarget
1676 if (scrollTop >= maxScroll) {
1677 return activeTarget != (i = targets.last()[0]) && this.activate(i)
1680 for (i = offsets.length; i--;) {
1681 activeTarget != targets[i]
1682 && scrollTop >= offsets[i]
1683 && (!offsets[i + 1] || scrollTop <= offsets[i + 1])
1684 && this.activate( targets[i] )
1688 ScrollSpy.prototype.activate = function (target) {
1689 this.activeTarget = target
1693 .removeClass('active')
1695 var selector = this.selector
1696 + '[data-target="' + target + '"],'
1697 + this.selector + '[href="' + target + '"]'
1699 var active = $(selector)
1703 if (active.parent('.dropdown-menu').length) {
1705 .closest('li.dropdown')
1709 active.trigger('activate')
1713 // SCROLLSPY PLUGIN DEFINITION
1714 // ===========================
1716 var old = $.fn.scrollspy
1718 $.fn.scrollspy = function (option) {
1719 return this.each(function () {
1721 var data = $this.data('bs.scrollspy')
1722 var options = typeof option == 'object' && option
1724 if (!data) $this.data('bs.scrollspy', (data = new ScrollSpy(this, options)))
1725 if (typeof option == 'string') data[option]()
1729 $.fn.scrollspy.Constructor = ScrollSpy
1732 // SCROLLSPY NO CONFLICT
1733 // =====================
1735 $.fn.scrollspy.noConflict = function () {
1736 $.fn.scrollspy = old
1741 // SCROLLSPY DATA-API
1742 // ==================
1744 $(window).on('load', function () {
1745 $('[data-spy="scroll"]').each(function () {
1747 $spy.scrollspy($spy.data())
1753 /* ========================================================================
1754 * Bootstrap: tab.js v3.0.0
1755 * http://twbs.github.com/bootstrap/javascript.html#tabs
1756 * ========================================================================
1757 * Copyright 2012 Twitter, Inc.
1759 * Licensed under the Apache License, Version 2.0 (the "License");
1760 * you may not use this file except in compliance with the License.
1761 * You may obtain a copy of the License at
1763 * http://www.apache.org/licenses/LICENSE-2.0
1765 * Unless required by applicable law or agreed to in writing, software
1766 * distributed under the License is distributed on an "AS IS" BASIS,
1767 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
1768 * See the License for the specific language governing permissions and
1769 * limitations under the License.
1770 * ======================================================================== */
1773 +function ($) { "use strict";
1775 // TAB CLASS DEFINITION
1776 // ====================
1778 var Tab = function (element) {
1779 this.element = $(element)
1782 Tab.prototype.show = function () {
1783 var $this = this.element
1784 var $ul = $this.closest('ul:not(.dropdown-menu)')
1785 var selector = $this.attr('data-target')
1788 selector = $this.attr('href')
1789 selector = selector && selector.replace(/.*(?=#[^\s]*$)/, '') //strip for ie7
1792 if ($this.parent('li').hasClass('active')) return
1794 var previous = $ul.find('.active:last a')[0]
1795 var e = $.Event('show.bs.tab', {
1796 relatedTarget: previous
1801 if (e.isDefaultPrevented()) return
1803 var $target = $(selector)
1805 this.activate($this.parent('li'), $ul)
1806 this.activate($target, $target.parent(), function () {
1808 type: 'shown.bs.tab'
1809 , relatedTarget: previous
1814 Tab.prototype.activate = function (element, container, callback) {
1815 var $active = container.find('> .active')
1816 var transition = callback
1817 && $.support.transition
1818 && $active.hasClass('fade')
1822 .removeClass('active')
1823 .find('> .dropdown-menu > .active')
1824 .removeClass('active')
1826 element.addClass('active')
1829 element[0].offsetWidth // reflow for transition
1830 element.addClass('in')
1832 element.removeClass('fade')
1835 if (element.parent('.dropdown-menu')) {
1836 element.closest('li.dropdown').addClass('active')
1839 callback && callback()
1844 .one($.support.transition.end, next)
1845 .emulateTransitionEnd(150) :
1848 $active.removeClass('in')
1852 // TAB PLUGIN DEFINITION
1853 // =====================
1857 $.fn.tab = function ( option ) {
1858 return this.each(function () {
1860 var data = $this.data('bs.tab')
1862 if (!data) $this.data('bs.tab', (data = new Tab(this)))
1863 if (typeof option == 'string') data[option]()
1867 $.fn.tab.Constructor = Tab
1873 $.fn.tab.noConflict = function () {
1882 $(document).on('click.bs.tab.data-api', '[data-toggle="tab"], [data-toggle="pill"]', function (e) {
1889 /* ========================================================================
1890 * Bootstrap: affix.js v3.0.0
1891 * http://twbs.github.com/bootstrap/javascript.html#affix
1892 * ========================================================================
1893 * Copyright 2012 Twitter, Inc.
1895 * Licensed under the Apache License, Version 2.0 (the "License");
1896 * you may not use this file except in compliance with the License.
1897 * You may obtain a copy of the License at
1899 * http://www.apache.org/licenses/LICENSE-2.0
1901 * Unless required by applicable law or agreed to in writing, software
1902 * distributed under the License is distributed on an "AS IS" BASIS,
1903 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
1904 * See the License for the specific language governing permissions and
1905 * limitations under the License.
1906 * ======================================================================== */
1909 +function ($) { "use strict";
1911 // AFFIX CLASS DEFINITION
1912 // ======================
1914 var Affix = function (element, options) {
1915 this.options = $.extend({}, Affix.DEFAULTS, options)
1916 this.$window = $(window)
1917 .on('scroll.bs.affix.data-api', $.proxy(this.checkPosition, this))
1918 .on('click.bs.affix.data-api', $.proxy(this.checkPositionWithEventLoop, this))
1920 this.$element = $(element)
1924 this.checkPosition()
1927 Affix.RESET = 'affix affix-top affix-bottom'
1933 Affix.prototype.checkPositionWithEventLoop = function () {
1934 setTimeout($.proxy(this.checkPosition, this), 1)
1937 Affix.prototype.checkPosition = function () {
1938 if (!this.$element.is(':visible')) return
1940 var scrollHeight = $(document).height()
1941 var scrollTop = this.$window.scrollTop()
1942 var position = this.$element.offset()
1943 var offset = this.options.offset
1944 var offsetTop = offset.top
1945 var offsetBottom = offset.bottom
1947 if (typeof offset != 'object') offsetBottom = offsetTop = offset
1948 if (typeof offsetTop == 'function') offsetTop = offset.top()
1949 if (typeof offsetBottom == 'function') offsetBottom = offset.bottom()
1951 var affix = this.unpin != null && (scrollTop + this.unpin <= position.top) ? false :
1952 offsetBottom != null && (position.top + this.$element.height() >= scrollHeight - offsetBottom) ? 'bottom' :
1953 offsetTop != null && (scrollTop <= offsetTop) ? 'top' : false
1955 if (this.affixed === affix) return
1956 if (this.unpin) this.$element.css('top', '')
1958 this.affixed = affix
1959 this.unpin = affix == 'bottom' ? position.top - scrollTop : null
1961 this.$element.removeClass(Affix.RESET).addClass('affix' + (affix ? '-' + affix : ''))
1963 if (affix == 'bottom') {
1964 this.$element.offset({ top: document.body.offsetHeight - offsetBottom - this.$element.height() })
1969 // AFFIX PLUGIN DEFINITION
1970 // =======================
1972 var old = $.fn.affix
1974 $.fn.affix = function (option) {
1975 return this.each(function () {
1977 var data = $this.data('bs.affix')
1978 var options = typeof option == 'object' && option
1980 if (!data) $this.data('bs.affix', (data = new Affix(this, options)))
1981 if (typeof option == 'string') data[option]()
1985 $.fn.affix.Constructor = Affix
1988 // AFFIX NO CONFLICT
1989 // =================
1991 $.fn.affix.noConflict = function () {
2000 $(window).on('load', function () {
2001 $('[data-spy="affix"]').each(function () {
2003 var data = $spy.data()
2005 data.offset = data.offset || {}
2007 if (data.offsetBottom) data.offset.bottom = data.offsetBottom
2008 if (data.offsetTop) data.offset.top = data.offsetTop