bootstrap.js 67.3 KB
Newer Older
1
/*!
Mark Otto's avatar
grunt    
Mark Otto committed
2
 * Bootstrap v4.0.0-alpha (http://getbootstrap.com)
Mark Otto's avatar
Mark Otto committed
3
 * Copyright 2011-2015 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

Heinrich Fenkart's avatar
grunt    
Heinrich Fenkart committed
7
8
9
10
11
12
13
14
15
16
if (typeof jQuery === 'undefined') {
  throw new Error('Bootstrap\'s JavaScript requires jQuery')
}

+function ($) {
  var version = $.fn.jquery.split(' ')[0].split('.')
  if ((version[0] < 2 && version[1] < 9) || (version[0] == 1 && version[1] == 9 && version[2] < 1)) {
    throw new Error('Bootstrap\'s JavaScript requires jQuery version 1.9.1 or higher')
  }
}(jQuery);
17

fat's avatar
fat committed
18
19
20
21
22
23
24
/* ========================================================================
 * Bootstrap: transition.js v3.3.4
 * http://getbootstrap.com/javascript/#transitions
 * ========================================================================
 * Copyright 2011-2015 Twitter, Inc.
 * Licensed under MIT (https://github.com/twbs/bootstrap/blob/master/LICENSE)
 * ======================================================================== */
25
26


fat's avatar
fat committed
27
28
+function ($) {
  'use strict';
29

fat's avatar
fat committed
30
31
  // CSS TRANSITION SUPPORT (Shoutout: http://www.modernizr.com/)
  // ============================================================
32

fat's avatar
fat committed
33
34
  function transitionEnd() {
    var el = document.createElement('bootstrap')
35

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

fat's avatar
fat committed
43
44
45
46
47
    for (var name in transEndEventNames) {
      if (el.style[name] !== undefined) {
        return { end: transEndEventNames[name] }
      }
    }
fat's avatar
fat committed
48

fat's avatar
fat committed
49
    return false // explicit for ie8 (  ._.)
XhmikosR's avatar
XhmikosR committed
50
  }
51

fat's avatar
fat committed
52
53
54
55
56
57
58
59
  // 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
fat's avatar
fat committed
60
  }
61

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

fat's avatar
fat committed
65
    if (!$.support.transition) return
66

fat's avatar
fat committed
67
68
69
70
71
72
    $.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)
      }
fat's avatar
fat committed
73
    }
fat's avatar
fat committed
74
  })
fat's avatar
fat committed
75

fat's avatar
fat committed
76
}(jQuery);
fat's avatar
fat committed
77

fat's avatar
fat committed
78
79
80
/* ========================================================================
 * Bootstrap: alert.js v3.3.4
 * http://getbootstrap.com/javascript/#alerts
81
 * ========================================================================
Bootstrap's Grunt bot's avatar
Bootstrap's Grunt bot committed
82
 * Copyright 2011-2015 Twitter, Inc.
83
 * Licensed under MIT (https://github.com/twbs/bootstrap/blob/master/LICENSE)
fat's avatar
fat committed
84
 * ======================================================================== */
fat's avatar
fat committed
85
86


fat's avatar
fat committed
87
88
+function ($) {
  'use strict';
fat's avatar
fat committed
89

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

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

fat's avatar
fat committed
98
  Alert.VERSION = '3.3.4'
fat's avatar
fat committed
99

fat's avatar
fat committed
100
  Alert.TRANSITION_DURATION = 150
fat's avatar
fat committed
101

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

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

fat's avatar
fat committed
111
    var $parent = $(selector)
fat's avatar
fat committed
112

fat's avatar
fat committed
113
    if (e) e.preventDefault()
fat's avatar
fat committed
114

fat's avatar
fat committed
115
116
117
    if (!$parent.length) {
      $parent = $this.closest('.alert')
    }
fat's avatar
fat committed
118

fat's avatar
fat committed
119
    $parent.trigger(e = $.Event('close.bs.alert'))
fat's avatar
fat committed
120

fat's avatar
fat committed
121
    if (e.isDefaultPrevented()) return
fat's avatar
fat committed
122

fat's avatar
fat committed
123
    $parent.removeClass('in')
fat's avatar
fat committed
124

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

fat's avatar
fat committed
130
131
132
133
134
135
    $.support.transition && $parent.hasClass('fade') ?
      $parent
        .one('bsTransitionEnd', removeElement)
        .emulateTransitionEnd(Alert.TRANSITION_DURATION) :
      removeElement()
  }
fat's avatar
fat committed
136
137


fat's avatar
fat committed
138
139
  // ALERT PLUGIN DEFINITION
  // =======================
fat's avatar
fat committed
140

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

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

fat's avatar
fat committed
151
  var old = $.fn.alert
fat's avatar
fat committed
152

fat's avatar
fat committed
153
154
  $.fn.alert             = Plugin
  $.fn.alert.Constructor = Alert
fat's avatar
fat committed
155
156


fat's avatar
fat committed
157
158
  // ALERT NO CONFLICT
  // =================
Mark Otto's avatar
grunt    
Mark Otto committed
159

fat's avatar
fat committed
160
161
162
  $.fn.alert.noConflict = function () {
    $.fn.alert = old
    return this
XhmikosR's avatar
XhmikosR committed
163
  }
164
165


fat's avatar
fat committed
166
167
  // ALERT DATA-API
  // ==============
fat's avatar
fat committed
168

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

fat's avatar
fat committed
171
}(jQuery);
172

fat's avatar
fat committed
173
174
175
176
177
178
179
/* ========================================================================
 * Bootstrap: button.js v3.3.4
 * http://getbootstrap.com/javascript/#buttons
 * ========================================================================
 * Copyright 2011-2015 Twitter, Inc.
 * Licensed under MIT (https://github.com/twbs/bootstrap/blob/master/LICENSE)
 * ======================================================================== */
Chris Rebert's avatar
Chris Rebert committed
180

Heinrich Fenkart's avatar
grunt    
Heinrich Fenkart committed
181

fat's avatar
fat committed
182
183
+function ($) {
  'use strict';
XhmikosR's avatar
XhmikosR committed
184

fat's avatar
fat committed
185
186
  // BUTTON PUBLIC CLASS DEFINITION
  // ==============================
XhmikosR's avatar
XhmikosR committed
187

fat's avatar
fat committed
188
189
190
191
  var Button = function (element, options) {
    this.$element  = $(element)
    this.options   = $.extend({}, Button.DEFAULTS, options)
    this.isLoading = false
fat's avatar
fat committed
192
193
  }

fat's avatar
fat committed
194
  Button.VERSION  = '3.3.4'
195

fat's avatar
fat committed
196
197
  Button.DEFAULTS = {
    loadingText: 'loading...'
XhmikosR's avatar
XhmikosR committed
198
  }
199

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

fat's avatar
fat committed
206
    state += 'Text'
207

fat's avatar
fat committed
208
    if (data.resetText == null) $el.data('resetText', $el[val]())
fat's avatar
fat committed
209

fat's avatar
fat committed
210
211
212
    // push to event loop to allow forms to submit
    setTimeout($.proxy(function () {
      $el[val](data[state] == null ? this.options[state] : data[state])
fat's avatar
fat committed
213

fat's avatar
fat committed
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
      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')) changed = false
        $parent.find('.active').removeClass('active')
        this.$element.addClass('active')
      } else if ($input.prop('type') == 'checkbox') {
        if (($input.prop('checked')) !== this.$element.hasClass('active')) changed = false
        this.$element.toggleClass('active')
      }
      $input.prop('checked', this.$element.hasClass('active'))
      if (changed) $input.trigger('change')
    } else {
      this.$element.attr('aria-pressed', !this.$element.hasClass('active'))
      this.$element.toggleClass('active')
    }
XhmikosR's avatar
XhmikosR committed
244
  }
245

fat's avatar
fat committed
246

fat's avatar
fat committed
247
248
  // BUTTON PLUGIN DEFINITION
  // ========================
fat's avatar
fat committed
249

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

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

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

fat's avatar
fat committed
263
  var old = $.fn.button
264

fat's avatar
fat committed
265
266
  $.fn.button             = Plugin
  $.fn.button.Constructor = Button
fat's avatar
fat committed
267
268


fat's avatar
fat committed
269
270
  // BUTTON NO CONFLICT
  // ==================
fat's avatar
fat committed
271

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


fat's avatar
fat committed
278
279
  // BUTTON DATA-API
  // ===============
fat's avatar
fat committed
280

fat's avatar
fat committed
281
282
283
284
285
286
287
288
289
290
  $(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')
      if (!($(e.target).is('input[type="radio"]') || $(e.target).is('input[type="checkbox"]'))) e.preventDefault()
    })
    .on('focus.bs.button.data-api blur.bs.button.data-api', '[data-toggle^="button"]', function (e) {
      $(e.target).closest('.btn').toggleClass('focus', /^focus(in)?$/.test(e.type))
    })
fat's avatar
fat committed
291

fat's avatar
fat committed
292
}(jQuery);
fat's avatar
fat committed
293

fat's avatar
fat committed
294
295
296
/* ========================================================================
 * Bootstrap: carousel.js v3.3.4
 * http://getbootstrap.com/javascript/#carousel
297
 * ========================================================================
Bootstrap's Grunt bot's avatar
Bootstrap's Grunt bot committed
298
 * Copyright 2011-2015 Twitter, Inc.
299
 * Licensed under MIT (https://github.com/twbs/bootstrap/blob/master/LICENSE)
fat's avatar
fat committed
300
 * ======================================================================== */
301
302


fat's avatar
fat committed
303
304
+function ($) {
  'use strict';
fat's avatar
fat committed
305

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

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

fat's avatar
fat committed
319
    this.options.keyboard && this.$element.on('keydown.bs.carousel', $.proxy(this.keydown, this))
fat's avatar
fat committed
320

fat's avatar
fat committed
321
322
323
324
    this.options.pause == 'hover' && !('ontouchstart' in document.documentElement) && this.$element
      .on('mouseenter.bs.carousel', $.proxy(this.pause, this))
      .on('mouseleave.bs.carousel', $.proxy(this.cycle, this))
  }
fat's avatar
fat committed
325

fat's avatar
fat committed
326
  Carousel.VERSION  = '3.3.4'
fat's avatar
fat committed
327

fat's avatar
fat committed
328
  Carousel.TRANSITION_DURATION = 600
XhmikosR's avatar
XhmikosR committed
329

fat's avatar
fat committed
330
331
332
333
334
335
  Carousel.DEFAULTS = {
    interval: 5000,
    pause: 'hover',
    wrap: true,
    keyboard: true
  }
fat's avatar
fat committed
336

fat's avatar
fat committed
337
338
339
340
341
342
  Carousel.prototype.keydown = function (e) {
    if (/input|textarea/i.test(e.target.tagName)) return
    switch (e.which) {
      case 37: this.prev(); break
      case 39: this.next(); break
      default: return
343
344
    }

fat's avatar
fat committed
345
346
    e.preventDefault()
  }
347

fat's avatar
fat committed
348
349
  Carousel.prototype.cycle = function (e) {
    e || (this.paused = false)
350

fat's avatar
fat committed
351
    this.interval && clearInterval(this.interval)
fat's avatar
fat committed
352

fat's avatar
fat committed
353
354
355
    this.options.interval
      && !this.paused
      && (this.interval = setInterval($.proxy(this.next, this), this.options.interval))
fat's avatar
fat committed
356

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

fat's avatar
fat committed
360
361
362
363
  Carousel.prototype.getItemIndex = function (item) {
    this.$items = item.parent().children('.item')
    return this.$items.index(item || this.$active)
  }
fat's avatar
fat committed
364

fat's avatar
fat committed
365
366
367
368
369
370
371
372
  Carousel.prototype.getItemForDirection = function (direction, active) {
    var activeIndex = this.getItemIndex(active)
    var willWrap = (direction == 'prev' && activeIndex === 0)
                || (direction == 'next' && activeIndex == (this.$items.length - 1))
    if (willWrap && !this.options.wrap) return active
    var delta = direction == 'prev' ? -1 : 1
    var itemIndex = (activeIndex + delta) % this.$items.length
    return this.$items.eq(itemIndex)
XhmikosR's avatar
XhmikosR committed
373
  }
374

fat's avatar
fat committed
375
376
377
  Carousel.prototype.to = function (pos) {
    var that        = this
    var activeIndex = this.getItemIndex(this.$active = this.$element.find('.item.active'))
Jacob Thornton's avatar
Jacob Thornton committed
378

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

fat's avatar
fat committed
381
382
    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
383

fat's avatar
fat committed
384
385
    return this.slide(pos > activeIndex ? 'next' : 'prev', this.$items.eq(pos))
  }
fat's avatar
fat committed
386

fat's avatar
fat committed
387
388
  Carousel.prototype.pause = function (e) {
    e || (this.paused = true)
fat's avatar
fat committed
389

fat's avatar
fat committed
390
391
392
393
    if (this.$element.find('.next, .prev').length && $.support.transition) {
      this.$element.trigger($.support.transition.end)
      this.cycle(true)
    }
fat's avatar
fat committed
394

fat's avatar
fat committed
395
    this.interval = clearInterval(this.interval)
396

fat's avatar
fat committed
397
    return this
XhmikosR's avatar
XhmikosR committed
398
  }
399

fat's avatar
fat committed
400
401
402
  Carousel.prototype.next = function () {
    if (this.sliding) return
    return this.slide('next')
fat's avatar
fat committed
403
  }
XhmikosR's avatar
XhmikosR committed
404

fat's avatar
fat committed
405
406
407
408
  Carousel.prototype.prev = function () {
    if (this.sliding) return
    return this.slide('prev')
  }
fat's avatar
fat committed
409

fat's avatar
fat committed
410
411
412
413
414
415
  Carousel.prototype.slide = function (type, next) {
    var $active   = this.$element.find('.item.active')
    var $next     = next || this.getItemForDirection(type, $active)
    var isCycling = this.interval
    var direction = type == 'next' ? 'left' : 'right'
    var that      = this
fat's avatar
fat committed
416

fat's avatar
fat committed
417
    if ($next.hasClass('active')) return (this.sliding = false)
fat's avatar
fat committed
418

fat's avatar
fat committed
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
    var relatedTarget = $next[0]
    var slideEvent = $.Event('slide.bs.carousel', {
      relatedTarget: relatedTarget,
      direction: direction
    })
    this.$element.trigger(slideEvent)
    if (slideEvent.isDefaultPrevented()) return

    this.sliding = true

    isCycling && this.pause()

    if (this.$indicators.length) {
      this.$indicators.find('.active').removeClass('active')
      var $nextIndicator = $(this.$indicators.children()[this.getItemIndex($next)])
      $nextIndicator && $nextIndicator.addClass('active')
    }

    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(Carousel.TRANSITION_DURATION)
    } else {
      $active.removeClass('active')
      $next.addClass('active')
      this.sliding = false
      this.$element.trigger(slidEvent)
    }
fat's avatar
fat committed
459

fat's avatar
fat committed
460
    isCycling && this.cycle()
fat's avatar
fat committed
461

fat's avatar
fat committed
462
    return this
XhmikosR's avatar
XhmikosR committed
463
  }
464
465


fat's avatar
fat committed
466
467
  // CAROUSEL PLUGIN DEFINITION
  // ==========================
468

fat's avatar
fat committed
469
470
471
472
473
474
  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
475

fat's avatar
fat committed
476
477
478
479
480
      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()
    })
fat's avatar
fat committed
481
  }
fat's avatar
fat committed
482

fat's avatar
fat committed
483
  var old = $.fn.carousel
484

fat's avatar
fat committed
485
486
  $.fn.carousel             = Plugin
  $.fn.carousel.Constructor = Carousel
487
488


fat's avatar
fat committed
489
490
  // CAROUSEL NO CONFLICT
  // ====================
491

fat's avatar
fat committed
492
493
494
  $.fn.carousel.noConflict = function () {
    $.fn.carousel = old
    return this
Heinrich Fenkart's avatar
grunt    
Heinrich Fenkart committed
495
  }
fat's avatar
fat committed
496
497


fat's avatar
fat committed
498
499
  // CAROUSEL DATA-API
  // =================
fat's avatar
fat committed
500

fat's avatar
fat committed
501
502
503
504
505
506
507
508
  var clickHandler = function (e) {
    var href
    var $this   = $(this)
    var $target = $($this.attr('data-target') || (href = $this.attr('href')) && href.replace(/.*(?=#[^\s]+$)/, '')) // strip for ie7
    if (!$target.hasClass('carousel')) return
    var options = $.extend({}, $target.data(), $this.data())
    var slideIndex = $this.attr('data-slide-to')
    if (slideIndex) options.interval = false
509

fat's avatar
fat committed
510
    Plugin.call($target, options)
511

fat's avatar
fat committed
512
513
514
    if (slideIndex) {
      $target.data('bs.carousel').to(slideIndex)
    }
515

fat's avatar
fat committed
516
    e.preventDefault()
fat's avatar
fat committed
517
  }
518

fat's avatar
fat committed
519
520
521
  $(document)
    .on('click.bs.carousel.data-api', '[data-slide]', clickHandler)
    .on('click.bs.carousel.data-api', '[data-slide-to]', clickHandler)
Mark Otto's avatar
grunt    
Mark Otto committed
522

fat's avatar
fat committed
523
524
525
526
527
528
  $(window).on('load', function () {
    $('[data-ride="carousel"]').each(function () {
      var $carousel = $(this)
      Plugin.call($carousel, $carousel.data())
    })
  })
529

fat's avatar
fat committed
530
}(jQuery);
Heinrich Fenkart's avatar
grunt    
Heinrich Fenkart committed
531

fat's avatar
fat committed
532
533
534
535
536
537
538
/* ========================================================================
 * Bootstrap: collapse.js v3.3.4
 * http://getbootstrap.com/javascript/#collapse
 * ========================================================================
 * Copyright 2011-2015 Twitter, Inc.
 * Licensed under MIT (https://github.com/twbs/bootstrap/blob/master/LICENSE)
 * ======================================================================== */
fat's avatar
fat committed
539

540

fat's avatar
fat committed
541
542
+function ($) {
  'use strict';
543

fat's avatar
fat committed
544
545
  // COLLAPSE PUBLIC CLASS DEFINITION
  // ================================
546

fat's avatar
fat committed
547
548
549
550
551
552
  var Collapse = function (element, options) {
    this.$element      = $(element)
    this.options       = $.extend({}, Collapse.DEFAULTS, options)
    this.$trigger      = $('[data-toggle="collapse"][href="#' + element.id + '"],' +
                           '[data-toggle="collapse"][data-target="#' + element.id + '"]')
    this.transitioning = null
fat's avatar
fat committed
553

fat's avatar
fat committed
554
555
556
557
    if (this.options.parent) {
      this.$parent = this.getParent()
    } else {
      this.addAriaAndCollapsedClass(this.$element, this.$trigger)
fat's avatar
fat committed
558
    }
559

fat's avatar
fat committed
560
561
    if (this.options.toggle) this.toggle()
  }
Heinrich Fenkart's avatar
grunt    
Heinrich Fenkart committed
562

fat's avatar
fat committed
563
  Collapse.VERSION  = '3.3.4'
564

fat's avatar
fat committed
565
  Collapse.TRANSITION_DURATION = 350
566

fat's avatar
fat committed
567
568
569
  Collapse.DEFAULTS = {
    toggle: true
  }
570

fat's avatar
fat committed
571
572
573
574
  Collapse.prototype.dimension = function () {
    var hasWidth = this.$element.hasClass('width')
    return hasWidth ? 'width' : 'height'
  }
575

fat's avatar
fat committed
576
577
  Collapse.prototype.show = function () {
    if (this.transitioning || this.$element.hasClass('in')) return
Heinrich Fenkart's avatar
grunt    
Heinrich Fenkart committed
578

fat's avatar
fat committed
579
580
    var activesData
    var actives = this.$parent && this.$parent.children('.panel').children('.in, .collapsing')
581

fat's avatar
fat committed
582
583
584
    if (actives && actives.length) {
      activesData = actives.data('bs.collapse')
      if (activesData && activesData.transitioning) return
Chris Rebert's avatar
Chris Rebert committed
585
    }
586

fat's avatar
fat committed
587
588
589
590
591
592
593
594
    var startEvent = $.Event('show.bs.collapse')
    this.$element.trigger(startEvent)
    if (startEvent.isDefaultPrevented()) return

    if (actives && actives.length) {
      Plugin.call(actives, 'hide')
      activesData || actives.data('bs.collapse', null)
    }
fat's avatar
fat committed
595

fat's avatar
fat committed
596
    var dimension = this.dimension()
fat's avatar
fat committed
597

fat's avatar
fat committed
598
599
600
601
    this.$element
      .removeClass('collapse')
      .addClass('collapsing')[dimension](0)
      .attr('aria-expanded', true)
602

fat's avatar
fat committed
603
604
605
    this.$trigger
      .removeClass('collapsed')
      .attr('aria-expanded', true)
606

fat's avatar
fat committed
607
    this.transitioning = 1
608

fat's avatar
fat committed
609
610
611
612
613
614
615
616
    var complete = function () {
      this.$element
        .removeClass('collapsing')
        .addClass('collapse in')[dimension]('')
      this.transitioning = 0
      this.$element
        .trigger('shown.bs.collapse')
    }
617

fat's avatar
fat committed
618
    if (!$.support.transition) return complete.call(this)
XhmikosR's avatar
XhmikosR committed
619

fat's avatar
fat committed
620
    var scrollSize = $.camelCase(['scroll', dimension].join('-'))
621

fat's avatar
fat committed
622
623
624
    this.$element
      .one('bsTransitionEnd', $.proxy(complete, this))
      .emulateTransitionEnd(Collapse.TRANSITION_DURATION)[dimension](this.$element[0][scrollSize])
fat's avatar
fat committed
625
  }
Heinrich Fenkart's avatar
grunt    
Heinrich Fenkart committed
626

fat's avatar
fat committed
627
628
  Collapse.prototype.hide = function () {
    if (this.transitioning || !this.$element.hasClass('in')) return
629

fat's avatar
fat committed
630
631
632
    var startEvent = $.Event('hide.bs.collapse')
    this.$element.trigger(startEvent)
    if (startEvent.isDefaultPrevented()) return
633

fat's avatar
fat committed
634
    var dimension = this.dimension()
635

fat's avatar
fat committed
636
    this.$element[dimension](this.$element[dimension]())[0].offsetHeight
637

fat's avatar
fat committed
638
639
640
641
    this.$element
      .addClass('collapsing')
      .removeClass('collapse in')
      .attr('aria-expanded', false)
642

fat's avatar
fat committed
643
644
645
    this.$trigger
      .addClass('collapsed')
      .attr('aria-expanded', false)
Heinrich Fenkart's avatar
grunt    
Heinrich Fenkart committed
646

fat's avatar
fat committed
647
    this.transitioning = 1
Heinrich Fenkart's avatar
grunt    
Heinrich Fenkart committed
648

fat's avatar
fat committed
649
650
651
652
653
654
655
656
657
658
659
660
661
662
    var complete = function () {
      this.transitioning = 0
      this.$element
        .removeClass('collapsing')
        .addClass('collapse')
        .trigger('hidden.bs.collapse')
    }

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

    this.$element
      [dimension](0)
      .one('bsTransitionEnd', $.proxy(complete, this))
      .emulateTransitionEnd(Collapse.TRANSITION_DURATION)
Heinrich Fenkart's avatar
grunt    
Heinrich Fenkart committed
663
664
  }

fat's avatar
fat committed
665
666
667
  Collapse.prototype.toggle = function () {
    this[this.$element.hasClass('in') ? 'hide' : 'show']()
  }
Heinrich Fenkart's avatar
grunt    
Heinrich Fenkart committed
668

fat's avatar
fat committed
669
670
671
672
673
674
675
676
677
  Collapse.prototype.getParent = function () {
    return $(this.options.parent)
      .find('[data-toggle="collapse"][data-parent="' + this.options.parent + '"]')
      .each($.proxy(function (i, element) {
        var $element = $(element)
        this.addAriaAndCollapsedClass(getTargetFromTrigger($element), $element)
      }, this))
      .end()
  }
Heinrich Fenkart's avatar
grunt    
Heinrich Fenkart committed
678

fat's avatar
fat committed
679
680
  Collapse.prototype.addAriaAndCollapsedClass = function ($element, $trigger) {
    var isOpen = $element.hasClass('in')
681

fat's avatar
fat committed
682
683
684
685
686
    $element.attr('aria-expanded', isOpen)
    $trigger
      .toggleClass('collapsed', !isOpen)
      .attr('aria-expanded', isOpen)
  }
687

fat's avatar
fat committed
688
689
690
691
  function getTargetFromTrigger($trigger) {
    var href
    var target = $trigger.attr('data-target')
      || (href = $trigger.attr('href')) && href.replace(/.*(?=#[^\s]+$)/, '') // strip for ie7
Mark Otto's avatar
Mark Otto committed
692

fat's avatar
fat committed
693
694
    return $(target)
  }
695
696


fat's avatar
fat committed
697
698
  // COLLAPSE PLUGIN DEFINITION
  // ==========================
699

fat's avatar
fat committed
700
701
702
703
704
  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)
705

fat's avatar
fat committed
706
707
708
709
710
      if (!data && options.toggle && /show|hide/.test(option)) options.toggle = false
      if (!data) $this.data('bs.collapse', (data = new Collapse(this, options)))
      if (typeof option == 'string') data[option]()
    })
  }
711

fat's avatar
fat committed
712
  var old = $.fn.collapse
713

fat's avatar
fat committed
714
715
  $.fn.collapse             = Plugin
  $.fn.collapse.Constructor = Collapse
716

XhmikosR's avatar
XhmikosR committed
717

fat's avatar
fat committed
718
719
  // COLLAPSE NO CONFLICT
  // ====================
Heinrich Fenkart's avatar
grunt    
Heinrich Fenkart committed
720

fat's avatar
fat committed
721
722
723
  $.fn.collapse.noConflict = function () {
    $.fn.collapse = old
    return this
fat's avatar
fat committed
724
  }
Heinrich Fenkart's avatar
grunt    
Heinrich Fenkart committed
725

fat's avatar
fat committed
726

fat's avatar
fat committed
727
728
  // COLLAPSE DATA-API
  // =================
729

fat's avatar
fat committed
730
731
  $(document).on('click.bs.collapse.data-api', '[data-toggle="collapse"]', function (e) {
    var $this   = $(this)
732

fat's avatar
fat committed
733
    if (!$this.attr('data-target')) e.preventDefault()
fat's avatar
fat committed
734

fat's avatar
fat committed
735
736
737
    var $target = getTargetFromTrigger($this)
    var data    = $target.data('bs.collapse')
    var option  = data ? 'toggle' : $this.data()
fat's avatar
fat committed
738

fat's avatar
fat committed
739
740
741
742
743
744
745
746
    Plugin.call($target, option)
  })

}(jQuery);

/* ========================================================================
 * Bootstrap: dropdown.js v3.3.4
 * http://getbootstrap.com/javascript/#dropdowns
747
 * ========================================================================
Bootstrap's Grunt bot's avatar
Bootstrap's Grunt bot committed
748
 * Copyright 2011-2015 Twitter, Inc.
749
 * Licensed under MIT (https://github.com/twbs/bootstrap/blob/master/LICENSE)
fat's avatar
fat committed
750
 * ======================================================================== */
Chris Rebert's avatar
Chris Rebert committed
751

Mark Otto's avatar
grunt    
Mark Otto committed
752

fat's avatar
fat committed
753
754
+function ($) {
  'use strict';
755

fat's avatar
fat committed
756
757
  // DROPDOWN CLASS DEFINITION
  // =========================
Mark Otto's avatar
grunt    
Mark Otto committed
758

fat's avatar
fat committed
759
760
761
762
763
  var backdrop = '.dropdown-backdrop'
  var toggle   = '[data-toggle="dropdown"]'
  var Dropdown = function (element) {
    $(element).on('click.bs.dropdown', this.toggle)
  }
764

fat's avatar
fat committed
765
  Dropdown.VERSION = '3.3.4'
766

fat's avatar
fat committed
767
768
  function getParent($this) {
    var selector = $this.attr('data-target')
769

fat's avatar
fat committed
770
771
772
773
    if (!selector) {
      selector = $this.attr('href')
      selector = selector && /#[A-Za-z]/.test(selector) && selector.replace(/.*(?=#[^\s]*$)/, '') // strip for ie7
    }
fat's avatar
fat committed
774

fat's avatar
fat committed
775
    var $parent = selector && $(selector)
776

fat's avatar
fat committed
777
778
    return $parent && $parent.length ? $parent : $this.parent()
  }
779

fat's avatar
fat committed
780
781
782
783
784
785
786
  function clearMenus(e) {
    if (e && e.which === 3) return
    $(backdrop).remove()
    $(toggle).each(function () {
      var $this         = $(this)
      var $parent       = getParent($this)
      var relatedTarget = { relatedTarget: this }
787

fat's avatar
fat committed
788
      if (!$parent.hasClass('open')) return
Mark Otto's avatar
Mark Otto committed
789

fat's avatar
fat committed
790
      if (e && e.type == 'click' && /input|textarea/i.test(e.target.tagName) && $.contains($parent[0], e.target)) return
791

fat's avatar
fat committed
792
      $parent.trigger(e = $.Event('hide.bs.dropdown', relatedTarget))
793

fat's avatar
fat committed
794
      if (e.isDefaultPrevented()) return
795

fat's avatar
fat committed
796
797
798
799
      $this.attr('aria-expanded', 'false')
      $parent.removeClass('open').trigger('hidden.bs.dropdown', relatedTarget)
    })
  }
800

fat's avatar
fat committed
801
802
  Dropdown.prototype.toggle = function (e) {
    var $this = $(this)
803

fat's avatar
fat committed
804
    if ($this.is('.disabled, :disabled')) return
805

fat's avatar
fat committed
806
807
    var $parent  = getParent($this)
    var isActive = $parent.hasClass('open')
808

fat's avatar
fat committed
809
    clearMenus()
810

fat's avatar
fat committed
811
812
813
814
815
816
817
818
    if (!isActive) {
      if ('ontouchstart' in document.documentElement && !$parent.closest('.navbar-nav').length) {
        // if mobile we use a backdrop because click events don't delegate
        $(document.createElement('div'))
          .addClass('dropdown-backdrop')
          .insertAfter($(this))
          .on('click', clearMenus)
      }
819

fat's avatar
fat committed
820
821
      var relatedTarget = { relatedTarget: this }
      $parent.trigger(e = $.Event('show.bs.dropdown', relatedTarget))
822

fat's avatar
fat committed
823
      if (e.isDefaultPrevented()) return
824

fat's avatar
fat committed
825
826
827
      $this
        .trigger('focus')
        .attr('aria-expanded', 'true')
828

fat's avatar
fat committed
829
830
831
832
      $parent
        .toggleClass('open')
        .trigger('shown.bs.dropdown', relatedTarget)
    }
Chris Rebert's avatar
Chris Rebert committed
833

fat's avatar
fat committed
834
835
    return false
  }
836

fat's avatar
fat committed
837
838
  Dropdown.prototype.keydown = function (e) {
    if (!/(38|40|27|32)/.test(e.which) || /input|textarea/i.test(e.target.tagName)) return
839

fat's avatar
fat committed
840
    var $this = $(this)
841

fat's avatar
fat committed
842
843
    e.preventDefault()
    e.stopPropagation()
844

fat's avatar
fat committed
845
    if ($this.is('.disabled, :disabled')) return
846

fat's avatar
fat committed
847
848
    var $parent  = getParent($this)
    var isActive = $parent.hasClass('open')
849

fat's avatar
fat committed
850
851
852
    if (!isActive && e.which != 27 || isActive && e.which == 27) {
      if (e.which == 27) $parent.find(toggle).trigger('focus')
      return $this.trigger('click')
853
854
    }

fat's avatar
fat committed
855
856
    var desc = ' li:not(.disabled):visible a'
    var $items = $parent.find('[role="menu"]' + desc + ', [role="listbox"]' + desc)
857

fat's avatar
fat committed
858
    if (!$items.length) return
859

fat's avatar
fat committed
860
    var index = $items.index(e.target)
861

fat's avatar
fat committed
862
863
864
865
866
    if (e.which == 38 && index > 0)                 index--         // up
    if (e.which == 40 && index < $items.length - 1) index++         // down
    if (!~index)                                    index = 0

    $items.eq(index).trigger('focus')
XhmikosR's avatar
XhmikosR committed
867
  }
Mark Otto's avatar
Mark Otto committed
868

869

fat's avatar
fat committed
870
871
  // DROPDOWN PLUGIN DEFINITION
  // ==========================
872

fat's avatar
fat committed
873
874
875
876
  function Plugin(option) {
    return this.each(function () {
      var $this = $(this)
      var data  = $this.data('bs.dropdown')
877

fat's avatar
fat committed
878
879
880
881
      if (!data) $this.data('bs.dropdown', (data = new Dropdown(this)))
      if (typeof option == 'string') data[option].call($this)
    })
  }
882

fat's avatar
fat committed
883
  var old = $.fn.dropdown
884

fat's avatar
fat committed
885
886
  $.fn.dropdown             = Plugin
  $.fn.dropdown.Constructor = Dropdown
887

XhmikosR's avatar
XhmikosR committed
888

fat's avatar
fat committed
889
890
  // DROPDOWN NO CONFLICT
  // ====================
891

fat's avatar
fat committed
892
893
894
895
  $.fn.dropdown.noConflict = function () {
    $.fn.dropdown = old
    return this
  }
896

897

fat's avatar
fat committed
898
899
  // APPLY TO STANDARD DROPDOWN ELEMENTS
  // ===================================
900

fat's avatar
fat committed
901
902
903
904
905
906
  $(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, Dropdown.prototype.keydown)
    .on('keydown.bs.dropdown.data-api', '.dropdown-menu', Dropdown.prototype.keydown)
907

fat's avatar
fat committed
908
}(jQuery);
909

fat's avatar
fat committed
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
/* ========================================================================
 * Bootstrap: modal.js v3.3.4
 * http://getbootstrap.com/javascript/#modals
 * ========================================================================
 * Copyright 2011-2015 Twitter, Inc.
 * Licensed under MIT (https://github.com/twbs/bootstrap/blob/master/LICENSE)
 * ======================================================================== */


+function ($) {
  'use strict';

  // MODAL CLASS DEFINITION
  // ======================

  var Modal = function (element, options) {
    this.options             = options
    this.$body               = $(document.body)
    this.$element            = $(element)
    this.$dialog             = this.$element.find('.modal-dialog')
    this.$backdrop           = null
    this.isShown             = null
    this.originalBodyPad     = null
    this.scrollbarWidth      = 0
    this.ignoreBackdropClick = false
935

fat's avatar
fat committed
936
937
938
939
940
941
    if (this.options.remote) {
      this.$element
        .find('.modal-content')
        .load(this.options.remote, $.proxy(function () {
          this.$element.trigger('loaded.bs.modal')
        }, this))
942
    }
XhmikosR's avatar
XhmikosR committed
943
  }
944

fat's avatar
fat committed
945
  Modal.VERSION  = '3.3.4'
946

fat's avatar
fat committed
947
948
  Modal.TRANSITION_DURATION = 300
  Modal.BACKDROP_TRANSITION_DURATION = 150
fat's avatar
fat committed
949

fat's avatar
fat committed
950
951
952
953
  Modal.DEFAULTS = {
    backdrop: true,
    keyboard: true,
    show: true
XhmikosR's avatar
XhmikosR committed
954
  }
955

fat's avatar
fat committed
956
957
958
  Modal.prototype.toggle = function (_relatedTarget) {
    return this.isShown ? this.hide() : this.show(_relatedTarget)
  }
959

fat's avatar
fat committed
960
961
962
  Modal.prototype.show = function (_relatedTarget) {
    var that = this
    var e    = $.Event('show.bs.modal', { relatedTarget: _relatedTarget })
963

fat's avatar
fat committed
964
    this.$element.trigger(e)
965

fat's avatar
fat committed
966
    if (this.isShown || e.isDefaultPrevented()) return
fat's avatar
build    
fat committed
967

fat's avatar
fat committed
968
    this.isShown = true
969

fat's avatar
fat committed
970
971
972
    this.checkScrollbar()
    this.setScrollbar()
    this.$body.addClass('modal-open')
fat's avatar
rebuild    
fat committed
973

fat's avatar
fat committed
974
975
    this.escape()
    this.resize()
976

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

fat's avatar
fat committed
979
980
981
982
983
    this.$dialog.on('mousedown.dismiss.bs.modal', function () {
      that.$element.one('mouseup.dismiss.bs.modal', function (e) {
        if ($(e.target).is(that.$element)) that.ignoreBackdropClick = true
      })
    })
984

fat's avatar
fat committed
985
986
    this.backdrop(function () {
      var transition = $.support.transition && that.$element.hasClass('fade')
Jacob Thornton's avatar
Jacob Thornton committed
987

fat's avatar
fat committed
988
989
990
      if (!that.$element.parent().length) {
        that.$element.appendTo(that.$body) // don't move modals dom position
      }
Heinrich Fenkart's avatar
grunt    
Heinrich Fenkart committed
991

fat's avatar
fat committed
992
993
994
      that.$element
        .show()
        .scrollTop(0)
995

fat's avatar
fat committed
996
      that.adjustDialog()
997

fat's avatar
fat committed
998
999
1000
      if (transition) {
        that.$element[0].offsetWidth // force reflow
      }
For faster browsing, not all history is shown. View entire blame