2 * Bootstrap v3.1.1 (http://getbootstrap.com)
\r
3 * Copyright 2011-2014 Twitter, Inc.
\r
4 * Licensed under MIT (https://github.com/twbs/bootstrap/blob/master/LICENSE)
\r
7 if (typeof jQuery === 'undefined') { throw new Error('Bootstrap\'s JavaScript requires jQuery') }
\r
9 /* ========================================================================
\r
10 * Bootstrap: transition.js v3.1.1
\r
11 * http://getbootstrap.com/javascript/#transitions
\r
12 * ========================================================================
\r
13 * Copyright 2011-2014 Twitter, Inc.
\r
14 * Licensed under MIT (https://github.com/twbs/bootstrap/blob/master/LICENSE)
\r
15 * ======================================================================== */
\r
21 // CSS TRANSITION SUPPORT (Shoutout: http://www.modernizr.com/)
\r
22 // ============================================================
\r
24 function transitionEnd() {
\r
25 var el = document.createElement('bootstrap')
\r
27 var transEndEventNames = {
\r
28 'WebkitTransition' : 'webkitTransitionEnd',
\r
29 'MozTransition' : 'transitionend',
\r
30 'OTransition' : 'oTransitionEnd otransitionend',
\r
31 'transition' : 'transitionend'
\r
34 for (var name in transEndEventNames) {
\r
35 if (el.style[name] !== undefined) {
\r
36 return { end: transEndEventNames[name] }
\r
40 return false // explicit for ie8 ( ._.)
\r
43 // http://blog.alexmaccaw.com/css-transitions
\r
44 $.fn.emulateTransitionEnd = function (duration) {
\r
45 var called = false, $el = this
\r
46 $(this).one($.support.transition.end, function () { called = true })
\r
47 var callback = function () { if (!called) $($el).trigger($.support.transition.end) }
\r
48 setTimeout(callback, duration)
\r
53 $.support.transition = transitionEnd()
\r
58 /* ========================================================================
\r
59 * Bootstrap: alert.js v3.1.1
\r
60 * http://getbootstrap.com/javascript/#alerts
\r
61 * ========================================================================
\r
62 * Copyright 2011-2014 Twitter, Inc.
\r
63 * Licensed under MIT (https://github.com/twbs/bootstrap/blob/master/LICENSE)
\r
64 * ======================================================================== */
\r
70 // ALERT CLASS DEFINITION
\r
71 // ======================
\r
73 var dismiss = '[data-dismiss="alert"]'
\r
74 var Alert = function (el) {
\r
75 $(el).on('click', dismiss, this.close)
\r
78 Alert.prototype.close = function (e) {
\r
80 var selector = $this.attr('data-target')
\r
83 selector = $this.attr('href')
\r
84 selector = selector && selector.replace(/.*(?=#[^\s]*$)/, '') // strip for ie7
\r
87 var $parent = $(selector)
\r
89 if (e) e.preventDefault()
\r
91 if (!$parent.length) {
\r
92 $parent = $this.hasClass('alert') ? $this : $this.parent()
\r
95 $parent.trigger(e = $.Event('close.bs.alert'))
\r
97 if (e.isDefaultPrevented()) return
\r
99 $parent.removeClass('in')
\r
101 function removeElement() {
\r
102 $parent.trigger('closed.bs.alert').remove()
\r
105 $.support.transition && $parent.hasClass('fade') ?
\r
107 .one($.support.transition.end, removeElement)
\r
108 .emulateTransitionEnd(150) :
\r
113 // ALERT PLUGIN DEFINITION
\r
114 // =======================
\r
116 var old = $.fn.alert
\r
118 $.fn.alert = function (option) {
\r
119 return this.each(function () {
\r
120 var $this = $(this)
\r
121 var data = $this.data('bs.alert')
\r
123 if (!data) $this.data('bs.alert', (data = new Alert(this)))
\r
124 if (typeof option == 'string') data[option].call($this)
\r
128 $.fn.alert.Constructor = Alert
\r
131 // ALERT NO CONFLICT
\r
132 // =================
\r
134 $.fn.alert.noConflict = function () {
\r
143 $(document).on('click.bs.alert.data-api', dismiss, Alert.prototype.close)
\r
147 /* ========================================================================
\r
148 * Bootstrap: button.js v3.1.1
\r
149 * http://getbootstrap.com/javascript/#buttons
\r
150 * ========================================================================
\r
151 * Copyright 2011-2014 Twitter, Inc.
\r
152 * Licensed under MIT (https://github.com/twbs/bootstrap/blob/master/LICENSE)
\r
153 * ======================================================================== */
\r
159 // BUTTON PUBLIC CLASS DEFINITION
\r
160 // ==============================
\r
162 var Button = function (element, options) {
\r
163 this.$element = $(element)
\r
164 this.options = $.extend({}, Button.DEFAULTS, options)
\r
165 this.isLoading = false
\r
168 Button.DEFAULTS = {
\r
169 loadingText: 'loading...'
\r
172 Button.prototype.setState = function (state) {
\r
174 var $el = this.$element
\r
175 var val = $el.is('input') ? 'val' : 'html'
\r
176 var data = $el.data()
\r
178 state = state + 'Text'
\r
180 if (!data.resetText) $el.data('resetText', $el[val]())
\r
182 $el[val](data[state] || this.options[state])
\r
184 // push to event loop to allow forms to submit
\r
185 setTimeout($.proxy(function () {
\r
186 if (state == 'loadingText') {
\r
187 this.isLoading = true
\r
188 $el.addClass(d).attr(d, d)
\r
189 } else if (this.isLoading) {
\r
190 this.isLoading = false
\r
191 $el.removeClass(d).removeAttr(d)
\r
196 Button.prototype.toggle = function () {
\r
198 var $parent = this.$element.closest('[data-toggle="buttons"]')
\r
200 if ($parent.length) {
\r
201 var $input = this.$element.find('input')
\r
202 if ($input.prop('type') == 'radio') {
\r
203 if ($input.prop('checked') && this.$element.hasClass('active')) changed = false
\r
204 else $parent.find('.active').removeClass('active')
\r
206 if (changed) $input.prop('checked', !this.$element.hasClass('active')).trigger('change')
\r
209 if (changed) this.$element.toggleClass('active')
\r
213 // BUTTON PLUGIN DEFINITION
\r
214 // ========================
\r
216 var old = $.fn.button
\r
218 $.fn.button = function (option) {
\r
219 return this.each(function () {
\r
220 var $this = $(this)
\r
221 var data = $this.data('bs.button')
\r
222 var options = typeof option == 'object' && option
\r
224 if (!data) $this.data('bs.button', (data = new Button(this, options)))
\r
226 if (option == 'toggle') data.toggle()
\r
227 else if (option) data.setState(option)
\r
231 $.fn.button.Constructor = Button
\r
234 // BUTTON NO CONFLICT
\r
235 // ==================
\r
237 $.fn.button.noConflict = function () {
\r
246 $(document).on('click.bs.button.data-api', '[data-toggle^=button]', function (e) {
\r
247 var $btn = $(e.target)
\r
248 if (!$btn.hasClass('btn')) $btn = $btn.closest('.btn')
\r
249 $btn.button('toggle')
\r
255 /* ========================================================================
\r
256 * Bootstrap: carousel.js v3.1.1
\r
257 * http://getbootstrap.com/javascript/#carousel
\r
258 * ========================================================================
\r
259 * Copyright 2011-2014 Twitter, Inc.
\r
260 * Licensed under MIT (https://github.com/twbs/bootstrap/blob/master/LICENSE)
\r
261 * ======================================================================== */
\r
267 // CAROUSEL CLASS DEFINITION
\r
268 // =========================
\r
270 var Carousel = function (element, options) {
\r
271 this.$element = $(element)
\r
272 this.$indicators = this.$element.find('.carousel-indicators')
\r
273 this.options = options
\r
280 this.options.pause == 'hover' && this.$element
\r
281 .on('mouseenter', $.proxy(this.pause, this))
\r
282 .on('mouseleave', $.proxy(this.cycle, this))
\r
285 Carousel.DEFAULTS = {
\r
291 Carousel.prototype.cycle = function (e) {
\r
292 e || (this.paused = false)
\r
294 this.interval && clearInterval(this.interval)
\r
296 this.options.interval
\r
298 && (this.interval = setInterval($.proxy(this.next, this), this.options.interval))
\r
303 Carousel.prototype.getActiveIndex = function () {
\r
304 this.$active = this.$element.find('.item.active')
\r
305 this.$items = this.$active.parent().children()
\r
307 return this.$items.index(this.$active)
\r
310 Carousel.prototype.to = function (pos) {
\r
312 var activeIndex = this.getActiveIndex()
\r
314 if (pos > (this.$items.length - 1) || pos < 0) return
\r
316 if (this.sliding) return this.$element.one('slid.bs.carousel', function () { that.to(pos) })
\r
317 if (activeIndex == pos) return this.pause().cycle()
\r
319 return this.slide(pos > activeIndex ? 'next' : 'prev', $(this.$items[pos]))
\r
322 Carousel.prototype.pause = function (e) {
\r
323 e || (this.paused = true)
\r
325 if (this.$element.find('.next, .prev').length && $.support.transition) {
\r
326 this.$element.trigger($.support.transition.end)
\r
330 this.interval = clearInterval(this.interval)
\r
335 Carousel.prototype.next = function () {
\r
336 if (this.sliding) return
\r
337 return this.slide('next')
\r
340 Carousel.prototype.prev = function () {
\r
341 if (this.sliding) return
\r
342 return this.slide('prev')
\r
345 Carousel.prototype.slide = function (type, next) {
\r
346 var $active = this.$element.find('.item.active')
\r
347 var $next = next || $active[type]()
\r
348 var isCycling = this.interval
\r
349 var direction = type == 'next' ? 'left' : 'right'
\r
350 var fallback = type == 'next' ? 'first' : 'last'
\r
353 if (!$next.length) {
\r
354 if (!this.options.wrap) return
\r
355 $next = this.$element.find('.item')[fallback]()
\r
358 if ($next.hasClass('active')) return this.sliding = false
\r
360 var e = $.Event('slide.bs.carousel', { relatedTarget: $next[0], direction: direction })
\r
361 this.$element.trigger(e)
\r
362 if (e.isDefaultPrevented()) return
\r
364 this.sliding = true
\r
366 isCycling && this.pause()
\r
368 if (this.$indicators.length) {
\r
369 this.$indicators.find('.active').removeClass('active')
\r
370 this.$element.one('slid.bs.carousel', function () {
\r
371 var $nextIndicator = $(that.$indicators.children()[that.getActiveIndex()])
\r
372 $nextIndicator && $nextIndicator.addClass('active')
\r
376 if ($.support.transition && this.$element.hasClass('slide')) {
\r
377 $next.addClass(type)
\r
378 $next[0].offsetWidth // force reflow
\r
379 $active.addClass(direction)
\r
380 $next.addClass(direction)
\r
382 .one($.support.transition.end, function () {
\r
383 $next.removeClass([type, direction].join(' ')).addClass('active')
\r
384 $active.removeClass(['active', direction].join(' '))
\r
385 that.sliding = false
\r
386 setTimeout(function () { that.$element.trigger('slid.bs.carousel') }, 0)
\r
388 .emulateTransitionEnd($active.css('transition-duration').slice(0, -1) * 1000)
\r
390 $active.removeClass('active')
\r
391 $next.addClass('active')
\r
392 this.sliding = false
\r
393 this.$element.trigger('slid.bs.carousel')
\r
396 isCycling && this.cycle()
\r
402 // CAROUSEL PLUGIN DEFINITION
\r
403 // ==========================
\r
405 var old = $.fn.carousel
\r
407 $.fn.carousel = function (option) {
\r
408 return this.each(function () {
\r
409 var $this = $(this)
\r
410 var data = $this.data('bs.carousel')
\r
411 var options = $.extend({}, Carousel.DEFAULTS, $this.data(), typeof option == 'object' && option)
\r
412 var action = typeof option == 'string' ? option : options.slide
\r
414 if (!data) $this.data('bs.carousel', (data = new Carousel(this, options)))
\r
415 if (typeof option == 'number') data.to(option)
\r
416 else if (action) data[action]()
\r
417 else if (options.interval) data.pause().cycle()
\r
421 $.fn.carousel.Constructor = Carousel
\r
424 // CAROUSEL NO CONFLICT
\r
425 // ====================
\r
427 $.fn.carousel.noConflict = function () {
\r
428 $.fn.carousel = old
\r
433 // CAROUSEL DATA-API
\r
434 // =================
\r
436 $(document).on('click.bs.carousel.data-api', '[data-slide], [data-slide-to]', function (e) {
\r
437 var $this = $(this), href
\r
438 var $target = $($this.attr('data-target') || (href = $this.attr('href')) && href.replace(/.*(?=#[^\s]+$)/, '')) //strip for ie7
\r
439 var options = $.extend({}, $target.data(), $this.data())
\r
440 var slideIndex = $this.attr('data-slide-to')
\r
441 if (slideIndex) options.interval = false
\r
443 $target.carousel(options)
\r
445 if (slideIndex = $this.attr('data-slide-to')) {
\r
446 $target.data('bs.carousel').to(slideIndex)
\r
452 $(window).on('load', function () {
\r
453 $('[data-ride="carousel"]').each(function () {
\r
454 var $carousel = $(this)
\r
455 $carousel.carousel($carousel.data())
\r
461 /* ========================================================================
\r
462 * Bootstrap: collapse.js v3.1.1
\r
463 * http://getbootstrap.com/javascript/#collapse
\r
464 * ========================================================================
\r
465 * Copyright 2011-2014 Twitter, Inc.
\r
466 * Licensed under MIT (https://github.com/twbs/bootstrap/blob/master/LICENSE)
\r
467 * ======================================================================== */
\r
473 // COLLAPSE PUBLIC CLASS DEFINITION
\r
474 // ================================
\r
476 var Collapse = function (element, options) {
\r
477 this.$element = $(element)
\r
478 this.options = $.extend({}, Collapse.DEFAULTS, options)
\r
479 this.transitioning = null
\r
481 if (this.options.parent) this.$parent = $(this.options.parent)
\r
482 if (this.options.toggle) this.toggle()
\r
485 Collapse.DEFAULTS = {
\r
489 Collapse.prototype.dimension = function () {
\r
490 var hasWidth = this.$element.hasClass('width')
\r
491 return hasWidth ? 'width' : 'height'
\r
494 Collapse.prototype.show = function () {
\r
495 if (this.transitioning || this.$element.hasClass('in')) return
\r
497 var startEvent = $.Event('show.bs.collapse')
\r
498 this.$element.trigger(startEvent)
\r
499 if (startEvent.isDefaultPrevented()) return
\r
501 var actives = this.$parent && this.$parent.find('> .panel > .in')
\r
503 if (actives && actives.length) {
\r
504 var hasData = actives.data('bs.collapse')
\r
505 if (hasData && hasData.transitioning) return
\r
506 actives.collapse('hide')
\r
507 hasData || actives.data('bs.collapse', null)
\r
510 var dimension = this.dimension()
\r
513 .removeClass('collapse')
\r
514 .addClass('collapsing')
\r
517 this.transitioning = 1
\r
519 var complete = function () {
\r
521 .removeClass('collapsing')
\r
522 .addClass('collapse in')
\r
523 [dimension]('auto')
\r
524 this.transitioning = 0
\r
525 this.$element.trigger('shown.bs.collapse')
\r
528 if (!$.support.transition) return complete.call(this)
\r
530 var scrollSize = $.camelCase(['scroll', dimension].join('-'))
\r
533 .one($.support.transition.end, $.proxy(complete, this))
\r
534 .emulateTransitionEnd(350)
\r
535 [dimension](this.$element[0][scrollSize])
\r
538 Collapse.prototype.hide = function () {
\r
539 if (this.transitioning || !this.$element.hasClass('in')) return
\r
541 var startEvent = $.Event('hide.bs.collapse')
\r
542 this.$element.trigger(startEvent)
\r
543 if (startEvent.isDefaultPrevented()) return
\r
545 var dimension = this.dimension()
\r
548 [dimension](this.$element[dimension]())
\r
552 .addClass('collapsing')
\r
553 .removeClass('collapse')
\r
556 this.transitioning = 1
\r
558 var complete = function () {
\r
559 this.transitioning = 0
\r
561 .trigger('hidden.bs.collapse')
\r
562 .removeClass('collapsing')
\r
563 .addClass('collapse')
\r
566 if (!$.support.transition) return complete.call(this)
\r
570 .one($.support.transition.end, $.proxy(complete, this))
\r
571 .emulateTransitionEnd(350)
\r
574 Collapse.prototype.toggle = function () {
\r
575 this[this.$element.hasClass('in') ? 'hide' : 'show']()
\r
579 // COLLAPSE PLUGIN DEFINITION
\r
580 // ==========================
\r
582 var old = $.fn.collapse
\r
584 $.fn.collapse = function (option) {
\r
585 return this.each(function () {
\r
586 var $this = $(this)
\r
587 var data = $this.data('bs.collapse')
\r
588 var options = $.extend({}, Collapse.DEFAULTS, $this.data(), typeof option == 'object' && option)
\r
590 if (!data && options.toggle && option == 'show') option = !option
\r
591 if (!data) $this.data('bs.collapse', (data = new Collapse(this, options)))
\r
592 if (typeof option == 'string') data[option]()
\r
596 $.fn.collapse.Constructor = Collapse
\r
599 // COLLAPSE NO CONFLICT
\r
600 // ====================
\r
602 $.fn.collapse.noConflict = function () {
\r
603 $.fn.collapse = old
\r
608 // COLLAPSE DATA-API
\r
609 // =================
\r
611 $(document).on('click.bs.collapse.data-api', '[data-toggle=collapse]', function (e) {
\r
612 var $this = $(this), href
\r
613 var target = $this.attr('data-target')
\r
614 || e.preventDefault()
\r
615 || (href = $this.attr('href')) && href.replace(/.*(?=#[^\s]+$)/, '') //strip for ie7
\r
616 var $target = $(target)
\r
617 var data = $target.data('bs.collapse')
\r
618 var option = data ? 'toggle' : $this.data()
\r
619 var parent = $this.attr('data-parent')
\r
620 var $parent = parent && $(parent)
\r
622 if (!data || !data.transitioning) {
\r
623 if ($parent) $parent.find('[data-toggle=collapse][data-parent="' + parent + '"]').not($this).addClass('collapsed')
\r
624 $this[$target.hasClass('in') ? 'addClass' : 'removeClass']('collapsed')
\r
627 $target.collapse(option)
\r
632 /* ========================================================================
\r
633 * Bootstrap: dropdown.js v3.1.1
\r
634 * http://getbootstrap.com/javascript/#dropdowns
\r
635 * ========================================================================
\r
636 * Copyright 2011-2014 Twitter, Inc.
\r
637 * Licensed under MIT (https://github.com/twbs/bootstrap/blob/master/LICENSE)
\r
638 * ======================================================================== */
\r
644 // DROPDOWN CLASS DEFINITION
\r
645 // =========================
\r
647 var backdrop = '.dropdown-backdrop'
\r
648 var toggle = '[data-toggle=dropdown]'
\r
649 var Dropdown = function (element) {
\r
650 $(element).on('click.bs.dropdown', this.toggle)
\r
653 Dropdown.prototype.toggle = function (e) {
\r
654 var $this = $(this)
\r
656 if ($this.is('.disabled, :disabled')) return
\r
658 var $parent = getParent($this)
\r
659 var isActive = $parent.hasClass('open')
\r
664 if ('ontouchstart' in document.documentElement && !$parent.closest('.navbar-nav').length) {
\r
665 // if mobile we use a backdrop because click events don't delegate
\r
666 $('<div class="dropdown-backdrop"/>').insertAfter($(this)).on('click', clearMenus)
\r
669 var relatedTarget = { relatedTarget: this }
\r
670 $parent.trigger(e = $.Event('show.bs.dropdown', relatedTarget))
\r
672 if (e.isDefaultPrevented()) return
\r
675 .toggleClass('open')
\r
676 .trigger('shown.bs.dropdown', relatedTarget)
\r
684 Dropdown.prototype.keydown = function (e) {
\r
685 if (!/(38|40|27)/.test(e.keyCode)) return
\r
687 var $this = $(this)
\r
690 e.stopPropagation()
\r
692 if ($this.is('.disabled, :disabled')) return
\r
694 var $parent = getParent($this)
\r
695 var isActive = $parent.hasClass('open')
\r
697 if (!isActive || (isActive && e.keyCode == 27)) {
\r
698 if (e.which == 27) $parent.find(toggle).focus()
\r
699 return $this.click()
\r
702 var desc = ' li:not(.divider):visible a'
\r
703 var $items = $parent.find('[role=menu]' + desc + ', [role=listbox]' + desc)
\r
705 if (!$items.length) return
\r
707 var index = $items.index($items.filter(':focus'))
\r
709 if (e.keyCode == 38 && index > 0) index-- // up
\r
710 if (e.keyCode == 40 && index < $items.length - 1) index++ // down
\r
711 if (!~index) index = 0
\r
713 $items.eq(index).focus()
\r
716 function clearMenus(e) {
\r
717 $(backdrop).remove()
\r
718 $(toggle).each(function () {
\r
719 var $parent = getParent($(this))
\r
720 var relatedTarget = { relatedTarget: this }
\r
721 if (!$parent.hasClass('open')) return
\r
722 $parent.trigger(e = $.Event('hide.bs.dropdown', relatedTarget))
\r
723 if (e.isDefaultPrevented()) return
\r
724 $parent.removeClass('open').trigger('hidden.bs.dropdown', relatedTarget)
\r
728 function getParent($this) {
\r
729 var selector = $this.attr('data-target')
\r
732 selector = $this.attr('href')
\r
733 selector = selector && /#[A-Za-z]/.test(selector) && selector.replace(/.*(?=#[^\s]*$)/, '') //strip for ie7
\r
736 var $parent = selector && $(selector)
\r
738 return $parent && $parent.length ? $parent : $this.parent()
\r
742 // DROPDOWN PLUGIN DEFINITION
\r
743 // ==========================
\r
745 var old = $.fn.dropdown
\r
747 $.fn.dropdown = function (option) {
\r
748 return this.each(function () {
\r
749 var $this = $(this)
\r
750 var data = $this.data('bs.dropdown')
\r
752 if (!data) $this.data('bs.dropdown', (data = new Dropdown(this)))
\r
753 if (typeof option == 'string') data[option].call($this)
\r
757 $.fn.dropdown.Constructor = Dropdown
\r
760 // DROPDOWN NO CONFLICT
\r
761 // ====================
\r
763 $.fn.dropdown.noConflict = function () {
\r
764 $.fn.dropdown = old
\r
769 // APPLY TO STANDARD DROPDOWN ELEMENTS
\r
770 // ===================================
\r
773 .on('click.bs.dropdown.data-api', clearMenus)
\r
774 .on('click.bs.dropdown.data-api', '.dropdown form', function (e) { e.stopPropagation() })
\r
775 .on('click.bs.dropdown.data-api', toggle, Dropdown.prototype.toggle)
\r
776 .on('keydown.bs.dropdown.data-api', toggle + ', [role=menu], [role=listbox]', Dropdown.prototype.keydown)
\r
780 /* ========================================================================
\r
781 * Bootstrap: modal.js v3.1.1
\r
782 * http://getbootstrap.com/javascript/#modals
\r
783 * ========================================================================
\r
784 * Copyright 2011-2014 Twitter, Inc.
\r
785 * Licensed under MIT (https://github.com/twbs/bootstrap/blob/master/LICENSE)
\r
786 * ======================================================================== */
\r
792 // MODAL CLASS DEFINITION
\r
793 // ======================
\r
795 var Modal = function (element, options) {
\r
796 this.options = options
\r
797 this.$element = $(element)
\r
799 this.isShown = null
\r
801 if (this.options.remote) {
\r
803 .find('.modal-content')
\r
804 .load(this.options.remote, $.proxy(function () {
\r
805 this.$element.trigger('loaded.bs.modal')
\r
816 Modal.prototype.toggle = function (_relatedTarget) {
\r
817 return this[!this.isShown ? 'show' : 'hide'](_relatedTarget)
\r
820 Modal.prototype.show = function (_relatedTarget) {
\r
822 var e = $.Event('show.bs.modal', { relatedTarget: _relatedTarget })
\r
824 this.$element.trigger(e)
\r
826 if (this.isShown || e.isDefaultPrevented()) return
\r
828 this.isShown = true
\r
832 this.$element.on('click.dismiss.bs.modal', '[data-dismiss="modal"]', $.proxy(this.hide, this))
\r
834 this.backdrop(function () {
\r
835 var transition = $.support.transition && that.$element.hasClass('fade')
\r
837 if (!that.$element.parent().length) {
\r
838 that.$element.appendTo(document.body) // don't move modals dom position
\r
846 that.$element[0].offsetWidth // force reflow
\r
851 .attr('aria-hidden', false)
\r
853 that.enforceFocus()
\r
855 var e = $.Event('shown.bs.modal', { relatedTarget: _relatedTarget })
\r
858 that.$element.find('.modal-dialog') // wait for modal to slide in
\r
859 .one($.support.transition.end, function () {
\r
860 that.$element.focus().trigger(e)
\r
862 .emulateTransitionEnd(300) :
\r
863 that.$element.focus().trigger(e)
\r
867 Modal.prototype.hide = function (e) {
\r
868 if (e) e.preventDefault()
\r
870 e = $.Event('hide.bs.modal')
\r
872 this.$element.trigger(e)
\r
874 if (!this.isShown || e.isDefaultPrevented()) return
\r
876 this.isShown = false
\r
880 $(document).off('focusin.bs.modal')
\r
884 .attr('aria-hidden', true)
\r
885 .off('click.dismiss.bs.modal')
\r
887 $.support.transition && this.$element.hasClass('fade') ?
\r
889 .one($.support.transition.end, $.proxy(this.hideModal, this))
\r
890 .emulateTransitionEnd(300) :
\r
894 Modal.prototype.enforceFocus = function () {
\r
896 .off('focusin.bs.modal') // guard against infinite focus loop
\r
897 .on('focusin.bs.modal', $.proxy(function (e) {
\r
898 if (this.$element[0] !== e.target && !this.$element.has(e.target).length) {
\r
899 this.$element.focus()
\r
904 Modal.prototype.escape = function () {
\r
905 if (this.isShown && this.options.keyboard) {
\r
906 this.$element.on('keyup.dismiss.bs.modal', $.proxy(function (e) {
\r
907 e.which == 27 && this.hide()
\r
909 } else if (!this.isShown) {
\r
910 this.$element.off('keyup.dismiss.bs.modal')
\r
914 Modal.prototype.hideModal = function () {
\r
916 this.$element.hide()
\r
917 this.backdrop(function () {
\r
918 that.removeBackdrop()
\r
919 that.$element.trigger('hidden.bs.modal')
\r
923 Modal.prototype.removeBackdrop = function () {
\r
924 this.$backdrop && this.$backdrop.remove()
\r
925 this.$backdrop = null
\r
928 Modal.prototype.backdrop = function (callback) {
\r
929 var animate = this.$element.hasClass('fade') ? 'fade' : ''
\r
931 if (this.isShown && this.options.backdrop) {
\r
932 var doAnimate = $.support.transition && animate
\r
934 this.$backdrop = $('<div class="modal-backdrop ' + animate + '" />')
\r
935 .appendTo(document.body)
\r
937 this.$element.on('click.dismiss.bs.modal', $.proxy(function (e) {
\r
938 if (e.target !== e.currentTarget) return
\r
939 this.options.backdrop == 'static'
\r
940 ? this.$element[0].focus.call(this.$element[0])
\r
941 : this.hide.call(this)
\r
944 if (doAnimate) this.$backdrop[0].offsetWidth // force reflow
\r
946 this.$backdrop.addClass('in')
\r
948 if (!callback) return
\r
952 .one($.support.transition.end, callback)
\r
953 .emulateTransitionEnd(150) :
\r
956 } else if (!this.isShown && this.$backdrop) {
\r
957 this.$backdrop.removeClass('in')
\r
959 $.support.transition && this.$element.hasClass('fade') ?
\r
961 .one($.support.transition.end, callback)
\r
962 .emulateTransitionEnd(150) :
\r
965 } else if (callback) {
\r
971 // MODAL PLUGIN DEFINITION
\r
972 // =======================
\r
974 var old = $.fn.modal
\r
976 $.fn.modal = function (option, _relatedTarget) {
\r
977 return this.each(function () {
\r
978 var $this = $(this)
\r
979 var data = $this.data('bs.modal')
\r
980 var options = $.extend({}, Modal.DEFAULTS, $this.data(), typeof option == 'object' && option)
\r
982 if (!data) $this.data('bs.modal', (data = new Modal(this, options)))
\r
983 if (typeof option == 'string') data[option](_relatedTarget)
\r
984 else if (options.show) data.show(_relatedTarget)
\r
988 $.fn.modal.Constructor = Modal
\r
991 // MODAL NO CONFLICT
\r
992 // =================
\r
994 $.fn.modal.noConflict = function () {
\r
1003 $(document).on('click.bs.modal.data-api', '[data-toggle="modal"]', function (e) {
\r
1004 var $this = $(this)
\r
1005 var href = $this.attr('href')
\r
1006 var $target = $($this.attr('data-target') || (href && href.replace(/.*(?=#[^\s]+$)/, ''))) //strip for ie7
\r
1007 var option = $target.data('bs.modal') ? 'toggle' : $.extend({ remote: !/#/.test(href) && href }, $target.data(), $this.data())
\r
1009 if ($this.is('a')) e.preventDefault()
\r
1012 .modal(option, this)
\r
1013 .one('hide', function () {
\r
1014 $this.is(':visible') && $this.focus()
\r
1019 .on('show.bs.modal', '.modal', function () { $(document.body).addClass('modal-open') })
\r
1020 .on('hidden.bs.modal', '.modal', function () { $(document.body).removeClass('modal-open') })
\r
1024 /* ========================================================================
\r
1025 * Bootstrap: tooltip.js v3.1.1
\r
1026 * http://getbootstrap.com/javascript/#tooltip
\r
1027 * Inspired by the original jQuery.tipsy by Jason Frame
\r
1028 * ========================================================================
\r
1029 * Copyright 2011-2014 Twitter, Inc.
\r
1030 * Licensed under MIT (https://github.com/twbs/bootstrap/blob/master/LICENSE)
\r
1031 * ======================================================================== */
\r
1037 // TOOLTIP PUBLIC CLASS DEFINITION
\r
1038 // ===============================
\r
1040 var Tooltip = function (element, options) {
\r
1046 this.$element = null
\r
1048 this.init('tooltip', element, options)
\r
1051 Tooltip.DEFAULTS = {
\r
1055 template: '<div class="tooltip"><div class="tooltip-arrow"></div><div class="tooltip-inner"></div></div>',
\r
1056 trigger: 'hover focus',
\r
1063 Tooltip.prototype.init = function (type, element, options) {
\r
1064 this.enabled = true
\r
1066 this.$element = $(element)
\r
1067 this.options = this.getOptions(options)
\r
1069 var triggers = this.options.trigger.split(' ')
\r
1071 for (var i = triggers.length; i--;) {
\r
1072 var trigger = triggers[i]
\r
1074 if (trigger == 'click') {
\r
1075 this.$element.on('click.' + this.type, this.options.selector, $.proxy(this.toggle, this))
\r
1076 } else if (trigger != 'manual') {
\r
1077 var eventIn = trigger == 'hover' ? 'mouseenter' : 'focusin'
\r
1078 var eventOut = trigger == 'hover' ? 'mouseleave' : 'focusout'
\r
1080 this.$element.on(eventIn + '.' + this.type, this.options.selector, $.proxy(this.enter, this))
\r
1081 this.$element.on(eventOut + '.' + this.type, this.options.selector, $.proxy(this.leave, this))
\r
1085 this.options.selector ?
\r
1086 (this._options = $.extend({}, this.options, { trigger: 'manual', selector: '' })) :
\r
1090 Tooltip.prototype.getDefaults = function () {
\r
1091 return Tooltip.DEFAULTS
\r
1094 Tooltip.prototype.getOptions = function (options) {
\r
1095 options = $.extend({}, this.getDefaults(), this.$element.data(), options)
\r
1097 if (options.delay && typeof options.delay == 'number') {
\r
1099 show: options.delay,
\r
1100 hide: options.delay
\r
1107 Tooltip.prototype.getDelegateOptions = function () {
\r
1109 var defaults = this.getDefaults()
\r
1111 this._options && $.each(this._options, function (key, value) {
\r
1112 if (defaults[key] != value) options[key] = value
\r
1118 Tooltip.prototype.enter = function (obj) {
\r
1119 var self = obj instanceof this.constructor ?
\r
1120 obj : $(obj.currentTarget)[this.type](this.getDelegateOptions()).data('bs.' + this.type)
\r
1122 clearTimeout(self.timeout)
\r
1124 self.hoverState = 'in'
\r
1126 if (!self.options.delay || !self.options.delay.show) return self.show()
\r
1128 self.timeout = setTimeout(function () {
\r
1129 if (self.hoverState == 'in') self.show()
\r
1130 }, self.options.delay.show)
\r
1133 Tooltip.prototype.leave = function (obj) {
\r
1134 var self = obj instanceof this.constructor ?
\r
1135 obj : $(obj.currentTarget)[this.type](this.getDelegateOptions()).data('bs.' + this.type)
\r
1137 clearTimeout(self.timeout)
\r
1139 self.hoverState = 'out'
\r
1141 if (!self.options.delay || !self.options.delay.hide) return self.hide()
\r
1143 self.timeout = setTimeout(function () {
\r
1144 if (self.hoverState == 'out') self.hide()
\r
1145 }, self.options.delay.hide)
\r
1148 Tooltip.prototype.show = function () {
\r
1149 var e = $.Event('show.bs.' + this.type)
\r
1151 if (this.hasContent() && this.enabled) {
\r
1152 this.$element.trigger(e)
\r
1154 if (e.isDefaultPrevented()) return
\r
1157 var $tip = this.tip()
\r
1161 if (this.options.animation) $tip.addClass('fade')
\r
1163 var placement = typeof this.options.placement == 'function' ?
\r
1164 this.options.placement.call(this, $tip[0], this.$element[0]) :
\r
1165 this.options.placement
\r
1167 var autoToken = /\s?auto?\s?/i
\r
1168 var autoPlace = autoToken.test(placement)
\r
1169 if (autoPlace) placement = placement.replace(autoToken, '') || 'top'
\r
1173 .css({ top: 0, left: 0, display: 'block' })
\r
1174 .addClass(placement)
\r
1176 this.options.container ? $tip.appendTo(this.options.container) : $tip.insertAfter(this.$element)
\r
1178 var pos = this.getPosition()
\r
1179 var actualWidth = $tip[0].offsetWidth
\r
1180 var actualHeight = $tip[0].offsetHeight
\r
1183 var $parent = this.$element.parent()
\r
1185 var orgPlacement = placement
\r
1186 var docScroll = document.documentElement.scrollTop || document.body.scrollTop
\r
1187 var parentWidth = this.options.container == 'body' ? window.innerWidth : $parent.outerWidth()
\r
1188 var parentHeight = this.options.container == 'body' ? window.innerHeight : $parent.outerHeight()
\r
1189 var parentLeft = this.options.container == 'body' ? 0 : $parent.offset().left
\r
1191 placement = placement == 'bottom' && pos.top + pos.height + actualHeight - docScroll > parentHeight ? 'top' :
\r
1192 placement == 'top' && pos.top - docScroll - actualHeight < 0 ? 'bottom' :
\r
1193 placement == 'right' && pos.right + actualWidth > parentWidth ? 'left' :
\r
1194 placement == 'left' && pos.left - actualWidth < parentLeft ? 'right' :
\r
1198 .removeClass(orgPlacement)
\r
1199 .addClass(placement)
\r
1202 var calculatedOffset = this.getCalculatedOffset(placement, pos, actualWidth, actualHeight)
\r
1204 this.applyPlacement(calculatedOffset, placement)
\r
1205 this.hoverState = null
\r
1207 var complete = function() {
\r
1208 that.$element.trigger('shown.bs.' + that.type)
\r
1211 $.support.transition && this.$tip.hasClass('fade') ?
\r
1213 .one($.support.transition.end, complete)
\r
1214 .emulateTransitionEnd(150) :
\r
1219 Tooltip.prototype.applyPlacement = function (offset, placement) {
\r
1221 var $tip = this.tip()
\r
1222 var width = $tip[0].offsetWidth
\r
1223 var height = $tip[0].offsetHeight
\r
1225 // manually read margins because getBoundingClientRect includes difference
\r
1226 var marginTop = parseInt($tip.css('margin-top'), 10)
\r
1227 var marginLeft = parseInt($tip.css('margin-left'), 10)
\r
1229 // we must check for NaN for ie 8/9
\r
1230 if (isNaN(marginTop)) marginTop = 0
\r
1231 if (isNaN(marginLeft)) marginLeft = 0
\r
1233 offset.top = offset.top + marginTop
\r
1234 offset.left = offset.left + marginLeft
\r
1236 // $.fn.offset doesn't round pixel values
\r
1237 // so we use setOffset directly with our own function B-0
\r
1238 $.offset.setOffset($tip[0], $.extend({
\r
1239 using: function (props) {
\r
1241 top: Math.round(props.top),
\r
1242 left: Math.round(props.left)
\r
1247 $tip.addClass('in')
\r
1249 // check to see if placing tip in new offset caused the tip to resize itself
\r
1250 var actualWidth = $tip[0].offsetWidth
\r
1251 var actualHeight = $tip[0].offsetHeight
\r
1253 if (placement == 'top' && actualHeight != height) {
\r
1255 offset.top = offset.top + height - actualHeight
\r
1258 if (/bottom|top/.test(placement)) {
\r
1261 if (offset.left < 0) {
\r
1262 delta = offset.left * -2
\r
1265 $tip.offset(offset)
\r
1267 actualWidth = $tip[0].offsetWidth
\r
1268 actualHeight = $tip[0].offsetHeight
\r
1271 this.replaceArrow(delta - width + actualWidth, actualWidth, 'left')
\r
1273 this.replaceArrow(actualHeight - height, actualHeight, 'top')
\r
1276 if (replace) $tip.offset(offset)
\r
1279 Tooltip.prototype.replaceArrow = function (delta, dimension, position) {
\r
1280 this.arrow().css(position, delta ? (50 * (1 - delta / dimension) + '%') : '')
\r
1283 Tooltip.prototype.setContent = function () {
\r
1284 var $tip = this.tip()
\r
1285 var title = this.getTitle()
\r
1287 $tip.find('.tooltip-inner')[this.options.html ? 'html' : 'text'](title)
\r
1288 $tip.removeClass('fade in top bottom left right')
\r
1291 Tooltip.prototype.hide = function () {
\r
1293 var $tip = this.tip()
\r
1294 var e = $.Event('hide.bs.' + this.type)
\r
1296 function complete() {
\r
1297 if (that.hoverState != 'in') $tip.detach()
\r
1298 that.$element.trigger('hidden.bs.' + that.type)
\r
1301 this.$element.trigger(e)
\r
1303 if (e.isDefaultPrevented()) return
\r
1305 $tip.removeClass('in')
\r
1307 $.support.transition && this.$tip.hasClass('fade') ?
\r
1309 .one($.support.transition.end, complete)
\r
1310 .emulateTransitionEnd(150) :
\r
1313 this.hoverState = null
\r
1318 Tooltip.prototype.fixTitle = function () {
\r
1319 var $e = this.$element
\r
1320 if ($e.attr('title') || typeof($e.attr('data-original-title')) != 'string') {
\r
1321 $e.attr('data-original-title', $e.attr('title') || '').attr('title', '')
\r
1325 Tooltip.prototype.hasContent = function () {
\r
1326 return this.getTitle()
\r
1329 Tooltip.prototype.getPosition = function () {
\r
1330 var el = this.$element[0]
\r
1331 return $.extend({}, (typeof el.getBoundingClientRect == 'function') ? el.getBoundingClientRect() : {
\r
1332 width: el.offsetWidth,
\r
1333 height: el.offsetHeight
\r
1334 }, this.$element.offset())
\r
1337 Tooltip.prototype.getCalculatedOffset = function (placement, pos, actualWidth, actualHeight) {
\r
1338 return placement == 'bottom' ? { top: pos.top + pos.height, left: pos.left + pos.width / 2 - actualWidth / 2 } :
\r
1339 placement == 'top' ? { top: pos.top - actualHeight, left: pos.left + pos.width / 2 - actualWidth / 2 } :
\r
1340 placement == 'left' ? { top: pos.top + pos.height / 2 - actualHeight / 2, left: pos.left - actualWidth } :
\r
1341 /* placement == 'right' */ { top: pos.top + pos.height / 2 - actualHeight / 2, left: pos.left + pos.width }
\r
1344 Tooltip.prototype.getTitle = function () {
\r
1346 var $e = this.$element
\r
1347 var o = this.options
\r
1349 title = $e.attr('data-original-title')
\r
1350 || (typeof o.title == 'function' ? o.title.call($e[0]) : o.title)
\r
1355 Tooltip.prototype.tip = function () {
\r
1356 return this.$tip = this.$tip || $(this.options.template)
\r
1359 Tooltip.prototype.arrow = function () {
\r
1360 return this.$arrow = this.$arrow || this.tip().find('.tooltip-arrow')
\r
1363 Tooltip.prototype.validate = function () {
\r
1364 if (!this.$element[0].parentNode) {
\r
1366 this.$element = null
\r
1367 this.options = null
\r
1371 Tooltip.prototype.enable = function () {
\r
1372 this.enabled = true
\r
1375 Tooltip.prototype.disable = function () {
\r
1376 this.enabled = false
\r
1379 Tooltip.prototype.toggleEnabled = function () {
\r
1380 this.enabled = !this.enabled
\r
1383 Tooltip.prototype.toggle = function (e) {
\r
1384 var self = e ? $(e.currentTarget)[this.type](this.getDelegateOptions()).data('bs.' + this.type) : this
\r
1385 self.tip().hasClass('in') ? self.leave(self) : self.enter(self)
\r
1388 Tooltip.prototype.destroy = function () {
\r
1389 clearTimeout(this.timeout)
\r
1390 this.hide().$element.off('.' + this.type).removeData('bs.' + this.type)
\r
1394 // TOOLTIP PLUGIN DEFINITION
\r
1395 // =========================
\r
1397 var old = $.fn.tooltip
\r
1399 $.fn.tooltip = function (option) {
\r
1400 return this.each(function () {
\r
1401 var $this = $(this)
\r
1402 var data = $this.data('bs.tooltip')
\r
1403 var options = typeof option == 'object' && option
\r
1405 if (!data && option == 'destroy') return
\r
1406 if (!data) $this.data('bs.tooltip', (data = new Tooltip(this, options)))
\r
1407 if (typeof option == 'string') data[option]()
\r
1411 $.fn.tooltip.Constructor = Tooltip
\r
1414 // TOOLTIP NO CONFLICT
\r
1415 // ===================
\r
1417 $.fn.tooltip.noConflict = function () {
\r
1418 $.fn.tooltip = old
\r
1424 /* ========================================================================
\r
1425 * Bootstrap: popover.js v3.1.1
\r
1426 * http://getbootstrap.com/javascript/#popovers
\r
1427 * ========================================================================
\r
1428 * Copyright 2011-2014 Twitter, Inc.
\r
1429 * Licensed under MIT (https://github.com/twbs/bootstrap/blob/master/LICENSE)
\r
1430 * ======================================================================== */
\r
1436 // POPOVER PUBLIC CLASS DEFINITION
\r
1437 // ===============================
\r
1439 var Popover = function (element, options) {
\r
1440 this.init('popover', element, options)
\r
1443 if (!$.fn.tooltip) throw new Error('Popover requires tooltip.js')
\r
1445 Popover.DEFAULTS = $.extend({}, $.fn.tooltip.Constructor.DEFAULTS, {
\r
1446 placement: 'right',
\r
1449 template: '<div class="popover"><div class="arrow"></div><h3 class="popover-title"></h3><div class="popover-content"></div></div>'
\r
1453 // NOTE: POPOVER EXTENDS tooltip.js
\r
1454 // ================================
\r
1456 Popover.prototype = $.extend({}, $.fn.tooltip.Constructor.prototype)
\r
1458 Popover.prototype.constructor = Popover
\r
1460 Popover.prototype.getDefaults = function () {
\r
1461 return Popover.DEFAULTS
\r
1464 Popover.prototype.setContent = function () {
\r
1465 var $tip = this.tip()
\r
1466 var title = this.getTitle()
\r
1467 var content = this.getContent()
\r
1469 $tip.find('.popover-title')[this.options.html ? 'html' : 'text'](title)
\r
1470 $tip.find('.popover-content')[ // we use append for html objects to maintain js events
\r
1471 this.options.html ? (typeof content == 'string' ? 'html' : 'append') : 'text'
\r
1474 $tip.removeClass('fade top bottom left right in')
\r
1476 // IE8 doesn't accept hiding via the `:empty` pseudo selector, we have to do
\r
1477 // this manually by checking the contents.
\r
1478 if (!$tip.find('.popover-title').html()) $tip.find('.popover-title').hide()
\r
1481 Popover.prototype.hasContent = function () {
\r
1482 return this.getTitle() || this.getContent()
\r
1485 Popover.prototype.getContent = function () {
\r
1486 var $e = this.$element
\r
1487 var o = this.options
\r
1489 return $e.attr('data-content')
\r
1490 || (typeof o.content == 'function' ?
\r
1491 o.content.call($e[0]) :
\r
1495 Popover.prototype.arrow = function () {
\r
1496 return this.$arrow = this.$arrow || this.tip().find('.arrow')
\r
1499 Popover.prototype.tip = function () {
\r
1500 if (!this.$tip) this.$tip = $(this.options.template)
\r
1505 // POPOVER PLUGIN DEFINITION
\r
1506 // =========================
\r
1508 var old = $.fn.popover
\r
1510 $.fn.popover = function (option) {
\r
1511 return this.each(function () {
\r
1512 var $this = $(this)
\r
1513 var data = $this.data('bs.popover')
\r
1514 var options = typeof option == 'object' && option
\r
1516 if (!data && option == 'destroy') return
\r
1517 if (!data) $this.data('bs.popover', (data = new Popover(this, options)))
\r
1518 if (typeof option == 'string') data[option]()
\r
1522 $.fn.popover.Constructor = Popover
\r
1525 // POPOVER NO CONFLICT
\r
1526 // ===================
\r
1528 $.fn.popover.noConflict = function () {
\r
1529 $.fn.popover = old
\r
1535 /* ========================================================================
\r
1536 * Bootstrap: scrollspy.js v3.1.1
\r
1537 * http://getbootstrap.com/javascript/#scrollspy
\r
1538 * ========================================================================
\r
1539 * Copyright 2011-2014 Twitter, Inc.
\r
1540 * Licensed under MIT (https://github.com/twbs/bootstrap/blob/master/LICENSE)
\r
1541 * ======================================================================== */
\r
1547 // SCROLLSPY CLASS DEFINITION
\r
1548 // ==========================
\r
1550 function ScrollSpy(element, options) {
\r
1552 var process = $.proxy(this.process, this)
\r
1554 this.$element = $(element).is('body') ? $(window) : $(element)
\r
1555 this.$body = $('body')
\r
1556 this.$scrollElement = this.$element.on('scroll.bs.scroll-spy.data-api', process)
\r
1557 this.options = $.extend({}, ScrollSpy.DEFAULTS, options)
\r
1558 this.selector = (this.options.target
\r
1559 || ((href = $(element).attr('href')) && href.replace(/.*(?=#[^\s]+$)/, '')) //strip for ie7
\r
1560 || '') + ' .nav li > a'
\r
1561 this.offsets = $([])
\r
1562 this.targets = $([])
\r
1563 this.activeTarget = null
\r
1569 ScrollSpy.DEFAULTS = {
\r
1573 ScrollSpy.prototype.refresh = function () {
\r
1574 var offsetMethod = this.$element[0] == window ? 'offset' : 'position'
\r
1576 this.offsets = $([])
\r
1577 this.targets = $([])
\r
1580 var $targets = this.$body
\r
1581 .find(this.selector)
\r
1582 .map(function () {
\r
1584 var href = $el.data('target') || $el.attr('href')
\r
1585 var $href = /^#./.test(href) && $(href)
\r
1589 && $href.is(':visible')
\r
1590 && [[ $href[offsetMethod]().top + (!$.isWindow(self.$scrollElement.get(0)) && self.$scrollElement.scrollTop()), href ]]) || null
\r
1592 .sort(function (a, b) { return a[0] - b[0] })
\r
1593 .each(function () {
\r
1594 self.offsets.push(this[0])
\r
1595 self.targets.push(this[1])
\r
1599 ScrollSpy.prototype.process = function () {
\r
1600 var scrollTop = this.$scrollElement.scrollTop() + this.options.offset
\r
1601 var scrollHeight = this.$scrollElement[0].scrollHeight || this.$body[0].scrollHeight
\r
1602 var maxScroll = scrollHeight - this.$scrollElement.height()
\r
1603 var offsets = this.offsets
\r
1604 var targets = this.targets
\r
1605 var activeTarget = this.activeTarget
\r
1608 if (scrollTop >= maxScroll) {
\r
1609 return activeTarget != (i = targets.last()[0]) && this.activate(i)
\r
1612 if (activeTarget && scrollTop <= offsets[0]) {
\r
1613 return activeTarget != (i = targets[0]) && this.activate(i)
\r
1616 for (i = offsets.length; i--;) {
\r
1617 activeTarget != targets[i]
\r
1618 && scrollTop >= offsets[i]
\r
1619 && (!offsets[i + 1] || scrollTop <= offsets[i + 1])
\r
1620 && this.activate( targets[i] )
\r
1624 ScrollSpy.prototype.activate = function (target) {
\r
1625 this.activeTarget = target
\r
1628 .parentsUntil(this.options.target, '.active')
\r
1629 .removeClass('active')
\r
1631 var selector = this.selector +
\r
1632 '[data-target="' + target + '"],' +
\r
1633 this.selector + '[href="' + target + '"]'
\r
1635 var active = $(selector)
\r
1637 .addClass('active')
\r
1639 if (active.parent('.dropdown-menu').length) {
\r
1641 .closest('li.dropdown')
\r
1642 .addClass('active')
\r
1645 active.trigger('activate.bs.scrollspy')
\r
1649 // SCROLLSPY PLUGIN DEFINITION
\r
1650 // ===========================
\r
1652 var old = $.fn.scrollspy
\r
1654 $.fn.scrollspy = function (option) {
\r
1655 return this.each(function () {
\r
1656 var $this = $(this)
\r
1657 var data = $this.data('bs.scrollspy')
\r
1658 var options = typeof option == 'object' && option
\r
1660 if (!data) $this.data('bs.scrollspy', (data = new ScrollSpy(this, options)))
\r
1661 if (typeof option == 'string') data[option]()
\r
1665 $.fn.scrollspy.Constructor = ScrollSpy
\r
1668 // SCROLLSPY NO CONFLICT
\r
1669 // =====================
\r
1671 $.fn.scrollspy.noConflict = function () {
\r
1672 $.fn.scrollspy = old
\r
1677 // SCROLLSPY DATA-API
\r
1678 // ==================
\r
1680 $(window).on('load', function () {
\r
1681 $('[data-spy="scroll"]').each(function () {
\r
1682 var $spy = $(this)
\r
1683 $spy.scrollspy($spy.data())
\r
1689 /* ========================================================================
\r
1690 * Bootstrap: tab.js v3.1.1
\r
1691 * http://getbootstrap.com/javascript/#tabs
\r
1692 * ========================================================================
\r
1693 * Copyright 2011-2014 Twitter, Inc.
\r
1694 * Licensed under MIT (https://github.com/twbs/bootstrap/blob/master/LICENSE)
\r
1695 * ======================================================================== */
\r
1701 // TAB CLASS DEFINITION
\r
1702 // ====================
\r
1704 var Tab = function (element) {
\r
1705 this.element = $(element)
\r
1708 Tab.prototype.show = function () {
\r
1709 var $this = this.element
\r
1710 var $ul = $this.closest('ul:not(.dropdown-menu)')
\r
1711 var selector = $this.data('target')
\r
1714 selector = $this.attr('href')
\r
1715 selector = selector && selector.replace(/.*(?=#[^\s]*$)/, '') //strip for ie7
\r
1718 if ($this.parent('li').hasClass('active')) return
\r
1720 var previous = $ul.find('.active:last a')[0]
\r
1721 var e = $.Event('show.bs.tab', {
\r
1722 relatedTarget: previous
\r
1727 if (e.isDefaultPrevented()) return
\r
1729 var $target = $(selector)
\r
1731 this.activate($this.parent('li'), $ul)
\r
1732 this.activate($target, $target.parent(), function () {
\r
1734 type: 'shown.bs.tab',
\r
1735 relatedTarget: previous
\r
1740 Tab.prototype.activate = function (element, container, callback) {
\r
1741 var $active = container.find('> .active')
\r
1742 var transition = callback
\r
1743 && $.support.transition
\r
1744 && $active.hasClass('fade')
\r
1748 .removeClass('active')
\r
1749 .find('> .dropdown-menu > .active')
\r
1750 .removeClass('active')
\r
1752 element.addClass('active')
\r
1755 element[0].offsetWidth // reflow for transition
\r
1756 element.addClass('in')
\r
1758 element.removeClass('fade')
\r
1761 if (element.parent('.dropdown-menu')) {
\r
1762 element.closest('li.dropdown').addClass('active')
\r
1765 callback && callback()
\r
1770 .one($.support.transition.end, next)
\r
1771 .emulateTransitionEnd(150) :
\r
1774 $active.removeClass('in')
\r
1778 // TAB PLUGIN DEFINITION
\r
1779 // =====================
\r
1781 var old = $.fn.tab
\r
1783 $.fn.tab = function ( option ) {
\r
1784 return this.each(function () {
\r
1785 var $this = $(this)
\r
1786 var data = $this.data('bs.tab')
\r
1788 if (!data) $this.data('bs.tab', (data = new Tab(this)))
\r
1789 if (typeof option == 'string') data[option]()
\r
1793 $.fn.tab.Constructor = Tab
\r
1796 // TAB NO CONFLICT
\r
1797 // ===============
\r
1799 $.fn.tab.noConflict = function () {
\r
1808 $(document).on('click.bs.tab.data-api', '[data-toggle="tab"], [data-toggle="pill"]', function (e) {
\r
1809 e.preventDefault()
\r
1810 $(this).tab('show')
\r
1815 /* ========================================================================
\r
1816 * Bootstrap: affix.js v3.1.1
\r
1817 * http://getbootstrap.com/javascript/#affix
\r
1818 * ========================================================================
\r
1819 * Copyright 2011-2014 Twitter, Inc.
\r
1820 * Licensed under MIT (https://github.com/twbs/bootstrap/blob/master/LICENSE)
\r
1821 * ======================================================================== */
\r
1827 // AFFIX CLASS DEFINITION
\r
1828 // ======================
\r
1830 var Affix = function (element, options) {
\r
1831 this.options = $.extend({}, Affix.DEFAULTS, options)
\r
1832 this.$window = $(window)
\r
1833 .on('scroll.bs.affix.data-api', $.proxy(this.checkPosition, this))
\r
1834 .on('click.bs.affix.data-api', $.proxy(this.checkPositionWithEventLoop, this))
\r
1836 this.$element = $(element)
\r
1839 this.pinnedOffset = null
\r
1841 this.checkPosition()
\r
1844 Affix.RESET = 'affix affix-top affix-bottom'
\r
1846 Affix.DEFAULTS = {
\r
1850 Affix.prototype.getPinnedOffset = function () {
\r
1851 if (this.pinnedOffset) return this.pinnedOffset
\r
1852 this.$element.removeClass(Affix.RESET).addClass('affix')
\r
1853 var scrollTop = this.$window.scrollTop()
\r
1854 var position = this.$element.offset()
\r
1855 return (this.pinnedOffset = position.top - scrollTop)
\r
1858 Affix.prototype.checkPositionWithEventLoop = function () {
\r
1859 setTimeout($.proxy(this.checkPosition, this), 1)
\r
1862 Affix.prototype.checkPosition = function () {
\r
1863 if (!this.$element.is(':visible')) return
\r
1865 var scrollHeight = $(document).height()
\r
1866 var scrollTop = this.$window.scrollTop()
\r
1867 var position = this.$element.offset()
\r
1868 var offset = this.options.offset
\r
1869 var offsetTop = offset.top
\r
1870 var offsetBottom = offset.bottom
\r
1872 if (this.affixed == 'top') position.top += scrollTop
\r
1874 if (typeof offset != 'object') offsetBottom = offsetTop = offset
\r
1875 if (typeof offsetTop == 'function') offsetTop = offset.top(this.$element)
\r
1876 if (typeof offsetBottom == 'function') offsetBottom = offset.bottom(this.$element)
\r
1878 var affix = this.unpin != null && (scrollTop + this.unpin <= position.top) ? false :
\r
1879 offsetBottom != null && (position.top + this.$element.height() >= scrollHeight - offsetBottom) ? 'bottom' :
\r
1880 offsetTop != null && (scrollTop <= offsetTop) ? 'top' : false
\r
1882 if (this.affixed === affix) return
\r
1883 if (this.unpin) this.$element.css('top', '')
\r
1885 var affixType = 'affix' + (affix ? '-' + affix : '')
\r
1886 var e = $.Event(affixType + '.bs.affix')
\r
1888 this.$element.trigger(e)
\r
1890 if (e.isDefaultPrevented()) return
\r
1892 this.affixed = affix
\r
1893 this.unpin = affix == 'bottom' ? this.getPinnedOffset() : null
\r
1896 .removeClass(Affix.RESET)
\r
1897 .addClass(affixType)
\r
1898 .trigger($.Event(affixType.replace('affix', 'affixed')))
\r
1900 if (affix == 'bottom') {
\r
1901 this.$element.offset({ top: scrollHeight - offsetBottom - this.$element.height() })
\r
1906 // AFFIX PLUGIN DEFINITION
\r
1907 // =======================
\r
1909 var old = $.fn.affix
\r
1911 $.fn.affix = function (option) {
\r
1912 return this.each(function () {
\r
1913 var $this = $(this)
\r
1914 var data = $this.data('bs.affix')
\r
1915 var options = typeof option == 'object' && option
\r
1917 if (!data) $this.data('bs.affix', (data = new Affix(this, options)))
\r
1918 if (typeof option == 'string') data[option]()
\r
1922 $.fn.affix.Constructor = Affix
\r
1925 // AFFIX NO CONFLICT
\r
1926 // =================
\r
1928 $.fn.affix.noConflict = function () {
\r
1937 $(window).on('load', function () {
\r
1938 $('[data-spy="affix"]').each(function () {
\r
1939 var $spy = $(this)
\r
1940 var data = $spy.data()
\r
1942 data.offset = data.offset || {}
\r
1944 if (data.offsetBottom) data.offset.bottom = data.offsetBottom
\r
1945 if (data.offsetTop) data.offset.top = data.offsetTop
\r