bootstrap.js 60.8 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


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

23
  'use strict';
24

25
26
  // CSS TRANSITION SUPPORT (Shoutout: http://www.modernizr.com/)
  // ============================================================
27

28
29
  function transitionEnd() {
    var el = document.createElement('bootstrap')
30

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

38
39
40
41
42
    for (var name in transEndEventNames) {
      if (el.style[name] !== undefined) {
        return { end: transEndEventNames[name] }
      }
    }
43
44

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

47
48
  // http://blog.alexmaccaw.com/css-transitions
  $.fn.emulateTransitionEnd = function (duration) {
XhmikosR's avatar
XhmikosR committed
49
50
    var called = false
    var $el = this
liuyl's avatar
liuyl committed
51
52
    $(this).one($.support.transition.end, function () { called = true })
    var callback = function () { if (!called) $($el).trigger($.support.transition.end) }
53
    setTimeout(callback, duration)
54
    return this
55
56
  }

57
58
  $(function () {
    $.support.transition = transitionEnd()
fat's avatar
fat committed
59
  })
60

Mark Otto's avatar
grunt    
Mark Otto committed
61
});
62

63
/* ========================================================================
Mark Otto's avatar
Mark Otto committed
64
 * Bootstrap: alert.js v3.1.1
Mark Otto's avatar
Mark Otto committed
65
 * http://getbootstrap.com/javascript/#alerts
66
 * ========================================================================
67
 * Copyright 2011-2014 Twitter, Inc.
68
 * Licensed under MIT (https://github.com/twbs/bootstrap/blob/master/LICENSE)
69
 * ======================================================================== */
70
71


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

77
  'use strict';
78

fat's avatar
fat committed
79
80
  // ALERT CLASS DEFINITION
  // ======================
81
82

  var dismiss = '[data-dismiss="alert"]'
fat's avatar
fat committed
83
84
85
  var Alert   = function (el) {
    $(el).on('click', dismiss, this.close)
  }
86

Mark Otto's avatar
grunt    
Mark Otto committed
87
88
  Alert.VERSION = '3.1.1'

89
  Alert.prototype.close = function (e) {
fat's avatar
fat committed
90
91
    var $this    = $(this)
    var selector = $this.attr('data-target')
92
93
94

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

fat's avatar
fat committed
98
    var $parent = $(selector)
99

fat's avatar
fat committed
100
    if (e) e.preventDefault()
101

fat's avatar
fat committed
102
103
104
    if (!$parent.length) {
      $parent = $this.hasClass('alert') ? $this : $this.parent()
    }
105

Mark Otto's avatar
Mark Otto committed
106
    $parent.trigger(e = $.Event('close.bs.alert'))
107
108
109
110
111
112

    if (e.isDefaultPrevented()) return

    $parent.removeClass('in')

    function removeElement() {
Chris Rebert's avatar
Chris Rebert committed
113
114
      // detach from parent, fire event then clean up data
      $parent.detach().trigger('closed.bs.alert').remove()
115
116
117
    }

    $.support.transition && $parent.hasClass('fade') ?
118
119
120
      $parent
        .one($.support.transition.end, removeElement)
        .emulateTransitionEnd(150) :
121
122
123
124
      removeElement()
  }


fat's avatar
fat committed
125
126
  // ALERT PLUGIN DEFINITION
  // =======================
127

Mark Otto's avatar
Mark Otto committed
128
  function Plugin(option) {
129
130
    return this.each(function () {
      var $this = $(this)
Mark Otto's avatar
Mark Otto committed
131
      var data  = $this.data('bs.alert')
fat's avatar
fat committed
132

Mark Otto's avatar
Mark Otto committed
133
      if (!data) $this.data('bs.alert', (data = new Alert(this)))
134
135
136
137
      if (typeof option == 'string') data[option].call($this)
    })
  }

Mark Otto's avatar
Mark Otto committed
138
139
140
  var old = $.fn.alert

  $.fn.alert             = Plugin
141
142
143
  $.fn.alert.Constructor = Alert


fat's avatar
fat committed
144
145
  // ALERT NO CONFLICT
  // =================
146
147
148
149
150
151
152

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


fat's avatar
fat committed
153
  // ALERT DATA-API
fat's avatar
fat committed
154
  // ==============
155

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

Mark Otto's avatar
grunt    
Mark Otto committed
158
});
159

160
/* ========================================================================
Mark Otto's avatar
Mark Otto committed
161
 * Bootstrap: button.js v3.1.1
Mark Otto's avatar
Mark Otto committed
162
 * http://getbootstrap.com/javascript/#buttons
163
 * ========================================================================
164
 * Copyright 2011-2014 Twitter, Inc.
165
 * Licensed under MIT (https://github.com/twbs/bootstrap/blob/master/LICENSE)
166
 * ======================================================================== */
167
168


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

174
  'use strict';
175

fat's avatar
fat committed
176
177
  // BUTTON PUBLIC CLASS DEFINITION
  // ==============================
178
179

  var Button = function (element, options) {
fat's avatar
fat committed
180
181
182
    this.$element  = $(element)
    this.options   = $.extend({}, Button.DEFAULTS, options)
    this.isLoading = false
fat's avatar
fat committed
183
184
  }

Mark Otto's avatar
grunt    
Mark Otto committed
185
186
  Button.VERSION  = '3.1.1'

fat's avatar
fat committed
187
188
  Button.DEFAULTS = {
    loadingText: 'loading...'
189
190
191
  }

  Button.prototype.setState = function (state) {
fat's avatar
fat committed
192
193
194
195
    var d    = 'disabled'
    var $el  = this.$element
    var val  = $el.is('input') ? 'val' : 'html'
    var data = $el.data()
196
197

    state = state + 'Text'
fat's avatar
fat committed
198

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

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

    // push to event loop to allow forms to submit
fat's avatar
fat committed
204
205
206
207
208
209
210
211
212
    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)
213
214
215
  }

  Button.prototype.toggle = function () {
216
    var changed = true
fat's avatar
fat committed
217
    var $parent = this.$element.closest('[data-toggle="buttons"]')
218

219
    if ($parent.length) {
fat's avatar
fat committed
220
      var $input = this.$element.find('input')
fat's avatar
fat committed
221
222
223
      if ($input.prop('type') == 'radio') {
        if ($input.prop('checked') && this.$element.hasClass('active')) changed = false
        else $parent.find('.active').removeClass('active')
224
225
      }
      if (changed) $input.prop('checked', !this.$element.hasClass('active')).trigger('change')
fat's avatar
fat committed
226
    }
227

228
    if (changed) this.$element.toggleClass('active')
229
230
231
  }


fat's avatar
fat committed
232
233
  // BUTTON PLUGIN DEFINITION
  // ========================
234

Mark Otto's avatar
Mark Otto committed
235
  function Plugin(option) {
236
    return this.each(function () {
fat's avatar
fat committed
237
      var $this   = $(this)
fat's avatar
fat committed
238
      var data    = $this.data('bs.button')
fat's avatar
fat committed
239
240
      var options = typeof option == 'object' && option

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

243
244
245
246
247
      if (option == 'toggle') data.toggle()
      else if (option) data.setState(option)
    })
  }

Mark Otto's avatar
Mark Otto committed
248
249
250
  var old = $.fn.button

  $.fn.button             = Plugin
251
252
253
  $.fn.button.Constructor = Button


fat's avatar
fat committed
254
255
  // BUTTON NO CONFLICT
  // ==================
256
257
258
259
260
261
262

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


fat's avatar
fat committed
263
264
  // BUTTON DATA-API
  // ===============
265

Chris Rebert's avatar
Chris Rebert committed
266
  $(document).on('click.bs.button.data-api', '[data-toggle^="button"]', function (e) {
267
268
    var $btn = $(e.target)
    if (!$btn.hasClass('btn')) $btn = $btn.closest('.btn')
Mark Otto's avatar
Mark Otto committed
269
    Plugin.call($btn, 'toggle')
270
    e.preventDefault()
271
272
  })

Mark Otto's avatar
grunt    
Mark Otto committed
273
});
274

275
/* ========================================================================
Mark Otto's avatar
Mark Otto committed
276
 * Bootstrap: carousel.js v3.1.1
Mark Otto's avatar
Mark Otto committed
277
 * http://getbootstrap.com/javascript/#carousel
278
 * ========================================================================
279
 * Copyright 2011-2014 Twitter, Inc.
280
 * Licensed under MIT (https://github.com/twbs/bootstrap/blob/master/LICENSE)
281
 * ======================================================================== */
282
283


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

289
  'use strict';
290

fat's avatar
fat committed
291
292
  // CAROUSEL CLASS DEFINITION
  // =========================
293
294

  var Carousel = function (element, options) {
fat's avatar
fat committed
295
    this.$element    = $(element)
fat's avatar
fat committed
296
    this.$indicators = this.$element.find('.carousel-indicators')
fat's avatar
fat committed
297
298
299
300
301
302
303
    this.options     = options
    this.paused      =
    this.sliding     =
    this.interval    =
    this.$active     =
    this.$items      = null

304
305
306
307
308
    this.options.pause == 'hover' && this.$element
      .on('mouseenter', $.proxy(this.pause, this))
      .on('mouseleave', $.proxy(this.cycle, this))
  }

Mark Otto's avatar
grunt    
Mark Otto committed
309
310
  Carousel.VERSION  = '3.1.1'

fat's avatar
fat committed
311
  Carousel.DEFAULTS = {
Mark Otto's avatar
Mark Otto committed
312
313
314
    interval: 5000,
    pause: 'hover',
    wrap: true
fat's avatar
fat committed
315
  }
316

XhmikosR's avatar
XhmikosR committed
317
  Carousel.prototype.cycle = function (e) {
fat's avatar
fat committed
318
    e || (this.paused = false)
319

fat's avatar
fat committed
320
    this.interval && clearInterval(this.interval)
fat's avatar
fat committed
321

fat's avatar
fat committed
322
323
324
    this.options.interval
      && !this.paused
      && (this.interval = setInterval($.proxy(this.next, this), this.options.interval))
325

fat's avatar
fat committed
326
327
    return this
  }
328

Mark Otto's avatar
grunt    
Mark Otto committed
329
330
331
  Carousel.prototype.getItemIndex = function (item) {
    this.$items = item.parent().children('.item')
    return this.$items.index(item || this.$active)
fat's avatar
fat committed
332
  }
333

fat's avatar
fat committed
334
335
  Carousel.prototype.to = function (pos) {
    var that        = this
Mark Otto's avatar
grunt    
Mark Otto committed
336
    var activeIndex = this.getItemIndex(this.$active = this.$element.find('.item.active'))
337

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

Mark Otto's avatar
Mark Otto committed
340
    if (this.sliding)       return this.$element.one('slid.bs.carousel', function () { that.to(pos) }) // yes, "slid"
fat's avatar
fat committed
341
342
343
344
    if (activeIndex == pos) return this.pause().cycle()

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

fat's avatar
fat committed
346
347
348
  Carousel.prototype.pause = function (e) {
    e || (this.paused = true)

349
    if (this.$element.find('.next, .prev').length && $.support.transition) {
fat's avatar
fat committed
350
351
      this.$element.trigger($.support.transition.end)
      this.cycle(true)
352
353
    }

fat's avatar
fat committed
354
    this.interval = clearInterval(this.interval)
355

fat's avatar
fat committed
356
357
    return this
  }
358

fat's avatar
fat committed
359
360
361
362
  Carousel.prototype.next = function () {
    if (this.sliding) return
    return this.slide('next')
  }
363

fat's avatar
fat committed
364
365
366
367
  Carousel.prototype.prev = function () {
    if (this.sliding) return
    return this.slide('prev')
  }
368

fat's avatar
fat committed
369
370
371
372
373
374
375
  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
376

Jacob Thornton's avatar
Jacob Thornton committed
377
378
379
380
381
    if (!$next.length) {
      if (!this.options.wrap) return
      $next = this.$element.find('.item')[fallback]()
    }

XhmikosR's avatar
XhmikosR committed
382
    if ($next.hasClass('active')) return (this.sliding = false)
fat's avatar
fat committed
383

Mark Otto's avatar
Mark Otto committed
384
    var relatedTarget = $next[0]
XhmikosR's avatar
XhmikosR committed
385
386
387
388
    var slideEvent = $.Event('slide.bs.carousel', {
      relatedTarget: relatedTarget,
      direction: direction
    })
Mark Otto's avatar
Mark Otto committed
389
390
    this.$element.trigger(slideEvent)
    if (slideEvent.isDefaultPrevented()) return
391

392
393
394
    this.sliding = true

    isCycling && this.pause()
fat's avatar
fat committed
395
396
397

    if (this.$indicators.length) {
      this.$indicators.find('.active').removeClass('active')
Mark Otto's avatar
grunt    
Mark Otto committed
398
399
      var $nextIndicator = $(this.$indicators.children()[this.getItemIndex($next)])
      $nextIndicator && $nextIndicator.addClass('active')
fat's avatar
fat committed
400
401
    }

Mark Otto's avatar
Mark Otto committed
402
    var slidEvent = $.Event('slid.bs.carousel', { relatedTarget: relatedTarget, direction: direction }) // yes, "slid"
fat's avatar
fat committed
403
404
405
406
407
    if ($.support.transition && this.$element.hasClass('slide')) {
      $next.addClass(type)
      $next[0].offsetWidth // force reflow
      $active.addClass(direction)
      $next.addClass(direction)
Jacob Thornton's avatar
Jacob Thornton committed
408
      $active
409
410
411
412
        .one($.support.transition.end, function () {
          $next.removeClass([type, direction].join(' ')).addClass('active')
          $active.removeClass(['active', direction].join(' '))
          that.sliding = false
XhmikosR's avatar
XhmikosR committed
413
414
415
          setTimeout(function () {
            that.$element.trigger(slidEvent)
          }, 0)
416
        })
Mark Otto's avatar
Mark Otto committed
417
        .emulateTransitionEnd($active.css('transition-duration').slice(0, -1) * 1000)
fat's avatar
fat committed
418
419
420
421
    } else {
      $active.removeClass('active')
      $next.addClass('active')
      this.sliding = false
Mark Otto's avatar
Mark Otto committed
422
      this.$element.trigger(slidEvent)
423
424
    }

fat's avatar
fat committed
425
426
427
    isCycling && this.cycle()

    return this
428
429
430
  }


fat's avatar
fat committed
431
432
  // CAROUSEL PLUGIN DEFINITION
  // ==========================
433

Mark Otto's avatar
Mark Otto committed
434
  function Plugin(option) {
435
    return this.each(function () {
fat's avatar
fat committed
436
      var $this   = $(this)
Mark Otto's avatar
Mark Otto committed
437
      var data    = $this.data('bs.carousel')
Jacob Thornton's avatar
Jacob Thornton committed
438
      var options = $.extend({}, Carousel.DEFAULTS, $this.data(), typeof option == 'object' && option)
fat's avatar
fat committed
439
440
      var action  = typeof option == 'string' ? option : options.slide

Mark Otto's avatar
Mark Otto committed
441
      if (!data) $this.data('bs.carousel', (data = new Carousel(this, options)))
442
      if (typeof option == 'number') data.to(option)
Jacob Thornton's avatar
Jacob Thornton committed
443
      else if (action) data[action]()
Mark Otto's avatar
Mark Otto committed
444
      else if (options.interval) data.pause().cycle()
445
446
447
    })
  }

Mark Otto's avatar
Mark Otto committed
448
449
450
  var old = $.fn.carousel

  $.fn.carousel             = Plugin
451
452
453
  $.fn.carousel.Constructor = Carousel


fat's avatar
fat committed
454
455
  // CAROUSEL NO CONFLICT
  // ====================
456
457
458
459
460
461

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

fat's avatar
fat committed
462

fat's avatar
fat committed
463
464
  // CAROUSEL DATA-API
  // =================
465

466
  $(document).on('click.bs.carousel.data-api', '[data-slide], [data-slide-to]', function (e) {
XhmikosR's avatar
XhmikosR committed
467
468
    var href
    var $this   = $(this)
fat's avatar
fat committed
469
470
    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
471
472
    var slideIndex = $this.attr('data-slide-to')
    if (slideIndex) options.interval = false
473

Mark Otto's avatar
Mark Otto committed
474
    Plugin.call($target, options)
475

XhmikosR's avatar
XhmikosR committed
476
    if (slideIndex) {
fat's avatar
fat committed
477
      $target.data('bs.carousel').to(slideIndex)
478
479
    }

480
    e.preventDefault()
481
482
  })

fat's avatar
fat committed
483
484
485
  $(window).on('load', function () {
    $('[data-ride="carousel"]').each(function () {
      var $carousel = $(this)
Mark Otto's avatar
Mark Otto committed
486
      Plugin.call($carousel, $carousel.data())
fat's avatar
fat committed
487
488
489
    })
  })

Mark Otto's avatar
grunt    
Mark Otto committed
490
});
491

492
/* ========================================================================
Mark Otto's avatar
Mark Otto committed
493
 * Bootstrap: collapse.js v3.1.1
Mark Otto's avatar
Mark Otto committed
494
 * http://getbootstrap.com/javascript/#collapse
495
 * ========================================================================
496
 * Copyright 2011-2014 Twitter, Inc.
497
 * Licensed under MIT (https://github.com/twbs/bootstrap/blob/master/LICENSE)
498
 * ======================================================================== */
499
500


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

506
  'use strict';
507

508
509
  // COLLAPSE PUBLIC CLASS DEFINITION
  // ================================
510
511

  var Collapse = function (element, options) {
512
513
514
    this.$element      = $(element)
    this.options       = $.extend({}, Collapse.DEFAULTS, options)
    this.transitioning = null
515

516
517
518
519
    if (this.options.parent) this.$parent = $(this.options.parent)
    if (this.options.toggle) this.toggle()
  }

Mark Otto's avatar
grunt    
Mark Otto committed
520
521
  Collapse.VERSION  = '3.1.1'

522
523
524
  Collapse.DEFAULTS = {
    toggle: true
  }
525

526
527
528
  Collapse.prototype.dimension = function () {
    var hasWidth = this.$element.hasClass('width')
    return hasWidth ? 'width' : 'height'
529
530
  }

531
532
  Collapse.prototype.show = function () {
    if (this.transitioning || this.$element.hasClass('in')) return
533

fat's avatar
fat committed
534
535
536
537
    var startEvent = $.Event('show.bs.collapse')
    this.$element.trigger(startEvent)
    if (startEvent.isDefaultPrevented()) return

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

540
    if (actives && actives.length) {
fat's avatar
fat committed
541
      var hasData = actives.data('bs.collapse')
542
      if (hasData && hasData.transitioning) return
Mark Otto's avatar
Mark Otto committed
543
      Plugin.call(actives, 'hide')
fat's avatar
fat committed
544
      hasData || actives.data('bs.collapse', null)
545
546
    }

547
548
549
550
    var dimension = this.dimension()

    this.$element
      .removeClass('collapse')
XhmikosR's avatar
XhmikosR committed
551
      .addClass('collapsing')[dimension](0)
552
553
554

    this.transitioning = 1

fat's avatar
fat committed
555
    var complete = function (e) {
Mark Otto's avatar
Mark Otto committed
556
557
558
559
560
      if (e && e.target != this.$element[0]) {
        this.$element
          .one($.support.transition.end, $.proxy(complete, this))
        return
      }
561
562
      this.$element
        .removeClass('collapsing')
Chris Rebert's avatar
Chris Rebert committed
563
        .addClass('collapse in')[dimension]('')
564
      this.transitioning = 0
XhmikosR's avatar
XhmikosR committed
565
566
567
      this.$element
        .off($.support.transition.end + '.bs.collapse')
        .trigger('shown.bs.collapse')
568
569
570
571
572
    }

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

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

574
    this.$element
XhmikosR's avatar
XhmikosR committed
575
      .on($.support.transition.end + '.bs.collapse', $.proxy(complete, this))
XhmikosR's avatar
XhmikosR committed
576
      .emulateTransitionEnd(350)[dimension](this.$element[0][scrollSize])
577
  }
578

579
580
  Collapse.prototype.hide = function () {
    if (this.transitioning || !this.$element.hasClass('in')) return
fat's avatar
fat committed
581
582
583
584
585

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

586
    var dimension = this.dimension()
587

XhmikosR's avatar
XhmikosR committed
588
    this.$element[dimension](this.$element[dimension]())[0].offsetHeight
589

590
    this.$element
591
      .addClass('collapsing')
592
      .removeClass('collapse')
593
      .removeClass('in')
594

595
    this.transitioning = 1
596

fat's avatar
fat committed
597
    var complete = function (e) {
Mark Otto's avatar
Mark Otto committed
598
599
600
601
602
      if (e && e.target != this.$element[0]) {
        this.$element
          .one($.support.transition.end, $.proxy(complete, this))
        return
      }
603
604
605
606
607
      this.transitioning = 0
      this.$element
        .trigger('hidden.bs.collapse')
        .removeClass('collapsing')
        .addClass('collapse')
608
609
    }

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

612
613
614
615
    this.$element
      [dimension](0)
      .one($.support.transition.end, $.proxy(complete, this))
      .emulateTransitionEnd(350)
616
  }
617

618
619
  Collapse.prototype.toggle = function () {
    this[this.$element.hasClass('in') ? 'hide' : 'show']()
620
621
622
  }


623
624
  // COLLAPSE PLUGIN DEFINITION
  // ==========================
625

Mark Otto's avatar
Mark Otto committed
626
  function Plugin(option) {
627
    return this.each(function () {
628
      var $this   = $(this)
fat's avatar
fat committed
629
      var data    = $this.data('bs.collapse')
630
631
      var options = $.extend({}, Collapse.DEFAULTS, $this.data(), typeof option == 'object' && option)

632
      if (!data && options.toggle && option == 'show') option = !option
fat's avatar
fat committed
633
      if (!data) $this.data('bs.collapse', (data = new Collapse(this, options)))
634
635
636
637
      if (typeof option == 'string') data[option]()
    })
  }

Mark Otto's avatar
Mark Otto committed
638
639
640
  var old = $.fn.collapse

  $.fn.collapse             = Plugin
641
642
643
  $.fn.collapse.Constructor = Collapse


644
645
  // COLLAPSE NO CONFLICT
  // ====================
646

647
648
649
650
651
652
  $.fn.collapse.noConflict = function () {
    $.fn.collapse = old
    return this
  }


653
654
  // COLLAPSE DATA-API
  // =================
655

Mark Otto's avatar
grunt    
Mark Otto committed
656
  $(document).on('click.bs.collapse.data-api', '[data-toggle="collapse"]', function (e) {
XhmikosR's avatar
XhmikosR committed
657
658
    var href
    var $this   = $(this)
659
    var target  = $this.attr('data-target')
660
661
        || e.preventDefault()
        || (href = $this.attr('href')) && href.replace(/.*(?=#[^\s]+$)/, '') //strip for ie7
662
663
664
665
    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
666
    var $parent = parent && $(parent)
667

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

Mark Otto's avatar
Mark Otto committed
673
    Plugin.call($target, option)
674
675
  })

Mark Otto's avatar
grunt    
Mark Otto committed
676
});
677

678
/* ========================================================================
Mark Otto's avatar
Mark Otto committed
679
 * Bootstrap: dropdown.js v3.1.1
Mark Otto's avatar
Mark Otto committed
680
 * http://getbootstrap.com/javascript/#dropdowns
681
 * ========================================================================
682
 * Copyright 2011-2014 Twitter, Inc.
683
 * Licensed under MIT (https://github.com/twbs/bootstrap/blob/master/LICENSE)
684
 * ======================================================================== */
685
686


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

692
  'use strict';
693

694
695
  // DROPDOWN CLASS DEFINITION
  // =========================
696

697
  var backdrop = '.dropdown-backdrop'
Mark Otto's avatar
grunt    
Mark Otto committed
698
  var toggle   = '[data-toggle="dropdown"]'
699
  var Dropdown = function (element) {
700
    $(element).on('click.bs.dropdown', this.toggle)
701
  }
702

Mark Otto's avatar
grunt    
Mark Otto committed
703
704
  Dropdown.VERSION = '3.1.1'

705
706
  Dropdown.prototype.toggle = function (e) {
    var $this = $(this)
707

708
    if ($this.is('.disabled, :disabled')) return
709

710
711
    var $parent  = getParent($this)
    var isActive = $parent.hasClass('open')
712

713
    clearMenus()
fat's avatar
fat committed
714

715
    if (!isActive) {
fat's avatar
fat committed
716
      if ('ontouchstart' in document.documentElement && !$parent.closest('.navbar-nav').length) {
Mark Otto's avatar
Mark Otto committed
717
        // if mobile we use a backdrop because click events don't delegate
Jacob Thornton's avatar
Jacob Thornton committed
718
        $('<div class="dropdown-backdrop"/>').insertAfter($(this)).on('click', clearMenus)
fat's avatar
fat committed
719
      }
720

721
722
      var relatedTarget = { relatedTarget: this }
      $parent.trigger(e = $.Event('show.bs.dropdown', relatedTarget))
723
724
725

      if (e.isDefaultPrevented()) return

Mark Otto's avatar
Mark Otto committed
726
727
      $this.trigger('focus')

728
729
      $parent
        .toggleClass('open')
730
        .trigger('shown.bs.dropdown', relatedTarget)
fat's avatar
rebuild    
fat committed
731
    }
732

733
734
    return false
  }
735

736
737
  Dropdown.prototype.keydown = function (e) {
    if (!/(38|40|27)/.test(e.keyCode)) return
738

739
    var $this = $(this)
740

741
742
    e.preventDefault()
    e.stopPropagation()
743

744
    if ($this.is('.disabled, :disabled')) return
745

746
747
    var $parent  = getParent($this)
    var isActive = $parent.hasClass('open')
748

749
    if (!isActive || (isActive && e.keyCode == 27)) {
750
751
      if (e.which == 27) $parent.find(toggle).trigger('focus')
      return $this.trigger('click')
752
    }
753

fat's avatar
fat committed
754
    var desc = ' li:not(.divider):visible a'
Mark Otto's avatar
grunt    
Mark Otto committed
755
    var $items = $parent.find('[role="menu"]' + desc + ', [role="listbox"]' + desc)
756

757
    if (!$items.length) return
758

759
    var index = $items.index($items.filter(':focus'))
760

761
762
    if (e.keyCode == 38 && index > 0)                 index--                        // up
    if (e.keyCode == 40 && index < $items.length - 1) index++                        // down
Mark Otto's avatar
Mark Otto committed
763
    if (!~index)                                      index = 0
764

765
    $items.eq(index).trigger('focus')
766
767
  }

768
  function clearMenus(e) {
Chris Rebert's avatar
Chris Rebert committed
769
    if (e && e.which === 3) return
770
    $(backdrop).remove()
771
    $(toggle).each(function () {
772
      var $parent = getParent($(this))
773
      var relatedTarget = { relatedTarget: this }
774
      if (!$parent.hasClass('open')) return
775
      $parent.trigger(e = $.Event('hide.bs.dropdown', relatedTarget))
776
      if (e.isDefaultPrevented()) return
777
      $parent.removeClass('open').trigger('hidden.bs.dropdown', relatedTarget)
778
    })
779
780
781
782
783
784
785
  }

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

    if (!selector) {
      selector = $this.attr('href')
786
      selector = selector && /#[A-Za-z]/.test(selector) && selector.replace(/.*(?=#[^\s]*$)/, '') //strip for ie7
787
788
    }

789
    var $parent = selector && $(selector)
790

791
    return $parent && $parent.length ? $parent : $this.parent()
792
793
794
  }


795
796
  // DROPDOWN PLUGIN DEFINITION
  // ==========================
797

Mark Otto's avatar
Mark Otto committed
798
  function Plugin(option) {
799
800
    return this.each(function () {
      var $this = $(this)
801
      var data  = $this.data('bs.dropdown')
802

803
      if (!data) $this.data('bs.dropdown', (data = new Dropdown(this)))
804
805
806
807
      if (typeof option == 'string') data[option].call($this)
    })
  }

Mark Otto's avatar
Mark Otto committed
808
809
810
  var old = $.fn.dropdown

  $.fn.dropdown             = Plugin
811
812
813
  $.fn.dropdown.Constructor = Dropdown


814
815
  // DROPDOWN NO CONFLICT
  // ====================
816
817
818
819
820
821
822

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


823
824
825
  // APPLY TO STANDARD DROPDOWN ELEMENTS
  // ===================================

826
  $(document)
827
828
    .on('click.bs.dropdown.data-api', clearMenus)
    .on('click.bs.dropdown.data-api', '.dropdown form', function (e) { e.stopPropagation() })
Mark Otto's avatar
Mark Otto committed
829
    .on('click.bs.dropdown.data-api', toggle, Dropdown.prototype.toggle)
Mark Otto's avatar
grunt    
Mark Otto committed
830
    .on('keydown.bs.dropdown.data-api', toggle + ', [role="menu"], [role="listbox"]', Dropdown.prototype.keydown)
831

Mark Otto's avatar
grunt    
Mark Otto committed
832
});
833

834
/* ========================================================================
Mark Otto's avatar
Mark Otto committed
835
 * Bootstrap: modal.js v3.1.1
Mark Otto's avatar
Mark Otto committed
836
 * http://getbootstrap.com/javascript/#modals
837
 * ========================================================================
838
 * Copyright 2011-2014 Twitter, Inc.
839
 * Licensed under MIT (https://github.com/twbs/bootstrap/blob/master/LICENSE)
840
 * ======================================================================== */
841
842


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

848
  'use strict';
849

fat's avatar
fat committed
850
851
  // MODAL CLASS DEFINITION
  // ======================
852

Jacob Thornton's avatar
Jacob Thornton committed
853
  var Modal = function (element, options) {
854
855
856
857
858
859
    this.options        = options
    this.$body          = $(document.body)
    this.$element       = $(element)
    this.$backdrop      =
    this.isShown        = null
    this.scrollbarWidth = 0
860

861
862
863
864
865
866
867
    if (this.options.remote) {
      this.$element
        .find('.modal-content')
        .load(this.options.remote, $.proxy(function () {
          this.$element.trigger('loaded.bs.modal')
        }, this))
    }
fat's avatar
fat committed
868
  }
869

Mark Otto's avatar
grunt    
Mark Otto committed
870
871
  Modal.VERSION  = '3.1.1'

fat's avatar
fat committed
872
  Modal.DEFAULTS = {
Mark Otto's avatar
Mark Otto committed
873
874
875
    backdrop: true,
    keyboard: true,
    show: true
fat's avatar
fat committed
876
  }
877

Jacob Thornton's avatar
Jacob Thornton committed
878
  Modal.prototype.toggle = function (_relatedTarget) {
879
    return this.isShown ? this.hide() : this.show(_relatedTarget)
fat's avatar
fat committed
880
  }
881

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

fat's avatar
fat committed
886
    this.$element.trigger(e)
887

fat's avatar
fat committed
888
    if (this.isShown || e.isDefaultPrevented()) return
889

fat's avatar
fat committed
890
    this.isShown = true
891

892
    this.checkScrollbar()
fat's avatar
build    
fat committed
893
894
895
    this.$body.addClass('modal-open')

    this.setScrollbar()
fat's avatar
fat committed
896
    this.escape()
897

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

fat's avatar
fat committed
900
901
    this.backdrop(function () {
      var transition = $.support.transition && that.$element.hasClass('fade')
902

fat's avatar
fat committed
903
      if (!that.$element.parent().length) {
fat's avatar
build    
fat committed
904
        that.$element.appendTo(that.$body) // don't move modals dom position
fat's avatar
fat committed
905
      }
906

907
908
909
      that.$element
        .show()
        .scrollTop(0)
910

fat's avatar
fat committed
911
912
913
      if (transition) {
        that.$element[0].offsetWidth // force reflow
      }
914

fat's avatar
fat committed
915
916
917
      that.$element
        .addClass('in')
        .attr('aria-hidden', false)
918

fat's avatar
fat committed
919
      that.enforceFocus()
920

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

fat's avatar
fat committed
923
      transition ?
fat's avatar
fat committed
924
        that.$element.find('.modal-dialog') // wait for modal to slide in
925
          .one($.support.transition.end, function () {
926
            that.$element.trigger('focus').trigger(e)
927
928
          })
          .emulateTransitionEnd(300) :
929
        that.$element.trigger('focus').trigger(e)
fat's avatar
fat committed
930
931
    })
  }
932

fat's avatar
fat committed
933
  Modal.prototype.hide = function (e) {
fat's avatar
fat committed
934
    if (e) e.preventDefault()
935

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

fat's avatar
fat committed
938
    this.$element.trigger(e)
939

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

fat's avatar
fat committed
942
    this.isShown = false
943

fat's avatar
build    
fat committed
944
945
946
    this.$body.removeClass('modal-open')

    this.resetScrollbar()
fat's avatar
fat committed
947
    this.escape()
948

Mark Otto's avatar
Mark Otto committed
949
    $(document).off('focusin.bs.modal')
950

fat's avatar
fat committed
951
952
953
    this.$element
      .removeClass('in')
      .attr('aria-hidden', true)
954
      .off('click.dismiss.bs.modal')
955

fat's avatar
fat committed
956
    $.support.transition && this.$element.hasClass('fade') ?
957
958
959
      this.$element
        .one($.support.transition.end, $.proxy(this.hideModal, this))
        .emulateTransitionEnd(300) :
fat's avatar
fat committed
960
961
      this.hideModal()
  }
962

fat's avatar
fat committed
963
  Modal.prototype.enforceFocus = function () {
Jacob Thornton's avatar
Jacob Thornton committed
964
965
    $(document)
      .off('focusin.bs.modal') // guard against infinite focus loop
fat's avatar
fat committed
966
967
      .on('focusin.bs.modal', $.proxy(function (e) {
        if (this.$element[0] !== e.target && !this.$element.has(e.target).length) {
968
          this.$element.trigger('focus')
fat's avatar
fat committed
969
970
        }
      }, this))
fat's avatar
fat committed
971
  }
972

fat's avatar
fat committed
973
974
  Modal.prototype.escape = function () {
    if (this.isShown && this.options.keyboard) {
fat's avatar
fat committed
975
      this.$element.on('keyup.dismiss.bs.modal', $.proxy(function (e) {
fat's avatar
fat committed
976
        e.which == 27 && this.hide()
fat's avatar
fat committed
977
      }, this))
fat's avatar
fat committed
978
    } else if (!this.isShown) {
Mark Otto's avatar
Mark Otto committed
979
      this.$element.off('keyup.dismiss.bs.modal')
fat's avatar
fat committed
980
981
    }
  }
982

fat's avatar
fat committed
983
984
985
986
  Modal.prototype.hideModal = function () {
    var that = this
    this.$element.hide()
    this.backdrop(function () {
Mark Otto's avatar
Mark Otto committed
987
      that.$element.trigger('hidden.bs.modal')
fat's avatar
fat committed
988
989
    })
  }
990

fat's avatar
fat committed
991
992
993
994
  Modal.prototype.removeBackdrop = function () {
    this.$backdrop && this.$backdrop.remove()
    this.$backdrop = null
  }
995

fat's avatar
fat committed
996
  Modal.prototype.backdrop = function (callback) {
Chris Rebert's avatar
Chris Rebert committed
997
    var that = this
fat's avatar
fat committed
998
    var animate = this.$element.hasClass('fade') ? 'fade' : ''
999

fat's avatar
fat committed
1000
    if (this.isShown && this.options.backdrop) {
For faster browsing, not all history is shown. View entire blame