2 * Bootstrap v3.2.0 (http://getbootstrap.com)
3 * Copyright 2011-2014 Twitter, Inc.
4 * Licensed under MIT (https://github.com/twbs/bootstrap/blob/master/LICENSE)
7 if (typeof jQuery === 'undefined') { throw new Error('Bootstrap\'s JavaScript requires jQuery') }
9 /* ========================================================================
10 * Bootstrap: transition.js v3.2.0
11 * http://getbootstrap.com/javascript/#transitions
12 * ========================================================================
13 * Copyright 2011-2014 Twitter, Inc.
14 * Licensed under MIT (https://github.com/twbs/bootstrap/blob/master/LICENSE)
15 * ======================================================================== */
21 // CSS TRANSITION SUPPORT (Shoutout: http://www.modernizr.com/)
22 // ============================================================
24 function transitionEnd() {
25 var el = document.createElement('bootstrap')
27 var transEndEventNames = {
28 WebkitTransition : 'webkitTransitionEnd',
29 MozTransition : 'transitionend',
30 OTransition : 'oTransitionEnd otransitionend',
31 transition : 'transitionend'
34 for (var name in transEndEventNames) {
35 if (el.style[name] !== undefined) {
36 return { end: transEndEventNames[name] }
40 return false // explicit for ie8 ( ._.)
43 // http://blog.alexmaccaw.com/css-transitions
44 $.fn.emulateTransitionEnd = function (duration) {
47 $(this).one('bsTransitionEnd', function () { called = true })
48 var callback = function () { if (!called) $($el).trigger($.support.transition.end) }
49 setTimeout(callback, duration)
54 $.support.transition = transitionEnd()
56 if (!$.support.transition) return
58 $.event.special.bsTransitionEnd = {
59 bindType: $.support.transition.end,
60 delegateType: $.support.transition.end,
61 handle: function (e) {
62 if ($(e.target).is(this)) return e.handleObj.handler.apply(this, arguments)
69 /* ========================================================================
70 * Bootstrap: alert.js v3.2.0
71 * http://getbootstrap.com/javascript/#alerts
72 * ========================================================================
73 * Copyright 2011-2014 Twitter, Inc.
74 * Licensed under MIT (https://github.com/twbs/bootstrap/blob/master/LICENSE)
75 * ======================================================================== */
81 // ALERT CLASS DEFINITION
82 // ======================
84 var dismiss = '[data-dismiss="alert"]'
85 var Alert = function (el) {
86 $(el).on('click', dismiss, this.close)
89 Alert.VERSION = '3.2.0'
91 Alert.prototype.close = function (e) {
93 var selector = $this.attr('data-target')
96 selector = $this.attr('href')
97 selector = selector && selector.replace(/.*(?=#[^\s]*$)/, '') // strip for ie7
100 var $parent = $(selector)
102 if (e) e.preventDefault()
104 if (!$parent.length) {
105 $parent = $this.hasClass('alert') ? $this : $this.parent()
108 $parent.trigger(e = $.Event('close.bs.alert'))
110 if (e.isDefaultPrevented()) return
112 $parent.removeClass('in')
114 function removeElement() {
115 // detach from parent, fire event then clean up data
116 $parent.detach().trigger('closed.bs.alert').remove()
119 $.support.transition && $parent.hasClass('fade') ?
121 .one('bsTransitionEnd', removeElement)
122 .emulateTransitionEnd(150) :
127 // ALERT PLUGIN DEFINITION
128 // =======================
130 function Plugin(option) {
131 return this.each(function () {
133 var data = $this.data('bs.alert')
135 if (!data) $this.data('bs.alert', (data = new Alert(this)))
136 if (typeof option == 'string') data[option].call($this)
143 $.fn.alert.Constructor = Alert
149 $.fn.alert.noConflict = function () {
158 $(document).on('click.bs.alert.data-api', dismiss, Alert.prototype.close)
162 /* ========================================================================
163 * Bootstrap: button.js v3.2.0
164 * http://getbootstrap.com/javascript/#buttons
165 * ========================================================================
166 * Copyright 2011-2014 Twitter, Inc.
167 * Licensed under MIT (https://github.com/twbs/bootstrap/blob/master/LICENSE)
168 * ======================================================================== */
174 // BUTTON PUBLIC CLASS DEFINITION
175 // ==============================
177 var Button = function (element, options) {
178 this.$element = $(element)
179 this.options = $.extend({}, Button.DEFAULTS, options)
180 this.isLoading = false
183 Button.VERSION = '3.2.0'
186 loadingText: 'loading...'
189 Button.prototype.setState = function (state) {
191 var $el = this.$element
192 var val = $el.is('input') ? 'val' : 'html'
193 var data = $el.data()
195 state = state + 'Text'
197 if (data.resetText == null) $el.data('resetText', $el[val]())
199 $el[val](data[state] == null ? this.options[state] : data[state])
201 // push to event loop to allow forms to submit
202 setTimeout($.proxy(function () {
203 if (state == 'loadingText') {
204 this.isLoading = true
205 $el.addClass(d).attr(d, d)
206 } else if (this.isLoading) {
207 this.isLoading = false
208 $el.removeClass(d).removeAttr(d)
213 Button.prototype.toggle = function () {
215 var $parent = this.$element.closest('[data-toggle="buttons"]')
217 if ($parent.length) {
218 var $input = this.$element.find('input')
219 if ($input.prop('type') == 'radio') {
220 if ($input.prop('checked') && this.$element.hasClass('active')) changed = false
221 else $parent.find('.active').removeClass('active')
223 if (changed) $input.prop('checked', !this.$element.hasClass('active')).trigger('change')
226 if (changed) this.$element.toggleClass('active')
230 // BUTTON PLUGIN DEFINITION
231 // ========================
233 function Plugin(option) {
234 return this.each(function () {
236 var data = $this.data('bs.button')
237 var options = typeof option == 'object' && option
239 if (!data) $this.data('bs.button', (data = new Button(this, options)))
241 if (option == 'toggle') data.toggle()
242 else if (option) data.setState(option)
246 var old = $.fn.button
249 $.fn.button.Constructor = Button
252 // BUTTON NO CONFLICT
253 // ==================
255 $.fn.button.noConflict = function () {
264 $(document).on('click.bs.button.data-api', '[data-toggle^="button"]', function (e) {
265 var $btn = $(e.target)
266 if (!$btn.hasClass('btn')) $btn = $btn.closest('.btn')
267 Plugin.call($btn, 'toggle')
273 /* ========================================================================
274 * Bootstrap: carousel.js v3.2.0
275 * http://getbootstrap.com/javascript/#carousel
276 * ========================================================================
277 * Copyright 2011-2014 Twitter, Inc.
278 * Licensed under MIT (https://github.com/twbs/bootstrap/blob/master/LICENSE)
279 * ======================================================================== */
285 // CAROUSEL CLASS DEFINITION
286 // =========================
288 var Carousel = function (element, options) {
289 this.$element = $(element).on('keydown.bs.carousel', $.proxy(this.keydown, this))
290 this.$indicators = this.$element.find('.carousel-indicators')
291 this.options = options
298 this.options.pause == 'hover' && this.$element
299 .on('mouseenter.bs.carousel', $.proxy(this.pause, this))
300 .on('mouseleave.bs.carousel', $.proxy(this.cycle, this))
303 Carousel.VERSION = '3.2.0'
305 Carousel.DEFAULTS = {
311 Carousel.prototype.keydown = function (e) {
313 case 37: this.prev(); break
314 case 39: this.next(); break
321 Carousel.prototype.cycle = function (e) {
322 e || (this.paused = false)
324 this.interval && clearInterval(this.interval)
326 this.options.interval
328 && (this.interval = setInterval($.proxy(this.next, this), this.options.interval))
333 Carousel.prototype.getItemIndex = function (item) {
334 this.$items = item.parent().children('.item')
335 return this.$items.index(item || this.$active)
338 Carousel.prototype.to = function (pos) {
340 var activeIndex = this.getItemIndex(this.$active = this.$element.find('.item.active'))
342 if (pos > (this.$items.length - 1) || pos < 0) return
344 if (this.sliding) return this.$element.one('slid.bs.carousel', function () { that.to(pos) }) // yes, "slid"
345 if (activeIndex == pos) return this.pause().cycle()
347 return this.slide(pos > activeIndex ? 'next' : 'prev', $(this.$items[pos]))
350 Carousel.prototype.pause = function (e) {
351 e || (this.paused = true)
353 if (this.$element.find('.next, .prev').length && $.support.transition) {
354 this.$element.trigger($.support.transition.end)
358 this.interval = clearInterval(this.interval)
363 Carousel.prototype.next = function () {
364 if (this.sliding) return
365 return this.slide('next')
368 Carousel.prototype.prev = function () {
369 if (this.sliding) return
370 return this.slide('prev')
373 Carousel.prototype.slide = function (type, next) {
374 var $active = this.$element.find('.item.active')
375 var $next = next || $active[type]()
376 var isCycling = this.interval
377 var direction = type == 'next' ? 'left' : 'right'
378 var fallback = type == 'next' ? 'first' : 'last'
382 if (!this.options.wrap) return
383 $next = this.$element.find('.item')[fallback]()
386 if ($next.hasClass('active')) return (this.sliding = false)
388 var relatedTarget = $next[0]
389 var slideEvent = $.Event('slide.bs.carousel', {
390 relatedTarget: relatedTarget,
393 this.$element.trigger(slideEvent)
394 if (slideEvent.isDefaultPrevented()) return
398 isCycling && this.pause()
400 if (this.$indicators.length) {
401 this.$indicators.find('.active').removeClass('active')
402 var $nextIndicator = $(this.$indicators.children()[this.getItemIndex($next)])
403 $nextIndicator && $nextIndicator.addClass('active')
406 var slidEvent = $.Event('slid.bs.carousel', { relatedTarget: relatedTarget, direction: direction }) // yes, "slid"
407 if ($.support.transition && this.$element.hasClass('slide')) {
409 $next[0].offsetWidth // force reflow
410 $active.addClass(direction)
411 $next.addClass(direction)
413 .one('bsTransitionEnd', function () {
414 $next.removeClass([type, direction].join(' ')).addClass('active')
415 $active.removeClass(['active', direction].join(' '))
417 setTimeout(function () {
418 that.$element.trigger(slidEvent)
421 .emulateTransitionEnd($active.css('transition-duration').slice(0, -1) * 1000)
423 $active.removeClass('active')
424 $next.addClass('active')
426 this.$element.trigger(slidEvent)
429 isCycling && this.cycle()
435 // CAROUSEL PLUGIN DEFINITION
436 // ==========================
438 function Plugin(option) {
439 return this.each(function () {
441 var data = $this.data('bs.carousel')
442 var options = $.extend({}, Carousel.DEFAULTS, $this.data(), typeof option == 'object' && option)
443 var action = typeof option == 'string' ? option : options.slide
445 if (!data) $this.data('bs.carousel', (data = new Carousel(this, options)))
446 if (typeof option == 'number') data.to(option)
447 else if (action) data[action]()
448 else if (options.interval) data.pause().cycle()
452 var old = $.fn.carousel
454 $.fn.carousel = Plugin
455 $.fn.carousel.Constructor = Carousel
458 // CAROUSEL NO CONFLICT
459 // ====================
461 $.fn.carousel.noConflict = function () {
470 $(document).on('click.bs.carousel.data-api', '[data-slide], [data-slide-to]', function (e) {
473 var $target = $($this.attr('data-target') || (href = $this.attr('href')) && href.replace(/.*(?=#[^\s]+$)/, '')) // strip for ie7
474 if (!$target.hasClass('carousel')) return
475 var options = $.extend({}, $target.data(), $this.data())
476 var slideIndex = $this.attr('data-slide-to')
477 if (slideIndex) options.interval = false
479 Plugin.call($target, options)
482 $target.data('bs.carousel').to(slideIndex)
488 $(window).on('load', function () {
489 $('[data-ride="carousel"]').each(function () {
490 var $carousel = $(this)
491 Plugin.call($carousel, $carousel.data())
497 /* ========================================================================
498 * Bootstrap: collapse.js v3.2.0
499 * http://getbootstrap.com/javascript/#collapse
500 * ========================================================================
501 * Copyright 2011-2014 Twitter, Inc.
502 * Licensed under MIT (https://github.com/twbs/bootstrap/blob/master/LICENSE)
503 * ======================================================================== */
509 // COLLAPSE PUBLIC CLASS DEFINITION
510 // ================================
512 var Collapse = function (element, options) {
513 this.$element = $(element)
514 this.options = $.extend({}, Collapse.DEFAULTS, options)
515 this.transitioning = null
517 if (this.options.parent) this.$parent = $(this.options.parent)
518 if (this.options.toggle) this.toggle()
521 Collapse.VERSION = '3.2.0'
523 Collapse.DEFAULTS = {
527 Collapse.prototype.dimension = function () {
528 var hasWidth = this.$element.hasClass('width')
529 return hasWidth ? 'width' : 'height'
532 Collapse.prototype.show = function () {
533 if (this.transitioning || this.$element.hasClass('in')) return
535 var startEvent = $.Event('show.bs.collapse')
536 this.$element.trigger(startEvent)
537 if (startEvent.isDefaultPrevented()) return
539 var actives = this.$parent && this.$parent.find('> .panel > .in')
541 if (actives && actives.length) {
542 var hasData = actives.data('bs.collapse')
543 if (hasData && hasData.transitioning) return
544 Plugin.call(actives, 'hide')
545 hasData || actives.data('bs.collapse', null)
548 var dimension = this.dimension()
551 .removeClass('collapse')
552 .addClass('collapsing')[dimension](0)
554 this.transitioning = 1
556 var complete = function () {
558 .removeClass('collapsing')
559 .addClass('collapse in')[dimension]('')
560 this.transitioning = 0
562 .trigger('shown.bs.collapse')
565 if (!$.support.transition) return complete.call(this)
567 var scrollSize = $.camelCase(['scroll', dimension].join('-'))
570 .one('bsTransitionEnd', $.proxy(complete, this))
571 .emulateTransitionEnd(350)[dimension](this.$element[0][scrollSize])
574 Collapse.prototype.hide = function () {
575 if (this.transitioning || !this.$element.hasClass('in')) return
577 var startEvent = $.Event('hide.bs.collapse')
578 this.$element.trigger(startEvent)
579 if (startEvent.isDefaultPrevented()) return
581 var dimension = this.dimension()
583 this.$element[dimension](this.$element[dimension]())[0].offsetHeight
586 .addClass('collapsing')
587 .removeClass('collapse')
590 this.transitioning = 1
592 var complete = function () {
593 this.transitioning = 0
595 .trigger('hidden.bs.collapse')
596 .removeClass('collapsing')
597 .addClass('collapse')
600 if (!$.support.transition) return complete.call(this)
604 .one('bsTransitionEnd', $.proxy(complete, this))
605 .emulateTransitionEnd(350)
608 Collapse.prototype.toggle = function () {
609 this[this.$element.hasClass('in') ? 'hide' : 'show']()
613 // COLLAPSE PLUGIN DEFINITION
614 // ==========================
616 function Plugin(option) {
617 return this.each(function () {
619 var data = $this.data('bs.collapse')
620 var options = $.extend({}, Collapse.DEFAULTS, $this.data(), typeof option == 'object' && option)
622 if (!data && options.toggle && option == 'show') option = !option
623 if (!data) $this.data('bs.collapse', (data = new Collapse(this, options)))
624 if (typeof option == 'string') data[option]()
628 var old = $.fn.collapse
630 $.fn.collapse = Plugin
631 $.fn.collapse.Constructor = Collapse
634 // COLLAPSE NO CONFLICT
635 // ====================
637 $.fn.collapse.noConflict = function () {
646 $(document).on('click.bs.collapse.data-api', '[data-toggle="collapse"]', function (e) {
649 var target = $this.attr('data-target')
650 || e.preventDefault()
651 || (href = $this.attr('href')) && href.replace(/.*(?=#[^\s]+$)/, '') // strip for ie7
652 var $target = $(target)
653 var data = $target.data('bs.collapse')
654 var option = data ? 'toggle' : $this.data()
655 var parent = $this.attr('data-parent')
656 var $parent = parent && $(parent)
658 if (!data || !data.transitioning) {
659 if ($parent) $parent.find('[data-toggle="collapse"][data-parent="' + parent + '"]').not($this).addClass('collapsed')
660 $this[$target.hasClass('in') ? 'addClass' : 'removeClass']('collapsed')
663 Plugin.call($target, option)
668 /* ========================================================================
669 * Bootstrap: dropdown.js v3.2.0
670 * http://getbootstrap.com/javascript/#dropdowns
671 * ========================================================================
672 * Copyright 2011-2014 Twitter, Inc.
673 * Licensed under MIT (https://github.com/twbs/bootstrap/blob/master/LICENSE)
674 * ======================================================================== */
680 // DROPDOWN CLASS DEFINITION
681 // =========================
683 var backdrop = '.dropdown-backdrop'
684 var toggle = '[data-toggle="dropdown"]'
685 var Dropdown = function (element) {
686 $(element).on('click.bs.dropdown', this.toggle)
689 Dropdown.VERSION = '3.2.0'
691 Dropdown.prototype.toggle = function (e) {
694 if ($this.is('.disabled, :disabled')) return
696 var $parent = getParent($this)
697 var isActive = $parent.hasClass('open')
702 if ('ontouchstart' in document.documentElement && !$parent.closest('.navbar-nav').length) {
703 // if mobile we use a backdrop because click events don't delegate
704 $('<div class="dropdown-backdrop"/>').insertAfter($(this)).on('click', clearMenus)
707 var relatedTarget = { relatedTarget: this }
708 $parent.trigger(e = $.Event('show.bs.dropdown', relatedTarget))
710 if (e.isDefaultPrevented()) return
712 $this.trigger('focus')
716 .trigger('shown.bs.dropdown', relatedTarget)
722 Dropdown.prototype.keydown = function (e) {
723 if (!/(38|40|27)/.test(e.keyCode)) return
730 if ($this.is('.disabled, :disabled')) return
732 var $parent = getParent($this)
733 var isActive = $parent.hasClass('open')
735 if (!isActive || (isActive && e.keyCode == 27)) {
736 if (e.which == 27) $parent.find(toggle).trigger('focus')
737 return $this.trigger('click')
740 var desc = ' li:not(.divider):visible a'
741 var $items = $parent.find('[role="menu"]' + desc + ', [role="listbox"]' + desc)
743 if (!$items.length) return
745 var index = $items.index($items.filter(':focus'))
747 if (e.keyCode == 38 && index > 0) index-- // up
748 if (e.keyCode == 40 && index < $items.length - 1) index++ // down
749 if (!~index) index = 0
751 $items.eq(index).trigger('focus')
754 function clearMenus(e) {
755 if (e && e.which === 3) return
757 $(toggle).each(function () {
758 var $parent = getParent($(this))
759 var relatedTarget = { relatedTarget: this }
760 if (!$parent.hasClass('open')) return
761 $parent.trigger(e = $.Event('hide.bs.dropdown', relatedTarget))
762 if (e.isDefaultPrevented()) return
763 $parent.removeClass('open').trigger('hidden.bs.dropdown', relatedTarget)
767 function getParent($this) {
768 var selector = $this.attr('data-target')
771 selector = $this.attr('href')
772 selector = selector && /#[A-Za-z]/.test(selector) && selector.replace(/.*(?=#[^\s]*$)/, '') // strip for ie7
775 var $parent = selector && $(selector)
777 return $parent && $parent.length ? $parent : $this.parent()
781 // DROPDOWN PLUGIN DEFINITION
782 // ==========================
784 function Plugin(option) {
785 return this.each(function () {
787 var data = $this.data('bs.dropdown')
789 if (!data) $this.data('bs.dropdown', (data = new Dropdown(this)))
790 if (typeof option == 'string') data[option].call($this)
794 var old = $.fn.dropdown
796 $.fn.dropdown = Plugin
797 $.fn.dropdown.Constructor = Dropdown
800 // DROPDOWN NO CONFLICT
801 // ====================
803 $.fn.dropdown.noConflict = function () {
809 // APPLY TO STANDARD DROPDOWN ELEMENTS
810 // ===================================
813 .on('click.bs.dropdown.data-api', clearMenus)
814 .on('click.bs.dropdown.data-api', '.dropdown form', function (e) { e.stopPropagation() })
815 .on('click.bs.dropdown.data-api', toggle, Dropdown.prototype.toggle)
816 .on('keydown.bs.dropdown.data-api', toggle + ', [role="menu"], [role="listbox"]', Dropdown.prototype.keydown)
820 /* ========================================================================
821 * Bootstrap: modal.js v3.2.0
822 * http://getbootstrap.com/javascript/#modals
823 * ========================================================================
824 * Copyright 2011-2014 Twitter, Inc.
825 * Licensed under MIT (https://github.com/twbs/bootstrap/blob/master/LICENSE)
826 * ======================================================================== */
832 // MODAL CLASS DEFINITION
833 // ======================
835 var Modal = function (element, options) {
836 this.options = options
837 this.$body = $(document.body)
838 this.$element = $(element)
841 this.scrollbarWidth = 0
843 if (this.options.remote) {
845 .find('.modal-content')
846 .load(this.options.remote, $.proxy(function () {
847 this.$element.trigger('loaded.bs.modal')
852 Modal.VERSION = '3.2.0'
860 Modal.prototype.toggle = function (_relatedTarget) {
861 return this.isShown ? this.hide() : this.show(_relatedTarget)
864 Modal.prototype.show = function (_relatedTarget) {
866 var e = $.Event('show.bs.modal', { relatedTarget: _relatedTarget })
868 this.$element.trigger(e)
870 if (this.isShown || e.isDefaultPrevented()) return
874 this.checkScrollbar()
875 this.$body.addClass('modal-open')
880 this.$element.on('click.dismiss.bs.modal', '[data-dismiss="modal"]', $.proxy(this.hide, this))
882 this.backdrop(function () {
883 var transition = $.support.transition && that.$element.hasClass('fade')
885 if (!that.$element.parent().length) {
886 that.$element.appendTo(that.$body) // don't move modals dom position
894 that.$element[0].offsetWidth // force reflow
899 .attr('aria-hidden', false)
903 var e = $.Event('shown.bs.modal', { relatedTarget: _relatedTarget })
906 that.$element.find('.modal-dialog') // wait for modal to slide in
907 .one('bsTransitionEnd', function () {
908 that.$element.trigger('focus').trigger(e)
910 .emulateTransitionEnd(300) :
911 that.$element.trigger('focus').trigger(e)
915 Modal.prototype.hide = function (e) {
916 if (e) e.preventDefault()
918 e = $.Event('hide.bs.modal')
920 this.$element.trigger(e)
922 if (!this.isShown || e.isDefaultPrevented()) return
926 this.$body.removeClass('modal-open')
928 this.resetScrollbar()
931 $(document).off('focusin.bs.modal')
935 .attr('aria-hidden', true)
936 .off('click.dismiss.bs.modal')
938 $.support.transition && this.$element.hasClass('fade') ?
940 .one('bsTransitionEnd', $.proxy(this.hideModal, this))
941 .emulateTransitionEnd(300) :
945 Modal.prototype.enforceFocus = function () {
947 .off('focusin.bs.modal') // guard against infinite focus loop
948 .on('focusin.bs.modal', $.proxy(function (e) {
949 if (this.$element[0] !== e.target && !this.$element.has(e.target).length) {
950 this.$element.trigger('focus')
955 Modal.prototype.escape = function () {
956 if (this.isShown && this.options.keyboard) {
957 this.$element.on('keyup.dismiss.bs.modal', $.proxy(function (e) {
958 e.which == 27 && this.hide()
960 } else if (!this.isShown) {
961 this.$element.off('keyup.dismiss.bs.modal')
965 Modal.prototype.hideModal = function () {
968 this.backdrop(function () {
969 that.$element.trigger('hidden.bs.modal')
973 Modal.prototype.removeBackdrop = function () {
974 this.$backdrop && this.$backdrop.remove()
975 this.$backdrop = null
978 Modal.prototype.backdrop = function (callback) {
980 var animate = this.$element.hasClass('fade') ? 'fade' : ''
982 if (this.isShown && this.options.backdrop) {
983 var doAnimate = $.support.transition && animate
985 this.$backdrop = $('<div class="modal-backdrop ' + animate + '" />')
986 .appendTo(this.$body)
988 this.$element.on('click.dismiss.bs.modal', $.proxy(function (e) {
989 if (e.target !== e.currentTarget) return
990 this.options.backdrop == 'static'
991 ? this.$element[0].focus.call(this.$element[0])
992 : this.hide.call(this)
995 if (doAnimate) this.$backdrop[0].offsetWidth // force reflow
997 this.$backdrop.addClass('in')
999 if (!callback) return
1003 .one('bsTransitionEnd', callback)
1004 .emulateTransitionEnd(150) :
1007 } else if (!this.isShown && this.$backdrop) {
1008 this.$backdrop.removeClass('in')
1010 var callbackRemove = function () {
1011 that.removeBackdrop()
1012 callback && callback()
1014 $.support.transition && this.$element.hasClass('fade') ?
1016 .one('bsTransitionEnd', callbackRemove)
1017 .emulateTransitionEnd(150) :
1020 } else if (callback) {
1025 Modal.prototype.checkScrollbar = function () {
1026 if (document.body.clientWidth >= window.innerWidth) return
1027 this.scrollbarWidth = this.scrollbarWidth || this.measureScrollbar()
1030 Modal.prototype.setScrollbar = function () {
1031 var bodyPad = parseInt((this.$body.css('padding-right') || 0), 10)
1032 if (this.scrollbarWidth) this.$body.css('padding-right', bodyPad + this.scrollbarWidth)
1035 Modal.prototype.resetScrollbar = function () {
1036 this.$body.css('padding-right', '')
1039 Modal.prototype.measureScrollbar = function () { // thx walsh
1040 var scrollDiv = document.createElement('div')
1041 scrollDiv.className = 'modal-scrollbar-measure'
1042 this.$body.append(scrollDiv)
1043 var scrollbarWidth = scrollDiv.offsetWidth - scrollDiv.clientWidth
1044 this.$body[0].removeChild(scrollDiv)
1045 return scrollbarWidth
1049 // MODAL PLUGIN DEFINITION
1050 // =======================
1052 function Plugin(option, _relatedTarget) {
1053 return this.each(function () {
1055 var data = $this.data('bs.modal')
1056 var options = $.extend({}, Modal.DEFAULTS, $this.data(), typeof option == 'object' && option)
1058 if (!data) $this.data('bs.modal', (data = new Modal(this, options)))
1059 if (typeof option == 'string') data[option](_relatedTarget)
1060 else if (options.show) data.show(_relatedTarget)
1064 var old = $.fn.modal
1067 $.fn.modal.Constructor = Modal
1070 // MODAL NO CONFLICT
1071 // =================
1073 $.fn.modal.noConflict = function () {
1082 $(document).on('click.bs.modal.data-api', '[data-toggle="modal"]', function (e) {
1084 var href = $this.attr('href')
1085 var $target = $($this.attr('data-target') || (href && href.replace(/.*(?=#[^\s]+$)/, ''))) // strip for ie7
1086 var option = $target.data('bs.modal') ? 'toggle' : $.extend({ remote: !/#/.test(href) && href }, $target.data(), $this.data())
1088 if ($this.is('a')) e.preventDefault()
1090 $target.one('show.bs.modal', function (showEvent) {
1091 if (showEvent.isDefaultPrevented()) return // only register focus restorer if modal will actually get shown
1092 $target.one('hidden.bs.modal', function () {
1093 $this.is(':visible') && $this.trigger('focus')
1096 Plugin.call($target, option, this)
1101 /* ========================================================================
1102 * Bootstrap: tooltip.js v3.2.0
1103 * http://getbootstrap.com/javascript/#tooltip
1104 * Inspired by the original jQuery.tipsy by Jason Frame
1105 * ========================================================================
1106 * Copyright 2011-2014 Twitter, Inc.
1107 * Licensed under MIT (https://github.com/twbs/bootstrap/blob/master/LICENSE)
1108 * ======================================================================== */
1114 // TOOLTIP PUBLIC CLASS DEFINITION
1115 // ===============================
1117 var Tooltip = function (element, options) {
1123 this.$element = null
1125 this.init('tooltip', element, options)
1128 Tooltip.VERSION = '3.2.0'
1130 Tooltip.DEFAULTS = {
1134 template: '<div class="tooltip" role="tooltip"><div class="tooltip-arrow"></div><div class="tooltip-inner"></div></div>',
1135 trigger: 'hover focus',
1146 Tooltip.prototype.init = function (type, element, options) {
1149 this.$element = $(element)
1150 this.options = this.getOptions(options)
1151 this.$viewport = this.options.viewport && $(this.options.viewport.selector || this.options.viewport)
1153 var triggers = this.options.trigger.split(' ')
1155 for (var i = triggers.length; i--;) {
1156 var trigger = triggers[i]
1158 if (trigger == 'click') {
1159 this.$element.on('click.' + this.type, this.options.selector, $.proxy(this.toggle, this))
1160 } else if (trigger != 'manual') {
1161 var eventIn = trigger == 'hover' ? 'mouseenter' : 'focusin'
1162 var eventOut = trigger == 'hover' ? 'mouseleave' : 'focusout'
1164 this.$element.on(eventIn + '.' + this.type, this.options.selector, $.proxy(this.enter, this))
1165 this.$element.on(eventOut + '.' + this.type, this.options.selector, $.proxy(this.leave, this))
1169 this.options.selector ?
1170 (this._options = $.extend({}, this.options, { trigger: 'manual', selector: '' })) :
1174 Tooltip.prototype.getDefaults = function () {
1175 return Tooltip.DEFAULTS
1178 Tooltip.prototype.getOptions = function (options) {
1179 options = $.extend({}, this.getDefaults(), this.$element.data(), options)
1181 if (options.delay && typeof options.delay == 'number') {
1183 show: options.delay,
1191 Tooltip.prototype.getDelegateOptions = function () {
1193 var defaults = this.getDefaults()
1195 this._options && $.each(this._options, function (key, value) {
1196 if (defaults[key] != value) options[key] = value
1202 Tooltip.prototype.enter = function (obj) {
1203 var self = obj instanceof this.constructor ?
1204 obj : $(obj.currentTarget).data('bs.' + this.type)
1207 self = new this.constructor(obj.currentTarget, this.getDelegateOptions())
1208 $(obj.currentTarget).data('bs.' + this.type, self)
1211 clearTimeout(self.timeout)
1213 self.hoverState = 'in'
1215 if (!self.options.delay || !self.options.delay.show) return self.show()
1217 self.timeout = setTimeout(function () {
1218 if (self.hoverState == 'in') self.show()
1219 }, self.options.delay.show)
1222 Tooltip.prototype.leave = function (obj) {
1223 var self = obj instanceof this.constructor ?
1224 obj : $(obj.currentTarget).data('bs.' + this.type)
1227 self = new this.constructor(obj.currentTarget, this.getDelegateOptions())
1228 $(obj.currentTarget).data('bs.' + this.type, self)
1231 clearTimeout(self.timeout)
1233 self.hoverState = 'out'
1235 if (!self.options.delay || !self.options.delay.hide) return self.hide()
1237 self.timeout = setTimeout(function () {
1238 if (self.hoverState == 'out') self.hide()
1239 }, self.options.delay.hide)
1242 Tooltip.prototype.show = function () {
1243 var e = $.Event('show.bs.' + this.type)
1245 if (this.hasContent() && this.enabled) {
1246 this.$element.trigger(e)
1248 var inDom = $.contains(document.documentElement, this.$element[0])
1249 if (e.isDefaultPrevented() || !inDom) return
1252 var $tip = this.tip()
1254 var tipId = this.getUID(this.type)
1257 $tip.attr('id', tipId)
1258 this.$element.attr('aria-describedby', tipId)
1260 if (this.options.animation) $tip.addClass('fade')
1262 var placement = typeof this.options.placement == 'function' ?
1263 this.options.placement.call(this, $tip[0], this.$element[0]) :
1264 this.options.placement
1266 var autoToken = /\s?auto?\s?/i
1267 var autoPlace = autoToken.test(placement)
1268 if (autoPlace) placement = placement.replace(autoToken, '') || 'top'
1272 .css({ top: 0, left: 0, display: 'block' })
1273 .addClass(placement)
1274 .data('bs.' + this.type, this)
1276 this.options.container ? $tip.appendTo(this.options.container) : $tip.insertAfter(this.$element)
1278 var pos = this.getPosition()
1279 var actualWidth = $tip[0].offsetWidth
1280 var actualHeight = $tip[0].offsetHeight
1283 var orgPlacement = placement
1284 var $parent = this.$element.parent()
1285 var parentDim = this.getPosition($parent)
1287 placement = placement == 'bottom' && pos.top + pos.height + actualHeight - parentDim.scroll > parentDim.height ? 'top' :
1288 placement == 'top' && pos.top - parentDim.scroll - actualHeight < 0 ? 'bottom' :
1289 placement == 'right' && pos.right + actualWidth > parentDim.width ? 'left' :
1290 placement == 'left' && pos.left - actualWidth < parentDim.left ? 'right' :
1294 .removeClass(orgPlacement)
1295 .addClass(placement)
1298 var calculatedOffset = this.getCalculatedOffset(placement, pos, actualWidth, actualHeight)
1300 this.applyPlacement(calculatedOffset, placement)
1302 var complete = function () {
1303 that.$element.trigger('shown.bs.' + that.type)
1304 that.hoverState = null
1307 $.support.transition && this.$tip.hasClass('fade') ?
1309 .one('bsTransitionEnd', complete)
1310 .emulateTransitionEnd(150) :
1315 Tooltip.prototype.applyPlacement = function (offset, placement) {
1316 var $tip = this.tip()
1317 var width = $tip[0].offsetWidth
1318 var height = $tip[0].offsetHeight
1320 // manually read margins because getBoundingClientRect includes difference
1321 var marginTop = parseInt($tip.css('margin-top'), 10)
1322 var marginLeft = parseInt($tip.css('margin-left'), 10)
1324 // we must check for NaN for ie 8/9
1325 if (isNaN(marginTop)) marginTop = 0
1326 if (isNaN(marginLeft)) marginLeft = 0
1328 offset.top = offset.top + marginTop
1329 offset.left = offset.left + marginLeft
1331 // $.fn.offset doesn't round pixel values
1332 // so we use setOffset directly with our own function B-0
1333 $.offset.setOffset($tip[0], $.extend({
1334 using: function (props) {
1336 top: Math.round(props.top),
1337 left: Math.round(props.left)
1344 // check to see if placing tip in new offset caused the tip to resize itself
1345 var actualWidth = $tip[0].offsetWidth
1346 var actualHeight = $tip[0].offsetHeight
1348 if (placement == 'top' && actualHeight != height) {
1349 offset.top = offset.top + height - actualHeight
1352 var delta = this.getViewportAdjustedDelta(placement, offset, actualWidth, actualHeight)
1354 if (delta.left) offset.left += delta.left
1355 else offset.top += delta.top
1357 var arrowDelta = delta.left ? delta.left * 2 - width + actualWidth : delta.top * 2 - height + actualHeight
1358 var arrowPosition = delta.left ? 'left' : 'top'
1359 var arrowOffsetPosition = delta.left ? 'offsetWidth' : 'offsetHeight'
1362 this.replaceArrow(arrowDelta, $tip[0][arrowOffsetPosition], arrowPosition)
1365 Tooltip.prototype.replaceArrow = function (delta, dimension, position) {
1366 this.arrow().css(position, delta ? (50 * (1 - delta / dimension) + '%') : '')
1369 Tooltip.prototype.setContent = function () {
1370 var $tip = this.tip()
1371 var title = this.getTitle()
1373 $tip.find('.tooltip-inner')[this.options.html ? 'html' : 'text'](title)
1374 $tip.removeClass('fade in top bottom left right')
1377 Tooltip.prototype.hide = function () {
1379 var $tip = this.tip()
1380 var e = $.Event('hide.bs.' + this.type)
1382 this.$element.removeAttr('aria-describedby')
1384 function complete() {
1385 if (that.hoverState != 'in') $tip.detach()
1386 that.$element.trigger('hidden.bs.' + that.type)
1389 this.$element.trigger(e)
1391 if (e.isDefaultPrevented()) return
1393 $tip.removeClass('in')
1395 $.support.transition && this.$tip.hasClass('fade') ?
1397 .one('bsTransitionEnd', complete)
1398 .emulateTransitionEnd(150) :
1401 this.hoverState = null
1406 Tooltip.prototype.fixTitle = function () {
1407 var $e = this.$element
1408 if ($e.attr('title') || typeof ($e.attr('data-original-title')) != 'string') {
1409 $e.attr('data-original-title', $e.attr('title') || '').attr('title', '')
1413 Tooltip.prototype.hasContent = function () {
1414 return this.getTitle()
1417 Tooltip.prototype.getPosition = function ($element) {
1418 $element = $element || this.$element
1419 var el = $element[0]
1420 var isBody = el.tagName == 'BODY'
1421 return $.extend({}, (typeof el.getBoundingClientRect == 'function') ? el.getBoundingClientRect() : null, {
1422 scroll: isBody ? document.documentElement.scrollTop || document.body.scrollTop : $element.scrollTop(),
1423 width: isBody ? $(window).width() : $element.outerWidth(),
1424 height: isBody ? $(window).height() : $element.outerHeight()
1425 }, isBody ? { top: 0, left: 0 } : $element.offset())
1428 Tooltip.prototype.getCalculatedOffset = function (placement, pos, actualWidth, actualHeight) {
1429 return placement == 'bottom' ? { top: pos.top + pos.height, left: pos.left + pos.width / 2 - actualWidth / 2 } :
1430 placement == 'top' ? { top: pos.top - actualHeight, left: pos.left + pos.width / 2 - actualWidth / 2 } :
1431 placement == 'left' ? { top: pos.top + pos.height / 2 - actualHeight / 2, left: pos.left - actualWidth } :
1432 /* placement == 'right' */ { top: pos.top + pos.height / 2 - actualHeight / 2, left: pos.left + pos.width }
1436 Tooltip.prototype.getViewportAdjustedDelta = function (placement, pos, actualWidth, actualHeight) {
1437 var delta = { top: 0, left: 0 }
1438 if (!this.$viewport) return delta
1440 var viewportPadding = this.options.viewport && this.options.viewport.padding || 0
1441 var viewportDimensions = this.getPosition(this.$viewport)
1443 if (/right|left/.test(placement)) {
1444 var topEdgeOffset = pos.top - viewportPadding - viewportDimensions.scroll
1445 var bottomEdgeOffset = pos.top + viewportPadding - viewportDimensions.scroll + actualHeight
1446 if (topEdgeOffset < viewportDimensions.top) { // top overflow
1447 delta.top = viewportDimensions.top - topEdgeOffset
1448 } else if (bottomEdgeOffset > viewportDimensions.top + viewportDimensions.height) { // bottom overflow
1449 delta.top = viewportDimensions.top + viewportDimensions.height - bottomEdgeOffset
1452 var leftEdgeOffset = pos.left - viewportPadding
1453 var rightEdgeOffset = pos.left + viewportPadding + actualWidth
1454 if (leftEdgeOffset < viewportDimensions.left) { // left overflow
1455 delta.left = viewportDimensions.left - leftEdgeOffset
1456 } else if (rightEdgeOffset > viewportDimensions.width) { // right overflow
1457 delta.left = viewportDimensions.left + viewportDimensions.width - rightEdgeOffset
1464 Tooltip.prototype.getTitle = function () {
1466 var $e = this.$element
1467 var o = this.options
1469 title = $e.attr('data-original-title')
1470 || (typeof o.title == 'function' ? o.title.call($e[0]) : o.title)
1475 Tooltip.prototype.getUID = function (prefix) {
1476 do prefix += ~~(Math.random() * 1000000)
1477 while (document.getElementById(prefix))
1481 Tooltip.prototype.tip = function () {
1482 return (this.$tip = this.$tip || $(this.options.template))
1485 Tooltip.prototype.arrow = function () {
1486 return (this.$arrow = this.$arrow || this.tip().find('.tooltip-arrow'))
1489 Tooltip.prototype.validate = function () {
1490 if (!this.$element[0].parentNode) {
1492 this.$element = null
1497 Tooltip.prototype.enable = function () {
1501 Tooltip.prototype.disable = function () {
1502 this.enabled = false
1505 Tooltip.prototype.toggleEnabled = function () {
1506 this.enabled = !this.enabled
1509 Tooltip.prototype.toggle = function (e) {
1512 self = $(e.currentTarget).data('bs.' + this.type)
1514 self = new this.constructor(e.currentTarget, this.getDelegateOptions())
1515 $(e.currentTarget).data('bs.' + this.type, self)
1519 self.tip().hasClass('in') ? self.leave(self) : self.enter(self)
1522 Tooltip.prototype.destroy = function () {
1523 clearTimeout(this.timeout)
1524 this.hide().$element.off('.' + this.type).removeData('bs.' + this.type)
1528 // TOOLTIP PLUGIN DEFINITION
1529 // =========================
1531 function Plugin(option) {
1532 return this.each(function () {
1534 var data = $this.data('bs.tooltip')
1535 var options = typeof option == 'object' && option
1537 if (!data && option == 'destroy') return
1538 if (!data) $this.data('bs.tooltip', (data = new Tooltip(this, options)))
1539 if (typeof option == 'string') data[option]()
1543 var old = $.fn.tooltip
1545 $.fn.tooltip = Plugin
1546 $.fn.tooltip.Constructor = Tooltip
1549 // TOOLTIP NO CONFLICT
1550 // ===================
1552 $.fn.tooltip.noConflict = function () {
1559 /* ========================================================================
1560 * Bootstrap: popover.js v3.2.0
1561 * http://getbootstrap.com/javascript/#popovers
1562 * ========================================================================
1563 * Copyright 2011-2014 Twitter, Inc.
1564 * Licensed under MIT (https://github.com/twbs/bootstrap/blob/master/LICENSE)
1565 * ======================================================================== */
1571 // POPOVER PUBLIC CLASS DEFINITION
1572 // ===============================
1574 var Popover = function (element, options) {
1575 this.init('popover', element, options)
1578 if (!$.fn.tooltip) throw new Error('Popover requires tooltip.js')
1580 Popover.VERSION = '3.2.0'
1582 Popover.DEFAULTS = $.extend({}, $.fn.tooltip.Constructor.DEFAULTS, {
1586 template: '<div class="popover" role="tooltip"><div class="arrow"></div><h3 class="popover-title"></h3><div class="popover-content"></div></div>'
1590 // NOTE: POPOVER EXTENDS tooltip.js
1591 // ================================
1593 Popover.prototype = $.extend({}, $.fn.tooltip.Constructor.prototype)
1595 Popover.prototype.constructor = Popover
1597 Popover.prototype.getDefaults = function () {
1598 return Popover.DEFAULTS
1601 Popover.prototype.setContent = function () {
1602 var $tip = this.tip()
1603 var title = this.getTitle()
1604 var content = this.getContent()
1606 $tip.find('.popover-title')[this.options.html ? 'html' : 'text'](title)
1607 $tip.find('.popover-content').empty()[ // we use append for html objects to maintain js events
1608 this.options.html ? (typeof content == 'string' ? 'html' : 'append') : 'text'
1611 $tip.removeClass('fade top bottom left right in')
1613 // IE8 doesn't accept hiding via the `:empty` pseudo selector, we have to do
1614 // this manually by checking the contents.
1615 if (!$tip.find('.popover-title').html()) $tip.find('.popover-title').hide()
1618 Popover.prototype.hasContent = function () {
1619 return this.getTitle() || this.getContent()
1622 Popover.prototype.getContent = function () {
1623 var $e = this.$element
1624 var o = this.options
1626 return $e.attr('data-content')
1627 || (typeof o.content == 'function' ?
1628 o.content.call($e[0]) :
1632 Popover.prototype.arrow = function () {
1633 return (this.$arrow = this.$arrow || this.tip().find('.arrow'))
1636 Popover.prototype.tip = function () {
1637 if (!this.$tip) this.$tip = $(this.options.template)
1642 // POPOVER PLUGIN DEFINITION
1643 // =========================
1645 function Plugin(option) {
1646 return this.each(function () {
1648 var data = $this.data('bs.popover')
1649 var options = typeof option == 'object' && option
1651 if (!data && option == 'destroy') return
1652 if (!data) $this.data('bs.popover', (data = new Popover(this, options)))
1653 if (typeof option == 'string') data[option]()
1657 var old = $.fn.popover
1659 $.fn.popover = Plugin
1660 $.fn.popover.Constructor = Popover
1663 // POPOVER NO CONFLICT
1664 // ===================
1666 $.fn.popover.noConflict = function () {
1673 /* ========================================================================
1674 * Bootstrap: scrollspy.js v3.2.0
1675 * http://getbootstrap.com/javascript/#scrollspy
1676 * ========================================================================
1677 * Copyright 2011-2014 Twitter, Inc.
1678 * Licensed under MIT (https://github.com/twbs/bootstrap/blob/master/LICENSE)
1679 * ======================================================================== */
1685 // SCROLLSPY CLASS DEFINITION
1686 // ==========================
1688 function ScrollSpy(element, options) {
1689 var process = $.proxy(this.process, this)
1691 this.$body = $('body')
1692 this.$scrollElement = $(element).is('body') ? $(window) : $(element)
1693 this.options = $.extend({}, ScrollSpy.DEFAULTS, options)
1694 this.selector = (this.options.target || '') + ' .nav li > a'
1697 this.activeTarget = null
1698 this.scrollHeight = 0
1700 this.$scrollElement.on('scroll.bs.scrollspy', process)
1705 ScrollSpy.VERSION = '3.2.0'
1707 ScrollSpy.DEFAULTS = {
1711 ScrollSpy.prototype.getScrollHeight = function () {
1712 return this.$scrollElement[0].scrollHeight || Math.max(this.$body[0].scrollHeight, document.documentElement.scrollHeight)
1715 ScrollSpy.prototype.refresh = function () {
1716 var offsetMethod = 'offset'
1719 if (!$.isWindow(this.$scrollElement[0])) {
1720 offsetMethod = 'position'
1721 offsetBase = this.$scrollElement.scrollTop()
1726 this.scrollHeight = this.getScrollHeight()
1731 .find(this.selector)
1734 var href = $el.data('target') || $el.attr('href')
1735 var $href = /^#./.test(href) && $(href)
1739 && $href.is(':visible')
1740 && [[$href[offsetMethod]().top + offsetBase, href]]) || null
1742 .sort(function (a, b) { return a[0] - b[0] })
1744 self.offsets.push(this[0])
1745 self.targets.push(this[1])
1749 ScrollSpy.prototype.process = function () {
1750 var scrollTop = this.$scrollElement.scrollTop() + this.options.offset
1751 var scrollHeight = this.getScrollHeight()
1752 var maxScroll = this.options.offset + scrollHeight - this.$scrollElement.height()
1753 var offsets = this.offsets
1754 var targets = this.targets
1755 var activeTarget = this.activeTarget
1758 if (this.scrollHeight != scrollHeight) {
1762 if (scrollTop >= maxScroll) {
1763 return activeTarget != (i = targets[targets.length - 1]) && this.activate(i)
1766 if (activeTarget && scrollTop <= offsets[0]) {
1767 return activeTarget != (i = targets[0]) && this.activate(i)
1770 for (i = offsets.length; i--;) {
1771 activeTarget != targets[i]
1772 && scrollTop >= offsets[i]
1773 && (!offsets[i + 1] || scrollTop <= offsets[i + 1])
1774 && this.activate(targets[i])
1778 ScrollSpy.prototype.activate = function (target) {
1779 this.activeTarget = target
1782 .parentsUntil(this.options.target, '.active')
1783 .removeClass('active')
1785 var selector = this.selector +
1786 '[data-target="' + target + '"],' +
1787 this.selector + '[href="' + target + '"]'
1789 var active = $(selector)
1793 if (active.parent('.dropdown-menu').length) {
1795 .closest('li.dropdown')
1799 active.trigger('activate.bs.scrollspy')
1803 // SCROLLSPY PLUGIN DEFINITION
1804 // ===========================
1806 function Plugin(option) {
1807 return this.each(function () {
1809 var data = $this.data('bs.scrollspy')
1810 var options = typeof option == 'object' && option
1812 if (!data) $this.data('bs.scrollspy', (data = new ScrollSpy(this, options)))
1813 if (typeof option == 'string') data[option]()
1817 var old = $.fn.scrollspy
1819 $.fn.scrollspy = Plugin
1820 $.fn.scrollspy.Constructor = ScrollSpy
1823 // SCROLLSPY NO CONFLICT
1824 // =====================
1826 $.fn.scrollspy.noConflict = function () {
1827 $.fn.scrollspy = old
1832 // SCROLLSPY DATA-API
1833 // ==================
1835 $(window).on('load.bs.scrollspy.data-api', function () {
1836 $('[data-spy="scroll"]').each(function () {
1838 Plugin.call($spy, $spy.data())
1844 /* ========================================================================
1845 * Bootstrap: tab.js v3.2.0
1846 * http://getbootstrap.com/javascript/#tabs
1847 * ========================================================================
1848 * Copyright 2011-2014 Twitter, Inc.
1849 * Licensed under MIT (https://github.com/twbs/bootstrap/blob/master/LICENSE)
1850 * ======================================================================== */
1856 // TAB CLASS DEFINITION
1857 // ====================
1859 var Tab = function (element) {
1860 this.element = $(element)
1863 Tab.VERSION = '3.2.0'
1865 Tab.prototype.show = function () {
1866 var $this = this.element
1867 var $ul = $this.closest('ul:not(.dropdown-menu)')
1868 var selector = $this.data('target')
1871 selector = $this.attr('href')
1872 selector = selector && selector.replace(/.*(?=#[^\s]*$)/, '') // strip for ie7
1875 if ($this.parent('li').hasClass('active')) return
1877 var previous = $ul.find('.active:last a')[0]
1878 var e = $.Event('show.bs.tab', {
1879 relatedTarget: previous
1884 if (e.isDefaultPrevented()) return
1886 var $target = $(selector)
1888 this.activate($this.closest('li'), $ul)
1889 this.activate($target, $target.parent(), function () {
1891 type: 'shown.bs.tab',
1892 relatedTarget: previous
1897 Tab.prototype.activate = function (element, container, callback) {
1898 var $active = container.find('> .active')
1899 var transition = callback
1900 && $.support.transition
1901 && $active.hasClass('fade')
1905 .removeClass('active')
1906 .find('> .dropdown-menu > .active')
1907 .removeClass('active')
1909 element.addClass('active')
1912 element[0].offsetWidth // reflow for transition
1913 element.addClass('in')
1915 element.removeClass('fade')
1918 if (element.parent('.dropdown-menu')) {
1919 element.closest('li.dropdown').addClass('active')
1922 callback && callback()
1927 .one('bsTransitionEnd', next)
1928 .emulateTransitionEnd(150) :
1931 $active.removeClass('in')
1935 // TAB PLUGIN DEFINITION
1936 // =====================
1938 function Plugin(option) {
1939 return this.each(function () {
1941 var data = $this.data('bs.tab')
1943 if (!data) $this.data('bs.tab', (data = new Tab(this)))
1944 if (typeof option == 'string') data[option]()
1951 $.fn.tab.Constructor = Tab
1957 $.fn.tab.noConflict = function () {
1966 $(document).on('click.bs.tab.data-api', '[data-toggle="tab"], [data-toggle="pill"]', function (e) {
1968 Plugin.call($(this), 'show')
1973 /* ========================================================================
1974 * Bootstrap: affix.js v3.2.0
1975 * http://getbootstrap.com/javascript/#affix
1976 * ========================================================================
1977 * Copyright 2011-2014 Twitter, Inc.
1978 * Licensed under MIT (https://github.com/twbs/bootstrap/blob/master/LICENSE)
1979 * ======================================================================== */
1985 // AFFIX CLASS DEFINITION
1986 // ======================
1988 var Affix = function (element, options) {
1989 this.options = $.extend({}, Affix.DEFAULTS, options)
1991 this.$target = $(this.options.target)
1992 .on('scroll.bs.affix.data-api', $.proxy(this.checkPosition, this))
1993 .on('click.bs.affix.data-api', $.proxy(this.checkPositionWithEventLoop, this))
1995 this.$element = $(element)
1998 this.pinnedOffset = null
2000 this.checkPosition()
2003 Affix.VERSION = '3.2.0'
2005 Affix.RESET = 'affix affix-top affix-bottom'
2012 Affix.prototype.getPinnedOffset = function () {
2013 if (this.pinnedOffset) return this.pinnedOffset
2014 this.$element.removeClass(Affix.RESET).addClass('affix')
2015 var scrollTop = this.$target.scrollTop()
2016 var position = this.$element.offset()
2017 return (this.pinnedOffset = position.top - scrollTop)
2020 Affix.prototype.checkPositionWithEventLoop = function () {
2021 setTimeout($.proxy(this.checkPosition, this), 1)
2024 Affix.prototype.checkPosition = function () {
2025 if (!this.$element.is(':visible')) return
2027 var scrollHeight = $(document).height()
2028 var scrollTop = this.$target.scrollTop()
2029 var position = this.$element.offset()
2030 var offset = this.options.offset
2031 var offsetTop = offset.top
2032 var offsetBottom = offset.bottom
2034 if (typeof offset != 'object') offsetBottom = offsetTop = offset
2035 if (typeof offsetTop == 'function') offsetTop = offset.top(this.$element)
2036 if (typeof offsetBottom == 'function') offsetBottom = offset.bottom(this.$element)
2038 var affix = this.unpin != null && (scrollTop + this.unpin <= position.top) ? false :
2039 offsetBottom != null && (position.top + this.$element.height() >= scrollHeight - offsetBottom) ? 'bottom' :
2040 offsetTop != null && (scrollTop <= offsetTop) ? 'top' : false
2042 if (this.affixed === affix) return
2043 if (this.unpin != null) this.$element.css('top', '')
2045 var affixType = 'affix' + (affix ? '-' + affix : '')
2046 var e = $.Event(affixType + '.bs.affix')
2048 this.$element.trigger(e)
2050 if (e.isDefaultPrevented()) return
2052 this.affixed = affix
2053 this.unpin = affix == 'bottom' ? this.getPinnedOffset() : null
2056 .removeClass(Affix.RESET)
2057 .addClass(affixType)
2058 .trigger($.Event(affixType.replace('affix', 'affixed')))
2060 if (affix == 'bottom') {
2061 this.$element.offset({
2062 top: scrollHeight - this.$element.height() - offsetBottom
2068 // AFFIX PLUGIN DEFINITION
2069 // =======================
2071 function Plugin(option) {
2072 return this.each(function () {
2074 var data = $this.data('bs.affix')
2075 var options = typeof option == 'object' && option
2077 if (!data) $this.data('bs.affix', (data = new Affix(this, options)))
2078 if (typeof option == 'string') data[option]()
2082 var old = $.fn.affix
2085 $.fn.affix.Constructor = Affix
2088 // AFFIX NO CONFLICT
2089 // =================
2091 $.fn.affix.noConflict = function () {
2100 $(window).on('load', function () {
2101 $('[data-spy="affix"]').each(function () {
2103 var data = $spy.data()
2105 data.offset = data.offset || {}
2107 if (data.offsetBottom) data.offset.bottom = data.offsetBottom
2108 if (data.offsetTop) data.offset.top = data.offsetTop
2110 Plugin.call($spy, data)