PageSourceSearch

https://scboston.org/wp-content/plugins/tabs-responsive/assets/js/tabs-custom.js?ver=7.0.5

js scboston.org collected 2026-09-24 10:15:10 UTC 65,473 bytes, 2,247 lines download raw bytes

vendor: 65,473 bytes, lines 1-2247
1+function ($) {
2  'use strict';
3
4  // CSS TRANSITION SUPPORT (Shoutout: http://www.modernizr.com/)
5  // ============================================================
6
7  function transitionEnd() {
8    var el = document.createElement('bootstrap')
9
10    var transEndEventNames = {
11      WebkitTransition : 'webkitTransitionEnd',
12      MozTransition    : 'transitionend',
13      OTransition      : 'oTransitionEnd otransitionend',
14      transition       : 'transitionend'
15    }
16
17    for (var name in transEndEventNames) {
18      if (el.style[name] !== undefined) {
19        return { end: transEndEventNames[name] }
20      }
21    }
22
23    return false // explicit for ie8 (  ._.)
24  }
25
26  // http://blog.alexmaccaw.com/css-transitions
27  $.fn.emulateTransitionEnd = function (duration) {
28    var called = false
29    var $el = this
30    $(this).one('bsTransitionEnd', function () { called = true })
31    var callback = function () { if (!called) $($el).trigger($.support.transition.end) }
32    setTimeout(callback, duration)
33    return this
34  }
35
36  $(function () {
37    $.support.transition = transitionEnd()
38
39    if (!$.support.transition) return
40
41    $.event.special.bsTransitionEnd = {
42      bindType: $.support.transition.end,
43      delegateType: $.support.transition.end,
44      handle: function (e) {
45        if ($(e.target).is(this)) return e.handleObj.handler.apply(this, arguments)
46      }
47    }
48  })
49
50}(jQuery);
51
52
53+function ($) {
54  'use strict';
55
56  // ALERT CLASS DEFINITION
57  // ======================
58
59  var dismiss = '[data-dismiss="alert"]'
60  var Alert   = function (el) {
61    $(el).on('click', dismiss, this.close)
62  }
63
64  Alert.VERSION = '3.3.6'
65
66  Alert.TRANSITION_DURATION = 150
67
68  Alert.prototype.close = function (e) {
69    var $this    = $(this)
70    var selector = $this.attr('data-target')
71
72    if (!selector) {
73      selector = $this.attr('href')
74      selector = selector && selector.replace(/.*(?=#[^\s]*$)/, '') // strip for ie7
75    }
76
77    var $parent = $(selector)
78
79    if (e) e.preventDefault()
80
81    if (!$parent.length) {
82      $parent = $this.closest('.alert')
83    }
84
85    $parent.trigger(e = $.Event('close.bs.alert'))
86
87    if (e.isDefaultPrevented()) return
88
89    $parent.removeClass('in')
90
91    function removeElement() {
92      // detach from parent, fire event then clean up data
93      $parent.detach().trigger('closed.bs.alert').remove()
94    }
95
96    $.support.transition && $parent.hasClass('fade') ?
97      $parent
98        .one('bsTransitionEnd', removeElement)
99        .emulateTransitionEnd(Alert.TRANSITION_DURATION) :
100      removeElement()
101  }
102
103
104  // ALERT PLUGIN DEFINITION
105  // =======================
106
107  function Plugin(option) {
108    return this.each(function () {
109      var $this = $(this)
110      var data  = $this.data('bs.alert')
111
112      if (!data) $this.data('bs.alert', (data = new Alert(this)))
113      if (typeof option == 'string') data[option].call($this)
114    })
115  }
116
117  var old = $.fn.alert
118
119  $.fn.alert             = Plugin
120  $.fn.alert.Constructor = Alert
121
122
123  // ALERT NO CONFLICT
124  // =================
125
126  $.fn.alert.noConflict = function () {
127    $.fn.alert = old
128    return this
129  }
130
131
132  // ALERT DATA-API
133  // ==============
134
135  $(document).on('click.bs.alert.data-api', dismiss, Alert.prototype.close)
136
137}(jQuery);
138
139
140+function ($) {
141  'use strict';
142
143  // BUTTON PUBLIC CLASS DEFINITION
144  // ==============================
145
146  var Button = function (element, options) {
147    this.$element  = $(element)
148    this.options   = $.extend({}, Button.DEFAULTS, options)
149    this.isLoading = false
150  }
151
152  Button.VERSION  = '3.3.6'
153
154  Button.DEFAULTS = {
155    loadingText: 'loading...'
156  }
157
158  Button.prototype.setState = function (state) {
159    var d    = 'disabled'
160    var $el  = this.$element
161    var val  = $el.is('input') ? 'val' : 'html'
162    var data = $el.data()
163
164    state += 'Text'
165
166    if (data.resetText == null) $el.data('resetText', $el[val]())
167
168    // push to event loop to allow forms to submit
169    setTimeout($.proxy(function () {
170      $el[val](data[state] == null ? this.options[state] : data[state])
171
172      if (state == 'loadingText') {
173        this.isLoading = true
174        $el.addClass(d).attr(d, d)
175      } else if (this.isLoading) {
176        this.isLoading = false
177        $el.removeClass(d).removeAttr(d)
178      }
179    }, this), 0)
180  }
181
182  Button.prototype.toggle = function () {
183    var changed = true
184    var $parent = this.$element.closest('[data-toggle="buttons"]')
185
186    if ($parent.length) {
187      var $input = this.$element.find('input')
188      if ($input.prop('type') == 'radio') {
189        if ($input.prop('checked')) changed = false
190        $parent.find('.active').removeClass('active')
191        this.$element.addClass('active')
192      } else if ($input.prop('type') == 'checkbox') {
193        if (($input.prop('checked')) !== this.$element.hasClass('active')) changed = false
194        this.$element.toggleClass('active')
195      }
196      $input.prop('checked', this.$element.hasClass('active'))
197      if (changed) $input.trigger('change')
198    } else {
199      this.$element.attr('aria-pressed', !this.$element.hasClass('active'))
200      this.$element.toggleClass('active')
201    }
202  }
203
204
205  // BUTTON PLUGIN DEFINITION
206  // ========================
207
208  function Plugin(option) {
209    return this.each(function () {
210      var $this   = $(this)
211      var data    = $this.data('bs.button')
212      var options = typeof option == 'object' && option
213
214      if (!data) $this.data('bs.button', (data = new Button(this, options)))
215
216      if (option == 'toggle') data.toggle()
217      else if (option) data.setState(option)
218    })
219  }
220
221  var old = $.fn.button
222
223  $.fn.button             = Plugin
224  $.fn.button.Constructor = Button
225
226
227  // BUTTON NO CONFLICT
228  // ==================
229
230  $.fn.button.noConflict = function () {
231    $.fn.button = old
232    return this
233  }
234
235
236  // BUTTON DATA-API
237  // ===============
238
239  $(document)
240    .on('click.bs.button.data-api', '[data-toggle^="button"]', function (e) {
241      var $btn = $(e.target)
242      if (!$btn.hasClass('btn')) $btn = $btn.closest('.btn')
243      Plugin.call($btn, 'toggle')
244      if (!($(e.target).is('input[type="radio"]') || $(e.target).is('input[type="checkbox"]'))) e.preventDefault()
245    })
246    .on('focus.bs.button.data-api blur.bs.button.data-api', '[data-toggle^="button"]', function (e) {
247      $(e.target).closest('.btn').toggleClass('focus', /^focus(in)?$/.test(e.type))
248    })
249
250}(jQuery);
251
252
253+function ($) {
254  'use strict';
255
256  // CAROUSEL CLASS DEFINITION
257  // =========================
258
259  var Carousel = function (element, options) {
260    this.$element    = $(element)
261    this.$indicators = this.$element.find('.carousel-indicators')
262    this.options     = options
263    this.paused      = null
264    this.sliding     = null
265    this.interval    = null
266    this.$active     = null
267    this.$items      = null
268
269    this.options.keyboard && this.$element.on('keydown.bs.carousel', $.proxy(this.keydown, this))
270
271    this.options.pause == 'hover' && !('ontouchstart' in document.documentElement) && this.$element
272      .on('mouseenter.bs.carousel', $.proxy(this.pause, this))
273      .on('mouseleave.bs.carousel', $.proxy(this.cycle, this))
274  }
275
276  Carousel.VERSION  = '3.3.6'
277
278  Carousel.TRANSITION_DURATION = 600
279
280  Carousel.DEFAULTS = {
281    interval: 5000,
282    pause: 'hover',
283    wrap: true,
284    keyboard: true
285  }
286
287  Carousel.prototype.keydown = function (e) {
288    if (/input|textarea/i.test(e.target.tagName)) return
289    switch (e.which) {
290      case 37: this.prev(); break
291      case 39: this.next(); break
292      default: return
293    }
294
295    e.preventDefault()
296  }
297
298  Carousel.prototype.cycle = function (e) {
299    e || (this.paused = false)
300
301    this.interval && clearInterval(this.interval)
302
303    this.options.interval
304      && !this.paused
305      && (this.interval = setInterval($.proxy(this.next, this), this.options.interval))
306
307    return this
308  }
309
310  Carousel.prototype.getItemIndex = function (item) {
311    this.$items = item.parent().children('.item')
312    return this.$items.index(item || this.$active)
313  }
314
315  Carousel.prototype.getItemForDirection = function (direction, active) {
316    var activeIndex = this.getItemIndex(active)
317    var willWrap = (direction == 'prev' && activeIndex === 0)
318                || (direction == 'next' && activeIndex == (this.$items.length - 1))
319    if (willWrap && !this.options.wrap) return active
320    var delta = direction == 'prev' ? -1 : 1
321    var itemIndex = (activeIndex + delta) % this.$items.length
322    return this.$items.eq(itemIndex)
323  }
324
325  Carousel.prototype.to = function (pos) {
326    var that        = this
327    var activeIndex = this.getItemIndex(this.$active = this.$element.find('.item.active'))
328
329    if (pos > (this.$items.length - 1) || pos < 0) return
330
331    if (this.sliding)       return this.$element.one('slid.bs.carousel', function () { that.to(pos) }) // yes, "slid"
332    if (activeIndex == pos) return this.pause().cycle()
333
334    return this.slide(pos > activeIndex ? 'next' : 'prev', this.$items.eq(pos))
335  }
336
337  Carousel.prototype.pause = function (e) {
338    e || (this.paused = true)
339
340    if (this.$element.find('.next, .prev').length && $.support.transition) {
341      this.$element.trigger($.support.transition.end)
342      this.cycle(true)
343    }
344
345    this.interval = clearInterval(this.interval)
346
347    return this
348  }
349
350  Carousel.prototype.next = function () {
351    if (this.sliding) return
352    return this.slide('next')
353  }
354
355  Carousel.prototype.prev = function () {
356    if (this.sliding) return
357    return this.slide('prev')
358  }
359
360  Carousel.prototype.slide = function (type, next) {
361    var $active   = this.$element.find('.item.active')
362    var $next     = next || this.getItemForDirection(type, $active)
363    var isCycling = this.interval
364    var direction = type == 'next' ? 'left' : 'right'
365    var that      = this
366
367    if ($next.hasClass('active')) return (this.sliding = false)
368
369    var relatedTarget = $next[0]
370    var slideEvent = $.Event('slide.bs.carousel', {
371      relatedTarget: relatedTarget,
372      direction: direction
373    })
374    this.$element.trigger(slideEvent)
375    if (slideEvent.isDefaultPrevented()) return
376
377    this.sliding = true
378
379    isCycling && this.pause()
380
381    if (this.$indicators.length) {
382      this.$indicators.find('.active').removeClass('active')
383      var $nextIndicator = $(this.$indicators.children()[this.getItemIndex($next)])
384      $nextIndicator && $nextIndicator.addClass('active')
385    }
386
387    var slidEvent = $.Event('slid.bs.carousel', { relatedTarget: relatedTarget, direction: direction }) // yes, "slid"
388    if ($.support.transition && this.$element.hasClass('slide')) {
389      $next.addClass(type)
390      $next[0].offsetWidth // force reflow
391      $active.addClass(direction)
392      $next.addClass(direction)
393      $active
394        .one('bsTransitionEnd', function () {
395          $next.removeClass([type, direction].join(' ')).addClass('active')
396          $active.removeClass(['active', direction].join(' '))
397          that.sliding = false
398          setTimeout(function () {
399            that.$element.trigger(slidEvent)
400          }, 0)
401        })
402        .emulateTransitionEnd(Carousel.TRANSITION_DURATION)
403    } else {
404      $active.removeClass('active')
405      $next.addClass('active')
406      this.sliding = false
407      this.$element.trigger(slidEvent)
408    }
409
410    isCycling && this.cycle()
411
412    return this
413  }
414
415
416  // CAROUSEL PLUGIN DEFINITION
417  // ==========================
418
419  function Plugin(option) {
420    return this.each(function () {
421      var $this   = $(this)
422      var data    = $this.data('bs.carousel')
423      var options = $.extend({}, Carousel.DEFAULTS, $this.data(), typeof option == 'object' && option)
424      var action  = typeof option == 'string' ? option : options.slide
425
426      if (!data) $this.data('bs.carousel', (data = new Carousel(this, options)))
427      if (typeof option == 'number') data.to(option)
428      else if (action) data[action]()
429      else if (options.interval) data.pause().cycle()
430    })
431  }
432
433  var old = $.fn.carousel
434
435  $.fn.carousel             = Plugin
436  $.fn.carousel.Constructor = Carousel
437
438
439  // CAROUSEL NO CONFLICT
440  // ====================
441
442  $.fn.carousel.noConflict = function () {
443    $.fn.carousel = old
444    return this
445  }
446
447
448  // CAROUSEL DATA-API
449  // =================
450
451  var clickHandler = function (e) {
452    var href
453    var $this   = $(this)
454    var $target = $($this.attr('data-target') || (href = $this.attr('href')) && href.replace(/.*(?=#[^\s]+$)/, '')) // strip for ie7
455    if (!$target.hasClass('carousel')) return
456    var options = $.extend({}, $target.data(), $this.data())
457    var slideIndex = $this.attr('data-slide-to')
458    if (slideIndex) options.interval = false
459
460    Plugin.call($target, options)
461
462    if (slideIndex) {
463      $target.data('bs.carousel').to(slideIndex)
464    }
465
466    e.preventDefault()
467  }
468
469  $(document)
470    .on('click.bs.carousel.data-api', '[data-slide]', clickHandler)
471    .on('click.bs.carousel.data-api', '[data-slide-to]', clickHandler)
472
473  $(window).on('load', function () {
474    $('[data-ride="carousel"]').each(function () {
475      var $carousel = $(this)
476      Plugin.call($carousel, $carousel.data())
477    })
478  })
479
480}(jQuery);
481
482
483+function ($) {
484  'use strict';
485
486  // COLLAPSE PUBLIC CLASS DEFINITION
487  // ================================
488
489  var Collapse = function (element, options) {
490    this.$element      = $(element)
491    this.options       = $.extend({}, Collapse.DEFAULTS, options)
492    this.$trigger      = $('[data-toggle="collapse"][href="#' + element.id + '"],' +
493                           '[data-toggle="collapse"][data-target="#' + element.id + '"]')
494    this.transitioning = null
495
496    if (this.options.parent) {
497      this.$parent = this.getParent()
498    } else {
499      this.addAriaAndCollapsedClass(this.$element, this.$trigger)
500    }
501
502    if (this.options.toggle) this.toggle()
503  }
504
505  Collapse.VERSION  = '3.3.6'
506
507  Collapse.TRANSITION_DURATION = 350
508
509  Collapse.DEFAULTS = {
510    toggle: true
511  }
512
513  Collapse.prototype.dimension = function () {
514    var hasWidth = this.$element.hasClass('width')
515    return hasWidth ? 'width' : 'height'
516  }
517
518  Collapse.prototype.show = function () {
519    if (this.transitioning || this.$element.hasClass('in')) return
520
521    var activesData
522    var actives = this.$parent && this.$parent.children('.wpsm_panel').children('.in, .collapsing')
523
524    if (actives && actives.length) {
525      activesData = actives.data('bs.collapse')
526      if (activesData && activesData.transitioning) return
527    }
528
529    var startEvent = $.Event('show.bs.collapse')
530    this.$element.trigger(startEvent)
531    if (startEvent.isDefaultPrevented()) return
532
533    if (actives && actives.length) {
534      Plugin.call(actives, 'hide')
535      activesData || actives.data('bs.collapse', null)
536    }
537
538    var dimension = this.dimension()
539
540    this.$element
541      .removeClass('collapse')
542      .addClass('collapsing')[dimension](0)
543      .attr('aria-expanded', true)
544
545    this.$trigger
546      .removeClass('collapsed')
547      .attr('aria-expanded', true)
548
549    this.transitioning = 1
550
551    var complete = function () {
552      this.$element
553        .removeClass('collapsing')
554        .addClass('collapse in')[dimension]('')
555      this.transitioning = 0
556      this.$element
557        .trigger('shown.bs.collapse')
558    }
559
560    if (!$.support.transition) return complete.call(this)
561
562    var scrollSize = $.camelCase(['scroll', dimension].join('-'))
563
564    this.$element
565      .one('bsTransitionEnd', $.proxy(complete, this))
566      .emulateTransitionEnd(Collapse.TRANSITION_DURATION)[dimension](this.$element[0][scrollSize])
567  }
568
569  Collapse.prototype.hide = function () {
570    if (this.transitioning || !this.$element.hasClass('in')) return
571
572    var startEvent = $.Event('hide.bs.collapse')
573    this.$element.trigger(startEvent)
574    if (startEvent.isDefaultPrevented()) return
575
576    var dimension = this.dimension()
577
578    this.$element[dimension](this.$element[dimension]())[0].offsetHeight
579
580    this.$element
581      .addClass('collapsing')
582      .removeClass('collapse in')
583      .attr('aria-expanded', false)
584
585    this.$trigger
586      .addClass('collapsed')
587      .attr('aria-expanded', false)
588
589    this.transitioning = 1
590
591    var complete = function () {
592      this.transitioning = 0
593      this.$element
594        .removeClass('collapsing')
595        .addClass('collapse')
596        .trigger('hidden.bs.collapse')
597    }
598
599    if (!$.support.transition) return complete.call(this)
600
601    this.$element
602      [dimension](0)
603      .one('bsTransitionEnd', $.proxy(complete, this))
604      .emulateTransitionEnd(Collapse.TRANSITION_DURATION)
605  }
606
607  Collapse.prototype.toggle = function () {
608    this[this.$element.hasClass('in') ? 'hide' : 'show']()
609  }
610
611  Collapse.prototype.getParent = function () {
612    return $(this.options.parent)
613      .find('[data-toggle="collapse"][data-parent="' + this.options.parent + '"]')
614      .each($.proxy(function (i, element) {
615        var $element = $(element)
616        this.addAriaAndCollapsedClass(getTargetFromTrigger($element), $element)
617      }, this))
618      .end()
619  }
620
621  Collapse.prototype.addAriaAndCollapsedClass = function ($element, $trigger) {
622    var isOpen = $element.hasClass('in')
623
624    $element.attr('aria-expanded', isOpen)
625    $trigger
626      .toggleClass('collapsed', !isOpen)
627      .attr('aria-expanded', isOpen)
628  }
629
630  function getTargetFromTrigger($trigger) {
631    var href
632    var target = $trigger.attr('data-target')
633      || (href = $trigger.attr('href')) && href.replace(/.*(?=#[^\s]+$)/, '') // strip for ie7
634
635    return $(target)
636  }
637
638
639  // COLLAPSE PLUGIN DEFINITION
640  // ==========================
641
642  function Plugin(option) {
643    return this.each(function () {
644      var $this   = $(this)
645      var data    = $this.data('bs.collapse')
646      var options = $.extend({}, Collapse.DEFAULTS, $this.data(), typeof option == 'object' && option)
647
648      if (!data && options.toggle && /show|hide/.test(option)) options.toggle = false
649      if (!data) $this.data('bs.collapse', (data = new Collapse(this, options)))
650      if (typeof option == 'string') data[option]()
651    })
652  }
653
654  var old = $.fn.collapse
655
656  $.fn.collapse             = Plugin
657  $.fn.collapse.Constructor = Collapse
658
659
660  // COLLAPSE NO CONFLICT
661  // ====================
662
663  $.fn.collapse.noConflict = function () {
664    $.fn.collapse = old
665    return this
666  }
667
668
669  // COLLAPSE DATA-API
670  // =================
671
672  $(document).on('click.bs.collapse.data-api', '[data-toggle="collapse"]', function (e) {
673    var $this   = $(this)
674
675    if (!$this.attr('data-target')) e.preventDefault()
676
677    var $target = getTargetFromTrigger($this)
678    var data    = $target.data('bs.collapse')
679    var option  = data ? 'toggle' : $this.data()
680
681    Plugin.call($target, option)
682  })
683
684}(jQuery);
685
686
687+function ($) {
688  'use strict';
689
690  // DROPDOWN CLASS DEFINITION
691  // =========================
692
693  var backdrop = '.dropdown-backdrop'
694  var toggle   = '[data-toggle="dropdown"]'
695  var Dropdown = function (element) {
696    $(element).on('click.bs.dropdown', this.toggle)
697  }
698
699  Dropdown.VERSION = '3.3.6'
700
701  function getParent($this) {
702    var selector = $this.attr('data-target')
703
704    if (!selector) {
705      selector = $this.attr('href')
706      selector = selector && /#[A-Za-z]/.test(selector) && selector.replace(/.*(?=#[^\s]*$)/, '') // strip for ie7
707    }
708
709    var $parent = selector && $(selector)
710
711    return $parent && $parent.length ? $parent : $this.parent()
712  }
713
714  function clearMenus(e) {
715    if (e && e.which === 3) return
716    $(backdrop).remove()
717    $(toggle).each(function () {
718      var $this         = $(this)
719      var $parent       = getParent($this)
720      var relatedTarget = { relatedTarget: this }
721
722      if (!$parent.hasClass('open')) return
723
724      if (e && e.type == 'click' && /input|textarea/i.test(e.target.tagName) && $.contains($parent[0], e.target)) return
725
726      $parent.trigger(e = $.Event('hide.bs.dropdown', relatedTarget))
727
728      if (e.isDefaultPrevented()) return
729
730      $this.attr('aria-expanded', 'false')
731      $parent.removeClass('open').trigger($.Event('hidden.bs.dropdown', relatedTarget))
732    })
733  }
734
735  Dropdown.prototype.toggle = function (e) {
736    var $this = $(this)
737
738    if ($this.is('.disabled, :disabled')) return
739
740    var $parent  = getParent($this)
741    var isActive = $parent.hasClass('open')
742
743    clearMenus()
744
745    if (!isActive) {
746      if ('ontouchstart' in document.documentElement && !$parent.closest('.navbar-nav').length) {
747        // if mobile we use a backdrop because click events don't delegate
748        $(document.createElement('div'))
749          .addClass('dropdown-backdrop')
750          .insertAfter($(this))
751          .on('click', clearMenus)
752      }
753
754      var relatedTarget = { relatedTarget: this }
755      $parent.trigger(e = $.Event('show.bs.dropdown', relatedTarget))
756
757      if (e.isDefaultPrevented()) return
758
759      $this
760        .trigger('focus')
761        .attr('aria-expanded', 'true')
762
763      $parent
764        .toggleClass('open')
765        .trigger($.Event('shown.bs.dropdown', relatedTarget))
766    }
767
768    return false
769  }
770
771  Dropdown.prototype.keydown = function (e) {
772    if (!/(38|40|27|32)/.test(e.which) || /input|textarea/i.test(e.target.tagName)) return
773
774    var $this = $(this)
775
776    e.preventDefault()
777    e.stopPropagation()
778
779    if ($this.is('.disabled, :disabled')) return
780
781    var $parent  = getParent($this)
782    var isActive = $parent.hasClass('open')
783
784    if (!isActive && e.which != 27 || isActive && e.which == 27) {
785      if (e.which == 27) $parent.find(toggle).trigger('focus')
786      return $this.trigger('click')
787    }
788
789    var desc = ' li:not(.disabled):visible a'
790    var $items = $parent.find('.dropdown-menu' + desc)
791
792    if (!$items.length) return
793
794    var index = $items.index(e.target)
795
796    if (e.which == 38 && index > 0)                 index--         // up
797    if (e.which == 40 && index < $items.length - 1) index++         // down
798    if (!~index)                                    index = 0
799
800    $items.eq(index).trigger('focus')
801  }
802
803
804  // DROPDOWN PLUGIN DEFINITION
805  // ==========================
806
807  function Plugin(option) {
808    return this.each(function () {
809      var $this = $(this)
810      var data  = $this.data('bs.dropdown')
811
812      if (!data) $this.data('bs.dropdown', (data = new Dropdown(this)))
813      if (typeof option == 'string') data[option].call($this)
814    })
815  }
816
817  var old = $.fn.dropdown
818
819  $.fn.dropdown             = Plugin
820  $.fn.dropdown.Constructor = Dropdown
821
822
823  // DROPDOWN NO CONFLICT
824  // ====================
825
826  $.fn.dropdown.noConflict = function () {
827    $.fn.dropdown = old
828    return this
829  }
830
831
832  // APPLY TO STANDARD DROPDOWN ELEMENTS
833  // ===================================
834
835  $(document)
836    .on('click.bs.dropdown.data-api', clearMenus)
837    .on('click.bs.dropdown.data-api', '.dropdown form', function (e) { e.stopPropagation() })
838    .on('click.bs.dropdown.data-api', toggle, Dropdown.prototype.toggle)
839    .on('keydown.bs.dropdown.data-api', toggle, Dropdown.prototype.keydown)
840    .on('keydown.bs.dropdown.data-api', '.dropdown-menu', Dropdown.prototype.keydown)
841
842}(jQuery);
843
844
845+function ($) {
846  'use strict';
847
848  // MODAL CLASS DEFINITION
849  // ======================
850
851  var Modal = function (element, options) {
852    this.options             = options
853    this.$body               = $(document.body)
854    this.$element            = $(element)
855    this.$dialog             = this.$element.find('.modal-dialog')
856    this.$backdrop           = null
857    this.isShown             = null
858    this.originalBodyPad     = null
859    this.scrollbarWidth      = 0
860    this.ignoreBackdropClick = false
861
862    if (this.options.remote) {
863      this.$element
864        .find('.modal-content')
865        .load(this.options.remote, $.proxy(function () {
866          this.$element.trigger('loaded.bs.modal')
867        }, this))
868    }
869  }
870
871  Modal.VERSION  = '3.3.6'
872
873  Modal.TRANSITION_DURATION = 300
874  Modal.BACKDROP_TRANSITION_DURATION = 150
875
876  Modal.DEFAULTS = {
877    backdrop: true,
878    keyboard: true,
879    show: true
880  }
881
882  Modal.prototype.toggle = function (_relatedTarget) {
883    return this.isShown ? this.hide() : this.show(_relatedTarget)
884  }
885
886  Modal.prototype.show = function (_relatedTarget) {
887    var that = this
888    var e    = $.Event('show.bs.modal', { relatedTarget: _relatedTarget })
889
890    this.$element.trigger(e)
891
892    if (this.isShown || e.isDefaultPrevented()) return
893
894    this.isShown = true
895
896    this.checkScrollbar()
897    this.setScrollbar()
898    this.$body.addClass('modal-open')
899
900    this.escape()
901    this.resize()
902
903    this.$element.on('click.dismiss.bs.modal', '[data-dismiss="modal"]', $.proxy(this.hide, this))
904
905    this.$dialog.on('mousedown.dismiss.bs.modal', function () {
906      that.$element.one('mouseup.dismiss.bs.modal', function (e) {
907        if ($(e.target).is(that.$element)) that.ignoreBackdropClick = true
908      })
909    })
910
911    this.backdrop(function () {
912      var transition = $.support.transition && that.$element.hasClass('fade')
913
914      if (!that.$element.parent().length) {
915        that.$element.appendTo(that.$body) // don't move modals dom position
916      }
917
918      that.$element
919        .show()
920        .scrollTop(0)
921
922      that.adjustDialog()
923
924      if (transition) {
925        that.$element[0].offsetWidth // force reflow
926      }
927
928      that.$element.addClass('in')
929
930      that.enforceFocus()
931
932      var e = $.Event('shown.bs.modal', { relatedTarget: _relatedTarget })
933
934      transition ?
935        that.$dialog // wait for modal to slide in
936          .one('bsTransitionEnd', function () {
937            that.$element.trigger('focus').trigger(e)
938          })
939          .emulateTransitionEnd(Modal.TRANSITION_DURATION) :
940        that.$element.trigger('focus').trigger(e)
941    })
942  }
943
944  Modal.prototype.hide = function (e) {
945    if (e) e.preventDefault()
946
947    e = $.Event('hide.bs.modal')
948
949    this.$element.trigger(e)
950
951    if (!this.isShown || e.isDefaultPrevented()) return
952
953    this.isShown = false
954
955    this.escape()
956    this.resize()
957
958    $(document).off('focusin.bs.modal')
959
960    this.$element
961      .removeClass('in')
962      .off('click.dismiss.bs.modal')
963      .off('mouseup.dismiss.bs.modal')
964
965    this.$dialog.off('mousedown.dismiss.bs.modal')
966
967    $.support.transition && this.$element.hasClass('fade') ?
968      this.$element
969        .one('bsTransitionEnd', $.proxy(this.hideModal, this))
970        .emulateTransitionEnd(Modal.TRANSITION_DURATION) :
971      this.hideModal()
972  }
973
974  Modal.prototype.enforceFocus = function () {
975    $(document)
976      .off('focusin.bs.modal') // guard against infinite focus loop
977      .on('focusin.bs.modal', $.proxy(function (e) {
978        if (this.$element[0] !== e.target && !this.$element.has(e.target).length) {
979          this.$element.trigger('focus')
980        }
981      }, this))
982  }
983
984  Modal.prototype.escape = function () {
985    if (this.isShown && this.options.keyboard) {
986      this.$element.on('keydown.dismiss.bs.modal', $.proxy(function (e) {
987        e.which == 27 && this.hide()
988      }, this))
989    } else if (!this.isShown) {
990      this.$element.off('keydown.dismiss.bs.modal')
991    }
992  }
993
994  Modal.prototype.resize = function () {
995    if (this.isShown) {
996      $(window).on('resize.bs.modal', $.proxy(this.handleUpdate, this))
997    } else {
998      $(window).off('resize.bs.modal')
999    }
1000  }
1001
1002  Modal.prototype.hideModal = function () {
1003    var that = this
1004    this.$element.hide()
1005    this.backdrop(function () {
1006      that.$body.removeClass('modal-open')
1007      that.resetAdjustments()
1008      that.resetScrollbar()
1009      that.$element.trigger('hidden.bs.modal')
1010    })
1011  }
1012
1013  Modal.prototype.removeBackdrop = function () {
1014    this.$backdrop && this.$backdrop.remove()
1015    this.$backdrop = null
1016  }
1017
1018  Modal.prototype.backdrop = function (callback) {
1019    var that = this
1020    var animate = this.$element.hasClass('fade') ? 'fade' : ''
1021
1022    if (this.isShown && this.options.backdrop) {
1023      var doAnimate = $.support.transition && animate
1024
1025      this.$backdrop = $(document.createElement('div'))
1026        .addClass('modal-backdrop ' + animate)
1027        .appendTo(this.$body)
1028
1029      this.$element.on('click.dismiss.bs.modal', $.proxy(function (e) {
1030        if (this.ignoreBackdropClick) {
1031          this.ignoreBackdropClick = false
1032          return
1033        }
1034        if (e.target !== e.currentTarget) return
1035        this.options.backdrop == 'static'
1036          ? this.$element[0].focus()
1037          : this.hide()
1038      }, this))
1039
1040      if (doAnimate) this.$backdrop[0].offsetWidth // force reflow
1041
1042      this.$backdrop.addClass('in')
1043
1044      if (!callback) return
1045
1046      doAnimate ?
1047        this.$backdrop
1048          .one('bsTransitionEnd', callback)
1049          .emulateTransitionEnd(Modal.BACKDROP_TRANSITION_DURATION) :
1050        callback()
1051
1052    } else if (!this.isShown && this.$backdrop) {
1053      this.$backdrop.removeClass('in')
1054
1055      var callbackRemove = function () {
1056        that.removeBackdrop()
1057        callback && callback()
1058      }
1059      $.support.transition && this.$element.hasClass('fade') ?
1060        this.$backdrop
1061          .one('bsTransitionEnd', callbackRemove)
1062          .emulateTransitionEnd(Modal.BACKDROP_TRANSITION_DURATION) :
1063        callbackRemove()
1064
1065    } else if (callback) {
1066      callback()
1067    }
1068  }
1069
1070  // these following methods are used to handle overflowing modals
1071
1072  Modal.prototype.handleUpdate = function () {
1073    this.adjustDialog()
1074  }
1075
1076  Modal.prototype.adjustDialog = function () {
1077    var modalIsOverflowing = this.$element[0].scrollHeight > document.documentElement.clientHeight
1078
1079    this.$element.css({
1080      paddingLeft:  !this.bodyIsOverflowing && modalIsOverflowing ? this.scrollbarWidth : '',
1081      paddingRight: this.bodyIsOverflowing && !modalIsOverflowing ? this.scrollbarWidth : ''
1082    })
1083  }
1084
1085  Modal.prototype.resetAdjustments = function () {
1086    this.$element.css({
1087      paddingLeft: '',
1088      paddingRight: ''
1089    })
1090  }
1091
1092  Modal.prototype.checkScrollbar = function () {
1093    var fullWindowWidth = window.innerWidth
1094    if (!fullWindowWidth) { // workaround for missing window.innerWidth in IE8
1095      var documentElementRect = document.documentElement.getBoundingClientRect()
1096      fullWindowWidth = documentElementRect.right - Math.abs(documentElementRect.left)
1097    }
1098    this.bodyIsOverflowing = document.body.clientWidth < fullWindowWidth
1099    this.scrollbarWidth = this.measureScrollbar()
1100  }
1101
1102  Modal.prototype.setScrollbar = function () {
1103    var bodyPad = parseInt((this.$body.css('padding-right') || 0), 10)
1104    this.originalBodyPad = document.body.style.paddingRight || ''
1105    if (this.bodyIsOverflowing) this.$body.css('padding-right', bodyPad + this.scrollbarWidth)
1106  }
1107
1108  Modal.prototype.resetScrollbar = function () {
1109    this.$body.css('padding-right', this.originalBodyPad)
1110  }
1111
1112  Modal.prototype.measureScrollbar = function () { // thx walsh
1113    var scrollDiv = document.createElement('div')
1114    scrollDiv.className = 'modal-scrollbar-measure'
1115    this.$body.append(scrollDiv)
1116    var scrollbarWidth = scrollDiv.offsetWidth - scrollDiv.clientWidth
1117    this.$body[0].removeChild(scrollDiv)
1118    return scrollbarWidth
1119  }
1120
1121
1122  // MODAL PLUGIN DEFINITION
1123  // =======================
1124
1125  function Plugin(option, _relatedTarget) {
1126    return this.each(function () {
1127      var $this   = $(this)
1128      var data    = $this.data('bs.modal')
1129      var options = $.extend({}, Modal.DEFAULTS, $this.data(), typeof option == 'object' && option)
1130
1131      if (!data) $this.data('bs.modal', (data = new Modal(this, options)))
1132      if (typeof option == 'string') data[option](_relatedTarget)
1133      else if (options.show) data.show(_relatedTarget)
1134    })
1135  }
1136
1137  var old = $.fn.modal
1138
1139  $.fn.modal             = Plugin
1140  $.fn.modal.Constructor = Modal
1141
1142
1143  // MODAL NO CONFLICT
1144  // =================
1145
1146  $.fn.modal.noConflict = function () {
1147    $.fn.modal = old
1148    return this
1149  }
1150
1151
1152  // MODAL DATA-API
1153  // ==============
1154
1155  $(document).on('click.bs.modal.data-api', '[data-toggle="modal"]', function (e) {
1156    var $this   = $(this)
1157    var href    = $this.attr('href')
1158    var $target = $($this.attr('data-target') || (href && href.replace(/.*(?=#[^\s]+$)/, ''))) // strip for ie7
1159    var option  = $target.data('bs.modal') ? 'toggle' : $.extend({ remote: !/#/.test(href) && href }, $target.data(), $this.data())
1160
1161    if ($this.is('a')) e.preventDefault()
1162
1163    $target.one('show.bs.modal', function (showEvent) {
1164      if (showEvent.isDefaultPrevented()) return // only register focus restorer if modal will actually get shown
1165      $target.one('hidden.bs.modal', function () {
1166        $this.is(':visible') && $this.trigger('focus')
1167      })
1168    })
1169    Plugin.call($target, option, this)
1170  })
1171
1172}(jQuery);
1173
1174
1175+function ($) {
1176  'use strict';
1177
1178  // TOOLTIP PUBLIC CLASS DEFINITION
1179  // ===============================
1180
1181  var Tooltip = function (element, options) {
1182    this.type       = null
1183    this.options    = null
1184    this.enabled    = null
1185    this.timeout    = null
1186    this.hoverState = null
1187    this.$element   = null
1188    this.inState    = null
1189
1190    this.init('tooltip', element, options)
1191  }
1192
1193  Tooltip.VERSION  = '3.3.6'
1194
1195  Tooltip.TRANSITION_DURATION = 150
1196
1197  Tooltip.DEFAULTS = {
1198    animation: true,
1199    placement: 'top',
1200    selector: false,
1201    template: '<div class="tooltip" role="tooltip"><div class="tooltip-arrow"></div><div class="tooltip-inner"></div></div>',
1202    trigger: 'hover focus',
1203    title: '',
1204    delay: 0,
1205    html: false,
1206    container: false,
1207    viewport: {
1208      selector: 'body',
1209      padding: 0
1210    }
1211  }
1212
1213  Tooltip.prototype.init = function (type, element, options) {
1214    this.enabled   = true
1215    this.type      = type
1216    this.$element  = $(element)
1217    this.options   = this.getOptions(options)
1218    this.$viewport = this.options.viewport && $($.isFunction(this.options.viewport) ? this.options.viewport.call(this, this.$element) : (this.options.viewport.selector || this.options.viewport))
1219    this.inState   = { click: false, hover: false, focus: false }
1220
1221    if (this.$element[0] instanceof document.constructor && !this.options.selector) {
1222      throw new Error('`selector` option must be specified when initializing ' + this.type + ' on the window.document object!')
1223    }
1224
1225    var triggers = this.options.trigger.split(' ')
1226
1227    for (var i = triggers.length; i--;) {
1228      var trigger = triggers[i]
1229
1230      if (trigger == 'click') {
1231        this.$element.on('click.' + this.type, this.options.selector, $.proxy(this.toggle, this))
1232      } else if (trigger != 'manual') {
1233        var eventIn  = trigger == 'hover' ? 'mouseenter' : 'focusin'
1234        var eventOut = trigger == 'hover' ? 'mouseleave' : 'focusout'
1235
1236        this.$element.on(eventIn  + '.' + this.type, this.options.selector, $.proxy(this.enter, this))
1237        this.$element.on(eventOut + '.' + this.type, this.options.selector, $.proxy(this.leave, this))
1238      }
1239    }
1240
1241    this.options.selector ?
1242      (this._options = $.extend({}, this.options, { trigger: 'manual', selector: '' })) :
1243      this.fixTitle()
1244  }
1245
1246  Tooltip.prototype.getDefaults = function () {
1247    return Tooltip.DEFAULTS
1248  }
1249
1250  Tooltip.prototype.getOptions = function (options) {
1251    options = $.extend({}, this.getDefaults(), this.$element.data(), options)
1252
1253    if (options.delay && typeof options.delay == 'number') {
1254      options.delay = {
1255        show: options.delay,
1256        hide: options.delay
1257      }
1258    }
1259
1260    return options
1261  }
1262
1263  Tooltip.prototype.getDelegateOptions = function () {
1264    var options  = {}
1265    var defaults = this.getDefaults()
1266
1267    this._options && $.each(this._options, function (key, value) {
1268      if (defaults[key] != value) options[key] = value
1269    })
1270
1271    return options
1272  }
1273
1274  Tooltip.prototype.enter = function (obj) {
1275    var self = obj instanceof this.constructor ?
1276      obj : $(obj.currentTarget).data('bs.' + this.type)
1277
1278    if (!self) {
1279      self = new this.constructor(obj.currentTarget, this.getDelegateOptions())
1280      $(obj.currentTarget).data('bs.' + this.type, self)
1281    }
1282
1283    if (obj instanceof $.Event) {
1284      self.inState[obj.type == 'focusin' ? 'focus' : 'hover'] = true
1285    }
1286
1287    if (self.tip().hasClass('in') || self.hoverState == 'in') {
1288      self.hoverState = 'in'
1289      return
1290    }
1291
1292    clearTimeout(self.timeout)
1293
1294    self.hoverState = 'in'
1295
1296    if (!self.options.delay || !self.options.delay.show) return self.show()
1297
1298    self.timeout = setTimeout(function () {
1299      if (self.hoverState == 'in') self.show()
1300    }, self.options.delay.show)
1301  }
1302
1303  Tooltip.prototype.isInStateTrue = function () {
1304    for (var key in this.inState) {
1305      if (this.inState[key]) return true
1306    }
1307
1308    return false
1309  }
1310
1311  Tooltip.prototype.leave = function (obj) {
1312    var self = obj instanceof this.constructor ?
1313      obj : $(obj.currentTarget).data('bs.' + this.type)
1314
1315    if (!self) {
1316      self = new this.constructor(obj.currentTarget, this.getDelegateOptions())
1317      $(obj.currentTarget).data('bs.' + this.type, self)
1318    }
1319
1320    if (obj instanceof $.Event) {
1321      self.inState[obj.type == 'focusout' ? 'focus' : 'hover'] = false
1322    }
1323
1324    if (self.isInStateTrue()) return
1325
1326    clearTimeout(self.timeout)
1327
1328    self.hoverState = 'out'
1329
1330    if (!self.options.delay || !self.options.delay.hide) return self.hide()
1331
1332    self.timeout = setTimeout(function () {
1333      if (self.hoverState == 'out') self.hide()
1334    }, self.options.delay.hide)
1335  }
1336
1337  Tooltip.prototype.show = function () {
1338    var e = $.Event('show.bs.' + this.type)
1339
1340    if (this.hasContent() && this.enabled) {
1341      this.$element.trigger(e)
1342
1343      var inDom = $.contains(this.$element[0].ownerDocument.documentElement, this.$element[0])
1344      if (e.isDefaultPrevented() || !inDom) return
1345      var that = this
1346
1347      var $tip = this.tip()
1348
1349      var tipId = this.getUID(this.type)
1350
1351      this.setContent()
1352      $tip.attr('id', tipId)
1353      this.$element.attr('aria-describedby', tipId)
1354
1355      if (this.options.animation) $tip.addClass('fade')
1356
1357      var placement = typeof this.options.placement == 'function' ?
1358        this.options.placement.call(this, $tip[0], this.$element[0]) :
1359        this.options.placement
1360
1361      var autoToken = /\s?auto?\s?/i
1362      var autoPlace = autoToken.test(placement)
1363      if (autoPlace) placement = placement.replace(autoToken, '') || 'top'
1364
1365      $tip
1366        .detach()
1367        .css({ top: 0, left: 0, display: 'block' })
1368        .addClass(placement)
1369        .data('bs.' + this.type, this)
1370
1371      this.options.container ? $tip.appendTo(this.options.container) : $tip.insertAfter(this.$element)
1372      this.$element.trigger('inserted.bs.' + this.type)
1373
1374      var pos          = this.getPosition()
1375      var actualWidth  = $tip[0].offsetWidth
1376      var actualHeight = $tip[0].offsetHeight
1377
1378      if (autoPlace) {
1379        var orgPlacement = placement
1380        var viewportDim = this.getPosition(this.$viewport)
1381
1382        placement = placement == 'bottom' && pos.bottom + actualHeight > viewportDim.bottom ? 'top'    :
1383                    placement == 'top'    && pos.top    - actualHeight < viewportDim.top    ? 'bottom' :
1384                    placement == 'right'  && pos.right  + actualWidth  > viewportDim.width  ? 'left'   :
1385                    placement == 'left'   && pos.left   - actualWidth  < viewportDim.left   ? 'right'  :
1386                    placement
1387
1388        $tip
1389          .removeClass(orgPlacement)
1390          .addClass(placement)
1391      }
1392
1393      var calculatedOffset = this.getCalculatedOffset(placement, pos, actualWidth, actualHeight)
1394
1395      this.applyPlacement(calculatedOffset, placement)
1396
1397      var complete = function () {
1398        var prevHoverState = that.hoverState
1399        that.$element.trigger('shown.bs.' + that.type)
1400        that.hoverState = null
1401
1402        if (prevHoverState == 'out') that.leave(that)
1403      }
1404
1405      $.support.transition && this.$tip.hasClass('fade') ?
1406        $tip
1407          .one('bsTransitionEnd', complete)
1408          .emulateTransitionEnd(Tooltip.TRANSITION_DURATION) :
1409        complete()
1410    }
1411  }
1412
1413  Tooltip.prototype.applyPlacement = function (offset, placement) {
1414    var $tip   = this.tip()
1415    var width  = $tip[0].offsetWidth
1416    var height = $tip[0].offsetHeight
1417
1418    // manually read margins because getBoundingClientRect includes difference
1419    var marginTop = parseInt($tip.css('margin-top'), 10)
1420    var marginLeft = parseInt($tip.css('margin-left'), 10)
1421
1422    // we must check for NaN for ie 8/9
1423    if (isNaN(marginTop))  marginTop  = 0
1424    if (isNaN(marginLeft)) marginLeft = 0
1425
1426    offset.top  += marginTop
1427    offset.left += marginLeft
1428
1429    // $.fn.offset doesn't round pixel values
1430    // so we use setOffset directly with our own function B-0
1431    $.offset.setOffset($tip[0], $.extend({
1432      using: function (props) {
1433        $tip.css({
1434          top: Math.round(props.top),
1435          left: Math.round(props.left)
1436        })
1437      }
1438    }, offset), 0)
1439
1440    $tip.addClass('in')
1441
1442    // check to see if placing tip in new offset caused the tip to resize itself
1443    var actualWidth  = $tip[0].offsetWidth
1444    var actualHeight = $tip[0].offsetHeight
1445
1446    if (placement == 'top' && actualHeight != height) {
1447      offset.top = offset.top + height - actualHeight
1448    }
1449
1450    var delta = this.getViewportAdjustedDelta(placement, offset, actualWidth, actualHeight)
1451
1452    if (delta.left) offset.left += delta.left
1453    else offset.top += delta.top
1454
1455    var isVertical          = /top|bottom/.test(placement)
1456    var arrowDelta          = isVertical ? delta.left * 2 - width + actualWidth : delta.top * 2 - height + actualHeight
1457    var arrowOffsetPosition = isVertical ? 'offsetWidth' : 'offsetHeight'
1458
1459    $tip.offset(offset)
1460    this.replaceArrow(arrowDelta, $tip[0][arrowOffsetPosition], isVertical)
1461  }
1462
1463  Tooltip.prototype.replaceArrow = function (delta, dimension, isVertical) {
1464    this.arrow()
1465      .css(isVertical ? 'left' : 'top', 50 * (1 - delta / dimension) + '%')
1466      .css(isVertical ? 'top' : 'left', '')
1467  }
1468
1469  Tooltip.prototype.setContent = function () {
1470    var $tip  = this.tip()
1471    var title = this.getTitle()
1472
1473    $tip.find('.tooltip-inner')[this.options.html ? 'html' : 'text'](title)
1474    $tip.removeClass('fade in top bottom left right')
1475  }
1476
1477  Tooltip.prototype.hide = function (callback) {
1478    var that = this
1479    var $tip = $(this.$tip)
1480    var e    = $.Event('hide.bs.' + this.type)
1481
1482    function complete() {
1483      if (that.hoverState != 'in') $tip.detach()
1484      that.$element
1485        .removeAttr('aria-describedby')
1486        .trigger('hidden.bs.' + that.type)
1487      callback && callback()
1488    }
1489
1490    this.$element.trigger(e)
1491
1492    if (e.isDefaultPrevented()) return
1493
1494    $tip.removeClass('in')
1495
1496    $.support.transition && $tip.hasClass('fade') ?
1497      $tip
1498        .one('bsTransitionEnd', complete)
1499        .emulateTransitionEnd(Tooltip.TRANSITION_DURATION) :
1500      complete()
1501
1502    this.hoverState = null
1503
1504    return this
1505  }
1506
1507  Tooltip.prototype.fixTitle = function () {
1508    var $e = this.$element
1509    if ($e.attr('title') || typeof $e.attr('data-original-title') != 'string') {
1510      $e.attr('data-original-title', $e.attr('title') || '').attr('title', '')
1511    }
1512  }
1513
1514  Tooltip.prototype.hasContent = function () {
1515    return this.getTitle()
1516  }
1517
1518  Tooltip.prototype.getPosition = function ($element) {
1519    $element   = $element || this.$element
1520
1521    var el     = $element[0]
1522    var isBody = el.tagName == 'BODY'
1523
1524    var elRect    = el.getBoundingClientRect()
1525    if (elRect.width == null) {
1526      // width and height are missing in IE8, so compute them manually; see https://github.com/twbs/bootstrap/issues/14093
1527      elRect = $.extend({}, elRect, { width: elRect.right - elRect.left, height: elRect.bottom - elRect.top })
1528    }
1529    var elOffset  = isBody ? { top: 0, left: 0 } : $element.offset()
1530    var scroll    = { scroll: isBody ? document.documentElement.scrollTop || document.body.scrollTop : $element.scrollTop() }
1531    var outerDims = isBody ? { width: $(window).width(), height: $(window).height() } : null
1532
1533    return $.extend({}, elRect, scroll, outerDims, elOffset)
1534  }
1535
1536  Tooltip.prototype.getCalculatedOffset = function (placement, pos, actualWidth, actualHeight) {
1537    return placement == 'bottom' ? { top: pos.top + pos.height,   left: pos.left + pos.width / 2 - actualWidth / 2 } :
1538           placement == 'top'    ? { top: pos.top - actualHeight, left: pos.left + pos.width / 2 - actualWidth / 2 } :
1539           placement == 'left'   ? { top: pos.top + pos.height / 2 - actualHeight / 2, left: pos.left - actualWidth } :
1540        /* placement == 'right' */ { top: pos.top + pos.height / 2 - actualHeight / 2, left: pos.left + pos.width }
1541
1542  }
1543
1544  Tooltip.prototype.getViewportAdjustedDelta = function (placement, pos, actualWidth, actualHeight) {
1545    var delta = { top: 0, left: 0 }
1546    if (!this.$viewport) return delta
1547
1548    var viewportPadding = this.options.viewport && this.options.viewport.padding || 0
1549    var viewportDimensions = this.getPosition(this.$viewport)
1550
1551    if (/right|left/.test(placement)) {
1552      var topEdgeOffset    = pos.top - viewportPadding - viewportDimensions.scroll
1553      var bottomEdgeOffset = pos.top + viewportPadding - viewportDimensions.scroll + actualHeight
1554      if (topEdgeOffset < viewportDimensions.top) { // top overflow
1555        delta.top = viewportDimensions.top - topEdgeOffset
1556      } else if (bottomEdgeOffset > viewportDimensions.top + viewportDimensions.height) { // bottom overflow
1557        delta.top = viewportDimensions.top + viewportDimensions.height - bottomEdgeOffset
1558      }
1559    } else {
1560      var leftEdgeOffset  = pos.left - viewportPadding
1561      var rightEdgeOffset = pos.left + viewportPadding + actualWidth
1562      if (leftEdgeOffset < viewportDimensions.left) { // left overflow
1563        delta.left = viewportDimensions.left - leftEdgeOffset
1564      } else if (rightEdgeOffset > viewportDimensions.right) { // right overflow
1565        delta.left = viewportDimensions.left + viewportDimensions.width - rightEdgeOffset
1566      }
1567    }
1568
1569    return delta
1570  }
1571
1572  Tooltip.prototype.getTitle = function () {
1573    var title
1574    var $e = this.$element
1575    var o  = this.options
1576
1577    title = $e.attr('data-original-title')
1578      || (typeof o.title == 'function' ? o.title.call($e[0]) :  o.title)
1579
1580    return title
1581  }
1582
1583  Tooltip.prototype.getUID = function (prefix) {
1584    do prefix += ~~(Math.random() * 1000000)
1585    while (document.getElementById(prefix))
1586    return prefix
1587  }
1588
1589  Tooltip.prototype.tip = function () {
1590    if (!this.$tip) {
1591      this.$tip = $(this.options.template)
1592      if (this.$tip.length != 1) {
1593        throw new Error(this.type + ' `template` option must consist of exactly 1 top-level element!')
1594      }
1595    }
1596    return this.$tip
1597  }
1598
1599  Tooltip.prototype.arrow = function () {
1600    return (this.$arrow = this.$arrow || this.tip().find('.tooltip-arrow'))
1601  }
1602
1603  Tooltip.prototype.enable = function () {
1604    this.enabled = true
1605  }
1606
1607  Tooltip.prototype.disable = function () {
1608    this.enabled = false
1609  }
1610
1611  Tooltip.prototype.toggleEnabled = function () {
1612    this.enabled = !this.enabled
1613  }
1614
1615  Tooltip.prototype.toggle = function (e) {
1616    var self = this
1617    if (e) {
1618      self = $(e.currentTarget).data('bs.' + this.type)
1619      if (!self) {
1620        self = new this.constructor(e.currentTarget, this.getDelegateOptions())
1621        $(e.currentTarget).data('bs.' + this.type, self)
1622      }
1623    }
1624
1625    if (e) {
1626      self.inState.click = !self.inState.click
1627      if (self.isInStateTrue()) self.enter(self)
1628      else self.leave(self)
1629    } else {
1630      self.tip().hasClass('in') ? self.leave(self) : self.enter(self)
1631    }
1632  }
1633
1634  Tooltip.prototype.destroy = function () {
1635    var that = this
1636    clearTimeout(this.timeout)
1637    this.hide(function () {
1638      that.$element.off('.' + that.type).removeData('bs.' + that.type)
1639      if (that.$tip) {
1640        that.$tip.detach()
1641      }
1642      that.$tip = null
1643      that.$arrow = null
1644      that.$viewport = null
1645    })
1646  }
1647
1648
1649  // TOOLTIP PLUGIN DEFINITION
1650  // =========================
1651
1652  function Plugin(option) {
1653    return this.each(function () {
1654      var $this   = $(this)
1655      var data    = $this.data('bs.tooltip')
1656      var options = typeof option == 'object' && option
1657
1658      if (!data && /destroy|hide/.test(option)) return
1659      if (!data) $this.data('bs.tooltip', (data = new Tooltip(this, options)))
1660      if (typeof option == 'string') data[option]()
1661    })
1662  }
1663
1664  var old = $.fn.tooltip
1665
1666  $.fn.tooltip             = Plugin
1667  $.fn.tooltip.Constructor = Tooltip
1668
1669
1670  // TOOLTIP NO CONFLICT
1671  // ===================
1672
1673  $.fn.tooltip.noConflict = function () {
1674    $.fn.tooltip = old
1675    return this
1676  }
1677
1678}(jQuery);
1679
1680
1681+function ($) {
1682  'use strict';
1683
1684  // POPOVER PUBLIC CLASS DEFINITION
1685  // ===============================
1686
1687  var Popover = function (element, options) {
1688    this.init('popover', element, options)
1689  }
1690
1691  if (!$.fn.tooltip) throw new Error('Popover requires tooltip.js')
1692
1693  Popover.VERSION  = '3.3.6'
1694
1695  Popover.DEFAULTS = $.extend({}, $.fn.tooltip.Constructor.DEFAULTS, {
1696    placement: 'right',
1697    trigger: 'click',
1698    content: '',
1699    template: '<div class="popover" role="tooltip"><div class="arrow"></div><h3 class="popover-title"></h3><div class="popover-content"></div></div>'
1700  })
1701
1702
1703  // NOTE: POPOVER EXTENDS tooltip.js
1704  // ================================
1705
1706  Popover.prototype = $.extend({}, $.fn.tooltip.Constructor.prototype)
1707
1708  Popover.prototype.constructor = Popover
1709
1710  Popover.prototype.getDefaults = function () {
1711    return Popover.DEFAULTS
1712  }
1713
1714  Popover.prototype.setContent = function () {
1715    var $tip    = this.tip()
1716    var title   = this.getTitle()
1717    var content = this.getContent()
1718
1719    $tip.find('.popover-title')[this.options.html ? 'html' : 'text'](title)
1720    $tip.find('.popover-content').children().detach().end()[ // we use append for html objects to maintain js events
1721      this.options.html ? (typeof content == 'string' ? 'html' : 'append') : 'text'
1722    ](content)
1723
1724    $tip.removeClass('fade top bottom left right in')
1725
1726    // IE8 doesn't accept hiding via the `:empty` pseudo selector, we have to do
1727    // this manually by checking the contents.
1728    if (!$tip.find('.popover-title').html()) $tip.find('.popover-title').hide()
1729  }
1730
1731  Popover.prototype.hasContent = function () {
1732    return this.getTitle() || this.getContent()
1733  }
1734
1735  Popover.prototype.getContent = function () {
1736    var $e = this.$element
1737    var o  = this.options
1738
1739    return $e.attr('data-content')
1740      || (typeof o.content == 'function' ?
1741            o.content.call($e[0]) :
1742            o.content)
1743  }
1744
1745  Popover.prototype.arrow = function () {
1746    return (this.$arrow = this.$arrow || this.tip().find('.arrow'))
1747  }
1748
1749
1750  // POPOVER PLUGIN DEFINITION
1751  // =========================
1752
1753  function Plugin(option) {
1754    return this.each(function () {
1755      var $this   = $(this)
1756      var data    = $this.data('bs.popover')
1757      var options = typeof option == 'object' && option
1758
1759      if (!data && /destroy|hide/.test(option)) return
1760      if (!data) $this.data('bs.popover', (data = new Popover(this, options)))
1761      if (typeof option == 'string') data[option]()
1762    })
1763  }
1764
1765  var old = $.fn.popover
1766
1767  $.fn.popover             = Plugin
1768  $.fn.popover.Constructor = Popover
1769
1770
1771  // POPOVER NO CONFLICT
1772  // ===================
1773
1774  $.fn.popover.noConflict = function () {
1775    $.fn.popover = old
1776    return this
1777  }
1778
1779}(jQuery);
1780
1781
1782+function ($) {
1783  'use strict';
1784
1785  // SCROLLSPY CLASS DEFINITION
1786  // ==========================
1787
1788  function ScrollSpy(element, options) {
1789    this.$body          = $(document.body)
1790    this.$scrollElement = $(element).is(document.body) ? $(window) : $(element)
1791    this.options        = $.extend({}, ScrollSpy.DEFAULTS, options)
1792    this.selector       = (this.options.target || '') + ' .nav li > a'
1793    this.offsets        = []
1794    this.targets        = []
1795    this.activeTarget   = null
1796    this.scrollHeight   = 0
1797
1798    this.$scrollElement.on('scroll.bs.scrollspy', $.proxy(this.process, this))
1799    this.refresh()
1800    this.process()
1801  }
1802
1803  ScrollSpy.VERSION  = '3.3.6'
1804
1805  ScrollSpy.DEFAULTS = {
1806    offset: 10
1807  }
1808
1809  ScrollSpy.prototype.getScrollHeight = function () {
1810    return this.$scrollElement[0].scrollHeight || Math.max(this.$body[0].scrollHeight, document.documentElement.scrollHeight)
1811  }
1812
1813  ScrollSpy.prototype.refresh = function () {
1814    var that          = this
1815    var offsetMethod  = 'offset'
1816    var offsetBase    = 0
1817
1818    this.offsets      = []
1819    this.targets      = []
1820    this.scrollHeight = this.getScrollHeight()
1821
1822    if (!$.isWindow(this.$scrollElement[0])) {
1823      offsetMethod = 'position'
1824      offsetBase   = this.$scrollElement.scrollTop()
1825    }
1826
1827    this.$body
1828      .find(this.selector)
1829      .map(function () {
1830        var $el   = $(this)
1831        var href  = $el.data('target') || $el.attr('href')
1832        var $href = /^#./.test(href) && $(href)
1833
1834        return ($href
1835          && $href.length
1836          && $href.is(':visible')
1837          && [[$href[offsetMethod]().top + offsetBase, href]]) || null
1838      })
1839      .sort(function (a, b) { return a[0] - b[0] })
1840      .each(function () {
1841        that.offsets.push(this[0])
1842        that.targets.push(this[1])
1843      })
1844  }
1845
1846  ScrollSpy.prototype.process = function () {
1847    var scrollTop    = this.$scrollElement.scrollTop() + this.options.offset
1848    var scrollHeight = this.getScrollHeight()
1849    var maxScroll    = this.options.offset + scrollHeight - this.$scrollElement.height()
1850    var offsets      = this.offsets
1851    var targets      = this.targets
1852    var activeTarget = this.activeTarget
1853    var i
1854
1855    if (this.scrollHeight != scrollHeight) {
1856      this.refresh()
1857    }
1858
1859    if (scrollTop >= maxScroll) {
1860      return activeTarget != (i = targets[targets.length - 1]) && this.activate(i)
1861    }
1862
1863    if (activeTarget && scrollTop < offsets[0]) {
1864      this.activeTarget = null
1865      return this.clear()
1866    }
1867
1868    for (i = offsets.length; i--;) {
1869      activeTarget != targets[i]
1870        && scrollTop >= offsets[i]
1871        && (offsets[i + 1] === undefined || scrollTop < offsets[i + 1])
1872        && this.activate(targets[i])
1873    }
1874  }
1875
1876  ScrollSpy.prototype.activate = function (target) {
1877    this.activeTarget = target
1878
1879    this.clear()
1880
1881    var selector = this.selector +
1882      '[data-target="' + target + '"],' +
1883      this.selector + '[href="' + target + '"]'
1884
1885    var active = $(selector)
1886      .parents('li')
1887      .addClass('active')
1888
1889    if (active.parent('.dropdown-menu').length) {
1890      active = active
1891        .closest('li.dropdown')
1892        .addClass('active')
1893    }
1894
1895    active.trigger('activate.bs.scrollspy')
1896  }
1897
1898  ScrollSpy.prototype.clear = function () {
1899    $(this.selector)
1900      .parentsUntil(this.options.target, '.active')
1901      .removeClass('active')
1902  }
1903
1904
1905  // SCROLLSPY PLUGIN DEFINITION
1906  // ===========================
1907
1908  function Plugin(option) {
1909    return this.each(function () {
1910      var $this   = $(this)
1911      var data    = $this.data('bs.scrollspy')
1912      var options = typeof option == 'object' && option
1913
1914      if (!data) $this.data('bs.scrollspy', (data = new ScrollSpy(this, options)))
1915      if (typeof option == 'string') data[option]()
1916    })
1917  }
1918
1919  var old = $.fn.scrollspy
1920
1921  $.fn.scrollspy             = Plugin
1922  $.fn.scrollspy.Constructor = ScrollSpy
1923
1924
1925  // SCROLLSPY NO CONFLICT
1926  // =====================
1927
1928  $.fn.scrollspy.noConflict = function () {
1929    $.fn.scrollspy = old
1930    return this
1931  }
1932
1933
1934  // SCROLLSPY DATA-API
1935  // ==================
1936
1937  $(window).on('load.bs.scrollspy.data-api', function () {
1938    $('[data-spy="scroll"]').each(function () {
1939      var $spy = $(this)
1940      Plugin.call($spy, $spy.data())
1941    })
1942  })
1943
1944}(jQuery);
1945
1946
1947+function ($) {
1948  'use strict';
1949
1950  // TAB CLASS DEFINITION
1951  // ====================
1952
1953  var Tab = function (element) {
1954    // jscs:disable requireDollarBeforejQueryAssignment
1955    this.element = $(element)
1956    // jscs:enable requireDollarBeforejQueryAssignment
1957  }
1958
1959  Tab.VERSION = '3.3.6'
1960
1961  Tab.TRANSITION_DURATION = 150
1962
1963  Tab.prototype.show = function () {
1964    var $this    = this.element
1965    var $ul      = $this.closest('ul:not(.dropdown-menu)')
1966    var selector = $this.data('target')
1967
1968    if (!selector) {
1969      selector = $this.attr('href')
1970      selector = selector && selector.replace(/.*(?=#[^\s]*$)/, '') // strip for ie7
1971    }
1972
1973    if ($this.parent('li').hasClass('active')) return
1974
1975    var $previous = $ul.find('.active:last a')
1976    var hideEvent = $.Event('hide.bs.tab', {
1977      relatedTarget: $this[0]
1978    })
1979    var showEvent = $.Event('show.bs.tab', {
1980      relatedTarget: $previous[0]
1981    })
1982
1983    $previous.trigger(hideEvent)
1984    $this.trigger(showEvent)
1985
1986    if (showEvent.isDefaultPrevented() || hideEvent.isDefaultPrevented()) return
1987
1988    var $target = $(selector)
1989
1990    this.activate($this.closest('li'), $ul)
1991    this.activate($target, $target.parent(), function () {
1992      $previous.trigger({
1993        type: 'hidden.bs.tab',
1994        relatedTarget: $this[0]
1995      })
1996      $this.trigger({
1997        type: 'shown.bs.tab',
1998        relatedTarget: $previous[0]
1999      })
2000    })
2001  }
2002
2003  Tab.prototype.activate = function (element, container, callback) {
2004    var $active    = container.find('> .active')
2005    var transition = callback
2006      && $.support.transition
2007      && ($active.length && $active.hasClass('fade') || !!container.find('> .fade').length)
2008
2009    function next() {
2010      $active
2011        .removeClass('active')
2012        .find('> .dropdown-menu > .active')
2013          .removeClass('active')
2014        .end()
2015        .find('[data-toggle="tab"]')
2016          .attr('aria-expanded', false)
2017
2018      element
2019        .addClass('active')
2020        .find('[data-toggle="tab"]')
2021          .attr('aria-expanded', true)
2022
2023      if (transition) {
2024        element[0].offsetWidth // reflow for transition
2025        element.addClass('in')
2026      } else {
2027        element.removeClass('fade')
2028      }
2029
2030      if (element.parent('.dropdown-menu').length) {
2031        element
2032          .closest('li.dropdown')
2033            .addClass('active')
2034          .end()
2035          .find('[data-toggle="tab"]')
2036            .attr('aria-expanded', true)
2037      }
2038
2039      callback && callback()
2040    }
2041
2042    $active.length && transition ?
2043      $active
2044        .one('bsTransitionEnd', next)
2045        .emulateTransitionEnd(Tab.TRANSITION_DURATION) :
2046      next()
2047
2048    $active.removeClass('in')
2049  }
2050
2051
2052  // TAB PLUGIN DEFINITION
2053  // =====================
2054
2055  function Plugin(option) {
2056    return this.each(function () {
2057      var $this = $(this)
2058      var data  = $this.data('bs.tab')
2059
2060      if (!data) $this.data('bs.tab', (data = new Tab(this)))
2061      if (typeof option == 'string') data[option]()
2062    })
2063  }
2064
2065  var old = $.fn.tab
2066
2067  $.fn.tab             = Plugin
2068  $.fn.tab.Constructor = Tab
2069
2070
2071  // TAB NO CONFLICT
2072  // ===============
2073
2074  $.fn.tab.noConflict = function () {
2075    $.fn.tab = old
2076    return this
2077  }
2078
2079
2080  // TAB DATA-API
2081  // ============
2082
2083  var clickHandler = function (e) {
2084    e.preventDefault()
2085    Plugin.call($(this), 'show')
2086  }
2087
2088  $(document)
2089    .on('click.bs.tab.data-api', '[data-toggle="tab"]', clickHandler)
2090    .on('click.bs.tab.data-api', '[data-toggle="pill"]', clickHandler)
2091
2092}(jQuery);
2093
2094
2095+function ($) {
2096  'use strict';
2097
2098  // AFFIX CLASS DEFINITION
2099  // ======================
2100
2101  var Affix = function (element, options) {
2102    this.options = $.extend({}, Affix.DEFAULTS, options)
2103
2104    this.$target = $(this.options.target)
2105      .on('scroll.bs.affix.data-api', $.proxy(this.checkPosition, this))
2106      .on('click.bs.affix.data-api',  $.proxy(this.checkPositionWithEventLoop, this))
2107
2108    this.$element     = $(element)
2109    this.affixed      = null
2110    this.unpin        = null
2111    this.pinnedOffset = null
2112
2113    this.checkPosition()
2114  }
2115
2116  Affix.VERSION  = '3.3.6'
2117
2118  Affix.RESET    = 'affix affix-top affix-bottom'
2119
2120  Affix.DEFAULTS = {
2121    offset: 0,
2122    target: window
2123  }
2124
2125  Affix.prototype.getState = function (scrollHeight, height, offsetTop, offsetBottom) {
2126    var scrollTop    = this.$target.scrollTop()
2127    var position     = this.$element.offset()
2128    var targetHeight = this.$target.height()
2129
2130    if (offsetTop != null && this.affixed == 'top') return scrollTop < offsetTop ? 'top' : false
2131
2132    if (this.affixed == 'bottom') {
2133      if (offsetTop != null) return (scrollTop + this.unpin <= position.top) ? false : 'bottom'
2134      return (scrollTop + targetHeight <= scrollHeight - offsetBottom) ? false : 'bottom'
2135    }
2136
2137    var initializing   = this.affixed == null
2138    var colliderTop    = initializing ? scrollTop : position.top
2139    var colliderHeight = initializing ? targetHeight : height
2140
2141    if (offsetTop != null && scrollTop <= offsetTop) return 'top'
2142    if (offsetBottom != null && (colliderTop + colliderHeight >= scrollHeight - offsetBottom)) return 'bottom'
2143
2144    return false
2145  }
2146
2147  Affix.prototype.getPinnedOffset = function () {
2148    if (this.pinnedOffset) return this.pinnedOffset
2149    this.$element.removeClass(Affix.RESET).addClass('affix')
2150    var scrollTop = this.$target.scrollTop()
2151    var position  = this.$element.offset()
2152    return (this.pinnedOffset = position.top - scrollTop)
2153  }
2154
2155  Affix.prototype.checkPositionWithEventLoop = function () {
2156    setTimeout($.proxy(this.checkPosition, this), 1)
2157  }
2158
2159  Affix.prototype.checkPosition = function () {
2160    if (!this.$element.is(':visible')) return
2161
2162    var height       = this.$element.height()
2163    var offset       = this.options.offset
2164    var offsetTop    = offset.top
2165    var offsetBottom = offset.bottom
2166    var scrollHeight = Math.max($(document).height(), $(document.body).height())
2167
2168    if (typeof offset != 'object')         offsetBottom = offsetTop = offset
2169    if (typeof offsetTop == 'function')    offsetTop    = offset.top(this.$element)
2170    if (typeof offsetBottom == 'function') offsetBottom = offset.bottom(this.$element)
2171
2172    var affix = this.getState(scrollHeight, height, offsetTop, offsetBottom)
2173
2174    if (this.affixed != affix) {
2175      if (this.unpin != null) this.$element.css('top', '')
2176
2177      var affixType = 'affix' + (affix ? '-' + affix : '')
2178      var e         = $.Event(affixType + '.bs.affix')
2179
2180      this.$element.trigger(e)
2181
2182      if (e.isDefaultPrevented()) return
2183
2184      this.affixed = affix
2185      this.unpin = affix == 'bottom' ? this.getPinnedOffset() : null
2186
2187      this.$element
2188        .removeClass(Affix.RESET)
2189        .addClass(affixType)
2190        .trigger(affixType.replace('affix', 'affixed') + '.bs.affix')
2191    }
2192
2193    if (affix == 'bottom') {
2194      this.$element.offset({
2195        top: scrollHeight - height - offsetBottom
2196      })
2197    }
2198  }
2199
2200
2201  // AFFIX PLUGIN DEFINITION
2202  // =======================
2203
2204  function Plugin(option) {
2205    return this.each(function () {
2206      var $this   = $(this)
2207      var data    = $this.data('bs.affix')
2208      var options = typeof option == 'object' && option
2209
2210      if (!data) $this.data('bs.affix', (data = new Affix(this, options)))
2211      if (typeof option == 'string') data[option]()
2212    })
2213  }
2214
2215  var old = $.fn.affix
2216
2217  $.fn.affix             = Plugin
2218  $.fn.affix.Constructor = Affix
2219
2220
2221  // AFFIX NO CONFLICT
2222  // =================
2223
2224  $.fn.affix.noConflict = function () {
2225    $.fn.affix = old
2226    return this
2227  }
2228
2229
2230  // AFFIX DATA-API
2231  // ==============
2232
2233  $(window).on('load', function () {
2234    $('[data-spy="affix"]').each(function () {
2235      var $spy = $(this)
2236      var data = $spy.data()
2237
2238      data.offset = data.offset || {}
2239
2240      if (data.offsetBottom != null) data.offset.bottom = data.offsetBottom
2241      if (data.offsetTop    != null) data.offset.top    = data.offsetTop
2242
2243      Plugin.call($spy, data)
2244    })
2245  })
2246
2247}(jQuery);

Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.