bootstrap.js 57.2 KB
Newer Older
1
/*!
Mark Otto's avatar
Mark Otto committed
2
 * Bootstrap v3.0.2 by @fat and @mdo
Chris Rebert's avatar
Chris Rebert committed
3
4
5
6
7
 * Copyright 2013 Twitter, Inc.
 * Licensed under http://www.apache.org/licenses/LICENSE-2.0
 *
 * Designed and built with all the love in the world by @mdo and @fat.
 */
8

Mark Otto's avatar
Mark Otto committed
9
if (typeof jQuery === "undefined") { throw new Error("Bootstrap requires jQuery") }
10

11
/* ========================================================================
Mark Otto's avatar
Mark Otto committed
12
 * Bootstrap: transition.js v3.0.2
Mark Otto's avatar
Mark Otto committed
13
 * http://getbootstrap.com/javascript/#transitions
14
 * ========================================================================
15
 * Copyright 2013 Twitter, Inc.
16
17
18
19
20
21
22
23
24
25
26
27
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 * http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
28
 * ======================================================================== */
29
30


31
+function ($) { "use strict";
32

33
34
  // CSS TRANSITION SUPPORT (Shoutout: http://www.modernizr.com/)
  // ============================================================
35

36
37
  function transitionEnd() {
    var el = document.createElement('bootstrap')
38

39
40
41
42
43
    var transEndEventNames = {
      'WebkitTransition' : 'webkitTransitionEnd'
    , 'MozTransition'    : 'transitionend'
    , 'OTransition'      : 'oTransitionEnd otransitionend'
    , 'transition'       : 'transitionend'
fat's avatar
fat committed
44
    }
45

46
47
48
49
50
    for (var name in transEndEventNames) {
      if (el.style[name] !== undefined) {
        return { end: transEndEventNames[name] }
      }
    }
51
52
  }

53
54
  // http://blog.alexmaccaw.com/css-transitions
  $.fn.emulateTransitionEnd = function (duration) {
55
    var called = false, $el = this
liuyl's avatar
liuyl committed
56
57
    $(this).one($.support.transition.end, function () { called = true })
    var callback = function () { if (!called) $($el).trigger($.support.transition.end) }
58
    setTimeout(callback, duration)
59
    return this
60
61
  }

62
63
  $(function () {
    $.support.transition = transitionEnd()
fat's avatar
fat committed
64
  })
65

Chris Rebert's avatar
Chris Rebert committed
66
}(jQuery);
67

68
/* ========================================================================
Mark Otto's avatar
Mark Otto committed
69
 * Bootstrap: alert.js v3.0.2
Mark Otto's avatar
Mark Otto committed
70
 * http://getbootstrap.com/javascript/#alerts
71
 * ========================================================================
fat's avatar
fat committed
72
 * Copyright 2013 Twitter, Inc.
73
74
75
76
77
78
79
80
81
82
83
84
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 * http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
85
 * ======================================================================== */
86
87


88
+function ($) { "use strict";
89

fat's avatar
fat committed
90
91
  // ALERT CLASS DEFINITION
  // ======================
92
93

  var dismiss = '[data-dismiss="alert"]'
fat's avatar
fat committed
94
95
96
  var Alert   = function (el) {
    $(el).on('click', dismiss, this.close)
  }
97
98

  Alert.prototype.close = function (e) {
fat's avatar
fat committed
99
100
    var $this    = $(this)
    var selector = $this.attr('data-target')
101
102
103

    if (!selector) {
      selector = $this.attr('href')
fat's avatar
fat committed
104
      selector = selector && selector.replace(/.*(?=#[^\s]*$)/, '') // strip for ie7
105
106
    }

fat's avatar
fat committed
107
    var $parent = $(selector)
108

fat's avatar
fat committed
109
    if (e) e.preventDefault()
110

fat's avatar
fat committed
111
112
113
    if (!$parent.length) {
      $parent = $this.hasClass('alert') ? $this : $this.parent()
    }
114

Mark Otto's avatar
Mark Otto committed
115
    $parent.trigger(e = $.Event('close.bs.alert'))
116
117
118
119
120
121

    if (e.isDefaultPrevented()) return

    $parent.removeClass('in')

    function removeElement() {
Mark Otto's avatar
Mark Otto committed
122
      $parent.trigger('closed.bs.alert').remove()
123
124
125
    }

    $.support.transition && $parent.hasClass('fade') ?
126
127
128
      $parent
        .one($.support.transition.end, removeElement)
        .emulateTransitionEnd(150) :
129
130
131
132
      removeElement()
  }


fat's avatar
fat committed
133
134
  // ALERT PLUGIN DEFINITION
  // =======================
135

136
137
  var old = $.fn.alert

138
139
140
  $.fn.alert = function (option) {
    return this.each(function () {
      var $this = $(this)
Mark Otto's avatar
Mark Otto committed
141
      var data  = $this.data('bs.alert')
fat's avatar
fat committed
142

Mark Otto's avatar
Mark Otto committed
143
      if (!data) $this.data('bs.alert', (data = new Alert(this)))
144
145
146
147
148
149
150
      if (typeof option == 'string') data[option].call($this)
    })
  }

  $.fn.alert.Constructor = Alert


fat's avatar
fat committed
151
152
  // ALERT NO CONFLICT
  // =================
153
154
155
156
157
158
159

  $.fn.alert.noConflict = function () {
    $.fn.alert = old
    return this
  }


fat's avatar
fat committed
160
  // ALERT DATA-API
fat's avatar
fat committed
161
  // ==============
162

Mark Otto's avatar
Mark Otto committed
163
  $(document).on('click.bs.alert.data-api', dismiss, Alert.prototype.close)
164

Chris Rebert's avatar
Chris Rebert committed
165
}(jQuery);
166

167
/* ========================================================================
Mark Otto's avatar
Mark Otto committed
168
 * Bootstrap: button.js v3.0.2
Mark Otto's avatar
Mark Otto committed
169
 * http://getbootstrap.com/javascript/#buttons
170
 * ========================================================================
fat's avatar
fat committed
171
 * Copyright 2013 Twitter, Inc.
172
173
174
175
176
177
178
179
180
181
182
183
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 * http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
184
 * ======================================================================== */
185
186


187
+function ($) { "use strict";
188

fat's avatar
fat committed
189
190
  // BUTTON PUBLIC CLASS DEFINITION
  // ==============================
191
192
193

  var Button = function (element, options) {
    this.$element = $(element)
fat's avatar
fat committed
194
195
196
197
198
    this.options  = $.extend({}, Button.DEFAULTS, options)
  }

  Button.DEFAULTS = {
    loadingText: 'loading...'
199
200
201
  }

  Button.prototype.setState = function (state) {
fat's avatar
fat committed
202
203
204
205
    var d    = 'disabled'
    var $el  = this.$element
    var val  = $el.is('input') ? 'val' : 'html'
    var data = $el.data()
206
207

    state = state + 'Text'
fat's avatar
fat committed
208
209

    if (!data.resetText) $el.data('resetText', $el[val]())
210
211
212
213
214
215
216

    $el[val](data[state] || this.options[state])

    // push to event loop to allow forms to submit
    setTimeout(function () {
      state == 'loadingText' ?
        $el.addClass(d).attr(d, d) :
fat's avatar
fat committed
217
        $el.removeClass(d).removeAttr(d);
218
219
220
221
    }, 0)
  }

  Button.prototype.toggle = function () {
222
    var $parent = this.$element.closest('[data-toggle="buttons"]')
223
    var changed = true
224

225
    if ($parent.length) {
fat's avatar
fat committed
226
      var $input = this.$element.find('input')
227
228
229
230
231
232
233
234
      if ($input.prop('type') === 'radio') {
        // see if clicking on current one
        if ($input.prop('checked') && this.$element.hasClass('active'))
          changed = false
        else
          $parent.find('.active').removeClass('active')
      }
      if (changed) $input.prop('checked', !this.$element.hasClass('active')).trigger('change')
fat's avatar
fat committed
235
    }
236

237
    if (changed) this.$element.toggleClass('active')
238
239
240
  }


fat's avatar
fat committed
241
242
  // BUTTON PLUGIN DEFINITION
  // ========================
243

244
245
  var old = $.fn.button

246
247
  $.fn.button = function (option) {
    return this.each(function () {
fat's avatar
fat committed
248
      var $this   = $(this)
fat's avatar
fat committed
249
      var data    = $this.data('bs.button')
fat's avatar
fat committed
250
251
      var options = typeof option == 'object' && option

Mark Otto's avatar
Mark Otto committed
252
      if (!data) $this.data('bs.button', (data = new Button(this, options)))
fat's avatar
fat committed
253

254
255
256
257
258
259
260
261
      if (option == 'toggle') data.toggle()
      else if (option) data.setState(option)
    })
  }

  $.fn.button.Constructor = Button


fat's avatar
fat committed
262
263
  // BUTTON NO CONFLICT
  // ==================
264
265
266
267
268
269
270

  $.fn.button.noConflict = function () {
    $.fn.button = old
    return this
  }


fat's avatar
fat committed
271
272
  // BUTTON DATA-API
  // ===============
273

Mark Otto's avatar
Mark Otto committed
274
  $(document).on('click.bs.button.data-api', '[data-toggle^=button]', function (e) {
275
276
277
    var $btn = $(e.target)
    if (!$btn.hasClass('btn')) $btn = $btn.closest('.btn')
    $btn.button('toggle')
278
    e.preventDefault()
279
280
  })

Chris Rebert's avatar
Chris Rebert committed
281
}(jQuery);
282

283
/* ========================================================================
Mark Otto's avatar
Mark Otto committed
284
 * Bootstrap: carousel.js v3.0.2
Mark Otto's avatar
Mark Otto committed
285
 * http://getbootstrap.com/javascript/#carousel
286
 * ========================================================================
287
 * Copyright 2013 Twitter, Inc.
288
289
290
291
292
293
294
295
296
297
298
299
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 * http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
300
 * ======================================================================== */
301
302


303
+function ($) { "use strict";
304

fat's avatar
fat committed
305
306
  // CAROUSEL CLASS DEFINITION
  // =========================
307
308

  var Carousel = function (element, options) {
fat's avatar
fat committed
309
    this.$element    = $(element)
fat's avatar
fat committed
310
    this.$indicators = this.$element.find('.carousel-indicators')
fat's avatar
fat committed
311
312
313
314
315
316
317
    this.options     = options
    this.paused      =
    this.sliding     =
    this.interval    =
    this.$active     =
    this.$items      = null

318
319
320
321
322
    this.options.pause == 'hover' && this.$element
      .on('mouseenter', $.proxy(this.pause, this))
      .on('mouseleave', $.proxy(this.cycle, this))
  }

fat's avatar
fat committed
323
324
325
  Carousel.DEFAULTS = {
    interval: 5000
  , pause: 'hover'
Jacob Thornton's avatar
Jacob Thornton committed
326
  , wrap: true
fat's avatar
fat committed
327
  }
328

fat's avatar
fat committed
329
330
  Carousel.prototype.cycle =  function (e) {
    e || (this.paused = false)
331

fat's avatar
fat committed
332
    this.interval && clearInterval(this.interval)
fat's avatar
fat committed
333

fat's avatar
fat committed
334
335
336
    this.options.interval
      && !this.paused
      && (this.interval = setInterval($.proxy(this.next, this), this.options.interval))
337

fat's avatar
fat committed
338
339
    return this
  }
340

fat's avatar
fat committed
341
342
343
  Carousel.prototype.getActiveIndex = function () {
    this.$active = this.$element.find('.item.active')
    this.$items  = this.$active.parent().children()
344

fat's avatar
fat committed
345
346
    return this.$items.index(this.$active)
  }
347

fat's avatar
fat committed
348
349
350
  Carousel.prototype.to = function (pos) {
    var that        = this
    var activeIndex = this.getActiveIndex()
351

fat's avatar
fat committed
352
    if (pos > (this.$items.length - 1) || pos < 0) return
353

354
    if (this.sliding)       return this.$element.one('slid.bs.carousel', function () { that.to(pos) })
fat's avatar
fat committed
355
356
357
358
    if (activeIndex == pos) return this.pause().cycle()

    return this.slide(pos > activeIndex ? 'next' : 'prev', $(this.$items[pos]))
  }
359

fat's avatar
fat committed
360
361
362
363
364
365
  Carousel.prototype.pause = function (e) {
    e || (this.paused = true)

    if (this.$element.find('.next, .prev').length && $.support.transition.end) {
      this.$element.trigger($.support.transition.end)
      this.cycle(true)
366
367
    }

fat's avatar
fat committed
368
    this.interval = clearInterval(this.interval)
369

fat's avatar
fat committed
370
371
    return this
  }
372

fat's avatar
fat committed
373
374
375
376
  Carousel.prototype.next = function () {
    if (this.sliding) return
    return this.slide('next')
  }
377

fat's avatar
fat committed
378
379
380
381
  Carousel.prototype.prev = function () {
    if (this.sliding) return
    return this.slide('prev')
  }
382

fat's avatar
fat committed
383
384
385
386
387
388
389
  Carousel.prototype.slide = function (type, next) {
    var $active   = this.$element.find('.item.active')
    var $next     = next || $active[type]()
    var isCycling = this.interval
    var direction = type == 'next' ? 'left' : 'right'
    var fallback  = type == 'next' ? 'first' : 'last'
    var that      = this
Jacob Thornton's avatar
Jacob Thornton committed
390

Jacob Thornton's avatar
Jacob Thornton committed
391
392
393
394
395
    if (!$next.length) {
      if (!this.options.wrap) return
      $next = this.$element.find('.item')[fallback]()
    }

fat's avatar
fat committed
396
    this.sliding = true
397

fat's avatar
fat committed
398
    isCycling && this.pause()
fat's avatar
fat committed
399

Mark Otto's avatar
Mark Otto committed
400
    var e = $.Event('slide.bs.carousel', { relatedTarget: $next[0], direction: direction })
401

fat's avatar
fat committed
402
403
404
405
    if ($next.hasClass('active')) return

    if (this.$indicators.length) {
      this.$indicators.find('.active').removeClass('active')
406
      this.$element.one('slid.bs.carousel', function () {
fat's avatar
fat committed
407
408
409
410
411
412
413
414
415
416
417
418
        var $nextIndicator = $(that.$indicators.children()[that.getActiveIndex()])
        $nextIndicator && $nextIndicator.addClass('active')
      })
    }

    if ($.support.transition && this.$element.hasClass('slide')) {
      this.$element.trigger(e)
      if (e.isDefaultPrevented()) return
      $next.addClass(type)
      $next[0].offsetWidth // force reflow
      $active.addClass(direction)
      $next.addClass(direction)
Jacob Thornton's avatar
Jacob Thornton committed
419
      $active
420
421
422
423
        .one($.support.transition.end, function () {
          $next.removeClass([type, direction].join(' ')).addClass('active')
          $active.removeClass(['active', direction].join(' '))
          that.sliding = false
424
          setTimeout(function () { that.$element.trigger('slid.bs.carousel') }, 0)
425
426
        })
        .emulateTransitionEnd(600)
fat's avatar
fat committed
427
428
429
430
431
432
    } else {
      this.$element.trigger(e)
      if (e.isDefaultPrevented()) return
      $active.removeClass('active')
      $next.addClass('active')
      this.sliding = false
433
      this.$element.trigger('slid.bs.carousel')
434
435
    }

fat's avatar
fat committed
436
437
438
    isCycling && this.cycle()

    return this
439
440
441
  }


fat's avatar
fat committed
442
443
  // CAROUSEL PLUGIN DEFINITION
  // ==========================
444

445
446
  var old = $.fn.carousel

447
448
  $.fn.carousel = function (option) {
    return this.each(function () {
fat's avatar
fat committed
449
      var $this   = $(this)
Mark Otto's avatar
Mark Otto committed
450
      var data    = $this.data('bs.carousel')
Jacob Thornton's avatar
Jacob Thornton committed
451
      var options = $.extend({}, Carousel.DEFAULTS, $this.data(), typeof option == 'object' && option)
fat's avatar
fat committed
452
453
      var action  = typeof option == 'string' ? option : options.slide

Mark Otto's avatar
Mark Otto committed
454
      if (!data) $this.data('bs.carousel', (data = new Carousel(this, options)))
455
      if (typeof option == 'number') data.to(option)
Jacob Thornton's avatar
Jacob Thornton committed
456
      else if (action) data[action]()
Mark Otto's avatar
Mark Otto committed
457
      else if (options.interval) data.pause().cycle()
458
459
460
461
462
463
    })
  }

  $.fn.carousel.Constructor = Carousel


fat's avatar
fat committed
464
465
  // CAROUSEL NO CONFLICT
  // ====================
466
467
468
469
470
471

  $.fn.carousel.noConflict = function () {
    $.fn.carousel = old
    return this
  }

fat's avatar
fat committed
472

fat's avatar
fat committed
473
474
  // CAROUSEL DATA-API
  // =================
475

476
  $(document).on('click.bs.carousel.data-api', '[data-slide], [data-slide-to]', function (e) {
fat's avatar
fat committed
477
    var $this   = $(this), href
fat's avatar
fat committed
478
479
    var $target = $($this.attr('data-target') || (href = $this.attr('href')) && href.replace(/.*(?=#[^\s]+$)/, '')) //strip for ie7
    var options = $.extend({}, $target.data(), $this.data())
fat's avatar
fat committed
480
481
    var slideIndex = $this.attr('data-slide-to')
    if (slideIndex) options.interval = false
482

483
    $target.carousel(options)
484
485

    if (slideIndex = $this.attr('data-slide-to')) {
fat's avatar
fat committed
486
      $target.data('bs.carousel').to(slideIndex)
487
488
    }

489
    e.preventDefault()
490
491
  })

fat's avatar
fat committed
492
493
494
495
496
497
498
  $(window).on('load', function () {
    $('[data-ride="carousel"]').each(function () {
      var $carousel = $(this)
      $carousel.carousel($carousel.data())
    })
  })

Chris Rebert's avatar
Chris Rebert committed
499
}(jQuery);
500

501
/* ========================================================================
Mark Otto's avatar
Mark Otto committed
502
 * Bootstrap: collapse.js v3.0.2
Mark Otto's avatar
Mark Otto committed
503
 * http://getbootstrap.com/javascript/#collapse
504
 * ========================================================================
505
 * Copyright 2013 Twitter, Inc.
506
507
508
509
510
511
512
513
514
515
516
517
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 * http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
518
 * ======================================================================== */
519
520


521
+function ($) { "use strict";
522

523
524
  // COLLAPSE PUBLIC CLASS DEFINITION
  // ================================
525
526

  var Collapse = function (element, options) {
527
528
529
    this.$element      = $(element)
    this.options       = $.extend({}, Collapse.DEFAULTS, options)
    this.transitioning = null
530

531
532
533
534
535
536
537
    if (this.options.parent) this.$parent = $(this.options.parent)
    if (this.options.toggle) this.toggle()
  }

  Collapse.DEFAULTS = {
    toggle: true
  }
538

539
540
541
  Collapse.prototype.dimension = function () {
    var hasWidth = this.$element.hasClass('width')
    return hasWidth ? 'width' : 'height'
542
543
  }

544
545
  Collapse.prototype.show = function () {
    if (this.transitioning || this.$element.hasClass('in')) return
546

fat's avatar
fat committed
547
548
549
550
    var startEvent = $.Event('show.bs.collapse')
    this.$element.trigger(startEvent)
    if (startEvent.isDefaultPrevented()) return

Mark Otto's avatar
Mark Otto committed
551
    var actives = this.$parent && this.$parent.find('> .panel > .in')
552

553
    if (actives && actives.length) {
fat's avatar
fat committed
554
      var hasData = actives.data('bs.collapse')
555
556
      if (hasData && hasData.transitioning) return
      actives.collapse('hide')
fat's avatar
fat committed
557
      hasData || actives.data('bs.collapse', null)
558
559
    }

560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
    var dimension = this.dimension()

    this.$element
      .removeClass('collapse')
      .addClass('collapsing')
      [dimension](0)

    this.transitioning = 1

    var complete = function () {
      this.$element
        .removeClass('collapsing')
        .addClass('in')
        [dimension]('auto')
      this.transitioning = 0
      this.$element.trigger('shown.bs.collapse')
    }

    if (!$.support.transition) return complete.call(this)

    var scrollSize = $.camelCase(['scroll', dimension].join('-'))
581

582
583
584
585
    this.$element
      .one($.support.transition.end, $.proxy(complete, this))
      .emulateTransitionEnd(350)
      [dimension](this.$element[0][scrollSize])
586
  }
587

588
589
  Collapse.prototype.hide = function () {
    if (this.transitioning || !this.$element.hasClass('in')) return
fat's avatar
fat committed
590
591
592
593
594

    var startEvent = $.Event('hide.bs.collapse')
    this.$element.trigger(startEvent)
    if (startEvent.isDefaultPrevented()) return

595
    var dimension = this.dimension()
596

597
598
599
    this.$element
      [dimension](this.$element[dimension]())
      [0].offsetHeight
600

601
    this.$element
602
      .addClass('collapsing')
603
      .removeClass('collapse')
604
      .removeClass('in')
605

606
    this.transitioning = 1
607

608
    var complete = function () {
609
610
611
612
613
      this.transitioning = 0
      this.$element
        .trigger('hidden.bs.collapse')
        .removeClass('collapsing')
        .addClass('collapse')
614
615
    }

616
    if (!$.support.transition) return complete.call(this)
617

618
619
620
621
    this.$element
      [dimension](0)
      .one($.support.transition.end, $.proxy(complete, this))
      .emulateTransitionEnd(350)
622
  }
623

624
625
  Collapse.prototype.toggle = function () {
    this[this.$element.hasClass('in') ? 'hide' : 'show']()
626
627
628
  }


629
630
  // COLLAPSE PLUGIN DEFINITION
  // ==========================
631
632

  var old = $.fn.collapse
633
634
635

  $.fn.collapse = function (option) {
    return this.each(function () {
636
      var $this   = $(this)
fat's avatar
fat committed
637
      var data    = $this.data('bs.collapse')
638
639
      var options = $.extend({}, Collapse.DEFAULTS, $this.data(), typeof option == 'object' && option)

fat's avatar
fat committed
640
      if (!data) $this.data('bs.collapse', (data = new Collapse(this, options)))
641
642
643
644
645
646
647
      if (typeof option == 'string') data[option]()
    })
  }

  $.fn.collapse.Constructor = Collapse


648
649
  // COLLAPSE NO CONFLICT
  // ====================
650

651
652
653
654
655
656
  $.fn.collapse.noConflict = function () {
    $.fn.collapse = old
    return this
  }


657
658
  // COLLAPSE DATA-API
  // =================
659

660
  $(document).on('click.bs.collapse.data-api', '[data-toggle=collapse]', function (e) {
661
662
    var $this   = $(this), href
    var target  = $this.attr('data-target')
663
664
        || e.preventDefault()
        || (href = $this.attr('href')) && href.replace(/.*(?=#[^\s]+$)/, '') //strip for ie7
665
666
667
668
    var $target = $(target)
    var data    = $target.data('bs.collapse')
    var option  = data ? 'toggle' : $this.data()
    var parent  = $this.attr('data-parent')
Mark Otto's avatar
Mark Otto committed
669
    var $parent = parent && $(parent)
670

fat's avatar
fat committed
671
    if (!data || !data.transitioning) {
672
      if ($parent) $parent.find('[data-toggle=collapse][data-parent="' + parent + '"]').not($this).addClass('collapsed')
673
      $this[$target.hasClass('in') ? 'addClass' : 'removeClass']('collapsed')
fat's avatar
fat committed
674
675
    }

676
    $target.collapse(option)
677
678
  })

Chris Rebert's avatar
Chris Rebert committed
679
}(jQuery);
680

681
/* ========================================================================
Mark Otto's avatar
Mark Otto committed
682
 * Bootstrap: dropdown.js v3.0.2
Mark Otto's avatar
Mark Otto committed
683
 * http://getbootstrap.com/javascript/#dropdowns
684
 * ========================================================================
685
 * Copyright 2013 Twitter, Inc.
686
687
688
689
690
691
692
693
694
695
696
697
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 * http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
698
 * ======================================================================== */
699
700


701
+function ($) { "use strict";
702

703
704
  // DROPDOWN CLASS DEFINITION
  // =========================
705

706
707
708
  var backdrop = '.dropdown-backdrop'
  var toggle   = '[data-toggle=dropdown]'
  var Dropdown = function (element) {
709
    var $el = $(element).on('click.bs.dropdown', this.toggle)
710
  }
711

712
713
  Dropdown.prototype.toggle = function (e) {
    var $this = $(this)
714

715
    if ($this.is('.disabled, :disabled')) return
716

717
718
    var $parent  = getParent($this)
    var isActive = $parent.hasClass('open')
719

720
    clearMenus()
fat's avatar
fat committed
721

722
    if (!isActive) {
fat's avatar
fat committed
723
      if ('ontouchstart' in document.documentElement && !$parent.closest('.navbar-nav').length) {
fat's avatar
fat committed
724
        // if mobile we we use a backdrop because click events don't delegate
Jacob Thornton's avatar
Jacob Thornton committed
725
        $('<div class="dropdown-backdrop"/>').insertAfter($(this)).on('click', clearMenus)
fat's avatar
fat committed
726
      }
727
728
729
730
731
732
733
734

      $parent.trigger(e = $.Event('show.bs.dropdown'))

      if (e.isDefaultPrevented()) return

      $parent
        .toggleClass('open')
        .trigger('shown.bs.dropdown')
735

fat's avatar
rebuild    
fat committed
736
737
      $this.focus()
    }
738

739
740
    return false
  }
741

742
743
  Dropdown.prototype.keydown = function (e) {
    if (!/(38|40|27)/.test(e.keyCode)) return
744

745
    var $this = $(this)
746

747
748
    e.preventDefault()
    e.stopPropagation()
749

750
    if ($this.is('.disabled, :disabled')) return
751

752
753
    var $parent  = getParent($this)
    var isActive = $parent.hasClass('open')
754

755
756
757
758
    if (!isActive || (isActive && e.keyCode == 27)) {
      if (e.which == 27) $parent.find(toggle).focus()
      return $this.click()
    }
759

760
    var $items = $('[role=menu] li:not(.divider):visible a', $parent)
761

762
    if (!$items.length) return
763

764
    var index = $items.index($items.filter(':focus'))
765

766
767
768
    if (e.keyCode == 38 && index > 0)                 index--                        // up
    if (e.keyCode == 40 && index < $items.length - 1) index++                        // down
    if (!~index)                                      index=0
769

770
    $items.eq(index).focus()
771
772
  }

Mark Otto's avatar
Mark Otto committed
773
  function clearMenus() {
774
    $(backdrop).remove()
775
    $(toggle).each(function (e) {
776
777
778
779
780
781
      var $parent = getParent($(this))
      if (!$parent.hasClass('open')) return
      $parent.trigger(e = $.Event('hide.bs.dropdown'))
      if (e.isDefaultPrevented()) return
      $parent.removeClass('open').trigger('hidden.bs.dropdown')
    })
782
783
784
785
786
787
788
  }

  function getParent($this) {
    var selector = $this.attr('data-target')

    if (!selector) {
      selector = $this.attr('href')
789
      selector = selector && /#/.test(selector) && selector.replace(/.*(?=#[^\s]*$)/, '') //strip for ie7
790
791
    }

792
    var $parent = selector && $(selector)
793

794
    return $parent && $parent.length ? $parent : $this.parent()
795
796
797
  }


798
799
  // DROPDOWN PLUGIN DEFINITION
  // ==========================
800

801
802
  var old = $.fn.dropdown

803
804
805
  $.fn.dropdown = function (option) {
    return this.each(function () {
      var $this = $(this)
806
807
      var data  = $this.data('dropdown')

808
809
810
811
812
813
814
815
      if (!data) $this.data('dropdown', (data = new Dropdown(this)))
      if (typeof option == 'string') data[option].call($this)
    })
  }

  $.fn.dropdown.Constructor = Dropdown


816
817
  // DROPDOWN NO CONFLICT
  // ====================
818
819
820
821
822
823
824

  $.fn.dropdown.noConflict = function () {
    $.fn.dropdown = old
    return this
  }


825
826
827
  // APPLY TO STANDARD DROPDOWN ELEMENTS
  // ===================================

828
  $(document)
829
830
831
832
    .on('click.bs.dropdown.data-api', clearMenus)
    .on('click.bs.dropdown.data-api', '.dropdown form', function (e) { e.stopPropagation() })
    .on('click.bs.dropdown.data-api'  , toggle, Dropdown.prototype.toggle)
    .on('keydown.bs.dropdown.data-api', toggle + ', [role=menu]' , Dropdown.prototype.keydown)
833

Chris Rebert's avatar
Chris Rebert committed
834
}(jQuery);
835

836
/* ========================================================================
Mark Otto's avatar
Mark Otto committed
837
 * Bootstrap: modal.js v3.0.2
Mark Otto's avatar
Mark Otto committed
838
 * http://getbootstrap.com/javascript/#modals
839
 * ========================================================================
840
 * Copyright 2013 Twitter, Inc.
841
842
843
844
845
846
847
848
849
850
851
852
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 * http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
853
 * ======================================================================== */
854
855


856
+function ($) { "use strict";
857

fat's avatar
fat committed
858
859
  // MODAL CLASS DEFINITION
  // ======================
860

Jacob Thornton's avatar
Jacob Thornton committed
861
  var Modal = function (element, options) {
fat's avatar
fat committed
862
    this.options   = options
fat's avatar
rebuild    
fat committed
863
    this.$element  = $(element)
fat's avatar
fat committed
864
865
    this.$backdrop =
    this.isShown   = null
866

Jacob Thornton's avatar
Jacob Thornton committed
867
    if (this.options.remote) this.$element.load(this.options.remote)
fat's avatar
fat committed
868
  }
869

fat's avatar
fat committed
870
871
872
873
874
  Modal.DEFAULTS = {
      backdrop: true
    , keyboard: true
    , show: true
  }
875

Jacob Thornton's avatar
Jacob Thornton committed
876
877
  Modal.prototype.toggle = function (_relatedTarget) {
    return this[!this.isShown ? 'show' : 'hide'](_relatedTarget)
fat's avatar
fat committed
878
  }
879

Jacob Thornton's avatar
Jacob Thornton committed
880
  Modal.prototype.show = function (_relatedTarget) {
fat's avatar
fat committed
881
    var that = this
Jacob Thornton's avatar
Jacob Thornton committed
882
    var e    = $.Event('show.bs.modal', { relatedTarget: _relatedTarget })
883

fat's avatar
fat committed
884
    this.$element.trigger(e)
885

fat's avatar
fat committed
886
    if (this.isShown || e.isDefaultPrevented()) return
887

fat's avatar
fat committed
888
    this.isShown = true
889

fat's avatar
fat committed
890
    this.escape()
891

fat's avatar
rebuild    
fat committed
892
893
    this.$element.on('click.dismiss.modal', '[data-dismiss="modal"]', $.proxy(this.hide, this))

fat's avatar
fat committed
894
895
    this.backdrop(function () {
      var transition = $.support.transition && that.$element.hasClass('fade')
896

fat's avatar
fat committed
897
      if (!that.$element.parent().length) {
Jacob Thornton's avatar
Jacob Thornton committed
898
        that.$element.appendTo(document.body) // don't move modals dom position
fat's avatar
fat committed
899
      }
900

fat's avatar
fat committed
901
      that.$element.show()
902

fat's avatar
fat committed
903
904
905
      if (transition) {
        that.$element[0].offsetWidth // force reflow
      }
906

fat's avatar
fat committed
907
908
909
      that.$element
        .addClass('in')
        .attr('aria-hidden', false)
910

fat's avatar
fat committed
911
      that.enforceFocus()
912

Jacob Thornton's avatar
Jacob Thornton committed
913
914
      var e = $.Event('shown.bs.modal', { relatedTarget: _relatedTarget })

fat's avatar
fat committed
915
      transition ?
fat's avatar
fat committed
916
        that.$element.find('.modal-dialog') // wait for modal to slide in
917
          .one($.support.transition.end, function () {
Jacob Thornton's avatar
Jacob Thornton committed
918
            that.$element.focus().trigger(e)
919
920
          })
          .emulateTransitionEnd(300) :
Jacob Thornton's avatar
Jacob Thornton committed
921
        that.$element.focus().trigger(e)
fat's avatar
fat committed
922
923
    })
  }
924

fat's avatar
fat committed
925
  Modal.prototype.hide = function (e) {
fat's avatar
fat committed
926
    if (e) e.preventDefault()
927

Mark Otto's avatar
Mark Otto committed
928
    e = $.Event('hide.bs.modal')
929

fat's avatar
fat committed
930
    this.$element.trigger(e)
931

fat's avatar
fat committed
932
    if (!this.isShown || e.isDefaultPrevented()) return
933

fat's avatar
fat committed
934
    this.isShown = false
935

fat's avatar
fat committed
936
    this.escape()
937

Mark Otto's avatar
Mark Otto committed
938
    $(document).off('focusin.bs.modal')
939

fat's avatar
fat committed
940
941
942
    this.$element
      .removeClass('in')
      .attr('aria-hidden', true)
Jacob Thornton's avatar
Jacob Thornton committed
943
      .off('click.dismiss.modal')
944

fat's avatar
fat committed
945
    $.support.transition && this.$element.hasClass('fade') ?
946
947
948
      this.$element
        .one($.support.transition.end, $.proxy(this.hideModal, this))
        .emulateTransitionEnd(300) :
fat's avatar
fat committed
949
950
      this.hideModal()
  }
951

fat's avatar
fat committed
952
  Modal.prototype.enforceFocus = function () {
Jacob Thornton's avatar
Jacob Thornton committed
953
954
    $(document)
      .off('focusin.bs.modal') // guard against infinite focus loop
fat's avatar
fat committed
955
956
957
958
959
      .on('focusin.bs.modal', $.proxy(function (e) {
        if (this.$element[0] !== e.target && !this.$element.has(e.target).length) {
          this.$element.focus()
        }
      }, this))
fat's avatar
fat committed
960
  }
961

fat's avatar
fat committed
962
963
  Modal.prototype.escape = function () {
    if (this.isShown && this.options.keyboard) {
fat's avatar
fat committed
964
      this.$element.on('keyup.dismiss.bs.modal', $.proxy(function (e) {
fat's avatar
fat committed
965
        e.which == 27 && this.hide()
fat's avatar
fat committed
966
      }, this))
fat's avatar
fat committed
967
    } else if (!this.isShown) {
Mark Otto's avatar
Mark Otto committed
968
      this.$element.off('keyup.dismiss.bs.modal')
fat's avatar
fat committed
969
970
    }
  }
971

fat's avatar
fat committed
972
973
974
975
976
  Modal.prototype.hideModal = function () {
    var that = this
    this.$element.hide()
    this.backdrop(function () {
      that.removeBackdrop()
Mark Otto's avatar
Mark Otto committed
977
      that.$element.trigger('hidden.bs.modal')
fat's avatar
fat committed
978
979
    })
  }
980

fat's avatar
fat committed
981
982
983
984
  Modal.prototype.removeBackdrop = function () {
    this.$backdrop && this.$backdrop.remove()
    this.$backdrop = null
  }
985

fat's avatar
fat committed
986
987
988
  Modal.prototype.backdrop = function (callback) {
    var that    = this
    var animate = this.$element.hasClass('fade') ? 'fade' : ''
989

fat's avatar
fat committed
990
991
    if (this.isShown && this.options.backdrop) {
      var doAnimate = $.support.transition && animate
992

fat's avatar
fat committed
993
994
      this.$backdrop = $('<div class="modal-backdrop ' + animate + '" />')
        .appendTo(document.body)
995

Jacob Thornton's avatar
Jacob Thornton committed
996
      this.$element.on('click.dismiss.modal', $.proxy(function (e) {
fat's avatar
fat committed
997
998
999
1000
1001
        if (e.target !== e.currentTarget) return
        this.options.backdrop == 'static'
          ? this.$element[0].focus.call(this.$element[0])
          : this.hide.call(this)
      }, this))
1002

fat's avatar
fat committed
1003
      if (doAnimate) this.$backdrop[0].offsetWidth // force reflow
1004

fat's avatar
fat committed
1005
      this.$backdrop.addClass('in')
1006

fat's avatar
fat committed
1007
      if (!callback) return
1008

fat's avatar
fat committed
1009
      doAnimate ?
1010
1011
1012
        this.$backdrop
          .one($.support.transition.end, callback)
          .emulateTransitionEnd(150) :
fat's avatar
fat committed
1013
        callback()
1014

fat's avatar
fat committed
1015
1016
    } else if (!this.isShown && this.$backdrop) {
      this.$backdrop.removeClass('in')
1017

fat's avatar
fat committed
1018
      $.support.transition && this.$element.hasClass('fade')?
1019
1020
1021
        this.$backdrop
          .one($.support.transition.end, callback)
          .emulateTransitionEnd(150) :
fat's avatar
fat committed
1022
        callback()
1023

fat's avatar
fat committed
1024
1025
1026
    } else if (callback) {
      callback()
    }
1027
1028
1029
  }


fat's avatar
fat committed
1030
1031
  // MODAL PLUGIN DEFINITION
  // =======================
1032

1033
1034
  var old = $.fn.modal

Jacob Thornton's avatar
Jacob Thornton committed
1035
  $.fn.modal = function (option, _relatedTarget) {
1036
    return this.each(function () {
fat's avatar
fat committed
1037
      var $this   = $(this)
Mark Otto's avatar
Mark Otto committed
1038
      var data    = $this.data('bs.modal')
fat's avatar
fat committed
1039
1040
      var options = $.extend({}, Modal.DEFAULTS, $this.data(), typeof option == 'object' && option)

Mark Otto's avatar
Mark Otto committed
1041
      if (!data) $this.data('bs.modal', (data = new Modal(this, options)))
Jacob Thornton's avatar
Jacob Thornton committed
1042
1043
      if (typeof option == 'string') data[option](_relatedTarget)
      else if (options.show) data.show(_relatedTarget)
1044
1045
1046
1047
1048
1049
    })
  }

  $.fn.modal.Constructor = Modal


fat's avatar
fat committed
1050
1051
  // MODAL NO CONFLICT
  // =================
1052
1053
1054
1055
1056
1057
1058

  $.fn.modal.noConflict = function () {
    $.fn.modal = old
    return this
  }


fat's avatar
fat committed
1059
1060
  // MODAL DATA-API
  // ==============
1061

Mark Otto's avatar
Mark Otto committed
1062
  $(document).on('click.bs.modal.data-api', '[data-toggle="modal"]', function (e) {
fat's avatar
fat committed
1063
1064
1065
    var $this   = $(this)
    var href    = $this.attr('href')
    var $target = $($this.attr('data-target') || (href && href.replace(/.*(?=#[^\s]+$)/, ''))) //strip for ie7
Jacob Thornton's avatar
Jacob Thornton committed
1066
    var option  = $target.data('modal') ? 'toggle' : $.extend({ remote: !/#/.test(href) && href }, $target.data(), $this.data())
1067

1068
    e.preventDefault()
1069

1070
    $target
Jacob Thornton's avatar
Jacob Thornton committed
1071
      .modal(option, this)
1072
      .one('hide', function () {
1073
        $this.is(':visible') && $this.focus()
1074
      })
Jacob Thornton's avatar
Jacob Thornton committed
1075
  })
1076

Jacob Thornton's avatar
Jacob Thornton committed
1077
  $(document)
fat's avatar
fat committed
1078
    .on('show.bs.modal',  '.modal', function () { $(document.body).addClass('modal-open') })
Jacob Thornton's avatar
Jacob Thornton committed
1079
    .on('hidden.bs.modal', '.modal', function () { $(document.body).removeClass('modal-open') })
1080

Chris Rebert's avatar
Chris Rebert committed
1081
}(jQuery);
1082

1083
/* ========================================================================
Mark Otto's avatar
Mark Otto committed
1084
 * Bootstrap: tooltip.js v3.0.2
Mark Otto's avatar
Mark Otto committed
1085
 * http://getbootstrap.com/javascript/#tooltip
1086
 * Inspired by the original jQuery.tipsy by Jason Frame
1087
 * ========================================================================
1088
 * Copyright 2013 Twitter, Inc.
1089
1090
1091
1092
1093
1094
1095
1096
1097
1098
1099
1100
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 * http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
1101
 * ======================================================================== */
1102
1103


1104
+function ($) { "use strict";
1105

1106
  // TOOLTIP PUBLIC CLASS DEFINITION
fat's avatar
fat committed
1107
  // ===============================
1108

1109
1110
1111
1112
1113
1114
1115
  var Tooltip = function (element, options) {
    this.type       =
    this.options    =
    this.enabled    =
    this.timeout    =
    this.hoverState =
    this.$element   = null
1116

1117
1118
    this.init('tooltip', element, options)
  }
1119

1120
1121
1122
1123
1124
1125
1126
1127
1128
1129
1130
  Tooltip.DEFAULTS = {
    animation: true
  , placement: 'top'
  , selector: false
  , template: '<div class="tooltip"><div class="tooltip-arrow"></div><div class="tooltip-inner"></div></div>'
  , trigger: 'hover focus'
  , title: ''
  , delay: 0
  , html: false
  , container: false
  }
1131

1132
1133
1134
1135
1136
  Tooltip.prototype.init = function (type, element, options) {
    this.enabled  = true
    this.type     = type
    this.$element = $(element)
    this.options  = this.getOptions(options)
1137

1138
    var triggers = this.options.trigger.split(' ')
1139

1140
1141
    for (var i = triggers.length; i--;) {
      var trigger = triggers[i]
fat's avatar
fat committed
1142

1143
1144
1145
1146
1147
      if (trigger == 'click') {
        this.$element.on('click.' + this.type, this.options.selector, $.proxy(this.toggle, this))
      } else if (trigger != 'manual') {
        var eventIn  = trigger == 'hover' ? 'mouseenter' : 'focus'
        var eventOut = trigger == 'hover' ? 'mouseleave' : 'blur'
1148

Jacob Thornton's avatar
Jacob Thornton committed
1149
        this.$element.on(eventIn  + '.' + this.type, this.options.selector, $.proxy(this.enter, this))
1150
1151
1152
        this.$element.on(eventOut + '.' + this.type, this.options.selector, $.proxy(this.leave, this))
      }
    }
1153

1154
1155
1156
    this.options.selector ?
      (this._options = $.extend({}, this.options, { trigger: 'manual', selector: '' })) :
      this.fixTitle()
fat's avatar
fat committed
1157
  }
1158

1159
1160
  Tooltip.prototype.getDefaults = function () {
    return Tooltip.DEFAULTS
1161
  }
1162

1163
1164
  Tooltip.prototype.getOptions = function (options) {
    options = $.extend({}, this.getDefaults(), this.$element.data(), options)
1165

1166
1167
1168
1169
1170
1171
    if (options.delay && typeof options.delay == 'number') {
      options.delay = {
        show: options.delay
      , hide: options.delay
      }
    }
1172

1173
    return options
1174
  }
Jacob Thornton's avatar
Jacob Thornton committed
1175

Jacob Thornton's avatar
Jacob Thornton committed
1176
  Tooltip.prototype.getDelegateOptions = function () {
1177
    var options  = {}
Jacob Thornton's avatar
Jacob Thornton committed
1178
    var defaults = this.getDefaults()
1179

1180
1181
1182
    this._options && $.each(this._options, function (key, value) {
      if (defaults[key] != value) options[key] = value
    })
fat's avatar
rebuild    
fat committed
1183

Jacob Thornton's avatar
Jacob Thornton committed
1184
1185
1186
1187
    return options
  }

  Tooltip.prototype.enter = function (obj) {
1188
    var self = obj instanceof this.constructor ?
Jacob Thornton's avatar
Jacob Thornton committed
1189
      obj : $(obj.currentTarget)[this.type](this.getDelegateOptions()).data('bs.' + this.type)
1190

1191
    clearTimeout(self.timeout)
1192

1193
1194
    self.hoverState = 'in'

1195
    if (!self.options.delay || !self.options.delay.show) return self.show()
1196

1197
    self.timeout = setTimeout(function () {
1198
1199
      if (self.hoverState == 'in') self.show()
    }, self.options.delay.show)
1200
  }
1201

1202
1203
  Tooltip.prototype.leave = function (obj) {
    var self = obj instanceof this.constructor ?
Jacob Thornton's avatar
Jacob Thornton committed
1204
      obj : $(obj.currentTarget)[this.type](this.getDelegateOptions()).data('bs.' + this.type)
1205

1206
    clearTimeout(self.timeout)
fat's avatar
fat committed
1207

1208
1209
    self.hoverState = 'out'

1210
    if (!self.options.delay || !self.options.delay.hide) return self.hide()
1211

1212
    self.timeout = setTimeout(function () {
1213
1214
      if (self.hoverState == 'out') self.hide()
    }, self.options.delay.hide)
1215
  }
1216

1217
1218
  Tooltip.prototype.show = function () {
    var e = $.Event('show.bs.'+ this.type)
1219

1220
1221
    if (this.hasContent() && this.enabled) {
      this.$element.trigger(e)
1222

1223
      if (e.isDefaultPrevented()) return
1224

1225
      var $tip = this.tip()
fat's avatar
fat committed
1226

1227
      this.setContent()
fat's avatar
fat committed
1228

1229
      if (this.options.animation) $tip.addClass('fade')
fat's avatar
fat committed
1230

1231
1232
1233
      var placement = typeof this.options.placement == 'function' ?
        this.options.placement.call(this, $tip[0], this.$element[0]) :
        this.options.placement
1234

1235
1236
1237
      var autoToken = /\s?auto?\s?/i
      var autoPlace = autoToken.test(placement)
      if (autoPlace) placement = placement.replace(autoToken, '') || 'top'
1238

1239
1240
1241
1242
      $tip
        .detach()
        .css({ top: 0, left: 0, display: 'block' })
        .addClass(placement)
1243

1244
      this.options.container ? $tip.appendTo(this.options.container) : $tip.insertAfter(this.$element)
1245

1246
1247
1248
      var pos          = this.getPosition()
      var actualWidth  = $tip[0].offsetWidth
      var actualHeight = $tip[0].offsetHeight
fat's avatar
fat committed
1249

1250
1251
      if (autoPlace) {
        var $parent = this.$element.parent()
1252

1253
1254
1255
1256
1257
        var orgPlacement = placement
        var docScroll    = document.documentElement.scrollTop || document.body.scrollTop
        var parentWidth  = this.options.container == 'body' ? window.innerWidth  : $parent.outerWidth()
        var parentHeight = this.options.container == 'body' ? window.innerHeight : $parent.outerHeight()
        var parentLeft   = this.options.container == 'body' ? 0 : $parent.offset().left
fat's avatar
fat committed
1258

1259
1260
1261
1262
1263
        placement = placement == 'bottom' && pos.top   + pos.height  + actualHeight - docScroll > parentHeight  ? 'top'    :
                    placement == 'top'    && pos.top   - docScroll   - actualHeight < 0                         ? 'bottom' :
                    placement == 'right'  && pos.right + actualWidth > parentWidth                              ? 'left'   :
                    placement == 'left'   && pos.left  - actualWidth < parentLeft                               ? 'right'  :
                    placement
fat's avatar
fat committed
1264

1265
1266
1267
1268
1269
        $tip
          .removeClass(orgPlacement)
          .addClass(placement)
      }

1270
      var calculatedOffset = this.getCalculatedOffset(placement, pos, actualWidth, actualHeight)
1271

fat's avatar
fat committed
1272
      this.applyPlacement(calculatedOffset, placement)
1273
      this.$element.trigger('shown.bs.' + this.type)
fat's avatar
fat committed
1274
    }
1275
  }
fat's avatar
fat committed
1276

1277
1278
1279
1280
1281
  Tooltip.prototype.applyPlacement = function(offset, placement) {
    var replace
    var $tip   = this.tip()
    var width  = $tip[0].offsetWidth
    var height = $tip[0].offsetHeight
fat's avatar
fat committed
1282

1283
    // manually read margins because getBoundingClientRect includes difference
fat's avatar
fat committed
1284
1285
1286
1287
1288
1289
1290
1291
1292
    var marginTop = parseInt($tip.css('margin-top'), 10)
    var marginLeft = parseInt($tip.css('margin-left'), 10)

    // we must check for NaN for ie 8/9
    if (isNaN(marginTop))  marginTop  = 0
    if (isNaN(marginLeft)) marginLeft = 0

    offset.top  = offset.top  + marginTop
    offset.left = offset.left + marginLeft
fat's avatar
fat committed
1293

1294
1295
1296
    $tip
      .offset(offset)
      .addClass('in')
fat's avatar
fat committed
1297

fat's avatar
fat committed
1298
    // check to see if placing tip in new offset caused the tip to resize itself
1299
1300
    var actualWidth  = $tip[0].offsetWidth
    var actualHeight = $tip[0].offsetHeight
fat's avatar
fat committed
1301

1302
1303
    if (placement == 'top' && actualHeight != height) {
      replace = true
fat's avatar
fat committed
1304
      offset.top = offset.top + height - actualHeight
fat's avatar
fat committed
1305
1306
    }

fat's avatar
fat committed
1307
    if (/bottom|top/.test(placement)) {
1308
      var delta = 0
1309

fat's avatar
fat committed
1310
      if (offset.left < 0) {
1311
1312
        delta       = offset.left * -2
        offset.left = 0
fat's avatar
fat committed
1313

1314
        $tip.offset(offset)
1315

1316
1317
1318
        actualWidth  = $tip[0].offsetWidth
        actualHeight = $tip[0].offsetHeight
      }
1319

1320
1321
1322
1323
      this.replaceArrow(delta - width + actualWidth, actualWidth, 'left')
    } else {
      this.replaceArrow(actualHeight - height, actualHeight, 'top')
    }
1324

1325
    if (replace) $tip.offset(offset)
1326
  }
1327

1328
1329
  Tooltip.prototype.replaceArrow = function(delta, dimension, position) {
    this.arrow().css(position, delta ? (50 * (1 - delta / dimension) + "%") : '')
fat's avatar
fat committed
1330
  }
1331

1332
1333
1334
  Tooltip.prototype.setContent = function () {
    var $tip  = this.tip()
    var title = this.getTitle()
1335

1336
1337
1338
    $tip.find('.tooltip-inner')[this.options.html ? 'html' : 'text'](title)
    $tip.removeClass('fade in top bottom left right')
  }
1339

1340
1341
1342
1343
  Tooltip.prototype.hide = function () {
    var that = this
    var $tip = this.tip()
    var e    = $.Event('hide.bs.' + this.type)
1344

1345
1346
1347
    function complete() {
      if (that.hoverState != 'in') $tip.detach()
    }
Jacob Thornton's avatar
Jacob Thornton committed
1348

1349
    this.$element.trigger(e)
1350

1351
    if (e.isDefaultPrevented()) return
1352

1353
    $tip.removeClass('in')
1354

1355
1356
    $.support.transition && this.$tip.hasClass('fade') ?
      $tip
Jacob Thornton's avatar
Jacob Thornton committed
1357
        .one($.support.transition.end, complete)
1358
        .emulateTransitionEnd(150) :
Jacob Thornton's avatar
Jacob Thornton committed
1359
      complete()
1360

1361
    this.$element.trigger('hidden.bs.' + this.type)
1362

1363
    return this
1364
1365
  }

1366
1367
1368
1369
  Tooltip.prototype.fixTitle = function () {
    var $e = this.$element
    if ($e.attr('title') || typeof($e.attr('data-original-title')) != 'string') {
      $e.attr('data-original-title', $e.attr('title') || '').attr('title', '')
1370
    }
1371
  }
1372

1373
1374
1375
  Tooltip.prototype.hasContent = function () {
    return this.getTitle()
  }
1376

1377
1378
1379
1380
1381
1382
1383
  Tooltip.prototype.getPosition = function () {
    var el = this.$element[0]
    return $.extend({}, (typeof el.getBoundingClientRect == 'function') ? el.getBoundingClientRect() : {
      width: el.offsetWidth
    , height: el.offsetHeight
    }, this.$element.offset())
  }
1384

1385
  Tooltip.prototype.getCalculatedOffset = function (placement, pos, actualWidth, actualHeight) {
fat's avatar
fat committed
1386
1387
1388
1389
1390
1391
    return placement == 'bottom' ? { top: pos.top + pos.height,   left: pos.left + pos.width / 2 - actualWidth / 2  } :
           placement == 'top'    ? { top: pos.top - actualHeight, left: pos.left + pos.width / 2 - actualWidth / 2  } :
           placement == 'left'   ? { top: pos.top + pos.height / 2 - actualHeight / 2, left: pos.left - actualWidth } :
        /* placement == 'right' */ { top: pos.top + pos.height / 2 - actualHeight / 2, left: pos.left + pos.width   }
  }

1392
1393
1394
1395
  Tooltip.prototype.getTitle = function () {
    var title
    var $e = this.$element
    var o  = this.options
1396

1397
1398
    title = $e.attr('data-original-title')
      || (typeof o.title == 'function' ? o.title.call($e[0]) :  o.title)
1399

1400
    return title
1401
  }
1402

1403
1404
1405
  Tooltip.prototype.tip = function () {
    return this.$tip = this.$tip || $(this.options.template)
  }
1406

Mark Otto's avatar
Mark Otto committed
1407
  Tooltip.prototype.arrow = function () {
fat's avatar
fat committed
1408
    return this.$arrow = this.$arrow || this.tip().find('.tooltip-arrow')
1409
  }
1410

1411
1412
1413
1414
1415
1416
1417
  Tooltip.prototype.validate = function () {
    if (!this.$element[0].parentNode) {
      this.hide()
      this.$element = null
      this.options  = null
    }
  }
1418

1419
1420
1421
  Tooltip.prototype.enable = function () {
    this.enabled = true
  }
1422

1423
1424
1425
  Tooltip.prototype.disable = function () {
    this.enabled = false
  }
1426

1427
1428
1429
  Tooltip.prototype.toggleEnabled = function () {
    this.enabled = !this.enabled
  }
Mark Otto's avatar
Mark Otto committed
1430

1431
  Tooltip.prototype.toggle = function (e) {
Jacob Thornton's avatar
Jacob Thornton committed
1432
    var self = e ? $(e.currentTarget)[this.type](this.getDelegateOptions()).data('bs.' + this.type) : this
1433
1434
    self.tip().hasClass('in') ? self.leave(self) : self.enter(self)
  }
1435

1436
1437
  Tooltip.prototype.destroy = function () {
    this.hide().$element.off('.' + this.type).removeData('bs.' + this.type)
fat's avatar
fat committed
1438
  }
1439
1440


1441
1442
  // TOOLTIP PLUGIN DEFINITION
  // =========================
1443

1444
  var old = $.fn.tooltip
1445

1446
  $.fn.tooltip = function (option) {
1447
    return this.each(function () {
1448
1449
1450
      var $this   = $(this)
      var data    = $this.data('bs.tooltip')
      var options = typeof option == 'object' && option
fat's avatar
fat committed
1451

1452
      if (!data) $this.data('bs.tooltip', (data = new Tooltip(this, options)))
1453
1454
1455
1456
      if (typeof option == 'string') data[option]()
    })
  }

1457
  $.fn.tooltip.Constructor = Tooltip
1458

1459

1460
1461
  // TOOLTIP NO CONFLICT
  // ===================
1462

1463
1464
  $.fn.tooltip.noConflict = function () {
    $.fn.tooltip = old
1465
1466
1467
    return this
  }

Chris Rebert's avatar
Chris Rebert committed
1468
}(jQuery);
1469

1470
/* ========================================================================
Mark Otto's avatar
Mark Otto committed
1471
 * Bootstrap: popover.js v3.0.2
Mark Otto's avatar
Mark Otto committed
1472
 * http://getbootstrap.com/javascript/#popovers
1473
 * ========================================================================
1474
 * Copyright 2013 Twitter, Inc.
1475
1476
1477
1478
1479
1480
1481
1482
1483
1484
1485
1486
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 * http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
1487
 * ======================================================================== */
1488
1489


1490
+function ($) { "use strict";
1491

1492
  // POPOVER PUBLIC CLASS DEFINITION
1493
  // ===============================
fat's avatar
fat committed
1494

1495
1496
  var Popover = function (element, options) {
    this.init('popover', element, options)
1497
1498
  }

fat's avatar
fat committed
1499
1500
  if (!$.fn.tooltip) throw new Error('Popover requires tooltip.js')

1501
1502
1503
1504
1505
1506
  Popover.DEFAULTS = $.extend({} , $.fn.tooltip.Constructor.DEFAULTS, {
    placement: 'right'
  , trigger: 'click'
  , content: ''
  , template: '<div class="popover"><div class="arrow"></div><h3 class="popover-title"></h3><div class="popover-content"></div></div>'
  })
1507

fat's avatar
fat committed
1508

1509
1510
  // NOTE: POPOVER EXTENDS tooltip.js
  // ================================
fat's avatar
fat committed
1511

1512
  Popover.prototype = $.extend({}, $.fn.tooltip.Constructor.prototype)
1513

1514
  Popover.prototype.constructor = Popover
fat's avatar
fat committed
1515

1516
1517
1518
  Popover.prototype.getDefaults = function () {
    return Popover.DEFAULTS
  }
1519

1520
1521
1522
1523
1524
1525
1526
1527
1528
1529
  Popover.prototype.setContent = function () {
    var $tip    = this.tip()
    var title   = this.getTitle()
    var content = this.getContent()

    $tip.find('.popover-title')[this.options.html ? 'html' : 'text'](title)
    $tip.find('.popover-content')[this.options.html ? 'html' : 'text'](content)

    $tip.removeClass('fade top bottom left right in')

1530
1531
    // IE8 doesn't accept hiding via the `:empty` pseudo selector, we have to do
    // this manually by checking the contents.
Jacob Thornton's avatar
Jacob Thornton committed
1532
    if (!$tip.find('.popover-title').html()) $tip.find('.popover-title').hide()
1533
1534
  }

1535
1536
  Popover.prototype.hasContent = function () {
    return this.getTitle() || this.getContent()
1537
1538
  }

1539
1540
1541
  Popover.prototype.getContent = function () {
    var $e = this.$element
    var o  = this.options
1542

1543
1544
1545
1546
1547
    return $e.attr('data-content')
      || (typeof o.content == 'function' ?
            o.content.call($e[0]) :
            o.content)
  }
1548

Mark Otto's avatar
Mark Otto committed
1549
  Popover.prototype.arrow = function () {
fat's avatar
fat committed
1550
1551
1552
    return this.$arrow = this.$arrow || this.tip().find('.arrow')
  }

1553
1554
1555
  Popover.prototype.tip = function () {
    if (!this.$tip) this.$tip = $(this.options.template)
    return this.$tip
fat's avatar
fat committed
1556
  }
1557

1558

1559
1560
  // POPOVER PLUGIN DEFINITION
  // =========================
1561

1562
  var old = $.fn.popover
1563

1564
1565
1566
1567
1568
  $.fn.popover = function (option) {
    return this.each(function () {
      var $this   = $(this)
      var data    = $this.data('bs.popover')
      var options = typeof option == 'object' && option
1569

1570
1571
1572
      if (!data) $this.data('bs.popover', (data = new Popover(this, options)))
      if (typeof option == 'string') data[option]()
    })
1573
1574
  }

1575
  $.fn.popover.Constructor = Popover
fat's avatar
fat committed
1576

1577

1578
1579
  // POPOVER NO CONFLICT
  // ===================
1580

1581
1582
1583
1584
  $.fn.popover.noConflict = function () {
    $.fn.popover = old
    return this
  }
1585

Chris Rebert's avatar
Chris Rebert committed
1586
}(jQuery);
1587

1588
/* ========================================================================
Mark Otto's avatar
Mark Otto committed
1589
 * Bootstrap: scrollspy.js v3.0.2
Mark Otto's avatar
Mark Otto committed
1590
 * http://getbootstrap.com/javascript/#scrollspy
1591
 * ========================================================================
1592
 * Copyright 2013 Twitter, Inc.
1593
1594
1595
1596
1597
1598
1599
1600
1601
1602
1603
1604
1605
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 * http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 * ======================================================================== */
1606
1607


1608
+function ($) { "use strict";
1609

1610
1611
  // SCROLLSPY CLASS DEFINITION
  // ==========================
1612

1613
1614
1615
  function ScrollSpy(element, options) {
    var href
    var process  = $.proxy(this.process, this)
1616

fat's avatar
fat committed
1617
    this.$element       = $(element).is('body') ? $(window) : $(element)
1618
    this.$body          = $('body')
fat's avatar
fat committed
1619
    this.$scrollElement = this.$element.on('scroll.bs.scroll-spy.data-api', process)
1620
1621
1622
1623
1624
1625
1626
    this.options        = $.extend({}, ScrollSpy.DEFAULTS, options)
    this.selector       = (this.options.target
      || ((href = $(element).attr('href')) && href.replace(/.*(?=#[^\s]+$)/, '')) //strip for ie7
      || '') + ' .nav li > a'
    this.offsets        = $([])
    this.targets        = $([])
    this.activeTarget   = null
1627

1628
1629
1630
    this.refresh()
    this.process()
  }
1631

1632
1633
1634
  ScrollSpy.DEFAULTS = {
    offset: 10
  }
1635

1636
  ScrollSpy.prototype.refresh = function () {
fat's avatar
fat committed
1637
1638
    var offsetMethod = this.$element[0] == window ? 'offset' : 'position'

1639
1640
    this.offsets = $([])
    this.targets = $([])
1641

1642
1643
1644
1645
1646
1647
1648
    var self     = this
    var $targets = this.$body
      .find(this.selector)
      .map(function () {
        var $el   = $(this)
        var href  = $el.data('target') || $el.attr('href')
        var $href = /^#\w/.test(href) && $(href)
1649

1650
1651
        return ($href
          && $href.length
fat's avatar
fat committed
1652
          && [[ $href[offsetMethod]().top + (!$.isWindow(self.$scrollElement.get(0)) && self.$scrollElement.scrollTop()), href ]]) || null
1653
1654
1655
1656
1657
1658
1659
      })
      .sort(function (a, b) { return a[0] - b[0] })
      .each(function () {
        self.offsets.push(this[0])
        self.targets.push(this[1])
      })
  }
1660

1661
1662
1663
1664
1665
1666
1667
1668
  ScrollSpy.prototype.process = function () {
    var scrollTop    = this.$scrollElement.scrollTop() + this.options.offset
    var scrollHeight = this.$scrollElement[0].scrollHeight || this.$body[0].scrollHeight
    var maxScroll    = scrollHeight - this.$scrollElement.height()
    var offsets      = this.offsets
    var targets      = this.targets
    var activeTarget = this.activeTarget
    var i
1669

1670
1671
1672
    if (scrollTop >= maxScroll) {
      return activeTarget != (i = targets.last()[0]) && this.activate(i)
    }
1673

1674
1675
1676
1677
1678
    for (i = offsets.length; i--;) {
      activeTarget != targets[i]
        && scrollTop >= offsets[i]
        && (!offsets[i + 1] || scrollTop <= offsets[i + 1])
        && this.activate( targets[i] )
1679
    }
1680
1681
  }

1682
1683
  ScrollSpy.prototype.activate = function (target) {
    this.activeTarget = target
1684

1685
1686
1687
    $(this.selector)
      .parents('.active')
      .removeClass('active')
1688

1689
1690
1691
    var selector = this.selector
      + '[data-target="' + target + '"],'
      + this.selector + '[href="' + target + '"]'
1692

1693
1694
1695
    var active = $(selector)
      .parents('li')
      .addClass('active')
1696

1697
1698
1699
1700
    if (active.parent('.dropdown-menu').length)  {
      active = active
        .closest('li.dropdown')
        .addClass('active')
1701
    }
1702

1703
    active.trigger('activate.bs.scrollspy')
1704
  }
1705
1706


1707
1708
  // SCROLLSPY PLUGIN DEFINITION
  // ===========================
1709

1710
  var old = $.fn.scrollspy
1711

1712
1713
1714
1715
1716
  $.fn.scrollspy = function (option) {
    return this.each(function () {
      var $this   = $(this)
      var data    = $this.data('bs.scrollspy')
      var options = typeof option == 'object' && option
1717

1718
1719
1720
      if (!data) $this.data('bs.scrollspy', (data = new ScrollSpy(this, options)))
      if (typeof option == 'string') data[option]()
    })
1721
1722
  }

1723
  $.fn.scrollspy.Constructor = ScrollSpy
1724
1725


1726
1727
1728
1729
1730
1731
  // SCROLLSPY NO CONFLICT
  // =====================

  $.fn.scrollspy.noConflict = function () {
    $.fn.scrollspy = old
    return this
1732
1733
1734
  }


1735
1736
  // SCROLLSPY DATA-API
  // ==================
1737

1738
1739
1740
1741
1742
1743
  $(window).on('load', function () {
    $('[data-spy="scroll"]').each(function () {
      var $spy = $(this)
      $spy.scrollspy($spy.data())
    })
  })
1744

Chris Rebert's avatar
Chris Rebert committed
1745
}(jQuery);
1746

1747
/* ========================================================================
Mark Otto's avatar
Mark Otto committed
1748
 * Bootstrap: tab.js v3.0.2
Mark Otto's avatar
Mark Otto committed
1749
 * http://getbootstrap.com/javascript/#tabs
1750
 * ========================================================================
1751
 * Copyright 2013 Twitter, Inc.
1752
1753
1754
1755
1756
1757
1758
1759
1760
1761
1762
1763
1764
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 * http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 * ======================================================================== */
1765

1766

1767
1768
1769
1770
1771
1772
1773
+function ($) { "use strict";

  // TAB CLASS DEFINITION
  // ====================

  var Tab = function (element) {
    this.element = $(element)
1774
  }
1775

1776
1777
1778
  Tab.prototype.show = function () {
    var $this    = this.element
    var $ul      = $this.closest('ul:not(.dropdown-menu)')
Chris Rebert's avatar
Chris Rebert committed
1779
    var selector = $this.data('target')
1780
1781
1782
1783

    if (!selector) {
      selector = $this.attr('href')
      selector = selector && selector.replace(/.*(?=#[^\s]*$)/, '') //strip for ie7
1784
    }
1785

1786
    if ($this.parent('li').hasClass('active')) return
1787

1788
1789
1790
1791
    var previous = $ul.find('.active:last a')[0]
    var e        = $.Event('show.bs.tab', {
      relatedTarget: previous
    })
1792

1793
    $this.trigger(e)
1794

1795
    if (e.isDefaultPrevented()) return
1796

1797
    var $target = $(selector)
1798

1799
1800
1801
1802
1803
1804
1805
    this.activate($this.parent('li'), $ul)
    this.activate($target, $target.parent(), function () {
      $this.trigger({
        type: 'shown.bs.tab'
      , relatedTarget: previous
      })
    })
1806
  }
1807

1808
1809
1810
1811
1812
  Tab.prototype.activate = function (element, container, callback) {
    var $active    = container.find('> .active')
    var transition = callback
      && $.support.transition
      && $active.hasClass('fade')
1813

1814
1815
1816
1817
1818
    function next() {
      $active
        .removeClass('active')
        .find('> .dropdown-menu > .active')
        .removeClass('active')
1819

1820
      element.addClass('active')
1821

1822
1823
1824
1825
1826
1827
      if (transition) {
        element[0].offsetWidth // reflow for transition
        element.addClass('in')
      } else {
        element.removeClass('fade')
      }
1828

1829
1830
1831
      if (element.parent('.dropdown-menu')) {
        element.closest('li.dropdown').addClass('active')
      }
fat's avatar
fat committed
1832

1833
1834
      callback && callback()
    }
fat's avatar
fat committed
1835

1836
1837
1838
1839
1840
1841
1842
    transition ?
      $active
        .one($.support.transition.end, next)
        .emulateTransitionEnd(150) :
      next()

    $active.removeClass('in')
1843
1844
1845
  }


1846
1847
  // TAB PLUGIN DEFINITION
  // =====================
1848

1849
  var old = $.fn.tab
1850

1851
  $.fn.tab = function ( option ) {
1852
    return this.each(function () {
1853
1854
      var $this = $(this)
      var data  = $this.data('bs.tab')
fat's avatar
fat committed
1855

1856
      if (!data) $this.data('bs.tab', (data = new Tab(this)))
1857
1858
1859
1860
      if (typeof option == 'string') data[option]()
    })
  }

1861
  $.fn.tab.Constructor = Tab
1862
1863


1864
1865
  // TAB NO CONFLICT
  // ===============
1866

1867
1868
  $.fn.tab.noConflict = function () {
    $.fn.tab = old
1869
1870
1871
    return this
  }

1872
1873
1874
1875
1876
1877
1878
1879
1880

  // TAB DATA-API
  // ============

  $(document).on('click.bs.tab.data-api', '[data-toggle="tab"], [data-toggle="pill"]', function (e) {
    e.preventDefault()
    $(this).tab('show')
  })

Chris Rebert's avatar
Chris Rebert committed
1881
}(jQuery);
1882

1883
/* ========================================================================
Mark Otto's avatar
Mark Otto committed
1884
 * Bootstrap: affix.js v3.0.2
Mark Otto's avatar
Mark Otto committed
1885
 * http://getbootstrap.com/javascript/#affix
1886
 * ========================================================================
1887
 * Copyright 2013 Twitter, Inc.
Mark Otto's avatar
Mark Otto committed
1888
1889
1890
1891
1892
1893
1894
1895
1896
1897
1898
1899
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 * http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
1900
 * ======================================================================== */
Mark Otto's avatar
Mark Otto committed
1901
1902


1903
+function ($) { "use strict";
Mark Otto's avatar
Mark Otto committed
1904

1905
1906
  // AFFIX CLASS DEFINITION
  // ======================
Mark Otto's avatar
Mark Otto committed
1907

1908
1909
1910
1911
1912
  var Affix = function (element, options) {
    this.options = $.extend({}, Affix.DEFAULTS, options)
    this.$window = $(window)
      .on('scroll.bs.affix.data-api', $.proxy(this.checkPosition, this))
      .on('click.bs.affix.data-api',  $.proxy(this.checkPositionWithEventLoop, this))
fat's avatar
fat committed
1913

1914
1915
1916
    this.$element = $(element)
    this.affixed  =
    this.unpin    = null
fat's avatar
fat committed
1917

1918
1919
1920
1921
1922
1923
1924
1925
1926
1927
1928
1929
1930
1931
1932
1933
1934
1935
1936
1937
1938
1939
1940
1941
1942
1943
1944
1945
1946
1947
1948
1949
1950
1951
1952
1953
1954
1955
1956
1957
1958
    this.checkPosition()
  }

  Affix.RESET = 'affix affix-top affix-bottom'

  Affix.DEFAULTS = {
    offset: 0
  }

  Affix.prototype.checkPositionWithEventLoop = function () {
    setTimeout($.proxy(this.checkPosition, this), 1)
  }

  Affix.prototype.checkPosition = function () {
    if (!this.$element.is(':visible')) return

    var scrollHeight = $(document).height()
    var scrollTop    = this.$window.scrollTop()
    var position     = this.$element.offset()
    var offset       = this.options.offset
    var offsetTop    = offset.top
    var offsetBottom = offset.bottom

    if (typeof offset != 'object')         offsetBottom = offsetTop = offset
    if (typeof offsetTop == 'function')    offsetTop    = offset.top()
    if (typeof offsetBottom == 'function') offsetBottom = offset.bottom()

    var affix = this.unpin   != null && (scrollTop + this.unpin <= position.top) ? false :
                offsetBottom != null && (position.top + this.$element.height() >= scrollHeight - offsetBottom) ? 'bottom' :
                offsetTop    != null && (scrollTop <= offsetTop) ? 'top' : false

    if (this.affixed === affix) return
    if (this.unpin) this.$element.css('top', '')

    this.affixed = affix
    this.unpin   = affix == 'bottom' ? position.top - scrollTop : null

    this.$element.removeClass(Affix.RESET).addClass('affix' + (affix ? '-' + affix : ''))

    if (affix == 'bottom') {
      this.$element.offset({ top: document.body.offsetHeight - offsetBottom - this.$element.height() })
1959
    }
Mark Otto's avatar
Mark Otto committed
1960
1961
  }

1962
1963
1964
1965
1966
1967
1968
1969
1970
1971
1972
1973
1974
1975
1976

  // AFFIX PLUGIN DEFINITION
  // =======================

  var old = $.fn.affix

  $.fn.affix = function (option) {
    return this.each(function () {
      var $this   = $(this)
      var data    = $this.data('bs.affix')
      var options = typeof option == 'object' && option

      if (!data) $this.data('bs.affix', (data = new Affix(this, options)))
      if (typeof option == 'string') data[option]()
    })
1977
1978
  }

1979
1980
1981
1982
1983
1984
1985
1986
1987
1988
1989
1990
1991
1992
1993
1994
1995
1996
1997
1998
1999
2000
2001
2002
2003
2004
2005
  $.fn.affix.Constructor = Affix


  // AFFIX NO CONFLICT
  // =================

  $.fn.affix.noConflict = function () {
    $.fn.affix = old
    return this
  }


  // AFFIX DATA-API
  // ==============

  $(window).on('load', function () {
    $('[data-spy="affix"]').each(function () {
      var $spy = $(this)
      var data = $spy.data()

      data.offset = data.offset || {}

      if (data.offsetBottom) data.offset.bottom = data.offsetBottom
      if (data.offsetTop)    data.offset.top    = data.offsetTop

      $spy.affix(data)
    })
Mark Otto's avatar
Mark Otto committed
2006
2007
  })

Chris Rebert's avatar
Chris Rebert committed
2008
}(jQuery);