bootstrap.js 62 KB
Newer Older
1
/*!
Mark Otto's avatar
Mark Otto committed
2
 * Bootstrap v3.2.0 (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.2.0
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


XhmikosR's avatar
XhmikosR committed
18
19
+function ($) {
  'use strict';
Mark Otto's avatar
grunt    
Mark Otto committed
20

XhmikosR's avatar
XhmikosR committed
21
22
  // CSS TRANSITION SUPPORT (Shoutout: http://www.modernizr.com/)
  // ============================================================
23

XhmikosR's avatar
XhmikosR committed
24
25
  function transitionEnd() {
    var el = document.createElement('bootstrap')
26

XhmikosR's avatar
XhmikosR committed
27
28
29
30
31
32
    var transEndEventNames = {
      WebkitTransition : 'webkitTransitionEnd',
      MozTransition    : 'transitionend',
      OTransition      : 'oTransitionEnd otransitionend',
      transition       : 'transitionend'
    }
33

XhmikosR's avatar
XhmikosR committed
34
35
36
    for (var name in transEndEventNames) {
      if (el.style[name] !== undefined) {
        return { end: transEndEventNames[name] }
37
      }
Chris Rebert's avatar
Chris Rebert committed
38
39
    }

XhmikosR's avatar
XhmikosR committed
40
41
    return false // explicit for ie8 (  ._.)
  }
42

XhmikosR's avatar
XhmikosR committed
43
44
45
46
47
48
49
50
51
  // 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
  }
52

XhmikosR's avatar
XhmikosR committed
53
54
  $(function () {
    $.support.transition = transitionEnd()
Chris Rebert's avatar
Chris Rebert committed
55

XhmikosR's avatar
XhmikosR committed
56
    if (!$.support.transition) return
57

XhmikosR's avatar
XhmikosR committed
58
59
60
61
62
63
64
    $.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
65
  })
66

XhmikosR's avatar
XhmikosR committed
67
}(jQuery);
68

69
/* ========================================================================
Mark Otto's avatar
Mark Otto committed
70
 * Bootstrap: alert.js v3.2.0
Mark Otto's avatar
Mark Otto committed
71
 * http://getbootstrap.com/javascript/#alerts
72
 * ========================================================================
73
 * Copyright 2011-2014 Twitter, Inc.
74
 * Licensed under MIT (https://github.com/twbs/bootstrap/blob/master/LICENSE)
75
 * ======================================================================== */
76
77


XhmikosR's avatar
XhmikosR committed
78
79
+function ($) {
  'use strict';
80

XhmikosR's avatar
XhmikosR committed
81
82
  // ALERT CLASS DEFINITION
  // ======================
83

XhmikosR's avatar
XhmikosR committed
84
85
86
87
  var dismiss = '[data-dismiss="alert"]'
  var Alert   = function (el) {
    $(el).on('click', dismiss, this.close)
  }
Mark Otto's avatar
grunt    
Mark Otto committed
88

Mark Otto's avatar
Mark Otto committed
89
  Alert.VERSION = '3.2.0'
90

91
92
  Alert.TRANSITION_DURATION = 150

XhmikosR's avatar
XhmikosR committed
93
94
95
  Alert.prototype.close = function (e) {
    var $this    = $(this)
    var selector = $this.attr('data-target')
96

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

XhmikosR's avatar
XhmikosR committed
102
    var $parent = $(selector)
103

XhmikosR's avatar
XhmikosR committed
104
    if (e) e.preventDefault()
105

XhmikosR's avatar
XhmikosR committed
106
    if (!$parent.length) {
Chris Rebert's avatar
grunt    
Chris Rebert committed
107
      $parent = $this.closest('.alert')
XhmikosR's avatar
XhmikosR committed
108
    }
109

XhmikosR's avatar
XhmikosR committed
110
    $parent.trigger(e = $.Event('close.bs.alert'))
Chris Rebert's avatar
Chris Rebert committed
111

XhmikosR's avatar
XhmikosR committed
112
    if (e.isDefaultPrevented()) return
113

XhmikosR's avatar
XhmikosR committed
114
    $parent.removeClass('in')
115

XhmikosR's avatar
XhmikosR committed
116
117
118
    function removeElement() {
      // detach from parent, fire event then clean up data
      $parent.detach().trigger('closed.bs.alert').remove()
119
120
    }

XhmikosR's avatar
XhmikosR committed
121
122
123
    $.support.transition && $parent.hasClass('fade') ?
      $parent
        .one('bsTransitionEnd', removeElement)
124
        .emulateTransitionEnd(Alert.TRANSITION_DURATION) :
XhmikosR's avatar
XhmikosR committed
125
126
      removeElement()
  }
127
128


XhmikosR's avatar
XhmikosR committed
129
130
  // ALERT PLUGIN DEFINITION
  // =======================
131

XhmikosR's avatar
XhmikosR committed
132
133
134
135
  function Plugin(option) {
    return this.each(function () {
      var $this = $(this)
      var data  = $this.data('bs.alert')
fat's avatar
fat committed
136

XhmikosR's avatar
XhmikosR committed
137
138
139
140
      if (!data) $this.data('bs.alert', (data = new Alert(this)))
      if (typeof option == 'string') data[option].call($this)
    })
  }
141

XhmikosR's avatar
XhmikosR committed
142
  var old = $.fn.alert
Mark Otto's avatar
Mark Otto committed
143

XhmikosR's avatar
XhmikosR committed
144
145
  $.fn.alert             = Plugin
  $.fn.alert.Constructor = Alert
146
147


XhmikosR's avatar
XhmikosR committed
148
149
  // ALERT NO CONFLICT
  // =================
150

XhmikosR's avatar
XhmikosR committed
151
152
153
154
  $.fn.alert.noConflict = function () {
    $.fn.alert = old
    return this
  }
155
156


XhmikosR's avatar
XhmikosR committed
157
158
  // ALERT DATA-API
  // ==============
159

XhmikosR's avatar
XhmikosR committed
160
  $(document).on('click.bs.alert.data-api', dismiss, Alert.prototype.close)
161

XhmikosR's avatar
XhmikosR committed
162
}(jQuery);
163

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


XhmikosR's avatar
XhmikosR committed
173
174
+function ($) {
  'use strict';
fat's avatar
fat committed
175

XhmikosR's avatar
XhmikosR committed
176
177
  // BUTTON PUBLIC CLASS DEFINITION
  // ==============================
Mark Otto's avatar
grunt    
Mark Otto committed
178

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

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

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

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

XhmikosR's avatar
XhmikosR committed
197
    state = state + 'Text'
198

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

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

XhmikosR's avatar
XhmikosR committed
203
204
205
206
207
208
209
210
    // 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)
211
      }
XhmikosR's avatar
XhmikosR committed
212
213
214
215
216
217
218
219
220
221
222
223
224
225
    }, 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')
Heinrich Fenkart's avatar
grunt    
Heinrich Fenkart committed
226
227
    } else {
      this.$element.attr('aria-pressed', !this.$element.hasClass('active'))
fat's avatar
fat committed
228
    }
229

XhmikosR's avatar
XhmikosR committed
230
231
    if (changed) this.$element.toggleClass('active')
  }
232
233


XhmikosR's avatar
XhmikosR committed
234
235
  // BUTTON PLUGIN DEFINITION
  // ========================
236

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

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

XhmikosR's avatar
XhmikosR committed
245
246
247
248
      if (option == 'toggle') data.toggle()
      else if (option) data.setState(option)
    })
  }
249

XhmikosR's avatar
XhmikosR committed
250
  var old = $.fn.button
Mark Otto's avatar
Mark Otto committed
251

XhmikosR's avatar
XhmikosR committed
252
253
  $.fn.button             = Plugin
  $.fn.button.Constructor = Button
254
255


XhmikosR's avatar
XhmikosR committed
256
257
  // BUTTON NO CONFLICT
  // ==================
258

XhmikosR's avatar
XhmikosR committed
259
260
261
262
  $.fn.button.noConflict = function () {
    $.fn.button = old
    return this
  }
263
264


XhmikosR's avatar
XhmikosR committed
265
266
  // BUTTON DATA-API
  // ===============
267

Mark Otto's avatar
grunt    
Mark Otto committed
268
269
270
271
272
273
274
  $(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()
    })
Chris Rebert's avatar
Chris Rebert committed
275
276
    .on('focus.bs.button.data-api blur.bs.button.data-api', '[data-toggle^="button"]', function (e) {
      $(e.target).closest('.btn').toggleClass('focus', e.type == 'focus')
Mark Otto's avatar
grunt    
Mark Otto committed
277
    })
278

XhmikosR's avatar
XhmikosR committed
279
}(jQuery);
280

281
/* ========================================================================
Mark Otto's avatar
Mark Otto committed
282
 * Bootstrap: carousel.js v3.2.0
Mark Otto's avatar
Mark Otto committed
283
 * http://getbootstrap.com/javascript/#carousel
284
 * ========================================================================
285
 * Copyright 2011-2014 Twitter, Inc.
286
 * Licensed under MIT (https://github.com/twbs/bootstrap/blob/master/LICENSE)
287
 * ======================================================================== */
288
289


XhmikosR's avatar
XhmikosR committed
290
291
+function ($) {
  'use strict';
292

XhmikosR's avatar
XhmikosR committed
293
294
  // CAROUSEL CLASS DEFINITION
  // =========================
295

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

Heinrich Fenkart's avatar
grunt    
Heinrich Fenkart committed
306
307
    this.options.keyboard && this.$element.on('keydown.bs.carousel', $.proxy(this.keydown, this))

308
    this.options.pause == 'hover' && !('ontouchstart' in document.documentElement) && this.$element
XhmikosR's avatar
XhmikosR committed
309
310
311
      .on('mouseenter.bs.carousel', $.proxy(this.pause, this))
      .on('mouseleave.bs.carousel', $.proxy(this.cycle, this))
  }
312

Mark Otto's avatar
Mark Otto committed
313
  Carousel.VERSION  = '3.2.0'
Mark Otto's avatar
grunt    
Mark Otto committed
314

315
316
  Carousel.TRANSITION_DURATION = 600

XhmikosR's avatar
XhmikosR committed
317
318
319
  Carousel.DEFAULTS = {
    interval: 5000,
    pause: 'hover',
Heinrich Fenkart's avatar
grunt    
Heinrich Fenkart committed
320
321
    wrap: true,
    keyboard: true
XhmikosR's avatar
XhmikosR committed
322
  }
323

XhmikosR's avatar
XhmikosR committed
324
325
326
327
328
  Carousel.prototype.keydown = function (e) {
    switch (e.which) {
      case 37: this.prev(); break
      case 39: this.next(); break
      default: return
Mark Otto's avatar
Mark Otto committed
329
330
    }

XhmikosR's avatar
XhmikosR committed
331
332
    e.preventDefault()
  }
333

XhmikosR's avatar
XhmikosR committed
334
335
  Carousel.prototype.cycle = function (e) {
    e || (this.paused = false)
fat's avatar
fat committed
336

XhmikosR's avatar
XhmikosR committed
337
    this.interval && clearInterval(this.interval)
338

XhmikosR's avatar
XhmikosR committed
339
340
341
    this.options.interval
      && !this.paused
      && (this.interval = setInterval($.proxy(this.next, this), this.options.interval))
342

XhmikosR's avatar
XhmikosR committed
343
344
    return this
  }
345

XhmikosR's avatar
XhmikosR committed
346
347
348
349
  Carousel.prototype.getItemIndex = function (item) {
    this.$items = item.parent().children('.item')
    return this.$items.index(item || this.$active)
  }
350

XhmikosR's avatar
XhmikosR committed
351
352
353
354
355
356
357
  Carousel.prototype.getItemForDirection = function (direction, active) {
    var delta = direction == 'prev' ? -1 : 1
    var activeIndex = this.getItemIndex(active)
    var itemIndex = (activeIndex + delta) % this.$items.length
    return this.$items.eq(itemIndex)
  }

XhmikosR's avatar
XhmikosR committed
358
359
360
  Carousel.prototype.to = function (pos) {
    var that        = this
    var activeIndex = this.getItemIndex(this.$active = this.$element.find('.item.active'))
361

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

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

XhmikosR's avatar
XhmikosR committed
367
    return this.slide(pos > activeIndex ? 'next' : 'prev', this.$items.eq(pos))
XhmikosR's avatar
XhmikosR committed
368
  }
fat's avatar
fat committed
369

XhmikosR's avatar
XhmikosR committed
370
371
372
373
374
375
  Carousel.prototype.pause = function (e) {
    e || (this.paused = true)

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

XhmikosR's avatar
XhmikosR committed
378
    this.interval = clearInterval(this.interval)
379

XhmikosR's avatar
XhmikosR committed
380
381
    return this
  }
382

XhmikosR's avatar
XhmikosR committed
383
384
385
386
  Carousel.prototype.next = function () {
    if (this.sliding) return
    return this.slide('next')
  }
387

XhmikosR's avatar
XhmikosR committed
388
389
390
391
  Carousel.prototype.prev = function () {
    if (this.sliding) return
    return this.slide('prev')
  }
392

XhmikosR's avatar
XhmikosR committed
393
394
  Carousel.prototype.slide = function (type, next) {
    var $active   = this.$element.find('.item.active')
XhmikosR's avatar
XhmikosR committed
395
    var $next     = next || this.getItemForDirection(type, $active)
XhmikosR's avatar
XhmikosR committed
396
397
398
399
    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
400

XhmikosR's avatar
XhmikosR committed
401
402
403
    if (!$next.length) {
      if (!this.options.wrap) return
      $next = this.$element.find('.item')[fallback]()
Jacob Thornton's avatar
Jacob Thornton committed
404
405
    }

XhmikosR's avatar
XhmikosR committed
406
    if ($next.hasClass('active')) return (this.sliding = false)
407

XhmikosR's avatar
XhmikosR committed
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
    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)
        })
441
        .emulateTransitionEnd(Carousel.TRANSITION_DURATION)
XhmikosR's avatar
XhmikosR committed
442
443
444
445
446
447
    } else {
      $active.removeClass('active')
      $next.addClass('active')
      this.sliding = false
      this.$element.trigger(slidEvent)
    }
fat's avatar
fat committed
448

XhmikosR's avatar
XhmikosR committed
449
    isCycling && this.cycle()
450

XhmikosR's avatar
XhmikosR committed
451
452
    return this
  }
453
454


XhmikosR's avatar
XhmikosR committed
455
456
  // CAROUSEL PLUGIN DEFINITION
  // ==========================
Chris Rebert's avatar
Chris Rebert committed
457

XhmikosR's avatar
XhmikosR committed
458
459
460
461
462
463
464
465
466
467
468
469
470
  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

      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()
    })
  }
471

XhmikosR's avatar
XhmikosR committed
472
  var old = $.fn.carousel
Mark Otto's avatar
Mark Otto committed
473

XhmikosR's avatar
XhmikosR committed
474
475
  $.fn.carousel             = Plugin
  $.fn.carousel.Constructor = Carousel
476
477


XhmikosR's avatar
XhmikosR committed
478
479
  // CAROUSEL NO CONFLICT
  // ====================
480

XhmikosR's avatar
XhmikosR committed
481
482
483
484
  $.fn.carousel.noConflict = function () {
    $.fn.carousel = old
    return this
  }
485

fat's avatar
fat committed
486

XhmikosR's avatar
XhmikosR committed
487
488
  // CAROUSEL DATA-API
  // =================
489

XhmikosR's avatar
XhmikosR committed
490
491
492
493
494
495
496
497
  $(document).on('click.bs.carousel.data-api', '[data-slide], [data-slide-to]', 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
498

XhmikosR's avatar
XhmikosR committed
499
    Plugin.call($target, options)
500

XhmikosR's avatar
XhmikosR committed
501
502
    if (slideIndex) {
      $target.data('bs.carousel').to(slideIndex)
503
504
    }

XhmikosR's avatar
XhmikosR committed
505
506
    e.preventDefault()
  })
507

XhmikosR's avatar
XhmikosR committed
508
509
510
511
  $(window).on('load', function () {
    $('[data-ride="carousel"]').each(function () {
      var $carousel = $(this)
      Plugin.call($carousel, $carousel.data())
fat's avatar
fat committed
512
513
514
    })
  })

XhmikosR's avatar
XhmikosR committed
515
}(jQuery);
516

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


XhmikosR's avatar
XhmikosR committed
526
527
+function ($) {
  'use strict';
528

XhmikosR's avatar
XhmikosR committed
529
530
  // COLLAPSE PUBLIC CLASS DEFINITION
  // ================================
Mark Otto's avatar
grunt    
Mark Otto committed
531

XhmikosR's avatar
XhmikosR committed
532
533
534
535
  var Collapse = function (element, options) {
    this.$element      = $(element)
    this.options       = $.extend({}, Collapse.DEFAULTS, options)
    this.transitioning = null
536

XhmikosR's avatar
XhmikosR committed
537
538
539
    if (this.options.parent) this.$parent = $(this.options.parent)
    if (this.options.toggle) this.toggle()
  }
540

Mark Otto's avatar
Mark Otto committed
541
  Collapse.VERSION  = '3.2.0'
542

543
544
  Collapse.TRANSITION_DURATION = 350

XhmikosR's avatar
XhmikosR committed
545
546
547
  Collapse.DEFAULTS = {
    toggle: true
  }
fat's avatar
fat committed
548

XhmikosR's avatar
XhmikosR committed
549
550
551
552
  Collapse.prototype.dimension = function () {
    var hasWidth = this.$element.hasClass('width')
    return hasWidth ? 'width' : 'height'
  }
553

XhmikosR's avatar
XhmikosR committed
554
555
  Collapse.prototype.show = function () {
    if (this.transitioning || this.$element.hasClass('in')) return
556

Heinrich Fenkart's avatar
grunt    
Heinrich Fenkart committed
557
558
559
560
561
562
563
564
    var activesData
    var actives = this.$parent && this.$parent.find('> .panel').children('.in, .collapsing')

    if (actives && actives.length) {
      activesData = actives.data('bs.collapse')
      if (activesData && activesData.transitioning) return
    }

XhmikosR's avatar
XhmikosR committed
565
566
567
    var startEvent = $.Event('show.bs.collapse')
    this.$element.trigger(startEvent)
    if (startEvent.isDefaultPrevented()) return
568

XhmikosR's avatar
XhmikosR committed
569
570
    if (actives && actives.length) {
      Plugin.call(actives, 'hide')
Heinrich Fenkart's avatar
grunt    
Heinrich Fenkart committed
571
      activesData || actives.data('bs.collapse', null)
XhmikosR's avatar
XhmikosR committed
572
    }
573

XhmikosR's avatar
XhmikosR committed
574
    var dimension = this.dimension()
575

XhmikosR's avatar
XhmikosR committed
576
577
578
    this.$element
      .removeClass('collapse')
      .addClass('collapsing')[dimension](0)
Heinrich Fenkart's avatar
Heinrich Fenkart committed
579
      .attr('aria-expanded', true)
580

XhmikosR's avatar
XhmikosR committed
581
    this.transitioning = 1
582

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

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

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

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

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

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

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

XhmikosR's avatar
XhmikosR committed
610
611
612
613
    this.$element[dimension](this.$element[dimension]())[0].offsetHeight

    this.$element
      .addClass('collapsing')
Mark Otto's avatar
grunt    
Mark Otto committed
614
      .removeClass('collapse in')
Heinrich Fenkart's avatar
Heinrich Fenkart committed
615
      .attr('aria-expanded', false)
616

XhmikosR's avatar
XhmikosR committed
617
    this.transitioning = 1
618

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

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

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

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

639

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

XhmikosR's avatar
XhmikosR 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)
Mark Otto's avatar
Mark Otto committed
648

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

XhmikosR's avatar
XhmikosR committed
655
  var old = $.fn.collapse
656

XhmikosR's avatar
XhmikosR committed
657
658
  $.fn.collapse             = Plugin
  $.fn.collapse.Constructor = Collapse
659

660

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

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

669

XhmikosR's avatar
XhmikosR committed
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
  // COLLAPSE DATA-API
  // =================

  $(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()
        || (href = $this.attr('href')) && href.replace(/.*(?=#[^\s]+$)/, '') // strip for ie7
    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) {
Heinrich Fenkart's avatar
Heinrich Fenkart committed
686
687
688
      if ($parent) $parent.find('[data-toggle="collapse"][data-parent="' + parent + '"]').not($this).addClass('collapsed').attr('aria-expanded', false)
      var isCollapsed = $target.hasClass('in')
      $this.toggleClass('collapsed', isCollapsed).attr('aria-expanded', !isCollapsed)
XhmikosR's avatar
XhmikosR committed
689
    }
fat's avatar
fat committed
690

XhmikosR's avatar
XhmikosR committed
691
    Plugin.call($target, option)
692
693
  })

XhmikosR's avatar
XhmikosR committed
694
}(jQuery);
695

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


XhmikosR's avatar
XhmikosR committed
705
706
+function ($) {
  'use strict';
Chris Rebert's avatar
Chris Rebert committed
707

XhmikosR's avatar
XhmikosR committed
708
709
  // DROPDOWN CLASS DEFINITION
  // =========================
Mark Otto's avatar
grunt    
Mark Otto committed
710

XhmikosR's avatar
XhmikosR committed
711
712
713
714
715
  var backdrop = '.dropdown-backdrop'
  var toggle   = '[data-toggle="dropdown"]'
  var Dropdown = function (element) {
    $(element).on('click.bs.dropdown', this.toggle)
  }
716

Mark Otto's avatar
Mark Otto committed
717
  Dropdown.VERSION = '3.2.0'
Mark Otto's avatar
grunt    
Mark Otto committed
718

XhmikosR's avatar
XhmikosR committed
719
720
  Dropdown.prototype.toggle = function (e) {
    var $this = $(this)
721

XhmikosR's avatar
XhmikosR committed
722
    if ($this.is('.disabled, :disabled')) return
723

XhmikosR's avatar
XhmikosR committed
724
725
    var $parent  = getParent($this)
    var isActive = $parent.hasClass('open')
726

XhmikosR's avatar
XhmikosR committed
727
    clearMenus()
fat's avatar
fat committed
728

XhmikosR's avatar
XhmikosR committed
729
730
731
732
733
    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)
      }
734

XhmikosR's avatar
XhmikosR committed
735
736
      var relatedTarget = { relatedTarget: this }
      $parent.trigger(e = $.Event('show.bs.dropdown', relatedTarget))
737

XhmikosR's avatar
XhmikosR committed
738
      if (e.isDefaultPrevented()) return
739

740
741
742
      $this
        .trigger('focus')
        .attr('aria-expanded', 'true')
Mark Otto's avatar
Mark Otto committed
743

XhmikosR's avatar
XhmikosR committed
744
745
746
      $parent
        .toggleClass('open')
        .trigger('shown.bs.dropdown', relatedTarget)
fat's avatar
rebuild    
fat committed
747
    }
748

XhmikosR's avatar
XhmikosR committed
749
750
    return false
  }
751

XhmikosR's avatar
XhmikosR committed
752
  Dropdown.prototype.keydown = function (e) {
Mark Otto's avatar
grunt    
Mark Otto committed
753
    if (!/(38|40|27|32)/.test(e.which)) return
754

XhmikosR's avatar
XhmikosR committed
755
    var $this = $(this)
756

XhmikosR's avatar
XhmikosR committed
757
758
    e.preventDefault()
    e.stopPropagation()
759

XhmikosR's avatar
XhmikosR committed
760
    if ($this.is('.disabled, :disabled')) return
761

XhmikosR's avatar
XhmikosR committed
762
763
    var $parent  = getParent($this)
    var isActive = $parent.hasClass('open')
764

Mark Otto's avatar
grunt    
Mark Otto committed
765
    if ((!isActive && e.which != 27) || (isActive && e.which == 27)) {
XhmikosR's avatar
XhmikosR committed
766
767
768
      if (e.which == 27) $parent.find(toggle).trigger('focus')
      return $this.trigger('click')
    }
769

XhmikosR's avatar
XhmikosR committed
770
771
    var desc = ' li:not(.divider):visible a'
    var $items = $parent.find('[role="menu"]' + desc + ', [role="listbox"]' + desc)
772

XhmikosR's avatar
XhmikosR committed
773
    if (!$items.length) return
774

XhmikosR's avatar
XhmikosR committed
775
    var index = $items.index($items.filter(':focus'))
776

Mark Otto's avatar
grunt    
Mark Otto committed
777
778
    if (e.which == 38 && index > 0)                 index--                        // up
    if (e.which == 40 && index < $items.length - 1) index++                        // down
XhmikosR's avatar
XhmikosR committed
779
    if (!~index)                                      index = 0
780

XhmikosR's avatar
XhmikosR committed
781
782
    $items.eq(index).trigger('focus')
  }
Chris Rebert's avatar
Chris Rebert committed
783

XhmikosR's avatar
XhmikosR committed
784
785
786
787
  function clearMenus(e) {
    if (e && e.which === 3) return
    $(backdrop).remove()
    $(toggle).each(function () {
788
789
      var $this         = $(this)
      var $parent       = getParent($this)
XhmikosR's avatar
XhmikosR committed
790
      var relatedTarget = { relatedTarget: this }
791

XhmikosR's avatar
XhmikosR committed
792
      if (!$parent.hasClass('open')) return
793

XhmikosR's avatar
XhmikosR committed
794
      $parent.trigger(e = $.Event('hide.bs.dropdown', relatedTarget))
795

XhmikosR's avatar
XhmikosR committed
796
      if (e.isDefaultPrevented()) return
797
798

      $this.attr('aria-expanded', 'false')
XhmikosR's avatar
XhmikosR committed
799
800
801
      $parent.removeClass('open').trigger('hidden.bs.dropdown', relatedTarget)
    })
  }
802

XhmikosR's avatar
XhmikosR committed
803
804
  function getParent($this) {
    var selector = $this.attr('data-target')
805

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

XhmikosR's avatar
XhmikosR committed
811
    var $parent = selector && $(selector)
812

XhmikosR's avatar
XhmikosR committed
813
814
    return $parent && $parent.length ? $parent : $this.parent()
  }
815
816


XhmikosR's avatar
XhmikosR committed
817
818
  // DROPDOWN PLUGIN DEFINITION
  // ==========================
819

XhmikosR's avatar
XhmikosR committed
820
821
822
823
  function Plugin(option) {
    return this.each(function () {
      var $this = $(this)
      var data  = $this.data('bs.dropdown')
824

XhmikosR's avatar
XhmikosR committed
825
826
827
828
      if (!data) $this.data('bs.dropdown', (data = new Dropdown(this)))
      if (typeof option == 'string') data[option].call($this)
    })
  }
Mark Otto's avatar
Mark Otto committed
829

XhmikosR's avatar
XhmikosR committed
830
  var old = $.fn.dropdown
831

XhmikosR's avatar
XhmikosR committed
832
833
  $.fn.dropdown             = Plugin
  $.fn.dropdown.Constructor = Dropdown
834

835

XhmikosR's avatar
XhmikosR committed
836
837
  // DROPDOWN NO CONFLICT
  // ====================
838

XhmikosR's avatar
XhmikosR committed
839
840
841
842
  $.fn.dropdown.noConflict = function () {
    $.fn.dropdown = old
    return this
  }
843

844

XhmikosR's avatar
XhmikosR committed
845
846
847
848
849
850
851
852
  // APPLY TO STANDARD DROPDOWN ELEMENTS
  // ===================================

  $(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)
853

XhmikosR's avatar
XhmikosR committed
854
}(jQuery);
855

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


XhmikosR's avatar
XhmikosR committed
865
866
+function ($) {
  'use strict';
867

XhmikosR's avatar
XhmikosR committed
868
869
  // MODAL CLASS DEFINITION
  // ======================
870

XhmikosR's avatar
XhmikosR committed
871
872
873
874
875
876
877
  var Modal = function (element, options) {
    this.options        = options
    this.$body          = $(document.body)
    this.$element       = $(element)
    this.$backdrop      =
    this.isShown        = null
    this.scrollbarWidth = 0
878

XhmikosR's avatar
XhmikosR committed
879
880
881
882
883
884
    if (this.options.remote) {
      this.$element
        .find('.modal-content')
        .load(this.options.remote, $.proxy(function () {
          this.$element.trigger('loaded.bs.modal')
        }, this))
885
    }
XhmikosR's avatar
XhmikosR committed
886
  }
887

Mark Otto's avatar
Mark Otto committed
888
  Modal.VERSION  = '3.2.0'
Mark Otto's avatar
grunt    
Mark Otto committed
889

890
891
892
  Modal.TRANSITION_DURATION = 300
  Modal.BACKDROP_TRANSITION_DURATION = 150

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

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

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

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

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

XhmikosR's avatar
XhmikosR committed
911
    this.isShown = true
fat's avatar
build    
fat committed
912

XhmikosR's avatar
XhmikosR committed
913
914
    this.checkScrollbar()
    this.$body.addClass('modal-open')
915

XhmikosR's avatar
XhmikosR committed
916
917
    this.setScrollbar()
    this.escape()
fat's avatar
rebuild    
fat committed
918

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

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

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

XhmikosR's avatar
XhmikosR committed
928
929
930
      that.$element
        .show()
        .scrollTop(0)
Jacob Thornton's avatar
Jacob Thornton committed
931

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

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

XhmikosR's avatar
XhmikosR committed
940
      that.enforceFocus()
941

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

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

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

XhmikosR's avatar
XhmikosR committed
957
    e = $.Event('hide.bs.modal')
fat's avatar
build    
fat committed
958

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

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

XhmikosR's avatar
XhmikosR committed
963
    this.isShown = false
964

XhmikosR's avatar
XhmikosR committed
965
    this.escape()
Chris Rebert's avatar
Chris Rebert committed
966

XhmikosR's avatar
XhmikosR committed
967
    $(document).off('focusin.bs.modal')
Chris Rebert's avatar
Chris Rebert committed
968

XhmikosR's avatar
XhmikosR committed
969
970
971
972
    this.$element
      .removeClass('in')
      .attr('aria-hidden', true)
      .off('click.dismiss.bs.modal')
973

XhmikosR's avatar
XhmikosR committed
974
975
976
    $.support.transition && this.$element.hasClass('fade') ?
      this.$element
        .one('bsTransitionEnd', $.proxy(this.hideModal, this))
977
        .emulateTransitionEnd(Modal.TRANSITION_DURATION) :
XhmikosR's avatar
XhmikosR committed
978
979
      this.hideModal()
  }
980

XhmikosR's avatar
XhmikosR committed
981
982
983
984
985
986
987
988
989
990
991
992
  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) {
Mark Otto's avatar
grunt    
Mark Otto committed
993
      this.$element.on('keydown.dismiss.bs.modal', $.proxy(function (e) {
XhmikosR's avatar
XhmikosR committed
994
995
996
        e.which == 27 && this.hide()
      }, this))
    } else if (!this.isShown) {
Mark Otto's avatar
grunt    
Mark Otto committed
997
      this.$element.off('keydown.dismiss.bs.modal')
XhmikosR's avatar
XhmikosR committed
998
999
1000
1001
1002
1003
1004
    }
  }

  Modal.prototype.hideModal = function () {
    var that = this
    this.$element.hide()
    this.backdrop(function () {
Heinrich Fenkart's avatar
grunt    
Heinrich Fenkart committed
1005
1006
      that.$body.removeClass('modal-open')
      that.resetScrollbar()
XhmikosR's avatar
XhmikosR committed
1007
1008
1009
      that.$element.trigger('hidden.bs.modal')
    })
  }
1010

XhmikosR's avatar
XhmikosR committed
1011
1012
1013
1014
  Modal.prototype.removeBackdrop = function () {
    this.$backdrop && this.$backdrop.remove()
    this.$backdrop = null
  }
1015

XhmikosR's avatar
XhmikosR committed
1016
1017
1018
  Modal.prototype.backdrop = function (callback) {
    var that = this
    var animate = this.$element.hasClass('fade') ? 'fade' : ''
1019

XhmikosR's avatar
XhmikosR committed
1020
1021
    if (this.isShown && this.options.backdrop) {
      var doAnimate = $.support.transition && animate
1022

XhmikosR's avatar
XhmikosR committed
1023
      this.$backdrop = $('<div class="modal-backdrop ' + animate + '" />')
1024
1025
1026
1027
1028
1029
1030
        .prependTo(this.$element)
        .on('click.dismiss.bs.modal', $.proxy(function (e) {
          if (e.target !== e.currentTarget) return
          this.options.backdrop == 'static'
            ? this.$element[0].focus.call(this.$element[0])
            : this.hide.call(this)
        }, this))
1031

XhmikosR's avatar
XhmikosR committed
1032
      if (doAnimate) this.$backdrop[0].offsetWidth // force reflow
1033

XhmikosR's avatar
XhmikosR committed
1034
      this.$backdrop.addClass('in')
1035

XhmikosR's avatar
XhmikosR committed
1036
      if (!callback) return
1037

XhmikosR's avatar
XhmikosR committed
1038
1039
1040
      doAnimate ?
        this.$backdrop
          .one('bsTransitionEnd', callback)
1041
          .emulateTransitionEnd(Modal.BACKDROP_TRANSITION_DURATION) :
XhmikosR's avatar
XhmikosR committed
1042
        callback()
1043

XhmikosR's avatar
XhmikosR committed
1044
1045
    } else if (!this.isShown && this.$backdrop) {
      this.$backdrop.removeClass('in')
Chris Rebert's avatar
Chris Rebert committed
1046

XhmikosR's avatar
XhmikosR committed
1047
1048
1049
      var callbackRemove = function () {
        that.removeBackdrop()
        callback && callback()
Chris Rebert's avatar
Chris Rebert committed
1050
      }
XhmikosR's avatar
XhmikosR committed
1051
1052
1053
      $.support.transition && this.$element.hasClass('fade') ?
        this.$backdrop
          .one('bsTransitionEnd', callbackRemove)
1054
          .emulateTransitionEnd(Modal.BACKDROP_TRANSITION_DURATION) :
XhmikosR's avatar
XhmikosR committed
1055
        callbackRemove()
1056

XhmikosR's avatar
XhmikosR committed
1057
1058
    } else if (callback) {
      callback()
Chris Rebert's avatar
Chris Rebert committed
1059
    }
XhmikosR's avatar
XhmikosR committed
1060
  }
1061

XhmikosR's avatar
XhmikosR committed
1062
  Modal.prototype.checkScrollbar = function () {
Mark Otto's avatar
grunt    
Mark Otto committed
1063
    this.scrollbarWidth = this.measureScrollbar()
XhmikosR's avatar
XhmikosR committed
1064
  }
fat's avatar
build    
fat committed
1065

XhmikosR's avatar
XhmikosR committed
1066
1067
1068
1069
  Modal.prototype.setScrollbar = function () {
    var bodyPad = parseInt((this.$body.css('padding-right') || 0), 10)
    if (this.scrollbarWidth) this.$body.css('padding-right', bodyPad + this.scrollbarWidth)
  }
fat's avatar
build    
fat committed
1070

XhmikosR's avatar
XhmikosR committed
1071
1072
1073
  Modal.prototype.resetScrollbar = function () {
    this.$body.css('padding-right', '')
  }
fat's avatar
build    
fat committed
1074

XhmikosR's avatar
XhmikosR committed
1075
  Modal.prototype.measureScrollbar = function () { // thx walsh
Mark Otto's avatar
grunt    
Mark Otto committed
1076
    if (document.body.clientWidth >= window.innerWidth) return 0
XhmikosR's avatar
XhmikosR committed
1077
1078
1079
1080
1081
1082
1083
    var scrollDiv = document.createElement('div')
    scrollDiv.className = 'modal-scrollbar-measure'
    this.$body.append(scrollDiv)
    var scrollbarWidth = scrollDiv.offsetWidth - scrollDiv.clientWidth
    this.$body[0].removeChild(scrollDiv)
    return scrollbarWidth
  }
1084
1085


XhmikosR's avatar
XhmikosR committed
1086
1087
  // MODAL PLUGIN DEFINITION
  // =======================
fat's avatar
fat committed
1088

XhmikosR's avatar
XhmikosR committed
1089
1090
1091
1092
1093
1094
1095
1096
1097
1098
1099
  function Plugin(option, _relatedTarget) {
    return this.each(function () {
      var $this   = $(this)
      var data    = $this.data('bs.modal')
      var options = $.extend({}, Modal.DEFAULTS, $this.data(), typeof option == 'object' && option)

      if (!data) $this.data('bs.modal', (data = new Modal(this, options)))
      if (typeof option == 'string') data[option](_relatedTarget)
      else if (options.show) data.show(_relatedTarget)
    })
  }
1100

XhmikosR's avatar
XhmikosR committed
1101
  var old = $.fn.modal
Mark Otto's avatar
Mark Otto committed
1102

XhmikosR's avatar
XhmikosR committed
1103
1104
  $.fn.modal             = Plugin
  $.fn.modal.Constructor = Modal
1105
1106


XhmikosR's avatar
XhmikosR committed
1107
1108
  // MODAL NO CONFLICT
  // =================
1109

XhmikosR's avatar
XhmikosR committed
1110
1111
1112
1113
  $.fn.modal.noConflict = function () {
    $.fn.modal = old
    return this
  }
1114
1115


XhmikosR's avatar
XhmikosR committed
1116
1117
  // MODAL DATA-API
  // ==============
1118

XhmikosR's avatar
XhmikosR committed
1119
1120
1121
1122
1123
  $(document).on('click.bs.modal.data-api', '[data-toggle="modal"]', function (e) {
    var $this   = $(this)
    var href    = $this.attr('href')
    var $target = $($this.attr('data-target') || (href && href.replace(/.*(?=#[^\s]+$)/, ''))) // strip for ie7
    var option  = $target.data('bs.modal') ? 'toggle' : $.extend({ remote: !/#/.test(href) && href }, $target.data(), $this.data())
1124

XhmikosR's avatar
XhmikosR committed
1125
    if ($this.is('a')) e.preventDefault()
1126

XhmikosR's avatar
XhmikosR committed
1127
1128
1129
1130
    $target.one('show.bs.modal', function (showEvent) {
      if (showEvent.isDefaultPrevented()) return // only register focus restorer if modal will actually get shown
      $target.one('hidden.bs.modal', function () {
        $this.is(':visible') && $this.trigger('focus')
Mark Otto's avatar
grunt    
Mark Otto committed
1131
      })
Mark Otto's avatar
Mark Otto committed
1132
    })
XhmikosR's avatar
XhmikosR committed
1133
    Plugin.call($target, option, this)
Jacob Thornton's avatar
Jacob Thornton committed
1134
  })
1135

XhmikosR's avatar
XhmikosR committed
1136
}(jQuery);
1137

1138
/* ========================================================================
Mark Otto's avatar
Mark Otto committed
1139
 * Bootstrap: tooltip.js v3.2.0
Mark Otto's avatar
Mark Otto committed
1140
 * http://getbootstrap.com/javascript/#tooltip
1141
 * Inspired by the original jQuery.tipsy by Jason Frame
1142
 * ========================================================================
1143
 * Copyright 2011-2014 Twitter, Inc.
1144
 * Licensed under MIT (https://github.com/twbs/bootstrap/blob/master/LICENSE)
1145
 * ======================================================================== */
1146
1147


XhmikosR's avatar
XhmikosR committed
1148
1149
1150
1151
1152
1153
1154
1155
1156
1157
1158
1159
1160
1161
1162
1163
1164
+function ($) {
  'use strict';

  // TOOLTIP PUBLIC CLASS DEFINITION
  // ===============================

  var Tooltip = function (element, options) {
    this.type       =
    this.options    =
    this.enabled    =
    this.timeout    =
    this.hoverState =
    this.$element   = null

    this.init('tooltip', element, options)
  }

Mark Otto's avatar
Mark Otto committed
1165
  Tooltip.VERSION  = '3.2.0'
XhmikosR's avatar
XhmikosR committed
1166

1167
1168
  Tooltip.TRANSITION_DURATION = 150

XhmikosR's avatar
XhmikosR committed
1169
1170
1171
1172
1173
1174
1175
1176
1177
1178
1179
1180
1181
1182
1183
1184
1185
1186
1187
1188
1189
1190
1191
1192
1193
1194
1195
1196
1197
1198
1199
1200
1201
1202
1203
1204
1205
1206
  Tooltip.DEFAULTS = {
    animation: true,
    placement: 'top',
    selector: false,
    template: '<div class="tooltip" role="tooltip"><div class="tooltip-arrow"></div><div class="tooltip-inner"></div></div>',
    trigger: 'hover focus',
    title: '',
    delay: 0,
    html: false,
    container: false,
    viewport: {
      selector: 'body',
      padding: 0
    }
  }

  Tooltip.prototype.init = function (type, element, options) {
    this.enabled   = true
    this.type      = type
    this.$element  = $(element)
    this.options   = this.getOptions(options)
    this.$viewport = this.options.viewport && $(this.options.viewport.selector || this.options.viewport)

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

    for (var i = triggers.length; i--;) {
      var trigger = triggers[i]

      if (trigger == 'click') {
        this.$element.on('click.' + this.type, this.options.selector, $.proxy(this.toggle, this))
      } else if (trigger != 'manual') {
        var eventIn  = trigger == 'hover' ? 'mouseenter' : 'focusin'
        var eventOut = trigger == 'hover' ? 'mouseleave' : 'focusout'

        this.$element.on(eventIn  + '.' + this.type, this.options.selector, $.proxy(this.enter, this))
        this.$element.on(eventOut + '.' + this.type, this.options.selector, $.proxy(this.leave, this))
      }
    }
1207

XhmikosR's avatar
XhmikosR committed
1208
1209
1210
1211
    this.options.selector ?
      (this._options = $.extend({}, this.options, { trigger: 'manual', selector: '' })) :
      this.fixTitle()
  }
1212

XhmikosR's avatar
XhmikosR committed
1213
1214
1215
  Tooltip.prototype.getDefaults = function () {
    return Tooltip.DEFAULTS
  }
1216

XhmikosR's avatar
XhmikosR committed
1217
1218
  Tooltip.prototype.getOptions = function (options) {
    options = $.extend({}, this.getDefaults(), this.$element.data(), options)
1219

XhmikosR's avatar
XhmikosR committed
1220
1221
1222
1223
    if (options.delay && typeof options.delay == 'number') {
      options.delay = {
        show: options.delay,
        hide: options.delay
1224
1225
      }
    }
1226

XhmikosR's avatar
XhmikosR committed
1227
1228
    return options
  }
Jacob Thornton's avatar
Jacob Thornton committed
1229

XhmikosR's avatar
XhmikosR committed
1230
1231
1232
  Tooltip.prototype.getDelegateOptions = function () {
    var options  = {}
    var defaults = this.getDefaults()
1233

XhmikosR's avatar
XhmikosR committed
1234
1235
1236
    this._options && $.each(this._options, function (key, value) {
      if (defaults[key] != value) options[key] = value
    })
fat's avatar
rebuild    
fat committed
1237

XhmikosR's avatar
XhmikosR committed
1238
1239
    return options
  }
Jacob Thornton's avatar
Jacob Thornton committed
1240

XhmikosR's avatar
XhmikosR committed
1241
1242
1243
  Tooltip.prototype.enter = function (obj) {
    var self = obj instanceof this.constructor ?
      obj : $(obj.currentTarget).data('bs.' + this.type)
Mark Otto's avatar
Mark Otto committed
1244

XhmikosR's avatar
XhmikosR committed
1245
1246
1247
1248
1249
    if (self && self.$tip && self.$tip.is(':visible')) {
      self.hoverState = 'in'
      return
    }

XhmikosR's avatar
XhmikosR committed
1250
1251
1252
    if (!self) {
      self = new this.constructor(obj.currentTarget, this.getDelegateOptions())
      $(obj.currentTarget).data('bs.' + this.type, self)
Mark Otto's avatar
Mark Otto committed
1253
    }
1254

XhmikosR's avatar
XhmikosR committed
1255
    clearTimeout(self.timeout)
1256

XhmikosR's avatar
XhmikosR committed
1257
    self.hoverState = 'in'
1258

XhmikosR's avatar
XhmikosR committed
1259
    if (!self.options.delay || !self.options.delay.show) return self.show()
1260

XhmikosR's avatar
XhmikosR committed
1261
1262
1263
1264
    self.timeout = setTimeout(function () {
      if (self.hoverState == 'in') self.show()
    }, self.options.delay.show)
  }
1265

XhmikosR's avatar
XhmikosR committed
1266
1267
1268
  Tooltip.prototype.leave = function (obj) {
    var self = obj instanceof this.constructor ?
      obj : $(obj.currentTarget).data('bs.' + this.type)
Mark Otto's avatar
Mark Otto committed
1269

XhmikosR's avatar
XhmikosR committed
1270
1271
1272
    if (!self) {
      self = new this.constructor(obj.currentTarget, this.getDelegateOptions())
      $(obj.currentTarget).data('bs.' + this.type, self)
Mark Otto's avatar
Mark Otto committed
1273
    }
1274

XhmikosR's avatar
XhmikosR committed
1275
    clearTimeout(self.timeout)
fat's avatar
fat committed
1276

XhmikosR's avatar
XhmikosR committed
1277
    self.hoverState = 'out'
1278

XhmikosR's avatar
XhmikosR committed
1279
    if (!self.options.delay || !self.options.delay.hide) return self.hide()
1280

XhmikosR's avatar
XhmikosR committed
1281
1282
1283
1284
    self.timeout = setTimeout(function () {
      if (self.hoverState == 'out') self.hide()
    }, self.options.delay.hide)
  }
1285

XhmikosR's avatar
XhmikosR committed
1286
1287
  Tooltip.prototype.show = function () {
    var e = $.Event('show.bs.' + this.type)
Chris Rebert's avatar
Chris Rebert committed
1288

XhmikosR's avatar
XhmikosR committed
1289
1290
    if (this.hasContent() && this.enabled) {
      this.$element.trigger(e)
fat's avatar
fat committed
1291

Heinrich Fenkart's avatar
Heinrich Fenkart committed
1292
      var inDom = $.contains(this.$element[0].ownerDocument.documentElement, this.$element[0])
XhmikosR's avatar
XhmikosR committed
1293
1294
      if (e.isDefaultPrevented() || !inDom) return
      var that = this
1295

XhmikosR's avatar
XhmikosR committed
1296
      var $tip = this.tip()
fat's avatar
fat committed
1297

XhmikosR's avatar
XhmikosR committed
1298
      var tipId = this.getUID(this.type)
fat's avatar
fat committed
1299

XhmikosR's avatar
XhmikosR committed
1300
1301
1302
      this.setContent()
      $tip.attr('id', tipId)
      this.$element.attr('aria-describedby', tipId)
1303

XhmikosR's avatar
XhmikosR committed
1304
      if (this.options.animation) $tip.addClass('fade')
1305

XhmikosR's avatar
XhmikosR committed
1306
1307
1308
      var placement = typeof this.options.placement == 'function' ?
        this.options.placement.call(this, $tip[0], this.$element[0]) :
        this.options.placement
1309

XhmikosR's avatar
XhmikosR committed
1310
1311
1312
      var autoToken = /\s?auto?\s?/i
      var autoPlace = autoToken.test(placement)
      if (autoPlace) placement = placement.replace(autoToken, '') || 'top'
1313

XhmikosR's avatar
XhmikosR committed
1314
1315
1316
1317
1318
      $tip
        .detach()
        .css({ top: 0, left: 0, display: 'block' })
        .addClass(placement)
        .data('bs.' + this.type, this)
fat's avatar
fat committed
1319

XhmikosR's avatar
XhmikosR committed
1320
      this.options.container ? $tip.appendTo(this.options.container) : $tip.insertAfter(this.$element)
1321

XhmikosR's avatar
XhmikosR committed
1322
1323
1324
      var pos          = this.getPosition()
      var actualWidth  = $tip[0].offsetWidth
      var actualHeight = $tip[0].offsetHeight
Chris Rebert's avatar
Chris Rebert committed
1325

XhmikosR's avatar
XhmikosR committed
1326
1327
      if (autoPlace) {
        var orgPlacement = placement
Heinrich Fenkart's avatar
grunt    
Heinrich Fenkart committed
1328
1329
        var $container   = this.options.container ? $(this.options.container) : this.$element.parent()
        var containerDim = this.getPosition($container)
Chris Rebert's avatar
Chris Rebert committed
1330

Heinrich Fenkart's avatar
grunt    
Heinrich Fenkart committed
1331
1332
1333
1334
        placement = placement == 'bottom' && pos.top   + pos.height          + actualHeight - containerDim.scroll > containerDim.height ? 'top'    :
                    placement == 'top'    && pos.top   - containerDim.scroll - actualHeight < containerDim.top                          ? 'bottom' :
                    placement == 'right'  && pos.right + actualWidth         > containerDim.width                                       ? 'left'   :
                    placement == 'left'   && pos.left  - actualWidth         < containerDim.left                                        ? 'right'  :
XhmikosR's avatar
XhmikosR committed
1335
                    placement
fat's avatar
fat committed
1336

1337
        $tip
XhmikosR's avatar
XhmikosR committed
1338
          .removeClass(orgPlacement)
1339
          .addClass(placement)
XhmikosR's avatar
XhmikosR committed
1340
      }
1341

XhmikosR's avatar
XhmikosR committed
1342
      var calculatedOffset = this.getCalculatedOffset(placement, pos, actualWidth, actualHeight)
1343

XhmikosR's avatar
XhmikosR committed
1344
      this.applyPlacement(calculatedOffset, placement)
fat's avatar
fat committed
1345

XhmikosR's avatar
XhmikosR committed
1346
1347
1348
1349
      var complete = function () {
        that.$element.trigger('shown.bs.' + that.type)
        that.hoverState = null
      }
fat's avatar
fat committed
1350

XhmikosR's avatar
XhmikosR committed
1351
1352
1353
      $.support.transition && this.$tip.hasClass('fade') ?
        $tip
          .one('bsTransitionEnd', complete)
1354
          .emulateTransitionEnd(Tooltip.TRANSITION_DURATION) :
XhmikosR's avatar
XhmikosR committed
1355
1356
1357
        complete()
    }
  }
fat's avatar
fat committed
1358

XhmikosR's avatar
XhmikosR committed
1359
1360
1361
1362
  Tooltip.prototype.applyPlacement = function (offset, placement) {
    var $tip   = this.tip()
    var width  = $tip[0].offsetWidth
    var height = $tip[0].offsetHeight
fat's avatar
fat committed
1363

XhmikosR's avatar
XhmikosR committed
1364
1365
1366
    // manually read margins because getBoundingClientRect includes difference
    var marginTop = parseInt($tip.css('margin-top'), 10)
    var marginLeft = parseInt($tip.css('margin-left'), 10)
fat's avatar
fat committed
1367

XhmikosR's avatar
XhmikosR committed
1368
1369
1370
    // we must check for NaN for ie 8/9
    if (isNaN(marginTop))  marginTop  = 0
    if (isNaN(marginLeft)) marginLeft = 0
fat's avatar
fat committed
1371

XhmikosR's avatar
XhmikosR committed
1372
1373
    offset.top  = offset.top  + marginTop
    offset.left = offset.left + marginLeft
fat's avatar
fat committed
1374

XhmikosR's avatar
XhmikosR committed
1375
1376
1377
1378
1379
1380
1381
1382
    // $.fn.offset doesn't round pixel values
    // so we use setOffset directly with our own function B-0
    $.offset.setOffset($tip[0], $.extend({
      using: function (props) {
        $tip.css({
          top: Math.round(props.top),
          left: Math.round(props.left)
        })
1383
      }
XhmikosR's avatar
XhmikosR committed
1384
    }, offset), 0)
1385

XhmikosR's avatar
XhmikosR committed
1386
    $tip.addClass('in')
fat's avatar
fat committed
1387

XhmikosR's avatar
XhmikosR committed
1388
1389
1390
    // check to see if placing tip in new offset caused the tip to resize itself
    var actualWidth  = $tip[0].offsetWidth
    var actualHeight = $tip[0].offsetHeight
fat's avatar
fat committed
1391

XhmikosR's avatar
XhmikosR committed
1392
1393
1394
    if (placement == 'top' && actualHeight != height) {
      offset.top = offset.top + height - actualHeight
    }
fat's avatar
fat committed
1395

XhmikosR's avatar
XhmikosR committed
1396
    var delta = this.getViewportAdjustedDelta(placement, offset, actualWidth, actualHeight)
fat's avatar
fat committed
1397

XhmikosR's avatar
XhmikosR committed
1398
1399
    if (delta.left) offset.left += delta.left
    else offset.top += delta.top
1400

Heinrich Fenkart's avatar
grunt    
Heinrich Fenkart committed
1401
1402
1403
    var isVertical          = /top|bottom/.test(placement)
    var arrowDelta          = isVertical ? delta.left * 2 - width + actualWidth : delta.top * 2 - height + actualHeight
    var arrowOffsetPosition = isVertical ? 'offsetWidth' : 'offsetHeight'
1404

XhmikosR's avatar
XhmikosR committed
1405
    $tip.offset(offset)
Heinrich Fenkart's avatar
grunt    
Heinrich Fenkart committed
1406
    this.replaceArrow(arrowDelta, $tip[0][arrowOffsetPosition], isVertical)
XhmikosR's avatar
XhmikosR committed
1407
  }
1408

Heinrich Fenkart's avatar
grunt    
Heinrich Fenkart committed
1409
1410
1411
1412
  Tooltip.prototype.replaceArrow = function (delta, dimension, isHorizontal) {
    this.arrow()
      .css(isHorizontal ? 'left' : 'top', 50 * (1 - delta / dimension) + '%')
      .css(isHorizontal ? 'top' : 'left', '')
XhmikosR's avatar
XhmikosR committed
1413
  }
1414

XhmikosR's avatar
XhmikosR committed
1415
1416
1417
  Tooltip.prototype.setContent = function () {
    var $tip  = this.tip()
    var title = this.getTitle()
1418

XhmikosR's avatar
XhmikosR committed
1419
1420
1421
    $tip.find('.tooltip-inner')[this.options.html ? 'html' : 'text'](title)
    $tip.removeClass('fade in top bottom left right')
  }
1422

Heinrich Fenkart's avatar
Heinrich Fenkart committed
1423
  Tooltip.prototype.hide = function (callback) {
XhmikosR's avatar
XhmikosR committed
1424
1425
1426
    var that = this
    var $tip = this.tip()
    var e    = $.Event('hide.bs.' + this.type)
1427

XhmikosR's avatar
XhmikosR committed
1428
1429
    function complete() {
      if (that.hoverState != 'in') $tip.detach()
Heinrich Fenkart's avatar
Heinrich Fenkart committed
1430
1431
1432
      that.$element
        .removeAttr('aria-describedby')
        .trigger('hidden.bs.' + that.type)
Heinrich Fenkart's avatar
Heinrich Fenkart committed
1433
      callback && callback()
XhmikosR's avatar
XhmikosR committed
1434
    }
Jacob Thornton's avatar
Jacob Thornton committed
1435

XhmikosR's avatar
XhmikosR committed
1436
    this.$element.trigger(e)
1437

XhmikosR's avatar
XhmikosR committed
1438
    if (e.isDefaultPrevented()) return
1439

XhmikosR's avatar
XhmikosR committed
1440
    $tip.removeClass('in')
1441

XhmikosR's avatar
XhmikosR committed
1442
1443
1444
    $.support.transition && this.$tip.hasClass('fade') ?
      $tip
        .one('bsTransitionEnd', complete)
1445
        .emulateTransitionEnd(Tooltip.TRANSITION_DURATION) :
XhmikosR's avatar
XhmikosR committed
1446
      complete()
1447

XhmikosR's avatar
XhmikosR committed
1448
    this.hoverState = null
1449

XhmikosR's avatar
XhmikosR committed
1450
1451
    return this
  }
1452

XhmikosR's avatar
XhmikosR committed
1453
1454
1455
1456
  Tooltip.prototype.fixTitle = function () {
    var $e = this.$element
    if ($e.attr('title') || typeof ($e.attr('data-original-title')) != 'string') {
      $e.attr('data-original-title', $e.attr('title') || '').attr('title', '')
1457
    }
XhmikosR's avatar
XhmikosR committed
1458
  }
1459

XhmikosR's avatar
XhmikosR committed
1460
1461
1462
  Tooltip.prototype.hasContent = function () {
    return this.getTitle()
  }
1463

XhmikosR's avatar
XhmikosR committed
1464
1465
  Tooltip.prototype.getPosition = function ($element) {
    $element   = $element || this.$element
Mark Otto's avatar
grunt    
Mark Otto committed
1466

XhmikosR's avatar
XhmikosR committed
1467
1468
    var el     = $element[0]
    var isBody = el.tagName == 'BODY'
Mark Otto's avatar
grunt    
Mark Otto committed
1469

Mark Otto's avatar
grunt    
Mark Otto committed
1470
    var elRect    = el.getBoundingClientRect()
Heinrich Fenkart's avatar
Heinrich Fenkart committed
1471
1472
1473
1474
    if (elRect.width == null) {
      // width and height are missing in IE8, so compute them manually; see https://github.com/twbs/bootstrap/issues/14093
      elRect = $.extend({}, elRect, { width: elRect.right - elRect.left, height: elRect.bottom - elRect.top })
    }
Mark Otto's avatar
grunt    
Mark Otto committed
1475
1476
    var elOffset  = isBody ? { top: 0, left: 0 } : $element.offset()
    var scroll    = { scroll: isBody ? document.documentElement.scrollTop || document.body.scrollTop : $element.scrollTop() }
Heinrich Fenkart's avatar
grunt    
Heinrich Fenkart committed
1477
    var outerDims = isBody ? { width: $(window).width(), height: $(window).height() } : null
Mark Otto's avatar
grunt    
Mark Otto committed
1478
1479

    return $.extend({}, elRect, scroll, outerDims, elOffset)
XhmikosR's avatar
XhmikosR committed
1480
  }
1481

XhmikosR's avatar
XhmikosR committed
1482
1483
1484
1485
1486
  Tooltip.prototype.getCalculatedOffset = function (placement, pos, actualWidth, actualHeight) {
    return placement == 'bottom' ? { top: pos.top + pos.height,   left: pos.left + pos.width / 2 - actualWidth / 2  } :
           placement == 'top'    ? { top: pos.top - actualHeight, left: pos.left + pos.width / 2 - actualWidth / 2  } :
           placement == 'left'   ? { top: pos.top + pos.height / 2 - actualHeight / 2, left: pos.left - actualWidth } :
        /* placement == 'right' */ { top: pos.top + pos.height / 2 - actualHeight / 2, left: pos.left + pos.width   }
1487

XhmikosR's avatar
XhmikosR committed
1488
  }
1489

XhmikosR's avatar
XhmikosR committed
1490
1491
1492
  Tooltip.prototype.getViewportAdjustedDelta = function (placement, pos, actualWidth, actualHeight) {
    var delta = { top: 0, left: 0 }
    if (!this.$viewport) return delta
1493

XhmikosR's avatar
XhmikosR committed
1494
1495
    var viewportPadding = this.options.viewport && this.options.viewport.padding || 0
    var viewportDimensions = this.getPosition(this.$viewport)
1496

XhmikosR's avatar
XhmikosR committed
1497
1498
1499
1500
1501
1502
1503
1504
1505
1506
1507
1508
1509
1510
1511
    if (/right|left/.test(placement)) {
      var topEdgeOffset    = pos.top - viewportPadding - viewportDimensions.scroll
      var bottomEdgeOffset = pos.top + viewportPadding - viewportDimensions.scroll + actualHeight
      if (topEdgeOffset < viewportDimensions.top) { // top overflow
        delta.top = viewportDimensions.top - topEdgeOffset
      } else if (bottomEdgeOffset > viewportDimensions.top + viewportDimensions.height) { // bottom overflow
        delta.top = viewportDimensions.top + viewportDimensions.height - bottomEdgeOffset
      }
    } else {
      var leftEdgeOffset  = pos.left - viewportPadding
      var rightEdgeOffset = pos.left + viewportPadding + actualWidth
      if (leftEdgeOffset < viewportDimensions.left) { // left overflow
        delta.left = viewportDimensions.left - leftEdgeOffset
      } else if (rightEdgeOffset > viewportDimensions.width) { // right overflow
        delta.left = viewportDimensions.left + viewportDimensions.width - rightEdgeOffset
1512
      }
Chris Rebert's avatar
Chris Rebert committed
1513
    }
fat's avatar
fat committed
1514

XhmikosR's avatar
XhmikosR committed
1515
1516
    return delta
  }
1517

XhmikosR's avatar
XhmikosR committed
1518
1519
1520
1521
  Tooltip.prototype.getTitle = function () {
    var title
    var $e = this.$element
    var o  = this.options
1522

XhmikosR's avatar
XhmikosR committed
1523
1524
    title = $e.attr('data-original-title')
      || (typeof o.title == 'function' ? o.title.call($e[0]) :  o.title)
1525

XhmikosR's avatar
XhmikosR committed
1526
1527
    return title
  }
1528

XhmikosR's avatar
XhmikosR committed
1529
1530
1531
1532
1533
  Tooltip.prototype.getUID = function (prefix) {
    do prefix += ~~(Math.random() * 1000000)
    while (document.getElementById(prefix))
    return prefix
  }
1534

XhmikosR's avatar
XhmikosR committed
1535
1536
1537
  Tooltip.prototype.tip = function () {
    return (this.$tip = this.$tip || $(this.options.template))
  }
1538

XhmikosR's avatar
XhmikosR committed
1539
1540
1541
  Tooltip.prototype.arrow = function () {
    return (this.$arrow = this.$arrow || this.tip().find('.tooltip-arrow'))
  }
1542

XhmikosR's avatar
XhmikosR committed
1543
1544
1545
  Tooltip.prototype.enable = function () {
    this.enabled = true
  }
1546

XhmikosR's avatar
XhmikosR committed
1547
1548
1549
  Tooltip.prototype.disable = function () {
    this.enabled = false
  }
Mark Otto's avatar
Mark Otto committed
1550

XhmikosR's avatar
XhmikosR committed
1551
1552
1553
  Tooltip.prototype.toggleEnabled = function () {
    this.enabled = !this.enabled
  }
Chris Rebert's avatar
Chris Rebert committed
1554

XhmikosR's avatar
XhmikosR committed
1555
1556
1557
1558
1559
1560
1561
1562
  Tooltip.prototype.toggle = function (e) {
    var self = this
    if (e) {
      self = $(e.currentTarget).data('bs.' + this.type)
      if (!self) {
        self = new this.constructor(e.currentTarget, this.getDelegateOptions())
        $(e.currentTarget).data('bs.' + this.type, self)
      }
Mark Otto's avatar
Mark Otto committed
1563
1564
    }

XhmikosR's avatar
XhmikosR committed
1565
1566
    self.tip().hasClass('in') ? self.leave(self) : self.enter(self)
  }
1567

XhmikosR's avatar
XhmikosR committed
1568
  Tooltip.prototype.destroy = function () {
Heinrich Fenkart's avatar
Heinrich Fenkart committed
1569
    var that = this
XhmikosR's avatar
XhmikosR committed
1570
    clearTimeout(this.timeout)
Heinrich Fenkart's avatar
Heinrich Fenkart committed
1571
1572
1573
    this.hide(function () {
      that.$element.off('.' + that.type).removeData('bs.' + that.type)
    })
XhmikosR's avatar
XhmikosR committed
1574
  }
1575
1576


XhmikosR's avatar
XhmikosR committed
1577
1578
  // TOOLTIP PLUGIN DEFINITION
  // =========================
1579

XhmikosR's avatar
XhmikosR committed
1580
1581
1582
1583
1584
  function Plugin(option) {
    return this.each(function () {
      var $this   = $(this)
      var data    = $this.data('bs.tooltip')
      var options = typeof option == 'object' && option
fat's avatar
fat committed
1585

XhmikosR's avatar
XhmikosR committed
1586
1587
1588
1589
1590
      if (!data && option == 'destroy') return
      if (!data) $this.data('bs.tooltip', (data = new Tooltip(this, options)))
      if (typeof option == 'string') data[option]()
    })
  }
1591

XhmikosR's avatar
XhmikosR committed
1592
  var old = $.fn.tooltip
Mark Otto's avatar
Mark Otto committed
1593

XhmikosR's avatar
XhmikosR committed
1594
1595
  $.fn.tooltip             = Plugin
  $.fn.tooltip.Constructor = Tooltip
1596

1597

XhmikosR's avatar
XhmikosR committed
1598
1599
  // TOOLTIP NO CONFLICT
  // ===================
1600

XhmikosR's avatar
XhmikosR committed
1601
1602
1603
1604
  $.fn.tooltip.noConflict = function () {
    $.fn.tooltip = old
    return this
  }
1605

XhmikosR's avatar
XhmikosR committed
1606
}(jQuery);
1607

1608
/* ========================================================================
Mark Otto's avatar
Mark Otto committed
1609
 * Bootstrap: popover.js v3.2.0
Mark Otto's avatar
Mark Otto committed
1610
 * http://getbootstrap.com/javascript/#popovers
1611
 * ========================================================================
1612
 * Copyright 2011-2014 Twitter, Inc.
1613
 * Licensed under MIT (https://github.com/twbs/bootstrap/blob/master/LICENSE)
1614
 * ======================================================================== */
1615
1616


XhmikosR's avatar
XhmikosR committed
1617
1618
+function ($) {
  'use strict';
Mark Otto's avatar
grunt    
Mark Otto committed
1619

XhmikosR's avatar
XhmikosR committed
1620
1621
  // POPOVER PUBLIC CLASS DEFINITION
  // ===============================
1622

XhmikosR's avatar
XhmikosR committed
1623
1624
1625
  var Popover = function (element, options) {
    this.init('popover', element, options)
  }
fat's avatar
fat committed
1626

XhmikosR's avatar
XhmikosR committed
1627
  if (!$.fn.tooltip) throw new Error('Popover requires tooltip.js')
1628

Mark Otto's avatar
Mark Otto committed
1629
  Popover.VERSION  = '3.2.0'
1630

XhmikosR's avatar
XhmikosR committed
1631
1632
1633
1634
1635
1636
  Popover.DEFAULTS = $.extend({}, $.fn.tooltip.Constructor.DEFAULTS, {
    placement: 'right',
    trigger: 'click',
    content: '',
    template: '<div class="popover" role="tooltip"><div class="arrow"></div><h3 class="popover-title"></h3><div class="popover-content"></div></div>'
  })
fat's avatar
fat committed
1637
1638


XhmikosR's avatar
XhmikosR committed
1639
1640
  // NOTE: POPOVER EXTENDS tooltip.js
  // ================================
1641

XhmikosR's avatar
XhmikosR committed
1642
  Popover.prototype = $.extend({}, $.fn.tooltip.Constructor.prototype)
fat's avatar
fat committed
1643

XhmikosR's avatar
XhmikosR committed
1644
  Popover.prototype.constructor = Popover
1645

XhmikosR's avatar
XhmikosR committed
1646
1647
1648
  Popover.prototype.getDefaults = function () {
    return Popover.DEFAULTS
  }
1649

XhmikosR's avatar
XhmikosR committed
1650
1651
1652
1653
  Popover.prototype.setContent = function () {
    var $tip    = this.tip()
    var title   = this.getTitle()
    var content = this.getContent()
1654

XhmikosR's avatar
XhmikosR committed
1655
    $tip.find('.popover-title')[this.options.html ? 'html' : 'text'](title)
Mark Otto's avatar
grunt    
Mark Otto committed
1656
    $tip.find('.popover-content').children().detach().end()[ // we use append for html objects to maintain js events
XhmikosR's avatar
XhmikosR committed
1657
1658
      this.options.html ? (typeof content == 'string' ? 'html' : 'append') : 'text'
    ](content)
1659

XhmikosR's avatar
XhmikosR committed
1660
    $tip.removeClass('fade top bottom left right in')
1661

XhmikosR's avatar
XhmikosR committed
1662
1663
1664
1665
    // IE8 doesn't accept hiding via the `:empty` pseudo selector, we have to do
    // this manually by checking the contents.
    if (!$tip.find('.popover-title').html()) $tip.find('.popover-title').hide()
  }
1666

XhmikosR's avatar
XhmikosR committed
1667
1668
1669
  Popover.prototype.hasContent = function () {
    return this.getTitle() || this.getContent()
  }
1670

XhmikosR's avatar
XhmikosR committed
1671
1672
1673
  Popover.prototype.getContent = function () {
    var $e = this.$element
    var o  = this.options
1674

XhmikosR's avatar
XhmikosR committed
1675
1676
1677
1678
1679
    return $e.attr('data-content')
      || (typeof o.content == 'function' ?
            o.content.call($e[0]) :
            o.content)
  }
fat's avatar
fat committed
1680

XhmikosR's avatar
XhmikosR committed
1681
1682
1683
  Popover.prototype.arrow = function () {
    return (this.$arrow = this.$arrow || this.tip().find('.arrow'))
  }
1684

XhmikosR's avatar
XhmikosR committed
1685
1686
1687
1688
  Popover.prototype.tip = function () {
    if (!this.$tip) this.$tip = $(this.options.template)
    return this.$tip
  }
1689

1690

XhmikosR's avatar
XhmikosR committed
1691
1692
  // POPOVER PLUGIN DEFINITION
  // =========================
1693

XhmikosR's avatar
XhmikosR committed
1694
1695
1696
1697
1698
  function Plugin(option) {
    return this.each(function () {
      var $this   = $(this)
      var data    = $this.data('bs.popover')
      var options = typeof option == 'object' && option
Chris Rebert's avatar
Chris Rebert committed
1699

XhmikosR's avatar
XhmikosR committed
1700
1701
1702
1703
1704
      if (!data && option == 'destroy') return
      if (!data) $this.data('bs.popover', (data = new Popover(this, options)))
      if (typeof option == 'string') data[option]()
    })
  }
1705

XhmikosR's avatar
XhmikosR committed
1706
  var old = $.fn.popover
Mark Otto's avatar
Mark Otto committed
1707

XhmikosR's avatar
XhmikosR committed
1708
1709
  $.fn.popover             = Plugin
  $.fn.popover.Constructor = Popover
fat's avatar
fat committed
1710

1711

XhmikosR's avatar
XhmikosR committed
1712
1713
  // POPOVER NO CONFLICT
  // ===================
1714

XhmikosR's avatar
XhmikosR committed
1715
1716
1717
1718
  $.fn.popover.noConflict = function () {
    $.fn.popover = old
    return this
  }
1719

XhmikosR's avatar
XhmikosR committed
1720
}(jQuery);
1721

1722
/* ========================================================================
Mark Otto's avatar
Mark Otto committed
1723
 * Bootstrap: scrollspy.js v3.2.0
Mark Otto's avatar
Mark Otto committed
1724
 * http://getbootstrap.com/javascript/#scrollspy
1725
 * ========================================================================
1726
 * Copyright 2011-2014 Twitter, Inc.
1727
 * Licensed under MIT (https://github.com/twbs/bootstrap/blob/master/LICENSE)
1728
 * ======================================================================== */
1729
1730


XhmikosR's avatar
XhmikosR committed
1731
1732
+function ($) {
  'use strict';
1733

XhmikosR's avatar
XhmikosR committed
1734
1735
  // SCROLLSPY CLASS DEFINITION
  // ==========================
1736

XhmikosR's avatar
XhmikosR committed
1737
1738
  function ScrollSpy(element, options) {
    var process  = $.proxy(this.process, this)
1739

XhmikosR's avatar
XhmikosR committed
1740
1741
1742
1743
1744
1745
1746
1747
    this.$body          = $('body')
    this.$scrollElement = $(element).is('body') ? $(window) : $(element)
    this.options        = $.extend({}, ScrollSpy.DEFAULTS, options)
    this.selector       = (this.options.target || '') + ' .nav li > a'
    this.offsets        = []
    this.targets        = []
    this.activeTarget   = null
    this.scrollHeight   = 0
1748

XhmikosR's avatar
XhmikosR committed
1749
1750
1751
1752
    this.$scrollElement.on('scroll.bs.scrollspy', process)
    this.refresh()
    this.process()
  }
1753

Mark Otto's avatar
Mark Otto committed
1754
  ScrollSpy.VERSION  = '3.2.0'
Mark Otto's avatar
grunt    
Mark Otto committed
1755

XhmikosR's avatar
XhmikosR committed
1756
1757
1758
  ScrollSpy.DEFAULTS = {
    offset: 10
  }
1759

XhmikosR's avatar
XhmikosR committed
1760
1761
1762
  ScrollSpy.prototype.getScrollHeight = function () {
    return this.$scrollElement[0].scrollHeight || Math.max(this.$body[0].scrollHeight, document.documentElement.scrollHeight)
  }
Mark Otto's avatar
grunt    
Mark Otto committed
1763

XhmikosR's avatar
XhmikosR committed
1764
1765
1766
  ScrollSpy.prototype.refresh = function () {
    var offsetMethod = 'offset'
    var offsetBase   = 0
Mark Otto's avatar
grunt    
Mark Otto committed
1767

XhmikosR's avatar
XhmikosR committed
1768
1769
1770
1771
    if (!$.isWindow(this.$scrollElement[0])) {
      offsetMethod = 'position'
      offsetBase   = this.$scrollElement.scrollTop()
    }
Mark Otto's avatar
grunt    
Mark Otto committed
1772

XhmikosR's avatar
XhmikosR committed
1773
1774
1775
    this.offsets = []
    this.targets = []
    this.scrollHeight = this.getScrollHeight()
fat's avatar
fat committed
1776

XhmikosR's avatar
XhmikosR committed
1777
    var self     = this
XhmikosR's avatar
XhmikosR committed
1778

XhmikosR's avatar
XhmikosR committed
1779
1780
1781
1782
1783
1784
    this.$body
      .find(this.selector)
      .map(function () {
        var $el   = $(this)
        var href  = $el.data('target') || $el.attr('href')
        var $href = /^#./.test(href) && $(href)
1785

XhmikosR's avatar
XhmikosR committed
1786
1787
1788
        return ($href
          && $href.length
          && $href.is(':visible')
Heinrich Fenkart's avatar
grunt    
Heinrich Fenkart committed
1789
          && $el.is(':visible')
XhmikosR's avatar
XhmikosR committed
1790
1791
1792
1793
1794
1795
1796
1797
1798
1799
1800
1801
1802
1803
1804
1805
1806
1807
1808
1809
          && [[$href[offsetMethod]().top + offsetBase, href]]) || null
      })
      .sort(function (a, b) { return a[0] - b[0] })
      .each(function () {
        self.offsets.push(this[0])
        self.targets.push(this[1])
      })
  }

  ScrollSpy.prototype.process = function () {
    var scrollTop    = this.$scrollElement.scrollTop() + this.options.offset
    var scrollHeight = this.getScrollHeight()
    var maxScroll    = this.options.offset + scrollHeight - this.$scrollElement.height()
    var offsets      = this.offsets
    var targets      = this.targets
    var activeTarget = this.activeTarget
    var i

    if (this.scrollHeight != scrollHeight) {
      this.refresh()
Mark Otto's avatar
grunt    
Mark Otto committed
1810
1811
    }

XhmikosR's avatar
XhmikosR committed
1812
1813
1814
    if (scrollTop >= maxScroll) {
      return activeTarget != (i = targets[targets.length - 1]) && this.activate(i)
    }
1815

XhmikosR's avatar
XhmikosR committed
1816
1817
    if (activeTarget && scrollTop <= offsets[0]) {
      return activeTarget != (i = targets[0]) && this.activate(i)
Chris Rebert's avatar
Chris Rebert committed
1818
    }
1819

XhmikosR's avatar
XhmikosR committed
1820
1821
1822
1823
1824
1825
1826
    for (i = offsets.length; i--;) {
      activeTarget != targets[i]
        && scrollTop >= offsets[i]
        && (!offsets[i + 1] || scrollTop <= offsets[i + 1])
        && this.activate(targets[i])
    }
  }
1827

XhmikosR's avatar
XhmikosR committed
1828
1829
  ScrollSpy.prototype.activate = function (target) {
    this.activeTarget = target
1830

XhmikosR's avatar
XhmikosR committed
1831
1832
1833
    $(this.selector)
      .parentsUntil(this.options.target, '.active')
      .removeClass('active')
1834

XhmikosR's avatar
XhmikosR committed
1835
1836
1837
    var selector = this.selector +
        '[data-target="' + target + '"],' +
        this.selector + '[href="' + target + '"]'
1838

XhmikosR's avatar
XhmikosR committed
1839
1840
1841
    var active = $(selector)
      .parents('li')
      .addClass('active')
1842

XhmikosR's avatar
XhmikosR committed
1843
1844
1845
1846
    if (active.parent('.dropdown-menu').length) {
      active = active
        .closest('li.dropdown')
        .addClass('active')
Chris Rebert's avatar
Chris Rebert committed
1847
    }
1848

XhmikosR's avatar
XhmikosR committed
1849
1850
    active.trigger('activate.bs.scrollspy')
  }
1851
1852


XhmikosR's avatar
XhmikosR committed
1853
1854
  // SCROLLSPY PLUGIN DEFINITION
  // ===========================
1855

XhmikosR's avatar
XhmikosR committed
1856
1857
1858
1859
1860
  function Plugin(option) {
    return this.each(function () {
      var $this   = $(this)
      var data    = $this.data('bs.scrollspy')
      var options = typeof option == 'object' && option
Mark Otto's avatar
Mark Otto committed
1861

XhmikosR's avatar
XhmikosR committed
1862
1863
1864
1865
      if (!data) $this.data('bs.scrollspy', (data = new ScrollSpy(this, options)))
      if (typeof option == 'string') data[option]()
    })
  }
1866

XhmikosR's avatar
XhmikosR committed
1867
  var old = $.fn.scrollspy
1868

XhmikosR's avatar
XhmikosR committed
1869
1870
  $.fn.scrollspy             = Plugin
  $.fn.scrollspy.Constructor = ScrollSpy
1871

1872

XhmikosR's avatar
XhmikosR committed
1873
1874
  // SCROLLSPY NO CONFLICT
  // =====================
1875

XhmikosR's avatar
XhmikosR committed
1876
1877
1878
1879
  $.fn.scrollspy.noConflict = function () {
    $.fn.scrollspy = old
    return this
  }
1880

Chris Rebert's avatar
Chris Rebert committed
1881

XhmikosR's avatar
XhmikosR committed
1882
1883
  // SCROLLSPY DATA-API
  // ==================
Chris Rebert's avatar
Chris Rebert committed
1884

XhmikosR's avatar
XhmikosR committed
1885
1886
1887
1888
1889
  $(window).on('load.bs.scrollspy.data-api', function () {
    $('[data-spy="scroll"]').each(function () {
      var $spy = $(this)
      Plugin.call($spy, $spy.data())
    })
1890
  })
1891

XhmikosR's avatar
XhmikosR committed
1892
}(jQuery);
1893

1894
/* ========================================================================
Mark Otto's avatar
Mark Otto committed
1895
 * Bootstrap: tab.js v3.2.0
Mark Otto's avatar
Mark Otto committed
1896
 * http://getbootstrap.com/javascript/#tabs
1897
 * ========================================================================
1898
 * Copyright 2011-2014 Twitter, Inc.
1899
 * Licensed under MIT (https://github.com/twbs/bootstrap/blob/master/LICENSE)
1900
 * ======================================================================== */
1901

1902

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

XhmikosR's avatar
XhmikosR committed
1906
1907
  // TAB CLASS DEFINITION
  // ====================
1908

XhmikosR's avatar
XhmikosR committed
1909
1910
1911
  var Tab = function (element) {
    this.element = $(element)
  }
1912

Mark Otto's avatar
Mark Otto committed
1913
  Tab.VERSION = '3.2.0'
Mark Otto's avatar
grunt    
Mark Otto committed
1914

1915
1916
  Tab.TRANSITION_DURATION = 150

XhmikosR's avatar
XhmikosR committed
1917
1918
1919
1920
  Tab.prototype.show = function () {
    var $this    = this.element
    var $ul      = $this.closest('ul:not(.dropdown-menu)')
    var selector = $this.data('target')
1921

XhmikosR's avatar
XhmikosR committed
1922
1923
1924
1925
    if (!selector) {
      selector = $this.attr('href')
      selector = selector && selector.replace(/.*(?=#[^\s]*$)/, '') // strip for ie7
    }
1926

XhmikosR's avatar
XhmikosR committed
1927
    if ($this.parent('li').hasClass('active')) return
1928

XhmikosR's avatar
XhmikosR committed
1929
1930
1931
1932
    var previous = $ul.find('.active:last a')[0]
    var e        = $.Event('show.bs.tab', {
      relatedTarget: previous
    })
1933

XhmikosR's avatar
XhmikosR committed
1934
    $this.trigger(e)
1935

XhmikosR's avatar
XhmikosR committed
1936
    if (e.isDefaultPrevented()) return
1937

XhmikosR's avatar
XhmikosR committed
1938
    var $target = $(selector)
1939

XhmikosR's avatar
XhmikosR committed
1940
1941
1942
1943
1944
    this.activate($this.closest('li'), $ul)
    this.activate($target, $target.parent(), function () {
      $this.trigger({
        type: 'shown.bs.tab',
        relatedTarget: previous
1945
      })
XhmikosR's avatar
XhmikosR committed
1946
1947
    })
  }
1948

XhmikosR's avatar
XhmikosR committed
1949
1950
1951
1952
  Tab.prototype.activate = function (element, container, callback) {
    var $active    = container.find('> .active')
    var transition = callback
      && $.support.transition
Mark Otto's avatar
grunt    
Mark Otto committed
1953
      && (($active.length && $active.hasClass('fade')) || !!container.find('> .fade').length)
1954

XhmikosR's avatar
XhmikosR committed
1955
1956
1957
1958
1959
    function next() {
      $active
        .removeClass('active')
        .find('> .dropdown-menu > .active')
        .removeClass('active')
1960

XhmikosR's avatar
XhmikosR committed
1961
1962
1963
1964
1965
1966
1967
      element.addClass('active')

      if (transition) {
        element[0].offsetWidth // reflow for transition
        element.addClass('in')
      } else {
        element.removeClass('fade')
1968
      }
1969

XhmikosR's avatar
XhmikosR committed
1970
1971
1972
      if (element.parent('.dropdown-menu')) {
        element.closest('li.dropdown').addClass('active')
      }
fat's avatar
fat committed
1973

XhmikosR's avatar
XhmikosR committed
1974
      callback && callback()
1975
    }
fat's avatar
fat committed
1976

Mark Otto's avatar
grunt    
Mark Otto committed
1977
    $active.length && transition ?
XhmikosR's avatar
XhmikosR committed
1978
1979
      $active
        .one('bsTransitionEnd', next)
1980
        .emulateTransitionEnd(Tab.TRANSITION_DURATION) :
XhmikosR's avatar
XhmikosR committed
1981
      next()
1982

XhmikosR's avatar
XhmikosR committed
1983
1984
    $active.removeClass('in')
  }
1985
1986


XhmikosR's avatar
XhmikosR committed
1987
1988
  // TAB PLUGIN DEFINITION
  // =====================
fat's avatar
fat committed
1989

XhmikosR's avatar
XhmikosR committed
1990
1991
1992
1993
  function Plugin(option) {
    return this.each(function () {
      var $this = $(this)
      var data  = $this.data('bs.tab')
1994

XhmikosR's avatar
XhmikosR committed
1995
1996
1997
1998
      if (!data) $this.data('bs.tab', (data = new Tab(this)))
      if (typeof option == 'string') data[option]()
    })
  }
Mark Otto's avatar
Mark Otto committed
1999

XhmikosR's avatar
XhmikosR committed
2000
  var old = $.fn.tab
2001

XhmikosR's avatar
XhmikosR committed
2002
2003
  $.fn.tab             = Plugin
  $.fn.tab.Constructor = Tab
2004

2005

XhmikosR's avatar
XhmikosR committed
2006
2007
  // TAB NO CONFLICT
  // ===============
2008

XhmikosR's avatar
XhmikosR committed
2009
2010
2011
2012
  $.fn.tab.noConflict = function () {
    $.fn.tab = old
    return this
  }
2013
2014


XhmikosR's avatar
XhmikosR committed
2015
2016
2017
2018
2019
2020
  // TAB DATA-API
  // ============

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

XhmikosR's avatar
XhmikosR committed
2023
}(jQuery);
2024

2025
/* ========================================================================
Mark Otto's avatar
Mark Otto committed
2026
 * Bootstrap: affix.js v3.2.0
Mark Otto's avatar
Mark Otto committed
2027
 * http://getbootstrap.com/javascript/#affix
2028
 * ========================================================================
2029
 * Copyright 2011-2014 Twitter, Inc.
2030
 * Licensed under MIT (https://github.com/twbs/bootstrap/blob/master/LICENSE)
2031
 * ======================================================================== */
Mark Otto's avatar
Mark Otto committed
2032
2033


XhmikosR's avatar
XhmikosR committed
2034
2035
+function ($) {
  'use strict';
Mark Otto's avatar
grunt    
Mark Otto committed
2036

XhmikosR's avatar
XhmikosR committed
2037
2038
  // AFFIX CLASS DEFINITION
  // ======================
Mark Otto's avatar
Mark Otto committed
2039

XhmikosR's avatar
XhmikosR committed
2040
2041
  var Affix = function (element, options) {
    this.options = $.extend({}, Affix.DEFAULTS, options)
Mark Otto's avatar
Mark Otto committed
2042

XhmikosR's avatar
XhmikosR committed
2043
2044
2045
    this.$target = $(this.options.target)
      .on('scroll.bs.affix.data-api', $.proxy(this.checkPosition, this))
      .on('click.bs.affix.data-api',  $.proxy(this.checkPositionWithEventLoop, this))
Chris Rebert's avatar
Chris Rebert committed
2046

XhmikosR's avatar
XhmikosR committed
2047
2048
2049
2050
    this.$element     = $(element)
    this.affixed      =
    this.unpin        =
    this.pinnedOffset = null
fat's avatar
fat committed
2051

XhmikosR's avatar
XhmikosR committed
2052
2053
    this.checkPosition()
  }
fat's avatar
fat committed
2054

Mark Otto's avatar
Mark Otto committed
2055
  Affix.VERSION  = '3.2.0'
2056

XhmikosR's avatar
XhmikosR committed
2057
  Affix.RESET    = 'affix affix-top affix-bottom'
Mark Otto's avatar
grunt    
Mark Otto committed
2058

XhmikosR's avatar
XhmikosR committed
2059
2060
2061
2062
  Affix.DEFAULTS = {
    offset: 0,
    target: window
  }
2063

2064
2065
2066
2067
2068
2069
2070
2071
2072
2073
2074
2075
2076
2077
2078
2079
2080
2081
2082
2083
2084
2085
  Affix.prototype.getState = function (scrollHeight, height, offsetTop, offsetBottom) {
    var scrollTop    = this.$target.scrollTop()
    var position     = this.$element.offset()
    var targetHeight = this.$target.height()

    if (offsetTop != null && this.affixed == 'top') return scrollTop < offsetTop ? 'top' : false

    if (this.affixed == 'bottom') {
      if (offsetTop != null) return (scrollTop + this.unpin <= position.top) ? false : 'bottom'
      return (scrollTop + targetHeight <= scrollHeight - offsetBottom) ? false : 'bottom'
    }

    var initializing   = this.affixed == null
    var colliderTop    = initializing ? scrollTop : position.top
    var colliderHeight = initializing ? targetHeight : height

    if (offsetTop != null && colliderTop <= offsetTop) return 'top'
    if (offsetBottom != null && (colliderTop + colliderHeight >= scrollHeight - offsetBottom)) return 'bottom'

    return false
  }

XhmikosR's avatar
XhmikosR committed
2086
2087
2088
2089
2090
2091
2092
  Affix.prototype.getPinnedOffset = function () {
    if (this.pinnedOffset) return this.pinnedOffset
    this.$element.removeClass(Affix.RESET).addClass('affix')
    var scrollTop = this.$target.scrollTop()
    var position  = this.$element.offset()
    return (this.pinnedOffset = position.top - scrollTop)
  }
2093

XhmikosR's avatar
XhmikosR committed
2094
2095
2096
  Affix.prototype.checkPositionWithEventLoop = function () {
    setTimeout($.proxy(this.checkPosition, this), 1)
  }
fat's avatar
fat committed
2097

XhmikosR's avatar
XhmikosR committed
2098
2099
  Affix.prototype.checkPosition = function () {
    if (!this.$element.is(':visible')) return
2100

2101
    var height       = this.$element.height()
XhmikosR's avatar
XhmikosR committed
2102
2103
2104
    var offset       = this.options.offset
    var offsetTop    = offset.top
    var offsetBottom = offset.bottom
2105
    var scrollHeight = $('body').height()
2106

XhmikosR's avatar
XhmikosR committed
2107
2108
2109
    if (typeof offset != 'object')         offsetBottom = offsetTop = offset
    if (typeof offsetTop == 'function')    offsetTop    = offset.top(this.$element)
    if (typeof offsetBottom == 'function') offsetBottom = offset.bottom(this.$element)
2110

2111
    var affix = this.getState(scrollHeight, height, offsetTop, offsetBottom)
2112

2113
2114
    if (this.affixed != affix) {
      if (this.unpin != null) this.$element.css('top', '')
2115

2116
2117
      var affixType = 'affix' + (affix ? '-' + affix : '')
      var e         = $.Event(affixType + '.bs.affix')
2118

2119
      this.$element.trigger(e)
2120

2121
      if (e.isDefaultPrevented()) return
2122

2123
2124
      this.affixed = affix
      this.unpin = affix == 'bottom' ? this.getPinnedOffset() : null
2125

2126
2127
2128
2129
2130
      this.$element
        .removeClass(Affix.RESET)
        .addClass(affixType)
        .trigger(affixType.replace('affix', 'affixed') + '.bs.affix')
    }
2131

XhmikosR's avatar
XhmikosR committed
2132
2133
    if (affix == 'bottom') {
      this.$element.offset({
2134
        top: scrollHeight - height - offsetBottom
XhmikosR's avatar
XhmikosR committed
2135
      })
2136
    }
XhmikosR's avatar
XhmikosR committed
2137
  }
Mark Otto's avatar
Mark Otto committed
2138

2139

XhmikosR's avatar
XhmikosR committed
2140
2141
  // AFFIX PLUGIN DEFINITION
  // =======================
2142

XhmikosR's avatar
XhmikosR committed
2143
2144
2145
2146
2147
  function Plugin(option) {
    return this.each(function () {
      var $this   = $(this)
      var data    = $this.data('bs.affix')
      var options = typeof option == 'object' && option
2148

XhmikosR's avatar
XhmikosR committed
2149
2150
2151
2152
      if (!data) $this.data('bs.affix', (data = new Affix(this, options)))
      if (typeof option == 'string') data[option]()
    })
  }
2153

XhmikosR's avatar
XhmikosR committed
2154
  var old = $.fn.affix
Mark Otto's avatar
Mark Otto committed
2155

XhmikosR's avatar
XhmikosR committed
2156
2157
  $.fn.affix             = Plugin
  $.fn.affix.Constructor = Affix
2158
2159


XhmikosR's avatar
XhmikosR committed
2160
2161
  // AFFIX NO CONFLICT
  // =================
2162

XhmikosR's avatar
XhmikosR committed
2163
2164
2165
2166
  $.fn.affix.noConflict = function () {
    $.fn.affix = old
    return this
  }
2167
2168


XhmikosR's avatar
XhmikosR committed
2169
2170
  // AFFIX DATA-API
  // ==============
2171

XhmikosR's avatar
XhmikosR committed
2172
2173
2174
2175
  $(window).on('load', function () {
    $('[data-spy="affix"]').each(function () {
      var $spy = $(this)
      var data = $spy.data()
2176

XhmikosR's avatar
XhmikosR committed
2177
      data.offset = data.offset || {}
2178

Heinrich Fenkart's avatar
Heinrich Fenkart committed
2179
2180
      if (data.offsetBottom != null) data.offset.bottom = data.offsetBottom
      if (data.offsetTop    != null) data.offset.top    = data.offsetTop
2181

XhmikosR's avatar
XhmikosR committed
2182
      Plugin.call($spy, data)
2183
    })
Mark Otto's avatar
Mark Otto committed
2184
2185
  })

XhmikosR's avatar
XhmikosR committed
2186
}(jQuery);