bootstrap.js 64.2 KB
Newer Older
1
/*!
Mark Otto's avatar
Mark Otto committed
2
 * Bootstrap v3.1.1 (http://getbootstrap.com)
3
 * Copyright 2011-2014 Twitter, Inc.
Mark Otto's avatar
Mark Otto committed
4
 * Licensed under MIT (https://github.com/twbs/bootstrap/blob/master/LICENSE)
Chris Rebert's avatar
Chris Rebert committed
5
 */
6

7
if (typeof jQuery === 'undefined') { throw new Error('Bootstrap\'s JavaScript requires jQuery') }
8

9
/* ========================================================================
Mark Otto's avatar
Mark Otto committed
10
 * Bootstrap: transition.js v3.1.1
Mark Otto's avatar
Mark Otto committed
11
 * http://getbootstrap.com/javascript/#transitions
12
 * ========================================================================
13
 * Copyright 2011-2014 Twitter, Inc.
14
 * Licensed under MIT (https://github.com/twbs/bootstrap/blob/master/LICENSE)
15
 * ======================================================================== */
16
17


Chris Rebert's avatar
Chris Rebert committed
18
+function () { 'use strict';
Mark Otto's avatar
grunt    
Mark Otto committed
19

Chris Rebert's avatar
Chris Rebert committed
20
21
22
23
  (function (o_o) {
    typeof define  == 'function' && define.amd ? define(['jquery'], o_o) :
    typeof exports == 'object' ? o_o(require('jquery')) : o_o(jQuery)
  })(function ($) {
24

Chris Rebert's avatar
Chris Rebert committed
25
26
    // CSS TRANSITION SUPPORT (Shoutout: http://www.modernizr.com/)
    // ============================================================
27

Chris Rebert's avatar
Chris Rebert committed
28
29
    function transitionEnd() {
      var el = document.createElement('bootstrap')
30

Chris Rebert's avatar
Chris Rebert committed
31
32
33
34
35
36
      var transEndEventNames = {
        WebkitTransition : 'webkitTransitionEnd',
        MozTransition    : 'transitionend',
        OTransition      : 'oTransitionEnd otransitionend',
        transition       : 'transitionend'
      }
37

Chris Rebert's avatar
Chris Rebert committed
38
39
40
41
      for (var name in transEndEventNames) {
        if (el.style[name] !== undefined) {
          return { end: transEndEventNames[name] }
        }
42
      }
Chris Rebert's avatar
Chris Rebert committed
43
44
45
46
47
48
49
50
51
52
53
54

      return false // explicit for ie8 (  ._.)
    }

    // http://blog.alexmaccaw.com/css-transitions
    $.fn.emulateTransitionEnd = function (duration) {
      var called = false
      var $el = this
      $(this).one('bsTransitionEnd', function () { called = true })
      var callback = function () { if (!called) $($el).trigger($.support.transition.end) }
      setTimeout(callback, duration)
      return this
55
    }
56

Chris Rebert's avatar
Chris Rebert committed
57
58
    $(function () {
      $.support.transition = transitionEnd()
59

Chris Rebert's avatar
Chris Rebert committed
60
61
62
63
64
65
66
67
68
69
      if (!$.support.transition) return

      $.event.special.bsTransitionEnd = {
        bindType: $.support.transition.end,
        delegateType: $.support.transition.end,
        handle: function (e) {
          if ($(e.target).is(this)) return e.handleObj.handler.apply(this, arguments)
        }
      }
    })
70

fat's avatar
fat committed
71
  })
72

Chris Rebert's avatar
Chris Rebert committed
73
}();
74

75
/* ========================================================================
Mark Otto's avatar
Mark Otto committed
76
 * Bootstrap: alert.js v3.1.1
Mark Otto's avatar
Mark Otto committed
77
 * http://getbootstrap.com/javascript/#alerts
78
 * ========================================================================
79
 * Copyright 2011-2014 Twitter, Inc.
80
 * Licensed under MIT (https://github.com/twbs/bootstrap/blob/master/LICENSE)
81
 * ======================================================================== */
82
83


Chris Rebert's avatar
Chris Rebert committed
84
+function () { 'use strict';
Mark Otto's avatar
grunt    
Mark Otto committed
85

Chris Rebert's avatar
Chris Rebert committed
86
87
88
89
  (function (o_o) {
    typeof define  == 'function' && define.amd ? define(['jquery'], o_o) :
    typeof exports == 'object' ? o_o(require('jquery')) : o_o(jQuery)
  })(function ($) {
90

Chris Rebert's avatar
Chris Rebert committed
91
92
    // ALERT CLASS DEFINITION
    // ======================
93

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

Chris Rebert's avatar
Chris Rebert committed
99
    Alert.VERSION = '3.1.1'
Mark Otto's avatar
grunt    
Mark Otto committed
100

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

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

Chris Rebert's avatar
Chris Rebert committed
110
      var $parent = $(selector)
111

Chris Rebert's avatar
Chris Rebert committed
112
      if (e) e.preventDefault()
113

Chris Rebert's avatar
Chris Rebert committed
114
115
116
      if (!$parent.length) {
        $parent = $this.hasClass('alert') ? $this : $this.parent()
      }
117

Chris Rebert's avatar
Chris Rebert committed
118
      $parent.trigger(e = $.Event('close.bs.alert'))
119

Chris Rebert's avatar
Chris Rebert committed
120
121
122
      if (e.isDefaultPrevented()) return

      $parent.removeClass('in')
123

Chris Rebert's avatar
Chris Rebert committed
124
125
126
127
      function removeElement() {
        // detach from parent, fire event then clean up data
        $parent.detach().trigger('closed.bs.alert').remove()
      }
128

Chris Rebert's avatar
Chris Rebert committed
129
130
131
132
133
      $.support.transition && $parent.hasClass('fade') ?
        $parent
          .one('bsTransitionEnd', removeElement)
          .emulateTransitionEnd(150) :
        removeElement()
134
135
136
    }


Chris Rebert's avatar
Chris Rebert committed
137
138
    // ALERT PLUGIN DEFINITION
    // =======================
139

Chris Rebert's avatar
Chris Rebert committed
140
141
142
143
    function Plugin(option) {
      return this.each(function () {
        var $this = $(this)
        var data  = $this.data('bs.alert')
144

Chris Rebert's avatar
Chris Rebert committed
145
146
147
148
        if (!data) $this.data('bs.alert', (data = new Alert(this)))
        if (typeof option == 'string') data[option].call($this)
      })
    }
fat's avatar
fat committed
149

Chris Rebert's avatar
Chris Rebert committed
150
    var old = $.fn.alert
151

Chris Rebert's avatar
Chris Rebert committed
152
153
    $.fn.alert             = Plugin
    $.fn.alert.Constructor = Alert
Mark Otto's avatar
Mark Otto committed
154

155

Chris Rebert's avatar
Chris Rebert committed
156
157
    // ALERT NO CONFLICT
    // =================
158

Chris Rebert's avatar
Chris Rebert committed
159
160
161
162
    $.fn.alert.noConflict = function () {
      $.fn.alert = old
      return this
    }
163
164


Chris Rebert's avatar
Chris Rebert committed
165
166
    // ALERT DATA-API
    // ==============
167

Chris Rebert's avatar
Chris Rebert committed
168
    $(document).on('click.bs.alert.data-api', dismiss, Alert.prototype.close)
169

Chris Rebert's avatar
Chris Rebert committed
170
  })
171

Chris Rebert's avatar
Chris Rebert committed
172
}();
173

174
/* ========================================================================
Mark Otto's avatar
Mark Otto committed
175
 * Bootstrap: button.js v3.1.1
Mark Otto's avatar
Mark Otto committed
176
 * http://getbootstrap.com/javascript/#buttons
177
 * ========================================================================
178
 * Copyright 2011-2014 Twitter, Inc.
179
 * Licensed under MIT (https://github.com/twbs/bootstrap/blob/master/LICENSE)
180
 * ======================================================================== */
181
182


Chris Rebert's avatar
Chris Rebert committed
183
+function () { 'use strict';
Mark Otto's avatar
grunt    
Mark Otto committed
184

Chris Rebert's avatar
Chris Rebert committed
185
186
187
188
  (function (o_o) {
    typeof define  == 'function' && define.amd ? define(['jquery'], o_o) :
    typeof exports == 'object' ? o_o(require('jquery')) : o_o(jQuery)
  })(function ($) {
189

Chris Rebert's avatar
Chris Rebert committed
190
191
    // BUTTON PUBLIC CLASS DEFINITION
    // ==============================
192

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

Chris Rebert's avatar
Chris Rebert committed
199
    Button.VERSION  = '3.1.1'
Mark Otto's avatar
grunt    
Mark Otto committed
200

Chris Rebert's avatar
Chris Rebert committed
201
202
203
    Button.DEFAULTS = {
      loadingText: 'loading...'
    }
204

Chris Rebert's avatar
Chris Rebert committed
205
206
207
208
209
    Button.prototype.setState = function (state) {
      var d    = 'disabled'
      var $el  = this.$element
      var val  = $el.is('input') ? 'val' : 'html'
      var data = $el.data()
210

Chris Rebert's avatar
Chris Rebert committed
211
      state = state + 'Text'
fat's avatar
fat committed
212

Chris Rebert's avatar
Chris Rebert committed
213
      if (data.resetText == null) $el.data('resetText', $el[val]())
214

Chris Rebert's avatar
Chris Rebert committed
215
      $el[val](data[state] == null ? this.options[state] : data[state])
216

Chris Rebert's avatar
Chris Rebert committed
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
      // push to event loop to allow forms to submit
      setTimeout($.proxy(function () {
        if (state == 'loadingText') {
          this.isLoading = true
          $el.addClass(d).attr(d, d)
        } else if (this.isLoading) {
          this.isLoading = false
          $el.removeClass(d).removeAttr(d)
        }
      }, this), 0)
    }

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

      if ($parent.length) {
        var $input = this.$element.find('input')
        if ($input.prop('type') == 'radio') {
          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')
240
      }
Chris Rebert's avatar
Chris Rebert committed
241
242

      if (changed) this.$element.toggleClass('active')
fat's avatar
fat committed
243
    }
244
245


Chris Rebert's avatar
Chris Rebert committed
246
247
    // BUTTON PLUGIN DEFINITION
    // ========================
248

Chris Rebert's avatar
Chris Rebert committed
249
250
251
252
253
    function Plugin(option) {
      return this.each(function () {
        var $this   = $(this)
        var data    = $this.data('bs.button')
        var options = typeof option == 'object' && option
254

Chris Rebert's avatar
Chris Rebert committed
255
        if (!data) $this.data('bs.button', (data = new Button(this, options)))
fat's avatar
fat committed
256

Chris Rebert's avatar
Chris Rebert committed
257
258
259
260
        if (option == 'toggle') data.toggle()
        else if (option) data.setState(option)
      })
    }
fat's avatar
fat committed
261

Chris Rebert's avatar
Chris Rebert committed
262
    var old = $.fn.button
263

Chris Rebert's avatar
Chris Rebert committed
264
265
    $.fn.button             = Plugin
    $.fn.button.Constructor = Button
Mark Otto's avatar
Mark Otto committed
266

267

Chris Rebert's avatar
Chris Rebert committed
268
269
    // BUTTON NO CONFLICT
    // ==================
270

Chris Rebert's avatar
Chris Rebert committed
271
272
273
274
    $.fn.button.noConflict = function () {
      $.fn.button = old
      return this
    }
275
276


Chris Rebert's avatar
Chris Rebert committed
277
278
    // BUTTON DATA-API
    // ===============
279

Chris Rebert's avatar
Chris Rebert committed
280
281
282
283
284
285
    $(document).on('click.bs.button.data-api', '[data-toggle^="button"]', function (e) {
      var $btn = $(e.target)
      if (!$btn.hasClass('btn')) $btn = $btn.closest('.btn')
      Plugin.call($btn, 'toggle')
      e.preventDefault()
    })
286
287
288

  })

Chris Rebert's avatar
Chris Rebert committed
289
}();
290

291
/* ========================================================================
Mark Otto's avatar
Mark Otto committed
292
 * Bootstrap: carousel.js v3.1.1
Mark Otto's avatar
Mark Otto committed
293
 * http://getbootstrap.com/javascript/#carousel
294
 * ========================================================================
295
 * Copyright 2011-2014 Twitter, Inc.
296
 * Licensed under MIT (https://github.com/twbs/bootstrap/blob/master/LICENSE)
297
 * ======================================================================== */
298
299


Chris Rebert's avatar
Chris Rebert committed
300
+function () { 'use strict';
301

Chris Rebert's avatar
Chris Rebert committed
302
303
304
305
  (function (o_o) {
    typeof define  == 'function' && define.amd ? define(['jquery'], o_o) :
    typeof exports == 'object' ? o_o(require('jquery')) : o_o(jQuery)
  })(function ($) {
306

Chris Rebert's avatar
Chris Rebert committed
307
308
    // CAROUSEL CLASS DEFINITION
    // =========================
fat's avatar
fat committed
309

Chris Rebert's avatar
Chris Rebert committed
310
311
312
313
314
315
316
317
318
    var Carousel = function (element, options) {
      this.$element    = $(element).on('keydown.bs.carousel', $.proxy(this.keydown, this))
      this.$indicators = this.$element.find('.carousel-indicators')
      this.options     = options
      this.paused      =
      this.sliding     =
      this.interval    =
      this.$active     =
      this.$items      = null
319

Chris Rebert's avatar
Chris Rebert committed
320
321
322
323
      this.options.pause == 'hover' && this.$element
        .on('mouseenter.bs.carousel', $.proxy(this.pause, this))
        .on('mouseleave.bs.carousel', $.proxy(this.cycle, this))
    }
Mark Otto's avatar
grunt    
Mark Otto committed
324

Chris Rebert's avatar
Chris Rebert committed
325
    Carousel.VERSION  = '3.1.1'
326

Chris Rebert's avatar
Chris Rebert committed
327
328
329
330
    Carousel.DEFAULTS = {
      interval: 5000,
      pause: 'hover',
      wrap: true
Mark Otto's avatar
Mark Otto committed
331
332
    }

Chris Rebert's avatar
Chris Rebert committed
333
334
335
336
337
338
    Carousel.prototype.keydown = function (e) {
      switch (e.which) {
        case 37: this.prev(); break
        case 39: this.next(); break
        default: return
      }
339

Chris Rebert's avatar
Chris Rebert committed
340
341
      e.preventDefault()
    }
fat's avatar
fat committed
342

Chris Rebert's avatar
Chris Rebert committed
343
344
    Carousel.prototype.cycle = function (e) {
      e || (this.paused = false)
345

Chris Rebert's avatar
Chris Rebert committed
346
      this.interval && clearInterval(this.interval)
347

Chris Rebert's avatar
Chris Rebert committed
348
349
350
      this.options.interval
        && !this.paused
        && (this.interval = setInterval($.proxy(this.next, this), this.options.interval))
351

Chris Rebert's avatar
Chris Rebert committed
352
353
      return this
    }
354

Chris Rebert's avatar
Chris Rebert committed
355
356
357
358
    Carousel.prototype.getItemIndex = function (item) {
      this.$items = item.parent().children('.item')
      return this.$items.index(item || this.$active)
    }
359

Chris Rebert's avatar
Chris Rebert committed
360
361
362
    Carousel.prototype.to = function (pos) {
      var that        = this
      var activeIndex = this.getItemIndex(this.$active = this.$element.find('.item.active'))
fat's avatar
fat committed
363

Chris Rebert's avatar
Chris Rebert committed
364
      if (pos > (this.$items.length - 1) || pos < 0) return
365

Chris Rebert's avatar
Chris Rebert committed
366
367
      if (this.sliding)       return this.$element.one('slid.bs.carousel', function () { that.to(pos) }) // yes, "slid"
      if (activeIndex == pos) return this.pause().cycle()
fat's avatar
fat committed
368

Chris Rebert's avatar
Chris Rebert committed
369
      return this.slide(pos > activeIndex ? 'next' : 'prev', $(this.$items[pos]))
370
371
    }

Chris Rebert's avatar
Chris Rebert committed
372
373
    Carousel.prototype.pause = function (e) {
      e || (this.paused = true)
374

Chris Rebert's avatar
Chris Rebert committed
375
376
377
378
      if (this.$element.find('.next, .prev').length && $.support.transition) {
        this.$element.trigger($.support.transition.end)
        this.cycle(true)
      }
379

Chris Rebert's avatar
Chris Rebert committed
380
      this.interval = clearInterval(this.interval)
381

Chris Rebert's avatar
Chris Rebert committed
382
383
      return this
    }
384

Chris Rebert's avatar
Chris Rebert committed
385
386
387
388
    Carousel.prototype.next = function () {
      if (this.sliding) return
      return this.slide('next')
    }
Jacob Thornton's avatar
Jacob Thornton committed
389

Chris Rebert's avatar
Chris Rebert committed
390
391
392
    Carousel.prototype.prev = function () {
      if (this.sliding) return
      return this.slide('prev')
Jacob Thornton's avatar
Jacob Thornton committed
393
394
    }

Chris Rebert's avatar
Chris Rebert committed
395
396
397
398
399
400
401
402
403
404
405
406
    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

      if (!$next.length) {
        if (!this.options.wrap) return
        $next = this.$element.find('.item')[fallback]()
      }
fat's avatar
fat committed
407

Chris Rebert's avatar
Chris Rebert committed
408
      if ($next.hasClass('active')) return (this.sliding = false)
409

Chris Rebert's avatar
Chris Rebert committed
410
411
412
413
414
415
416
      var relatedTarget = $next[0]
      var slideEvent = $.Event('slide.bs.carousel', {
        relatedTarget: relatedTarget,
        direction: direction
      })
      this.$element.trigger(slideEvent)
      if (slideEvent.isDefaultPrevented()) return
fat's avatar
fat committed
417

Chris Rebert's avatar
Chris Rebert committed
418
      this.sliding = true
419

Chris Rebert's avatar
Chris Rebert committed
420
      isCycling && this.pause()
421

Chris Rebert's avatar
Chris Rebert committed
422
423
424
425
426
      if (this.$indicators.length) {
        this.$indicators.find('.active').removeClass('active')
        var $nextIndicator = $(this.$indicators.children()[this.getItemIndex($next)])
        $nextIndicator && $nextIndicator.addClass('active')
      }
427

Chris Rebert's avatar
Chris Rebert committed
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
      var slidEvent = $.Event('slid.bs.carousel', { relatedTarget: relatedTarget, direction: direction }) // yes, "slid"
      if ($.support.transition && this.$element.hasClass('slide')) {
        $next.addClass(type)
        $next[0].offsetWidth // force reflow
        $active.addClass(direction)
        $next.addClass(direction)
        $active
          .one('bsTransitionEnd', function () {
            $next.removeClass([type, direction].join(' ')).addClass('active')
            $active.removeClass(['active', direction].join(' '))
            that.sliding = false
            setTimeout(function () {
              that.$element.trigger(slidEvent)
            }, 0)
          })
          .emulateTransitionEnd($active.css('transition-duration').slice(0, -1) * 1000)
      } else {
        $active.removeClass('active')
        $next.addClass('active')
        this.sliding = false
        this.$element.trigger(slidEvent)
      }

      isCycling && this.cycle()
452

Chris Rebert's avatar
Chris Rebert committed
453
454
      return this
    }
Mark Otto's avatar
Mark Otto committed
455

456

Chris Rebert's avatar
Chris Rebert committed
457
458
    // CAROUSEL PLUGIN DEFINITION
    // ==========================
459

Chris Rebert's avatar
Chris Rebert committed
460
461
462
463
464
465
    function Plugin(option) {
      return this.each(function () {
        var $this   = $(this)
        var data    = $this.data('bs.carousel')
        var options = $.extend({}, Carousel.DEFAULTS, $this.data(), typeof option == 'object' && option)
        var action  = typeof option == 'string' ? option : options.slide
466

Chris Rebert's avatar
Chris Rebert committed
467
468
469
470
471
472
        if (!data) $this.data('bs.carousel', (data = new Carousel(this, options)))
        if (typeof option == 'number') data.to(option)
        else if (action) data[action]()
        else if (options.interval) data.pause().cycle()
      })
    }
473

Chris Rebert's avatar
Chris Rebert committed
474
    var old = $.fn.carousel
fat's avatar
fat committed
475

Chris Rebert's avatar
Chris Rebert committed
476
477
    $.fn.carousel             = Plugin
    $.fn.carousel.Constructor = Carousel
478

479

Chris Rebert's avatar
Chris Rebert committed
480
481
    // CAROUSEL NO CONFLICT
    // ====================
482

Chris Rebert's avatar
Chris Rebert committed
483
484
485
    $.fn.carousel.noConflict = function () {
      $.fn.carousel = old
      return this
486
487
    }

488

Chris Rebert's avatar
Chris Rebert committed
489
490
491
492
493
494
    // CAROUSEL DATA-API
    // =================

    $(document).on('click.bs.carousel.data-api', '[data-slide], [data-slide-to]', function (e) {
      var href
      var $this   = $(this)
Mark Otto's avatar
Mark Otto committed
495
      var $target = $($this.attr('data-target') || (href = $this.attr('href')) && href.replace(/.*(?=#[^\s]+$)/, '')) // strip for ie7
Chris Rebert's avatar
Chris Rebert committed
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
      var options = $.extend({}, $target.data(), $this.data())
      var slideIndex = $this.attr('data-slide-to')
      if (slideIndex) options.interval = false

      Plugin.call($target, options)

      if (slideIndex) {
        $target.data('bs.carousel').to(slideIndex)
      }

      e.preventDefault()
    })

    $(window).on('load', function () {
      $('[data-ride="carousel"]').each(function () {
        var $carousel = $(this)
        Plugin.call($carousel, $carousel.data())
      })
fat's avatar
fat committed
514
    })
Chris Rebert's avatar
Chris Rebert committed
515

fat's avatar
fat committed
516
517
  })

Chris Rebert's avatar
Chris Rebert committed
518
}();
519

520
/* ========================================================================
Mark Otto's avatar
Mark Otto committed
521
 * Bootstrap: collapse.js v3.1.1
Mark Otto's avatar
Mark Otto committed
522
 * http://getbootstrap.com/javascript/#collapse
523
 * ========================================================================
524
 * Copyright 2011-2014 Twitter, Inc.
525
 * Licensed under MIT (https://github.com/twbs/bootstrap/blob/master/LICENSE)
526
 * ======================================================================== */
527
528


Chris Rebert's avatar
Chris Rebert committed
529
+function () { 'use strict';
Mark Otto's avatar
grunt    
Mark Otto committed
530

Chris Rebert's avatar
Chris Rebert committed
531
532
533
534
  (function (o_o) {
    typeof define  == 'function' && define.amd ? define(['jquery'], o_o) :
    typeof exports == 'object' ? o_o(require('jquery')) : o_o(jQuery)
  })(function ($) {
535

Chris Rebert's avatar
Chris Rebert committed
536
537
    // COLLAPSE PUBLIC CLASS DEFINITION
    // ================================
538

Chris Rebert's avatar
Chris Rebert committed
539
540
541
542
    var Collapse = function (element, options) {
      this.$element      = $(element)
      this.options       = $.extend({}, Collapse.DEFAULTS, options)
      this.transitioning = null
543

Chris Rebert's avatar
Chris Rebert committed
544
545
546
      if (this.options.parent) this.$parent = $(this.options.parent)
      if (this.options.toggle) this.toggle()
    }
547

Chris Rebert's avatar
Chris Rebert committed
548
    Collapse.VERSION  = '3.1.1'
Mark Otto's avatar
grunt    
Mark Otto committed
549

Chris Rebert's avatar
Chris Rebert committed
550
551
552
    Collapse.DEFAULTS = {
      toggle: true
    }
553

Chris Rebert's avatar
Chris Rebert committed
554
555
556
557
    Collapse.prototype.dimension = function () {
      var hasWidth = this.$element.hasClass('width')
      return hasWidth ? 'width' : 'height'
    }
558

Chris Rebert's avatar
Chris Rebert committed
559
560
    Collapse.prototype.show = function () {
      if (this.transitioning || this.$element.hasClass('in')) return
561

Chris Rebert's avatar
Chris Rebert committed
562
563
564
      var startEvent = $.Event('show.bs.collapse')
      this.$element.trigger(startEvent)
      if (startEvent.isDefaultPrevented()) return
fat's avatar
fat committed
565

Chris Rebert's avatar
Chris Rebert committed
566
      var actives = this.$parent && this.$parent.find('> .panel > .in')
567

Chris Rebert's avatar
Chris Rebert committed
568
569
570
571
572
573
      if (actives && actives.length) {
        var hasData = actives.data('bs.collapse')
        if (hasData && hasData.transitioning) return
        Plugin.call(actives, 'hide')
        hasData || actives.data('bs.collapse', null)
      }
574

Chris Rebert's avatar
Chris Rebert committed
575
      var dimension = this.dimension()
576

Chris Rebert's avatar
Chris Rebert committed
577
578
579
      this.$element
        .removeClass('collapse')
        .addClass('collapsing')[dimension](0)
580

Chris Rebert's avatar
Chris Rebert committed
581
      this.transitioning = 1
582

Chris Rebert's avatar
Chris Rebert committed
583
      var complete = function () {
Mark Otto's avatar
Mark Otto committed
584
        this.$element
Chris Rebert's avatar
Chris Rebert committed
585
586
587
588
589
          .removeClass('collapsing')
          .addClass('collapse in')[dimension]('')
        this.transitioning = 0
        this.$element
          .trigger('shown.bs.collapse')
Mark Otto's avatar
Mark Otto committed
590
      }
591

Chris Rebert's avatar
Chris Rebert committed
592
      if (!$.support.transition) return complete.call(this)
593

Chris Rebert's avatar
Chris Rebert committed
594
      var scrollSize = $.camelCase(['scroll', dimension].join('-'))
595

Chris Rebert's avatar
Chris Rebert committed
596
597
598
599
      this.$element
        .one('bsTransitionEnd', $.proxy(complete, this))
        .emulateTransitionEnd(350)[dimension](this.$element[0][scrollSize])
    }
600

Chris Rebert's avatar
Chris Rebert committed
601
602
    Collapse.prototype.hide = function () {
      if (this.transitioning || !this.$element.hasClass('in')) return
fat's avatar
fat committed
603

Chris Rebert's avatar
Chris Rebert committed
604
605
606
      var startEvent = $.Event('hide.bs.collapse')
      this.$element.trigger(startEvent)
      if (startEvent.isDefaultPrevented()) return
fat's avatar
fat committed
607

Chris Rebert's avatar
Chris Rebert committed
608
      var dimension = this.dimension()
609

Chris Rebert's avatar
Chris Rebert committed
610
      this.$element[dimension](this.$element[dimension]())[0].offsetHeight
611

Chris Rebert's avatar
Chris Rebert committed
612
613
614
615
      this.$element
        .addClass('collapsing')
        .removeClass('collapse')
        .removeClass('in')
616

Chris Rebert's avatar
Chris Rebert committed
617
      this.transitioning = 1
618

Chris Rebert's avatar
Chris Rebert committed
619
620
      var complete = function () {
        this.transitioning = 0
Mark Otto's avatar
Mark Otto committed
621
        this.$element
Chris Rebert's avatar
Chris Rebert committed
622
623
624
          .trigger('hidden.bs.collapse')
          .removeClass('collapsing')
          .addClass('collapse')
Mark Otto's avatar
Mark Otto committed
625
      }
626

Chris Rebert's avatar
Chris Rebert committed
627
      if (!$.support.transition) return complete.call(this)
628

Chris Rebert's avatar
Chris Rebert committed
629
630
631
632
633
      this.$element
        [dimension](0)
        .one('bsTransitionEnd', $.proxy(complete, this))
        .emulateTransitionEnd(350)
    }
634

Chris Rebert's avatar
Chris Rebert committed
635
636
637
    Collapse.prototype.toggle = function () {
      this[this.$element.hasClass('in') ? 'hide' : 'show']()
    }
638
639


Chris Rebert's avatar
Chris Rebert committed
640
641
    // COLLAPSE PLUGIN DEFINITION
    // ==========================
642

Chris Rebert's avatar
Chris Rebert committed
643
644
645
646
647
    function Plugin(option) {
      return this.each(function () {
        var $this   = $(this)
        var data    = $this.data('bs.collapse')
        var options = $.extend({}, Collapse.DEFAULTS, $this.data(), typeof option == 'object' && option)
648

Chris Rebert's avatar
Chris Rebert committed
649
650
651
652
653
        if (!data && options.toggle && option == 'show') option = !option
        if (!data) $this.data('bs.collapse', (data = new Collapse(this, options)))
        if (typeof option == 'string') data[option]()
      })
    }
654

Chris Rebert's avatar
Chris Rebert committed
655
    var old = $.fn.collapse
Mark Otto's avatar
Mark Otto committed
656

Chris Rebert's avatar
Chris Rebert committed
657
658
    $.fn.collapse             = Plugin
    $.fn.collapse.Constructor = Collapse
659
660


Chris Rebert's avatar
Chris Rebert committed
661
662
    // COLLAPSE NO CONFLICT
    // ====================
663

Chris Rebert's avatar
Chris Rebert committed
664
665
666
667
    $.fn.collapse.noConflict = function () {
      $.fn.collapse = old
      return this
    }
668
669


Chris Rebert's avatar
Chris Rebert committed
670
671
    // COLLAPSE DATA-API
    // =================
672

Chris Rebert's avatar
Chris Rebert committed
673
674
675
676
677
    $(document).on('click.bs.collapse.data-api', '[data-toggle="collapse"]', function (e) {
      var href
      var $this   = $(this)
      var target  = $this.attr('data-target')
          || e.preventDefault()
Mark Otto's avatar
Mark Otto committed
678
          || (href = $this.attr('href')) && href.replace(/.*(?=#[^\s]+$)/, '') // strip for ie7
Chris Rebert's avatar
Chris Rebert committed
679
680
681
682
683
684
685
686
687
688
      var $target = $(target)
      var data    = $target.data('bs.collapse')
      var option  = data ? 'toggle' : $this.data()
      var parent  = $this.attr('data-parent')
      var $parent = parent && $(parent)

      if (!data || !data.transitioning) {
        if ($parent) $parent.find('[data-toggle="collapse"][data-parent="' + parent + '"]').not($this).addClass('collapsed')
        $this[$target.hasClass('in') ? 'addClass' : 'removeClass']('collapsed')
      }
689

Chris Rebert's avatar
Chris Rebert committed
690
691
      Plugin.call($target, option)
    })
fat's avatar
fat committed
692

693
694
  })

Chris Rebert's avatar
Chris Rebert committed
695
}();
696

697
/* ========================================================================
Mark Otto's avatar
Mark Otto committed
698
 * Bootstrap: dropdown.js v3.1.1
Mark Otto's avatar
Mark Otto committed
699
 * http://getbootstrap.com/javascript/#dropdowns
700
 * ========================================================================
701
 * Copyright 2011-2014 Twitter, Inc.
702
 * Licensed under MIT (https://github.com/twbs/bootstrap/blob/master/LICENSE)
703
 * ======================================================================== */
704
705


Chris Rebert's avatar
Chris Rebert committed
706
707
708
709
710
711
+function () { 'use strict';

  (function (o_o) {
    typeof define  == 'function' && define.amd ? define(['jquery'], o_o) :
    typeof exports == 'object' ? o_o(require('jquery')) : o_o(jQuery)
  })(function ($) {
Mark Otto's avatar
grunt    
Mark Otto committed
712

Chris Rebert's avatar
Chris Rebert committed
713
714
    // DROPDOWN CLASS DEFINITION
    // =========================
715

Chris Rebert's avatar
Chris Rebert committed
716
717
718
719
720
    var backdrop = '.dropdown-backdrop'
    var toggle   = '[data-toggle="dropdown"]'
    var Dropdown = function (element) {
      $(element).on('click.bs.dropdown', this.toggle)
    }
721

Chris Rebert's avatar
Chris Rebert committed
722
    Dropdown.VERSION = '3.1.1'
723

Chris Rebert's avatar
Chris Rebert committed
724
725
    Dropdown.prototype.toggle = function (e) {
      var $this = $(this)
Mark Otto's avatar
grunt    
Mark Otto committed
726

Chris Rebert's avatar
Chris Rebert committed
727
      if ($this.is('.disabled, :disabled')) return
728

Chris Rebert's avatar
Chris Rebert committed
729
730
      var $parent  = getParent($this)
      var isActive = $parent.hasClass('open')
731

Chris Rebert's avatar
Chris Rebert committed
732
      clearMenus()
733

Chris Rebert's avatar
Chris Rebert committed
734
735
736
737
738
      if (!isActive) {
        if ('ontouchstart' in document.documentElement && !$parent.closest('.navbar-nav').length) {
          // if mobile we use a backdrop because click events don't delegate
          $('<div class="dropdown-backdrop"/>').insertAfter($(this)).on('click', clearMenus)
        }
fat's avatar
fat committed
739

Chris Rebert's avatar
Chris Rebert committed
740
741
        var relatedTarget = { relatedTarget: this }
        $parent.trigger(e = $.Event('show.bs.dropdown', relatedTarget))
742

Chris Rebert's avatar
Chris Rebert committed
743
        if (e.isDefaultPrevented()) return
744

Chris Rebert's avatar
Chris Rebert committed
745
        $this.trigger('focus')
746

Chris Rebert's avatar
Chris Rebert committed
747
748
749
750
        $parent
          .toggleClass('open')
          .trigger('shown.bs.dropdown', relatedTarget)
      }
Mark Otto's avatar
Mark Otto committed
751

Chris Rebert's avatar
Chris Rebert committed
752
      return false
fat's avatar
rebuild    
fat committed
753
    }
754

Chris Rebert's avatar
Chris Rebert committed
755
756
    Dropdown.prototype.keydown = function (e) {
      if (!/(38|40|27)/.test(e.keyCode)) return
757

Chris Rebert's avatar
Chris Rebert committed
758
      var $this = $(this)
759

Chris Rebert's avatar
Chris Rebert committed
760
761
      e.preventDefault()
      e.stopPropagation()
762

Chris Rebert's avatar
Chris Rebert committed
763
      if ($this.is('.disabled, :disabled')) return
764

Chris Rebert's avatar
Chris Rebert committed
765
766
      var $parent  = getParent($this)
      var isActive = $parent.hasClass('open')
767

Chris Rebert's avatar
Chris Rebert committed
768
769
770
771
      if (!isActive || (isActive && e.keyCode == 27)) {
        if (e.which == 27) $parent.find(toggle).trigger('focus')
        return $this.trigger('click')
      }
772

Chris Rebert's avatar
Chris Rebert committed
773
774
      var desc = ' li:not(.divider):visible a'
      var $items = $parent.find('[role="menu"]' + desc + ', [role="listbox"]' + desc)
775

Chris Rebert's avatar
Chris Rebert committed
776
      if (!$items.length) return
777

Chris Rebert's avatar
Chris Rebert committed
778
      var index = $items.index($items.filter(':focus'))
779

Chris Rebert's avatar
Chris Rebert committed
780
781
782
      if (e.keyCode == 38 && index > 0)                 index--                        // up
      if (e.keyCode == 40 && index < $items.length - 1) index++                        // down
      if (!~index)                                      index = 0
783

Chris Rebert's avatar
Chris Rebert committed
784
785
      $items.eq(index).trigger('focus')
    }
786

Chris Rebert's avatar
Chris Rebert committed
787
788
789
790
791
792
793
794
795
796
797
798
    function clearMenus(e) {
      if (e && e.which === 3) return
      $(backdrop).remove()
      $(toggle).each(function () {
        var $parent = getParent($(this))
        var relatedTarget = { relatedTarget: this }
        if (!$parent.hasClass('open')) return
        $parent.trigger(e = $.Event('hide.bs.dropdown', relatedTarget))
        if (e.isDefaultPrevented()) return
        $parent.removeClass('open').trigger('hidden.bs.dropdown', relatedTarget)
      })
    }
799

Chris Rebert's avatar
Chris Rebert committed
800
801
802
803
804
    function getParent($this) {
      var selector = $this.attr('data-target')

      if (!selector) {
        selector = $this.attr('href')
Mark Otto's avatar
Mark Otto committed
805
        selector = selector && /#[A-Za-z]/.test(selector) && selector.replace(/.*(?=#[^\s]*$)/, '') // strip for ie7
Chris Rebert's avatar
Chris Rebert committed
806
      }
807

Chris Rebert's avatar
Chris Rebert committed
808
      var $parent = selector && $(selector)
809

Chris Rebert's avatar
Chris Rebert committed
810
      return $parent && $parent.length ? $parent : $this.parent()
811
812
    }

813

Chris Rebert's avatar
Chris Rebert committed
814
815
    // DROPDOWN PLUGIN DEFINITION
    // ==========================
816

Chris Rebert's avatar
Chris Rebert committed
817
818
819
820
    function Plugin(option) {
      return this.each(function () {
        var $this = $(this)
        var data  = $this.data('bs.dropdown')
821

Chris Rebert's avatar
Chris Rebert committed
822
823
824
825
        if (!data) $this.data('bs.dropdown', (data = new Dropdown(this)))
        if (typeof option == 'string') data[option].call($this)
      })
    }
826

Chris Rebert's avatar
Chris Rebert committed
827
    var old = $.fn.dropdown
828

Chris Rebert's avatar
Chris Rebert committed
829
830
    $.fn.dropdown             = Plugin
    $.fn.dropdown.Constructor = Dropdown
Mark Otto's avatar
Mark Otto committed
831

832

Chris Rebert's avatar
Chris Rebert committed
833
834
    // DROPDOWN NO CONFLICT
    // ====================
835

Chris Rebert's avatar
Chris Rebert committed
836
837
838
839
    $.fn.dropdown.noConflict = function () {
      $.fn.dropdown = old
      return this
    }
840
841


Chris Rebert's avatar
Chris Rebert committed
842
843
    // APPLY TO STANDARD DROPDOWN ELEMENTS
    // ===================================
844

Chris Rebert's avatar
Chris Rebert committed
845
846
847
848
849
    $(document)
      .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"], [role="listbox"]', Dropdown.prototype.keydown)
850

Chris Rebert's avatar
Chris Rebert committed
851
  })
852

Chris Rebert's avatar
Chris Rebert committed
853
}();
854

855
/* ========================================================================
Mark Otto's avatar
Mark Otto committed
856
 * Bootstrap: modal.js v3.1.1
Mark Otto's avatar
Mark Otto committed
857
 * http://getbootstrap.com/javascript/#modals
858
 * ========================================================================
859
 * Copyright 2011-2014 Twitter, Inc.
860
 * Licensed under MIT (https://github.com/twbs/bootstrap/blob/master/LICENSE)
861
 * ======================================================================== */
862
863


Chris Rebert's avatar
Chris Rebert committed
864
+function () { 'use strict';
Mark Otto's avatar
grunt    
Mark Otto committed
865

Chris Rebert's avatar
Chris Rebert committed
866
867
868
869
  (function (o_o) {
    typeof define  == 'function' && define.amd ? define(['jquery'], o_o) :
    typeof exports == 'object' ? o_o(require('jquery')) : o_o(jQuery)
  })(function ($) {
870

Chris Rebert's avatar
Chris Rebert committed
871
872
    // MODAL CLASS DEFINITION
    // ======================
873

Chris Rebert's avatar
Chris Rebert committed
874
875
876
877
878
879
880
    var Modal = function (element, options) {
      this.options        = options
      this.$body          = $(document.body)
      this.$element       = $(element)
      this.$backdrop      =
      this.isShown        = null
      this.scrollbarWidth = 0
881

Chris Rebert's avatar
Chris Rebert committed
882
883
884
885
886
887
888
      if (this.options.remote) {
        this.$element
          .find('.modal-content')
          .load(this.options.remote, $.proxy(function () {
            this.$element.trigger('loaded.bs.modal')
          }, this))
      }
889
    }
890

Chris Rebert's avatar
Chris Rebert committed
891
    Modal.VERSION  = '3.1.1'
Mark Otto's avatar
grunt    
Mark Otto committed
892

Chris Rebert's avatar
Chris Rebert committed
893
894
895
896
897
    Modal.DEFAULTS = {
      backdrop: true,
      keyboard: true,
      show: true
    }
898

Chris Rebert's avatar
Chris Rebert committed
899
900
901
    Modal.prototype.toggle = function (_relatedTarget) {
      return this.isShown ? this.hide() : this.show(_relatedTarget)
    }
902

Chris Rebert's avatar
Chris Rebert committed
903
904
905
    Modal.prototype.show = function (_relatedTarget) {
      var that = this
      var e    = $.Event('show.bs.modal', { relatedTarget: _relatedTarget })
906

Chris Rebert's avatar
Chris Rebert committed
907
      this.$element.trigger(e)
908

Chris Rebert's avatar
Chris Rebert committed
909
      if (this.isShown || e.isDefaultPrevented()) return
910

Chris Rebert's avatar
Chris Rebert committed
911
      this.isShown = true
912

Chris Rebert's avatar
Chris Rebert committed
913
914
      this.checkScrollbar()
      this.$body.addClass('modal-open')
fat's avatar
build    
fat committed
915

Chris Rebert's avatar
Chris Rebert committed
916
917
      this.setScrollbar()
      this.escape()
918

Chris Rebert's avatar
Chris Rebert committed
919
      this.$element.on('click.dismiss.bs.modal', '[data-dismiss="modal"]', $.proxy(this.hide, this))
fat's avatar
rebuild    
fat committed
920

Chris Rebert's avatar
Chris Rebert committed
921
922
      this.backdrop(function () {
        var transition = $.support.transition && that.$element.hasClass('fade')
923

Chris Rebert's avatar
Chris Rebert committed
924
925
926
        if (!that.$element.parent().length) {
          that.$element.appendTo(that.$body) // don't move modals dom position
        }
927

Chris Rebert's avatar
Chris Rebert committed
928
929
930
        that.$element
          .show()
          .scrollTop(0)
931

Chris Rebert's avatar
Chris Rebert committed
932
933
934
        if (transition) {
          that.$element[0].offsetWidth // force reflow
        }
935

Chris Rebert's avatar
Chris Rebert committed
936
937
938
        that.$element
          .addClass('in')
          .attr('aria-hidden', false)
939

Chris Rebert's avatar
Chris Rebert committed
940
        that.enforceFocus()
Jacob Thornton's avatar
Jacob Thornton committed
941

Chris Rebert's avatar
Chris Rebert committed
942
        var e = $.Event('shown.bs.modal', { relatedTarget: _relatedTarget })
943

Chris Rebert's avatar
Chris Rebert committed
944
945
946
947
948
949
950
951
952
        transition ?
          that.$element.find('.modal-dialog') // wait for modal to slide in
            .one('bsTransitionEnd', function () {
              that.$element.trigger('focus').trigger(e)
            })
            .emulateTransitionEnd(300) :
          that.$element.trigger('focus').trigger(e)
      })
    }
953

Chris Rebert's avatar
Chris Rebert committed
954
955
    Modal.prototype.hide = function (e) {
      if (e) e.preventDefault()
956

Chris Rebert's avatar
Chris Rebert committed
957
      e = $.Event('hide.bs.modal')
958

Chris Rebert's avatar
Chris Rebert committed
959
      this.$element.trigger(e)
960

Chris Rebert's avatar
Chris Rebert committed
961
      if (!this.isShown || e.isDefaultPrevented()) return
962

Chris Rebert's avatar
Chris Rebert committed
963
      this.isShown = false
fat's avatar
build    
fat committed
964

Chris Rebert's avatar
Chris Rebert committed
965
      this.$body.removeClass('modal-open')
966

Chris Rebert's avatar
Chris Rebert committed
967
968
      this.resetScrollbar()
      this.escape()
969

Chris Rebert's avatar
Chris Rebert committed
970
      $(document).off('focusin.bs.modal')
971

972
      this.$element
Chris Rebert's avatar
Chris Rebert committed
973
974
975
        .removeClass('in')
        .attr('aria-hidden', true)
        .off('click.dismiss.bs.modal')
976

Chris Rebert's avatar
Chris Rebert committed
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
      $.support.transition && this.$element.hasClass('fade') ?
        this.$element
          .one('bsTransitionEnd', $.proxy(this.hideModal, this))
          .emulateTransitionEnd(300) :
        this.hideModal()
    }

    Modal.prototype.enforceFocus = function () {
      $(document)
        .off('focusin.bs.modal') // guard against infinite focus loop
        .on('focusin.bs.modal', $.proxy(function (e) {
          if (this.$element[0] !== e.target && !this.$element.has(e.target).length) {
            this.$element.trigger('focus')
          }
        }, this))
    }

    Modal.prototype.escape = function () {
      if (this.isShown && this.options.keyboard) {
        this.$element.on('keyup.dismiss.bs.modal', $.proxy(function (e) {
          e.which == 27 && this.hide()
        }, this))
      } else if (!this.isShown) {
        this.$element.off('keyup.dismiss.bs.modal')
For faster browsing, not all history is shown. View entire blame