2 * Bootstrap v3.3.2 (http://getbootstrap.com)
3 * Copyright 2011-2015 Twitter, Inc.
4 * Licensed under MIT (https://github.com/twbs/bootstrap/blob/master/LICENSE)
7 if (typeof jQuery === 'undefined') {
8 throw new Error('Bootstrap\'s JavaScript requires jQuery')
13 var version = $.fn.jquery.split(' ')[0].split('.')
14 if ((version[0] < 2 && version[1] < 9) || (version[0] == 1 && version[1] == 9 && version[2] < 1)) {
15 throw new Error('Bootstrap\'s JavaScript requires jQuery version 1.9.1 or higher')
19 /* ========================================================================
20 * Bootstrap: transition.js v3.3.2
21 * http://getbootstrap.com/javascript/#transitions
22 * ========================================================================
23 * Copyright 2011-2015 Twitter, Inc.
24 * Licensed under MIT (https://github.com/twbs/bootstrap/blob/master/LICENSE)
25 * ======================================================================== */
31 // CSS TRANSITION SUPPORT (Shoutout: http://www.modernizr.com/)
32 // ============================================================
34 function transitionEnd() {
35 var el = document.createElement('bootstrap')
37 var transEndEventNames = {
38 WebkitTransition : 'webkitTransitionEnd',
39 MozTransition : 'transitionend',
40 OTransition : 'oTransitionEnd otransitionend',
41 transition : 'transitionend'
44 for (var name in transEndEventNames) {
45 if (el.style[name] !== undefined) {
46 return { end: transEndEventNames[name] }
50 return false // explicit for ie8 ( ._.)
53 // http://blog.alexmaccaw.com/css-transitions
54 $.fn.emulateTransitionEnd = function (duration) {
57 $(this).one('bsTransitionEnd', function () { called = true })
58 var callback = function () { if (!called) $($el).trigger($.support.transition.end) }
59 setTimeout(callback, duration)
64 $.support.transition = transitionEnd()
66 if (!$.support.transition) return
68 $.event.special.bsTransitionEnd = {
69 bindType: $.support.transition.end,
70 delegateType: $.support.transition.end,
71 handle: function (e) {
72 if ($(e.target).is(this)) return e.handleObj.handler.apply(this, arguments)
79 /* ========================================================================
80 * Bootstrap: alert.js v3.3.2
81 * http://getbootstrap.com/javascript/#alerts
82 * ========================================================================
83 * Copyright 2011-2015 Twitter, Inc.
84 * Licensed under MIT (https://github.com/twbs/bootstrap/blob/master/LICENSE)
85 * ======================================================================== */
91 // ALERT CLASS DEFINITION
92 // ======================
94 var dismiss = '[data-dismiss="alert"]'
95 var Alert = function (el) {
96 $(el).on('click', dismiss, this.close)
99 Alert.VERSION = '3.3.2'
101 Alert.TRANSITION_DURATION = 150
103 Alert.prototype.close = function (e) {
105 var selector = $this.attr('data-target')
108 selector = $this.attr('href')
109 selector = selector && selector.replace(/.*(?=#[^\s]*$)/, '') // strip for ie7
112 var $parent = $(selector)
114 if (e) e.preventDefault()
116 if (!$parent.length) {
117 $parent = $this.closest('.alert')
120 $parent.trigger(e = $.Event('close.bs.alert'))
122 if (e.isDefaultPrevented()) return
124 $parent.removeClass('in')
126 function removeElement() {
127 // detach from parent, fire event then clean up data
128 $parent.detach().trigger('closed.bs.alert').remove()
131 $.support.transition && $parent.hasClass('fade') ?
133 .one('bsTransitionEnd', removeElement)
134 .emulateTransitionEnd(Alert.TRANSITION_DURATION) :
139 // ALERT PLUGIN DEFINITION
140 // =======================
142 function Plugin(option) {
143 return this.each(function () {
145 var data = $this.data('bs.alert')
147 if (!data) $this.data('bs.alert', (data = new Alert(this)))
148 if (typeof option == 'string') data[option].call($this)
155 $.fn.alert.Constructor = Alert
161 $.fn.alert.noConflict = function () {
170 $(document).on('click.bs.alert.data-api', dismiss, Alert.prototype.close)
174 /* ========================================================================
175 * Bootstrap: button.js v3.3.2
176 * http://getbootstrap.com/javascript/#buttons
177 * ========================================================================
178 * Copyright 2011-2015 Twitter, Inc.
179 * Licensed under MIT (https://github.com/twbs/bootstrap/blob/master/LICENSE)
180 * ======================================================================== */
186 // BUTTON PUBLIC CLASS DEFINITION
187 // ==============================
189 var Button = function (element, options) {
190 this.$element = $(element)
191 this.options = $.extend({}, Button.DEFAULTS, options)
192 this.isLoading = false
195 Button.VERSION = '3.3.2'
198 loadingText: 'loading...'
201 Button.prototype.setState = function (state) {
203 var $el = this.$element
204 var val = $el.is('input') ? 'val' : 'html'
205 var data = $el.data()
207 state = state + 'Text'
209 if (data.resetText == null) $el.data('resetText', $el[val]())
211 // push to event loop to allow forms to submit
212 setTimeout($.proxy(function () {
213 $el[val](data[state] == null ? this.options[state] : data[state])
215 if (state == 'loadingText') {
216 this.isLoading = true
217 $el.addClass(d).attr(d, d)
218 } else if (this.isLoading) {
219 this.isLoading = false
220 $el.removeClass(d).removeAttr(d)
225 Button.prototype.toggle = function () {
227 var $parent = this.$element.closest('[data-toggle="buttons"]')
229 if ($parent.length) {
230 var $input = this.$element.find('input')
231 if ($input.prop('type') == 'radio') {
232 if ($input.prop('checked') && this.$element.hasClass('active')) changed = false
233 else $parent.find('.active').removeClass('active')
235 if (changed) $input.prop('checked', !this.$element.hasClass('active')).trigger('change')
237 this.$element.attr('aria-pressed', !this.$element.hasClass('active'))
240 if (changed) this.$element.toggleClass('active')
244 // BUTTON PLUGIN DEFINITION
245 // ========================
247 function Plugin(option) {
248 return this.each(function () {
250 var data = $this.data('bs.button')
251 var options = typeof option == 'object' && option
253 if (!data) $this.data('bs.button', (data = new Button(this, options)))
255 if (option == 'toggle') data.toggle()
256 else if (option) data.setState(option)
260 var old = $.fn.button
263 $.fn.button.Constructor = Button
266 // BUTTON NO CONFLICT
267 // ==================
269 $.fn.button.noConflict = function () {
279 .on('click.bs.button.data-api', '[data-toggle^="button"]', function (e) {
280 var $btn = $(e.target)
281 if (!$btn.hasClass('btn')) $btn = $btn.closest('.btn')
282 Plugin.call($btn, 'toggle')
285 .on('focus.bs.button.data-api blur.bs.button.data-api', '[data-toggle^="button"]', function (e) {
286 $(e.target).closest('.btn').toggleClass('focus', /^focus(in)?$/.test(e.type))
291 /* ========================================================================
292 * Bootstrap: carousel.js v3.3.2
293 * http://getbootstrap.com/javascript/#carousel
294 * ========================================================================
295 * Copyright 2011-2015 Twitter, Inc.
296 * Licensed under MIT (https://github.com/twbs/bootstrap/blob/master/LICENSE)
297 * ======================================================================== */
303 // CAROUSEL CLASS DEFINITION
304 // =========================
306 var Carousel = function (element, options) {
307 this.$element = $(element)
308 this.$indicators = this.$element.find('.carousel-indicators')
309 this.options = options
316 this.options.keyboard && this.$element.on('keydown.bs.carousel', $.proxy(this.keydown, this))
318 this.options.pause == 'hover' && !('ontouchstart' in document.documentElement) && this.$element
319 .on('mouseenter.bs.carousel', $.proxy(this.pause, this))
320 .on('mouseleave.bs.carousel', $.proxy(this.cycle, this))
323 Carousel.VERSION = '3.3.2'
325 Carousel.TRANSITION_DURATION = 600
327 Carousel.DEFAULTS = {
334 Carousel.prototype.keydown = function (e) {
335 if (/input|textarea/i.test(e.target.tagName)) return
337 case 37: this.prev(); break
338 case 39: this.next(); break
345 Carousel.prototype.cycle = function (e) {
346 e || (this.paused = false)
348 this.interval && clearInterval(this.interval)
350 this.options.interval
352 && (this.interval = setInterval($.proxy(this.next, this), this.options.interval))
357 Carousel.prototype.getItemIndex = function (item) {
358 this.$items = item.parent().children('.item')
359 return this.$items.index(item || this.$active)
362 Carousel.prototype.getItemForDirection = function (direction, active) {
363 var activeIndex = this.getItemIndex(active)
364 var willWrap = (direction == 'prev' && activeIndex === 0)
365 || (direction == 'next' && activeIndex == (this.$items.length - 1))
366 if (willWrap && !this.options.wrap) return active
367 var delta = direction == 'prev' ? -1 : 1
368 var itemIndex = (activeIndex + delta) % this.$items.length
369 return this.$items.eq(itemIndex)
372 Carousel.prototype.to = function (pos) {
374 var activeIndex = this.getItemIndex(this.$active = this.$element.find('.item.active'))
376 if (pos > (this.$items.length - 1) || pos < 0) return
378 if (this.sliding) return this.$element.one('slid.bs.carousel', function () { that.to(pos) }) // yes, "slid"
379 if (activeIndex == pos) return this.pause().cycle()
381 return this.slide(pos > activeIndex ? 'next' : 'prev', this.$items.eq(pos))
384 Carousel.prototype.pause = function (e) {
385 e || (this.paused = true)
387 if (this.$element.find('.next, .prev').length && $.support.transition) {
388 this.$element.trigger($.support.transition.end)
392 this.interval = clearInterval(this.interval)
397 Carousel.prototype.next = function () {
398 if (this.sliding) return
399 return this.slide('next')
402 Carousel.prototype.prev = function () {
403 if (this.sliding) return
404 return this.slide('prev')
407 Carousel.prototype.slide = function (type, next) {
408 var $active = this.$element.find('.item.active')
409 var $next = next || this.getItemForDirection(type, $active)
410 var isCycling = this.interval
411 var direction = type == 'next' ? 'left' : 'right'
414 if ($next.hasClass('active')) return (this.sliding = false)
416 var relatedTarget = $next[0]
417 var slideEvent = $.Event('slide.bs.carousel', {
418 relatedTarget: relatedTarget,
421 this.$element.trigger(slideEvent)
422 if (slideEvent.isDefaultPrevented()) return
426 isCycling && this.pause()
428 if (this.$indicators.length) {
429 this.$indicators.find('.active').removeClass('active')
430 var $nextIndicator = $(this.$indicators.children()[this.getItemIndex($next)])
431 $nextIndicator && $nextIndicator.addClass('active')
434 var slidEvent = $.Event('slid.bs.carousel', { relatedTarget: relatedTarget, direction: direction }) // yes, "slid"
435 if ($.support.transition && this.$element.hasClass('slide')) {
437 $next[0].offsetWidth // force reflow
438 $active.addClass(direction)
439 $next.addClass(direction)
441 .one('bsTransitionEnd', function () {
442 $next.removeClass([type, direction].join(' ')).addClass('active')
443 $active.removeClass(['active', direction].join(' '))
445 setTimeout(function () {
446 that.$element.trigger(slidEvent)
449 .emulateTransitionEnd(Carousel.TRANSITION_DURATION)
451 $active.removeClass('active')
452 $next.addClass('active')
454 this.$element.trigger(slidEvent)
457 isCycling && this.cycle()
463 // CAROUSEL PLUGIN DEFINITION
464 // ==========================
466 function Plugin(option) {
467 return this.each(function () {
469 var data = $this.data('bs.carousel')
470 var options = $.extend({}, Carousel.DEFAULTS, $this.data(), typeof option == 'object' && option)
471 var action = typeof option == 'string' ? option : options.slide
473 if (!data) $this.data('bs.carousel', (data = new Carousel(this, options)))
474 if (typeof option == 'number') data.to(option)
475 else if (action) data[action]()
476 else if (options.interval) data.pause().cycle()
480 var old = $.fn.carousel
482 $.fn.carousel = Plugin
483 $.fn.carousel.Constructor = Carousel
486 // CAROUSEL NO CONFLICT
487 // ====================
489 $.fn.carousel.noConflict = function () {
498 var clickHandler = function (e) {
501 var $target = $($this.attr('data-target') || (href = $this.attr('href')) && href.replace(/.*(?=#[^\s]+$)/, '')) // strip for ie7
502 if (!$target.hasClass('carousel')) return
503 var options = $.extend({}, $target.data(), $this.data())
504 var slideIndex = $this.attr('data-slide-to')
505 if (slideIndex) options.interval = false
507 Plugin.call($target, options)
510 $target.data('bs.carousel').to(slideIndex)
517 .on('click.bs.carousel.data-api', '[data-slide]', clickHandler)
518 .on('click.bs.carousel.data-api', '[data-slide-to]', clickHandler)
520 $(window).on('load', function () {
521 $('[data-ride="carousel"]').each(function () {
522 var $carousel = $(this)
523 Plugin.call($carousel, $carousel.data())
529 /* ========================================================================
530 * Bootstrap: collapse.js v3.3.2
531 * http://getbootstrap.com/javascript/#collapse
532 * ========================================================================
533 * Copyright 2011-2015 Twitter, Inc.
534 * Licensed under MIT (https://github.com/twbs/bootstrap/blob/master/LICENSE)
535 * ======================================================================== */
541 // COLLAPSE PUBLIC CLASS DEFINITION
542 // ================================
544 var Collapse = function (element, options) {
545 this.$element = $(element)
546 this.options = $.extend({}, Collapse.DEFAULTS, options)
547 this.$trigger = $(this.options.trigger).filter('[href="#' + element.id + '"], [data-target="#' + element.id + '"]')
548 this.transitioning = null
550 if (this.options.parent) {
551 this.$parent = this.getParent()
553 this.addAriaAndCollapsedClass(this.$element, this.$trigger)
556 if (this.options.toggle) this.toggle()
559 Collapse.VERSION = '3.3.2'
561 Collapse.TRANSITION_DURATION = 350
563 Collapse.DEFAULTS = {
565 trigger: '[data-toggle="collapse"]'
568 Collapse.prototype.dimension = function () {
569 var hasWidth = this.$element.hasClass('width')
570 return hasWidth ? 'width' : 'height'
573 Collapse.prototype.show = function () {
574 if (this.transitioning || this.$element.hasClass('in')) return
577 var actives = this.$parent && this.$parent.children('.panel').children('.in, .collapsing')
579 if (actives && actives.length) {
580 activesData = actives.data('bs.collapse')
581 if (activesData && activesData.transitioning) return
584 var startEvent = $.Event('show.bs.collapse')
585 this.$element.trigger(startEvent)
586 if (startEvent.isDefaultPrevented()) return
588 if (actives && actives.length) {
589 Plugin.call(actives, 'hide')
590 activesData || actives.data('bs.collapse', null)
593 var dimension = this.dimension()
596 .removeClass('collapse')
597 .addClass('collapsing')[dimension](0)
598 .attr('aria-expanded', true)
601 .removeClass('collapsed')
602 .attr('aria-expanded', true)
604 this.transitioning = 1
606 var complete = function () {
608 .removeClass('collapsing')
609 .addClass('collapse in')[dimension]('')
610 this.transitioning = 0
612 .trigger('shown.bs.collapse')
615 if (!$.support.transition) return complete.call(this)
617 var scrollSize = $.camelCase(['scroll', dimension].join('-'))
620 .one('bsTransitionEnd', $.proxy(complete, this))
621 .emulateTransitionEnd(Collapse.TRANSITION_DURATION)[dimension](this.$element[0][scrollSize])
624 Collapse.prototype.hide = function () {
625 if (this.transitioning || !this.$element.hasClass('in')) return
627 var startEvent = $.Event('hide.bs.collapse')
628 this.$element.trigger(startEvent)
629 if (startEvent.isDefaultPrevented()) return
631 var dimension = this.dimension()
633 this.$element[dimension](this.$element[dimension]())[0].offsetHeight
636 .addClass('collapsing')
637 .removeClass('collapse in')
638 .attr('aria-expanded', false)
641 .addClass('collapsed')
642 .attr('aria-expanded', false)
644 this.transitioning = 1
646 var complete = function () {
647 this.transitioning = 0
649 .removeClass('collapsing')
650 .addClass('collapse')
651 .trigger('hidden.bs.collapse')
654 if (!$.support.transition) return complete.call(this)
658 .one('bsTransitionEnd', $.proxy(complete, this))
659 .emulateTransitionEnd(Collapse.TRANSITION_DURATION)
662 Collapse.prototype.toggle = function () {
663 this[this.$element.hasClass('in') ? 'hide' : 'show']()
666 Collapse.prototype.getParent = function () {
667 return $(this.options.parent)
668 .find('[data-toggle="collapse"][data-parent="' + this.options.parent + '"]')
669 .each($.proxy(function (i, element) {
670 var $element = $(element)
671 this.addAriaAndCollapsedClass(getTargetFromTrigger($element), $element)
676 Collapse.prototype.addAriaAndCollapsedClass = function ($element, $trigger) {
677 var isOpen = $element.hasClass('in')
679 $element.attr('aria-expanded', isOpen)
681 .toggleClass('collapsed', !isOpen)
682 .attr('aria-expanded', isOpen)
685 function getTargetFromTrigger($trigger) {
687 var target = $trigger.attr('data-target')
688 || (href = $trigger.attr('href')) && href.replace(/.*(?=#[^\s]+$)/, '') // strip for ie7
694 // COLLAPSE PLUGIN DEFINITION
695 // ==========================
697 function Plugin(option) {
698 return this.each(function () {
700 var data = $this.data('bs.collapse')
701 var options = $.extend({}, Collapse.DEFAULTS, $this.data(), typeof option == 'object' && option)
703 if (!data && options.toggle && option == 'show') options.toggle = false
704 if (!data) $this.data('bs.collapse', (data = new Collapse(this, options)))
705 if (typeof option == 'string') data[option]()
709 var old = $.fn.collapse
711 $.fn.collapse = Plugin
712 $.fn.collapse.Constructor = Collapse
715 // COLLAPSE NO CONFLICT
716 // ====================
718 $.fn.collapse.noConflict = function () {
727 $(document).on('click.bs.collapse.data-api', '[data-toggle="collapse"]', function (e) {
730 if (!$this.attr('data-target')) e.preventDefault()
732 var $target = getTargetFromTrigger($this)
733 var data = $target.data('bs.collapse')
734 var option = data ? 'toggle' : $.extend({}, $this.data(), { trigger: this })
736 Plugin.call($target, option)
741 /* ========================================================================
742 * Bootstrap: dropdown.js v3.3.2
743 * http://getbootstrap.com/javascript/#dropdowns
744 * ========================================================================
745 * Copyright 2011-2015 Twitter, Inc.
746 * Licensed under MIT (https://github.com/twbs/bootstrap/blob/master/LICENSE)
747 * ======================================================================== */
753 // DROPDOWN CLASS DEFINITION
754 // =========================
756 var backdrop = '.dropdown-backdrop'
757 var toggle = '[data-toggle="dropdown"]'
758 var Dropdown = function (element) {
759 $(element).on('click.bs.dropdown', this.toggle)
762 Dropdown.VERSION = '3.3.2'
764 Dropdown.prototype.toggle = function (e) {
767 if ($this.is('.disabled, :disabled')) return
769 var $parent = getParent($this)
770 var isActive = $parent.hasClass('open')
775 if ('ontouchstart' in document.documentElement && !$parent.closest('.navbar-nav').length) {
776 // if mobile we use a backdrop because click events don't delegate
777 $('<div class="dropdown-backdrop"/>').insertAfter($(this)).on('click', clearMenus)
780 var relatedTarget = { relatedTarget: this }
781 $parent.trigger(e = $.Event('show.bs.dropdown', relatedTarget))
783 if (e.isDefaultPrevented()) return
787 .attr('aria-expanded', 'true')
791 .trigger('shown.bs.dropdown', relatedTarget)
797 Dropdown.prototype.keydown = function (e) {
798 if (!/(38|40|27|32)/.test(e.which) || /input|textarea/i.test(e.target.tagName)) return
805 if ($this.is('.disabled, :disabled')) return
807 var $parent = getParent($this)
808 var isActive = $parent.hasClass('open')
810 if ((!isActive && e.which != 27) || (isActive && e.which == 27)) {
811 if (e.which == 27) $parent.find(toggle).trigger('focus')
812 return $this.trigger('click')
815 var desc = ' li:not(.divider):visible a'
816 var $items = $parent.find('[role="menu"]' + desc + ', [role="listbox"]' + desc)
818 if (!$items.length) return
820 var index = $items.index(e.target)
822 if (e.which == 38 && index > 0) index-- // up
823 if (e.which == 40 && index < $items.length - 1) index++ // down
824 if (!~index) index = 0
826 $items.eq(index).trigger('focus')
829 function clearMenus(e) {
830 if (e && e.which === 3) return
832 $(toggle).each(function () {
834 var $parent = getParent($this)
835 var relatedTarget = { relatedTarget: this }
837 if (!$parent.hasClass('open')) return
839 $parent.trigger(e = $.Event('hide.bs.dropdown', relatedTarget))
841 if (e.isDefaultPrevented()) return
843 $this.attr('aria-expanded', 'false')
844 $parent.removeClass('open').trigger('hidden.bs.dropdown', relatedTarget)
848 function getParent($this) {
849 var selector = $this.attr('data-target')
852 selector = $this.attr('href')
853 selector = selector && /#[A-Za-z]/.test(selector) && selector.replace(/.*(?=#[^\s]*$)/, '') // strip for ie7
856 var $parent = selector && $(selector)
858 return $parent && $parent.length ? $parent : $this.parent()
862 // DROPDOWN PLUGIN DEFINITION
863 // ==========================
865 function Plugin(option) {
866 return this.each(function () {
868 var data = $this.data('bs.dropdown')
870 if (!data) $this.data('bs.dropdown', (data = new Dropdown(this)))
871 if (typeof option == 'string') data[option].call($this)
875 var old = $.fn.dropdown
877 $.fn.dropdown = Plugin
878 $.fn.dropdown.Constructor = Dropdown
881 // DROPDOWN NO CONFLICT
882 // ====================
884 $.fn.dropdown.noConflict = function () {
890 // APPLY TO STANDARD DROPDOWN ELEMENTS
891 // ===================================
894 .on('click.bs.dropdown.data-api', clearMenus)
895 .on('click.bs.dropdown.data-api', '.dropdown form', function (e) { e.stopPropagation() })
896 .on('click.bs.dropdown.data-api', toggle, Dropdown.prototype.toggle)
897 .on('keydown.bs.dropdown.data-api', toggle, Dropdown.prototype.keydown)
898 .on('keydown.bs.dropdown.data-api', '[role="menu"]', Dropdown.prototype.keydown)
899 .on('keydown.bs.dropdown.data-api', '[role="listbox"]', Dropdown.prototype.keydown)
903 /* ========================================================================
904 * Bootstrap: modal.js v3.3.2
905 * http://getbootstrap.com/javascript/#modals
906 * ========================================================================
907 * Copyright 2011-2015 Twitter, Inc.
908 * Licensed under MIT (https://github.com/twbs/bootstrap/blob/master/LICENSE)
909 * ======================================================================== */
915 // MODAL CLASS DEFINITION
916 // ======================
918 var Modal = function (element, options) {
919 this.options = options
920 this.$body = $(document.body)
921 this.$element = $(element)
924 this.scrollbarWidth = 0
926 if (this.options.remote) {
928 .find('.modal-content')
929 .load(this.options.remote, $.proxy(function () {
930 this.$element.trigger('loaded.bs.modal')
935 Modal.VERSION = '3.3.2'
937 Modal.TRANSITION_DURATION = 300
938 Modal.BACKDROP_TRANSITION_DURATION = 150
946 Modal.prototype.toggle = function (_relatedTarget) {
947 return this.isShown ? this.hide() : this.show(_relatedTarget)
950 Modal.prototype.show = function (_relatedTarget) {
952 var e = $.Event('show.bs.modal', { relatedTarget: _relatedTarget })
954 this.$element.trigger(e)
956 if (this.isShown || e.isDefaultPrevented()) return
960 this.checkScrollbar()
962 this.$body.addClass('modal-open')
967 this.$element.on('click.dismiss.bs.modal', '[data-dismiss="modal"]', $.proxy(this.hide, this))
969 this.backdrop(function () {
970 var transition = $.support.transition && that.$element.hasClass('fade')
972 if (!that.$element.parent().length) {
973 that.$element.appendTo(that.$body) // don't move modals dom position
980 if (that.options.backdrop) that.adjustBackdrop()
984 that.$element[0].offsetWidth // force reflow
989 .attr('aria-hidden', false)
993 var e = $.Event('shown.bs.modal', { relatedTarget: _relatedTarget })
996 that.$element.find('.modal-dialog') // wait for modal to slide in
997 .one('bsTransitionEnd', function () {
998 that.$element.trigger('focus').trigger(e)
1000 .emulateTransitionEnd(Modal.TRANSITION_DURATION) :
1001 that.$element.trigger('focus').trigger(e)
1005 Modal.prototype.hide = function (e) {
1006 if (e) e.preventDefault()
1008 e = $.Event('hide.bs.modal')
1010 this.$element.trigger(e)
1012 if (!this.isShown || e.isDefaultPrevented()) return
1014 this.isShown = false
1019 $(document).off('focusin.bs.modal')
1023 .attr('aria-hidden', true)
1024 .off('click.dismiss.bs.modal')
1026 $.support.transition && this.$element.hasClass('fade') ?
1028 .one('bsTransitionEnd', $.proxy(this.hideModal, this))
1029 .emulateTransitionEnd(Modal.TRANSITION_DURATION) :
1033 Modal.prototype.enforceFocus = function () {
1035 .off('focusin.bs.modal') // guard against infinite focus loop
1036 .on('focusin.bs.modal', $.proxy(function (e) {
1037 if (this.$element[0] !== e.target && !this.$element.has(e.target).length) {
1038 this.$element.trigger('focus')
1043 Modal.prototype.escape = function () {
1044 if (this.isShown && this.options.keyboard) {
1045 this.$element.on('keydown.dismiss.bs.modal', $.proxy(function (e) {
1046 e.which == 27 && this.hide()
1048 } else if (!this.isShown) {
1049 this.$element.off('keydown.dismiss.bs.modal')
1053 Modal.prototype.resize = function () {
1055 $(window).on('resize.bs.modal', $.proxy(this.handleUpdate, this))
1057 $(window).off('resize.bs.modal')
1061 Modal.prototype.hideModal = function () {
1063 this.$element.hide()
1064 this.backdrop(function () {
1065 that.$body.removeClass('modal-open')
1066 that.resetAdjustments()
1067 that.resetScrollbar()
1068 that.$element.trigger('hidden.bs.modal')
1072 Modal.prototype.removeBackdrop = function () {
1073 this.$backdrop && this.$backdrop.remove()
1074 this.$backdrop = null
1077 Modal.prototype.backdrop = function (callback) {
1079 var animate = this.$element.hasClass('fade') ? 'fade' : ''
1081 if (this.isShown && this.options.backdrop) {
1082 var doAnimate = $.support.transition && animate
1084 this.$backdrop = $('<div class="modal-backdrop ' + animate + '" />')
1085 .prependTo(this.$element)
1086 .on('click.dismiss.bs.modal', $.proxy(function (e) {
1087 if (e.target !== e.currentTarget) return
1088 this.options.backdrop == 'static'
1089 ? this.$element[0].focus.call(this.$element[0])
1090 : this.hide.call(this)
1093 if (doAnimate) this.$backdrop[0].offsetWidth // force reflow
1095 this.$backdrop.addClass('in')
1097 if (!callback) return
1101 .one('bsTransitionEnd', callback)
1102 .emulateTransitionEnd(Modal.BACKDROP_TRANSITION_DURATION) :
1105 } else if (!this.isShown && this.$backdrop) {
1106 this.$backdrop.removeClass('in')
1108 var callbackRemove = function () {
1109 that.removeBackdrop()
1110 callback && callback()
1112 $.support.transition && this.$element.hasClass('fade') ?
1114 .one('bsTransitionEnd', callbackRemove)
1115 .emulateTransitionEnd(Modal.BACKDROP_TRANSITION_DURATION) :
1118 } else if (callback) {
1123 // these following methods are used to handle overflowing modals
1125 Modal.prototype.handleUpdate = function () {
1126 if (this.options.backdrop) this.adjustBackdrop()
1130 Modal.prototype.adjustBackdrop = function () {
1133 .css('height', this.$element[0].scrollHeight)
1136 Modal.prototype.adjustDialog = function () {
1137 var modalIsOverflowing = this.$element[0].scrollHeight > document.documentElement.clientHeight
1140 paddingLeft: !this.bodyIsOverflowing && modalIsOverflowing ? this.scrollbarWidth : '',
1141 paddingRight: this.bodyIsOverflowing && !modalIsOverflowing ? this.scrollbarWidth : ''
1145 Modal.prototype.resetAdjustments = function () {
1152 Modal.prototype.checkScrollbar = function () {
1153 this.bodyIsOverflowing = document.body.scrollHeight > document.documentElement.clientHeight
1154 this.scrollbarWidth = this.measureScrollbar()
1157 Modal.prototype.setScrollbar = function () {
1158 var bodyPad = parseInt((this.$body.css('padding-right') || 0), 10)
1159 if (this.bodyIsOverflowing) this.$body.css('padding-right', bodyPad + this.scrollbarWidth)
1162 Modal.prototype.resetScrollbar = function () {
1163 this.$body.css('padding-right', '')
1166 Modal.prototype.measureScrollbar = function () { // thx walsh
1167 var scrollDiv = document.createElement('div')
1168 scrollDiv.className = 'modal-scrollbar-measure'
1169 this.$body.append(scrollDiv)
1170 var scrollbarWidth = scrollDiv.offsetWidth - scrollDiv.clientWidth
1171 this.$body[0].removeChild(scrollDiv)
1172 return scrollbarWidth
1176 // MODAL PLUGIN DEFINITION
1177 // =======================
1179 function Plugin(option, _relatedTarget) {
1180 return this.each(function () {
1182 var data = $this.data('bs.modal')
1183 var options = $.extend({}, Modal.DEFAULTS, $this.data(), typeof option == 'object' && option)
1185 if (!data) $this.data('bs.modal', (data = new Modal(this, options)))
1186 if (typeof option == 'string') data[option](_relatedTarget)
1187 else if (options.show) data.show(_relatedTarget)
1191 var old = $.fn.modal
1194 $.fn.modal.Constructor = Modal
1197 // MODAL NO CONFLICT
1198 // =================
1200 $.fn.modal.noConflict = function () {
1209 $(document).on('click.bs.modal.data-api', '[data-toggle="modal"]', function (e) {
1211 var href = $this.attr('href')
1212 var $target = $($this.attr('data-target') || (href && href.replace(/.*(?=#[^\s]+$)/, ''))) // strip for ie7
1213 var option = $target.data('bs.modal') ? 'toggle' : $.extend({ remote: !/#/.test(href) && href }, $target.data(), $this.data())
1215 if ($this.is('a')) e.preventDefault()
1217 $target.one('show.bs.modal', function (showEvent) {
1218 if (showEvent.isDefaultPrevented()) return // only register focus restorer if modal will actually get shown
1219 $target.one('hidden.bs.modal', function () {
1220 $this.is(':visible') && $this.trigger('focus')
1223 Plugin.call($target, option, this)
1228 /* ========================================================================
1229 * Bootstrap: tooltip.js v3.3.2
1230 * http://getbootstrap.com/javascript/#tooltip
1231 * Inspired by the original jQuery.tipsy by Jason Frame
1232 * ========================================================================
1233 * Copyright 2011-2015 Twitter, Inc.
1234 * Licensed under MIT (https://github.com/twbs/bootstrap/blob/master/LICENSE)
1235 * ======================================================================== */
1241 // TOOLTIP PUBLIC CLASS DEFINITION
1242 // ===============================
1244 var Tooltip = function (element, options) {
1250 this.$element = null
1252 this.init('tooltip', element, options)
1255 Tooltip.VERSION = '3.3.2'
1257 Tooltip.TRANSITION_DURATION = 150
1259 Tooltip.DEFAULTS = {
1263 template: '<div class="tooltip" role="tooltip"><div class="tooltip-arrow"></div><div class="tooltip-inner"></div></div>',
1264 trigger: 'hover focus',
1275 Tooltip.prototype.init = function (type, element, options) {
1278 this.$element = $(element)
1279 this.options = this.getOptions(options)
1280 this.$viewport = this.options.viewport && $(this.options.viewport.selector || this.options.viewport)
1282 var triggers = this.options.trigger.split(' ')
1284 for (var i = triggers.length; i--;) {
1285 var trigger = triggers[i]
1287 if (trigger == 'click') {
1288 this.$element.on('click.' + this.type, this.options.selector, $.proxy(this.toggle, this))
1289 } else if (trigger != 'manual') {
1290 var eventIn = trigger == 'hover' ? 'mouseenter' : 'focusin'
1291 var eventOut = trigger == 'hover' ? 'mouseleave' : 'focusout'
1293 this.$element.on(eventIn + '.' + this.type, this.options.selector, $.proxy(this.enter, this))
1294 this.$element.on(eventOut + '.' + this.type, this.options.selector, $.proxy(this.leave, this))
1298 this.options.selector ?
1299 (this._options = $.extend({}, this.options, { trigger: 'manual', selector: '' })) :
1303 Tooltip.prototype.getDefaults = function () {
1304 return Tooltip.DEFAULTS
1307 Tooltip.prototype.getOptions = function (options) {
1308 options = $.extend({}, this.getDefaults(), this.$element.data(), options)
1310 if (options.delay && typeof options.delay == 'number') {
1312 show: options.delay,
1320 Tooltip.prototype.getDelegateOptions = function () {
1322 var defaults = this.getDefaults()
1324 this._options && $.each(this._options, function (key, value) {
1325 if (defaults[key] != value) options[key] = value
1331 Tooltip.prototype.enter = function (obj) {
1332 var self = obj instanceof this.constructor ?
1333 obj : $(obj.currentTarget).data('bs.' + this.type)
1335 if (self && self.$tip && self.$tip.is(':visible')) {
1336 self.hoverState = 'in'
1341 self = new this.constructor(obj.currentTarget, this.getDelegateOptions())
1342 $(obj.currentTarget).data('bs.' + this.type, self)
1345 clearTimeout(self.timeout)
1347 self.hoverState = 'in'
1349 if (!self.options.delay || !self.options.delay.show) return self.show()
1351 self.timeout = setTimeout(function () {
1352 if (self.hoverState == 'in') self.show()
1353 }, self.options.delay.show)
1356 Tooltip.prototype.leave = function (obj) {
1357 var self = obj instanceof this.constructor ?
1358 obj : $(obj.currentTarget).data('bs.' + this.type)
1361 self = new this.constructor(obj.currentTarget, this.getDelegateOptions())
1362 $(obj.currentTarget).data('bs.' + this.type, self)
1365 clearTimeout(self.timeout)
1367 self.hoverState = 'out'
1369 if (!self.options.delay || !self.options.delay.hide) return self.hide()
1371 self.timeout = setTimeout(function () {
1372 if (self.hoverState == 'out') self.hide()
1373 }, self.options.delay.hide)
1376 Tooltip.prototype.show = function () {
1377 var e = $.Event('show.bs.' + this.type)
1379 if (this.hasContent() && this.enabled) {
1380 this.$element.trigger(e)
1382 var inDom = $.contains(this.$element[0].ownerDocument.documentElement, this.$element[0])
1383 if (e.isDefaultPrevented() || !inDom) return
1386 var $tip = this.tip()
1388 var tipId = this.getUID(this.type)
1391 $tip.attr('id', tipId)
1392 this.$element.attr('aria-describedby', tipId)
1394 if (this.options.animation) $tip.addClass('fade')
1396 var placement = typeof this.options.placement == 'function' ?
1397 this.options.placement.call(this, $tip[0], this.$element[0]) :
1398 this.options.placement
1400 var autoToken = /\s?auto?\s?/i
1401 var autoPlace = autoToken.test(placement)
1402 if (autoPlace) placement = placement.replace(autoToken, '') || 'top'
1406 .css({ top: 0, left: 0, display: 'block' })
1407 .addClass(placement)
1408 .data('bs.' + this.type, this)
1410 this.options.container ? $tip.appendTo(this.options.container) : $tip.insertAfter(this.$element)
1412 var pos = this.getPosition()
1413 var actualWidth = $tip[0].offsetWidth
1414 var actualHeight = $tip[0].offsetHeight
1417 var orgPlacement = placement
1418 var $container = this.options.container ? $(this.options.container) : this.$element.parent()
1419 var containerDim = this.getPosition($container)
1421 placement = placement == 'bottom' && pos.bottom + actualHeight > containerDim.bottom ? 'top' :
1422 placement == 'top' && pos.top - actualHeight < containerDim.top ? 'bottom' :
1423 placement == 'right' && pos.right + actualWidth > containerDim.width ? 'left' :
1424 placement == 'left' && pos.left - actualWidth < containerDim.left ? 'right' :
1428 .removeClass(orgPlacement)
1429 .addClass(placement)
1432 var calculatedOffset = this.getCalculatedOffset(placement, pos, actualWidth, actualHeight)
1434 this.applyPlacement(calculatedOffset, placement)
1436 var complete = function () {
1437 var prevHoverState = that.hoverState
1438 that.$element.trigger('shown.bs.' + that.type)
1439 that.hoverState = null
1441 if (prevHoverState == 'out') that.leave(that)
1444 $.support.transition && this.$tip.hasClass('fade') ?
1446 .one('bsTransitionEnd', complete)
1447 .emulateTransitionEnd(Tooltip.TRANSITION_DURATION) :
1452 Tooltip.prototype.applyPlacement = function (offset, placement) {
1453 var $tip = this.tip()
1454 var width = $tip[0].offsetWidth
1455 var height = $tip[0].offsetHeight
1457 // manually read margins because getBoundingClientRect includes difference
1458 var marginTop = parseInt($tip.css('margin-top'), 10)
1459 var marginLeft = parseInt($tip.css('margin-left'), 10)
1461 // we must check for NaN for ie 8/9
1462 if (isNaN(marginTop)) marginTop = 0
1463 if (isNaN(marginLeft)) marginLeft = 0
1465 offset.top = offset.top + marginTop
1466 offset.left = offset.left + marginLeft
1468 // $.fn.offset doesn't round pixel values
1469 // so we use setOffset directly with our own function B-0
1470 $.offset.setOffset($tip[0], $.extend({
1471 using: function (props) {
1473 top: Math.round(props.top),
1474 left: Math.round(props.left)
1481 // check to see if placing tip in new offset caused the tip to resize itself
1482 var actualWidth = $tip[0].offsetWidth
1483 var actualHeight = $tip[0].offsetHeight
1485 if (placement == 'top' && actualHeight != height) {
1486 offset.top = offset.top + height - actualHeight
1489 var delta = this.getViewportAdjustedDelta(placement, offset, actualWidth, actualHeight)
1491 if (delta.left) offset.left += delta.left
1492 else offset.top += delta.top
1494 var isVertical = /top|bottom/.test(placement)
1495 var arrowDelta = isVertical ? delta.left * 2 - width + actualWidth : delta.top * 2 - height + actualHeight
1496 var arrowOffsetPosition = isVertical ? 'offsetWidth' : 'offsetHeight'
1499 this.replaceArrow(arrowDelta, $tip[0][arrowOffsetPosition], isVertical)
1502 Tooltip.prototype.replaceArrow = function (delta, dimension, isHorizontal) {
1504 .css(isHorizontal ? 'left' : 'top', 50 * (1 - delta / dimension) + '%')
1505 .css(isHorizontal ? 'top' : 'left', '')
1508 Tooltip.prototype.setContent = function () {
1509 var $tip = this.tip()
1510 var title = this.getTitle()
1512 $tip.find('.tooltip-inner')[this.options.html ? 'html' : 'text'](title)
1513 $tip.removeClass('fade in top bottom left right')
1516 Tooltip.prototype.hide = function (callback) {
1518 var $tip = this.tip()
1519 var e = $.Event('hide.bs.' + this.type)
1521 function complete() {
1522 if (that.hoverState != 'in') $tip.detach()
1524 .removeAttr('aria-describedby')
1525 .trigger('hidden.bs.' + that.type)
1526 callback && callback()
1529 this.$element.trigger(e)
1531 if (e.isDefaultPrevented()) return
1533 $tip.removeClass('in')
1535 $.support.transition && this.$tip.hasClass('fade') ?
1537 .one('bsTransitionEnd', complete)
1538 .emulateTransitionEnd(Tooltip.TRANSITION_DURATION) :
1541 this.hoverState = null
1546 Tooltip.prototype.fixTitle = function () {
1547 var $e = this.$element
1548 if ($e.attr('title') || typeof ($e.attr('data-original-title')) != 'string') {
1549 $e.attr('data-original-title', $e.attr('title') || '').attr('title', '')
1553 Tooltip.prototype.hasContent = function () {
1554 return this.getTitle()
1557 Tooltip.prototype.getPosition = function ($element) {
1558 $element = $element || this.$element
1560 var el = $element[0]
1561 var isBody = el.tagName == 'BODY'
1563 var elRect = el.getBoundingClientRect()
1564 if (elRect.width == null) {
1565 // width and height are missing in IE8, so compute them manually; see https://github.com/twbs/bootstrap/issues/14093
1566 elRect = $.extend({}, elRect, { width: elRect.right - elRect.left, height: elRect.bottom - elRect.top })
1568 var elOffset = isBody ? { top: 0, left: 0 } : $element.offset()
1569 var scroll = { scroll: isBody ? document.documentElement.scrollTop || document.body.scrollTop : $element.scrollTop() }
1570 var outerDims = isBody ? { width: $(window).width(), height: $(window).height() } : null
1572 return $.extend({}, elRect, scroll, outerDims, elOffset)
1575 Tooltip.prototype.getCalculatedOffset = function (placement, pos, actualWidth, actualHeight) {
1576 return placement == 'bottom' ? { top: pos.top + pos.height, left: pos.left + pos.width / 2 - actualWidth / 2 } :
1577 placement == 'top' ? { top: pos.top - actualHeight, left: pos.left + pos.width / 2 - actualWidth / 2 } :
1578 placement == 'left' ? { top: pos.top + pos.height / 2 - actualHeight / 2, left: pos.left - actualWidth } :
1579 /* placement == 'right' */ { top: pos.top + pos.height / 2 - actualHeight / 2, left: pos.left + pos.width }
1583 Tooltip.prototype.getViewportAdjustedDelta = function (placement, pos, actualWidth, actualHeight) {
1584 var delta = { top: 0, left: 0 }
1585 if (!this.$viewport) return delta
1587 var viewportPadding = this.options.viewport && this.options.viewport.padding || 0
1588 var viewportDimensions = this.getPosition(this.$viewport)
1590 if (/right|left/.test(placement)) {
1591 var topEdgeOffset = pos.top - viewportPadding - viewportDimensions.scroll
1592 var bottomEdgeOffset = pos.top + viewportPadding - viewportDimensions.scroll + actualHeight
1593 if (topEdgeOffset < viewportDimensions.top) { // top overflow
1594 delta.top = viewportDimensions.top - topEdgeOffset
1595 } else if (bottomEdgeOffset > viewportDimensions.top + viewportDimensions.height) { // bottom overflow
1596 delta.top = viewportDimensions.top + viewportDimensions.height - bottomEdgeOffset
1599 var leftEdgeOffset = pos.left - viewportPadding
1600 var rightEdgeOffset = pos.left + viewportPadding + actualWidth
1601 if (leftEdgeOffset < viewportDimensions.left) { // left overflow
1602 delta.left = viewportDimensions.left - leftEdgeOffset
1603 } else if (rightEdgeOffset > viewportDimensions.width) { // right overflow
1604 delta.left = viewportDimensions.left + viewportDimensions.width - rightEdgeOffset
1611 Tooltip.prototype.getTitle = function () {
1613 var $e = this.$element
1614 var o = this.options
1616 title = $e.attr('data-original-title')
1617 || (typeof o.title == 'function' ? o.title.call($e[0]) : o.title)
1622 Tooltip.prototype.getUID = function (prefix) {
1623 do prefix += ~~(Math.random() * 1000000)
1624 while (document.getElementById(prefix))
1628 Tooltip.prototype.tip = function () {
1629 return (this.$tip = this.$tip || $(this.options.template))
1632 Tooltip.prototype.arrow = function () {
1633 return (this.$arrow = this.$arrow || this.tip().find('.tooltip-arrow'))
1636 Tooltip.prototype.enable = function () {
1640 Tooltip.prototype.disable = function () {
1641 this.enabled = false
1644 Tooltip.prototype.toggleEnabled = function () {
1645 this.enabled = !this.enabled
1648 Tooltip.prototype.toggle = function (e) {
1651 self = $(e.currentTarget).data('bs.' + this.type)
1653 self = new this.constructor(e.currentTarget, this.getDelegateOptions())
1654 $(e.currentTarget).data('bs.' + this.type, self)
1658 self.tip().hasClass('in') ? self.leave(self) : self.enter(self)
1661 Tooltip.prototype.destroy = function () {
1663 clearTimeout(this.timeout)
1664 this.hide(function () {
1665 that.$element.off('.' + that.type).removeData('bs.' + that.type)
1670 // TOOLTIP PLUGIN DEFINITION
1671 // =========================
1673 function Plugin(option) {
1674 return this.each(function () {
1676 var data = $this.data('bs.tooltip')
1677 var options = typeof option == 'object' && option
1679 if (!data && option == 'destroy') return
1680 if (!data) $this.data('bs.tooltip', (data = new Tooltip(this, options)))
1681 if (typeof option == 'string') data[option]()
1685 var old = $.fn.tooltip
1687 $.fn.tooltip = Plugin
1688 $.fn.tooltip.Constructor = Tooltip
1691 // TOOLTIP NO CONFLICT
1692 // ===================
1694 $.fn.tooltip.noConflict = function () {
1701 /* ========================================================================
1702 * Bootstrap: popover.js v3.3.2
1703 * http://getbootstrap.com/javascript/#popovers
1704 * ========================================================================
1705 * Copyright 2011-2015 Twitter, Inc.
1706 * Licensed under MIT (https://github.com/twbs/bootstrap/blob/master/LICENSE)
1707 * ======================================================================== */
1713 // POPOVER PUBLIC CLASS DEFINITION
1714 // ===============================
1716 var Popover = function (element, options) {
1717 this.init('popover', element, options)
1720 if (!$.fn.tooltip) throw new Error('Popover requires tooltip.js')
1722 Popover.VERSION = '3.3.2'
1724 Popover.DEFAULTS = $.extend({}, $.fn.tooltip.Constructor.DEFAULTS, {
1728 template: '<div class="popover" role="tooltip"><div class="arrow"></div><h3 class="popover-title"></h3><div class="popover-content"></div></div>'
1732 // NOTE: POPOVER EXTENDS tooltip.js
1733 // ================================
1735 Popover.prototype = $.extend({}, $.fn.tooltip.Constructor.prototype)
1737 Popover.prototype.constructor = Popover
1739 Popover.prototype.getDefaults = function () {
1740 return Popover.DEFAULTS
1743 Popover.prototype.setContent = function () {
1744 var $tip = this.tip()
1745 var title = this.getTitle()
1746 var content = this.getContent()
1748 $tip.find('.popover-title')[this.options.html ? 'html' : 'text'](title)
1749 $tip.find('.popover-content').children().detach().end()[ // we use append for html objects to maintain js events
1750 this.options.html ? (typeof content == 'string' ? 'html' : 'append') : 'text'
1753 $tip.removeClass('fade top bottom left right in')
1755 // IE8 doesn't accept hiding via the `:empty` pseudo selector, we have to do
1756 // this manually by checking the contents.
1757 if (!$tip.find('.popover-title').html()) $tip.find('.popover-title').hide()
1760 Popover.prototype.hasContent = function () {
1761 return this.getTitle() || this.getContent()
1764 Popover.prototype.getContent = function () {
1765 var $e = this.$element
1766 var o = this.options
1768 return $e.attr('data-content')
1769 || (typeof o.content == 'function' ?
1770 o.content.call($e[0]) :
1774 Popover.prototype.arrow = function () {
1775 return (this.$arrow = this.$arrow || this.tip().find('.arrow'))
1778 Popover.prototype.tip = function () {
1779 if (!this.$tip) this.$tip = $(this.options.template)
1784 // POPOVER PLUGIN DEFINITION
1785 // =========================
1787 function Plugin(option) {
1788 return this.each(function () {
1790 var data = $this.data('bs.popover')
1791 var options = typeof option == 'object' && option
1793 if (!data && option == 'destroy') return
1794 if (!data) $this.data('bs.popover', (data = new Popover(this, options)))
1795 if (typeof option == 'string') data[option]()
1799 var old = $.fn.popover
1801 $.fn.popover = Plugin
1802 $.fn.popover.Constructor = Popover
1805 // POPOVER NO CONFLICT
1806 // ===================
1808 $.fn.popover.noConflict = function () {
1815 /* ========================================================================
1816 * Bootstrap: scrollspy.js v3.3.2
1817 * http://getbootstrap.com/javascript/#scrollspy
1818 * ========================================================================
1819 * Copyright 2011-2015 Twitter, Inc.
1820 * Licensed under MIT (https://github.com/twbs/bootstrap/blob/master/LICENSE)
1821 * ======================================================================== */
1827 // SCROLLSPY CLASS DEFINITION
1828 // ==========================
1830 function ScrollSpy(element, options) {
1831 var process = $.proxy(this.process, this)
1833 this.$body = $('body')
1834 this.$scrollElement = $(element).is('body') ? $(window) : $(element)
1835 this.options = $.extend({}, ScrollSpy.DEFAULTS, options)
1836 this.selector = (this.options.target || '') + ' .nav li > a'
1839 this.activeTarget = null
1840 this.scrollHeight = 0
1842 this.$scrollElement.on('scroll.bs.scrollspy', process)
1847 ScrollSpy.VERSION = '3.3.2'
1849 ScrollSpy.DEFAULTS = {
1853 ScrollSpy.prototype.getScrollHeight = function () {
1854 return this.$scrollElement[0].scrollHeight || Math.max(this.$body[0].scrollHeight, document.documentElement.scrollHeight)
1857 ScrollSpy.prototype.refresh = function () {
1858 var offsetMethod = 'offset'
1861 if (!$.isWindow(this.$scrollElement[0])) {
1862 offsetMethod = 'position'
1863 offsetBase = this.$scrollElement.scrollTop()
1868 this.scrollHeight = this.getScrollHeight()
1873 .find(this.selector)
1876 var href = $el.data('target') || $el.attr('href')
1877 var $href = /^#./.test(href) && $(href)
1881 && $href.is(':visible')
1882 && [[$href[offsetMethod]().top + offsetBase, href]]) || null
1884 .sort(function (a, b) { return a[0] - b[0] })
1886 self.offsets.push(this[0])
1887 self.targets.push(this[1])
1891 ScrollSpy.prototype.process = function () {
1892 var scrollTop = this.$scrollElement.scrollTop() + this.options.offset
1893 var scrollHeight = this.getScrollHeight()
1894 var maxScroll = this.options.offset + scrollHeight - this.$scrollElement.height()
1895 var offsets = this.offsets
1896 var targets = this.targets
1897 var activeTarget = this.activeTarget
1900 if (this.scrollHeight != scrollHeight) {
1904 if (scrollTop >= maxScroll) {
1905 return activeTarget != (i = targets[targets.length - 1]) && this.activate(i)
1908 if (activeTarget && scrollTop < offsets[0]) {
1909 this.activeTarget = null
1913 for (i = offsets.length; i--;) {
1914 activeTarget != targets[i]
1915 && scrollTop >= offsets[i]
1916 && (!offsets[i + 1] || scrollTop <= offsets[i + 1])
1917 && this.activate(targets[i])
1921 ScrollSpy.prototype.activate = function (target) {
1922 this.activeTarget = target
1926 var selector = this.selector +
1927 '[data-target="' + target + '"],' +
1928 this.selector + '[href="' + target + '"]'
1930 var active = $(selector)
1934 if (active.parent('.dropdown-menu').length) {
1936 .closest('li.dropdown')
1940 active.trigger('activate.bs.scrollspy')
1943 ScrollSpy.prototype.clear = function () {
1945 .parentsUntil(this.options.target, '.active')
1946 .removeClass('active')
1950 // SCROLLSPY PLUGIN DEFINITION
1951 // ===========================
1953 function Plugin(option) {
1954 return this.each(function () {
1956 var data = $this.data('bs.scrollspy')
1957 var options = typeof option == 'object' && option
1959 if (!data) $this.data('bs.scrollspy', (data = new ScrollSpy(this, options)))
1960 if (typeof option == 'string') data[option]()
1964 var old = $.fn.scrollspy
1966 $.fn.scrollspy = Plugin
1967 $.fn.scrollspy.Constructor = ScrollSpy
1970 // SCROLLSPY NO CONFLICT
1971 // =====================
1973 $.fn.scrollspy.noConflict = function () {
1974 $.fn.scrollspy = old
1979 // SCROLLSPY DATA-API
1980 // ==================
1982 $(window).on('load.bs.scrollspy.data-api', function () {
1983 $('[data-spy="scroll"]').each(function () {
1985 Plugin.call($spy, $spy.data())
1991 /* ========================================================================
1992 * Bootstrap: tab.js v3.3.2
1993 * http://getbootstrap.com/javascript/#tabs
1994 * ========================================================================
1995 * Copyright 2011-2015 Twitter, Inc.
1996 * Licensed under MIT (https://github.com/twbs/bootstrap/blob/master/LICENSE)
1997 * ======================================================================== */
2003 // TAB CLASS DEFINITION
2004 // ====================
2006 var Tab = function (element) {
2007 this.element = $(element)
2010 Tab.VERSION = '3.3.2'
2012 Tab.TRANSITION_DURATION = 150
2014 Tab.prototype.show = function () {
2015 var $this = this.element
2016 var $ul = $this.closest('ul:not(.dropdown-menu)')
2017 var selector = $this.data('target')
2020 selector = $this.attr('href')
2021 selector = selector && selector.replace(/.*(?=#[^\s]*$)/, '') // strip for ie7
2024 if ($this.parent('li').hasClass('active')) return
2026 var $previous = $ul.find('.active:last a')
2027 var hideEvent = $.Event('hide.bs.tab', {
2028 relatedTarget: $this[0]
2030 var showEvent = $.Event('show.bs.tab', {
2031 relatedTarget: $previous[0]
2034 $previous.trigger(hideEvent)
2035 $this.trigger(showEvent)
2037 if (showEvent.isDefaultPrevented() || hideEvent.isDefaultPrevented()) return
2039 var $target = $(selector)
2041 this.activate($this.closest('li'), $ul)
2042 this.activate($target, $target.parent(), function () {
2044 type: 'hidden.bs.tab',
2045 relatedTarget: $this[0]
2048 type: 'shown.bs.tab',
2049 relatedTarget: $previous[0]
2054 Tab.prototype.activate = function (element, container, callback) {
2055 var $active = container.find('> .active')
2056 var transition = callback
2057 && $.support.transition
2058 && (($active.length && $active.hasClass('fade')) || !!container.find('> .fade').length)
2062 .removeClass('active')
2063 .find('> .dropdown-menu > .active')
2064 .removeClass('active')
2066 .find('[data-toggle="tab"]')
2067 .attr('aria-expanded', false)
2071 .find('[data-toggle="tab"]')
2072 .attr('aria-expanded', true)
2075 element[0].offsetWidth // reflow for transition
2076 element.addClass('in')
2078 element.removeClass('fade')
2081 if (element.parent('.dropdown-menu')) {
2083 .closest('li.dropdown')
2086 .find('[data-toggle="tab"]')
2087 .attr('aria-expanded', true)
2090 callback && callback()
2093 $active.length && transition ?
2095 .one('bsTransitionEnd', next)
2096 .emulateTransitionEnd(Tab.TRANSITION_DURATION) :
2099 $active.removeClass('in')
2103 // TAB PLUGIN DEFINITION
2104 // =====================
2106 function Plugin(option) {
2107 return this.each(function () {
2109 var data = $this.data('bs.tab')
2111 if (!data) $this.data('bs.tab', (data = new Tab(this)))
2112 if (typeof option == 'string') data[option]()
2119 $.fn.tab.Constructor = Tab
2125 $.fn.tab.noConflict = function () {
2134 var clickHandler = function (e) {
2136 Plugin.call($(this), 'show')
2140 .on('click.bs.tab.data-api', '[data-toggle="tab"]', clickHandler)
2141 .on('click.bs.tab.data-api', '[data-toggle="pill"]', clickHandler)
2145 /* ========================================================================
2146 * Bootstrap: affix.js v3.3.2
2147 * http://getbootstrap.com/javascript/#affix
2148 * ========================================================================
2149 * Copyright 2011-2015 Twitter, Inc.
2150 * Licensed under MIT (https://github.com/twbs/bootstrap/blob/master/LICENSE)
2151 * ======================================================================== */
2157 // AFFIX CLASS DEFINITION
2158 // ======================
2160 var Affix = function (element, options) {
2161 this.options = $.extend({}, Affix.DEFAULTS, options)
2163 this.$target = $(this.options.target)
2164 .on('scroll.bs.affix.data-api', $.proxy(this.checkPosition, this))
2165 .on('click.bs.affix.data-api', $.proxy(this.checkPositionWithEventLoop, this))
2167 this.$element = $(element)
2170 this.pinnedOffset = null
2172 this.checkPosition()
2175 Affix.VERSION = '3.3.2'
2177 Affix.RESET = 'affix affix-top affix-bottom'
2184 Affix.prototype.getState = function (scrollHeight, height, offsetTop, offsetBottom) {
2185 var scrollTop = this.$target.scrollTop()
2186 var position = this.$element.offset()
2187 var targetHeight = this.$target.height()
2189 if (offsetTop != null && this.affixed == 'top') return scrollTop < offsetTop ? 'top' : false
2191 if (this.affixed == 'bottom') {
2192 if (offsetTop != null) return (scrollTop + this.unpin <= position.top) ? false : 'bottom'
2193 return (scrollTop + targetHeight <= scrollHeight - offsetBottom) ? false : 'bottom'
2196 var initializing = this.affixed == null
2197 var colliderTop = initializing ? scrollTop : position.top
2198 var colliderHeight = initializing ? targetHeight : height
2200 if (offsetTop != null && scrollTop <= offsetTop) return 'top'
2201 if (offsetBottom != null && (colliderTop + colliderHeight >= scrollHeight - offsetBottom)) return 'bottom'
2206 Affix.prototype.getPinnedOffset = function () {
2207 if (this.pinnedOffset) return this.pinnedOffset
2208 this.$element.removeClass(Affix.RESET).addClass('affix')
2209 var scrollTop = this.$target.scrollTop()
2210 var position = this.$element.offset()
2211 return (this.pinnedOffset = position.top - scrollTop)
2214 Affix.prototype.checkPositionWithEventLoop = function () {
2215 setTimeout($.proxy(this.checkPosition, this), 1)
2218 Affix.prototype.checkPosition = function () {
2219 if (!this.$element.is(':visible')) return
2221 var height = this.$element.height()
2222 var offset = this.options.offset
2223 var offsetTop = offset.top
2224 var offsetBottom = offset.bottom
2225 var scrollHeight = $('body').height()
2227 if (typeof offset != 'object') offsetBottom = offsetTop = offset
2228 if (typeof offsetTop == 'function') offsetTop = offset.top(this.$element)
2229 if (typeof offsetBottom == 'function') offsetBottom = offset.bottom(this.$element)
2231 var affix = this.getState(scrollHeight, height, offsetTop, offsetBottom)
2233 if (this.affixed != affix) {
2234 if (this.unpin != null) this.$element.css('top', '')
2236 var affixType = 'affix' + (affix ? '-' + affix : '')
2237 var e = $.Event(affixType + '.bs.affix')
2239 this.$element.trigger(e)
2241 if (e.isDefaultPrevented()) return
2243 this.affixed = affix
2244 this.unpin = affix == 'bottom' ? this.getPinnedOffset() : null
2247 .removeClass(Affix.RESET)
2248 .addClass(affixType)
2249 .trigger(affixType.replace('affix', 'affixed') + '.bs.affix')
2252 if (affix == 'bottom') {
2253 this.$element.offset({
2254 top: scrollHeight - height - offsetBottom
2260 // AFFIX PLUGIN DEFINITION
2261 // =======================
2263 function Plugin(option) {
2264 return this.each(function () {
2266 var data = $this.data('bs.affix')
2267 var options = typeof option == 'object' && option
2269 if (!data) $this.data('bs.affix', (data = new Affix(this, options)))
2270 if (typeof option == 'string') data[option]()
2274 var old = $.fn.affix
2277 $.fn.affix.Constructor = Affix
2280 // AFFIX NO CONFLICT
2281 // =================
2283 $.fn.affix.noConflict = function () {
2292 $(window).on('load', function () {
2293 $('[data-spy="affix"]').each(function () {
2295 var data = $spy.data()
2297 data.offset = data.offset || {}
2299 if (data.offsetBottom != null) data.offset.bottom = data.offsetBottom
2300 if (data.offsetTop != null) data.offset.top = data.offsetTop
2302 Plugin.call($spy, data)