public/assets/js/bootstrap.js
author Vincent Tondellier <tonton+hg@team1664.org>
Sun, 14 Feb 2016 22:42:29 +0100
changeset 100 4dae01f2beee
parent 28 0df70b8735e3
permissions -rw-r--r--
Allow extra columns in group index, and split search columns
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
28
0df70b8735e3 Update Twitter bootstrap to 3.2.0
Vincent Tondellier <tonton+hg@team1664.org>
parents: 1
diff changeset
     1
/*!
0df70b8735e3 Update Twitter bootstrap to 3.2.0
Vincent Tondellier <tonton+hg@team1664.org>
parents: 1
diff changeset
     2
 * Bootstrap v3.2.0 (http://getbootstrap.com)
0df70b8735e3 Update Twitter bootstrap to 3.2.0
Vincent Tondellier <tonton+hg@team1664.org>
parents: 1
diff changeset
     3
 * Copyright 2011-2014 Twitter, Inc.
0df70b8735e3 Update Twitter bootstrap to 3.2.0
Vincent Tondellier <tonton+hg@team1664.org>
parents: 1
diff changeset
     4
 * Licensed under MIT (https://github.com/twbs/bootstrap/blob/master/LICENSE)
0df70b8735e3 Update Twitter bootstrap to 3.2.0
Vincent Tondellier <tonton+hg@team1664.org>
parents: 1
diff changeset
     5
 */
0df70b8735e3 Update Twitter bootstrap to 3.2.0
Vincent Tondellier <tonton+hg@team1664.org>
parents: 1
diff changeset
     6
0df70b8735e3 Update Twitter bootstrap to 3.2.0
Vincent Tondellier <tonton+hg@team1664.org>
parents: 1
diff changeset
     7
if (typeof jQuery === 'undefined') { throw new Error('Bootstrap\'s JavaScript requires jQuery') }
0df70b8735e3 Update Twitter bootstrap to 3.2.0
Vincent Tondellier <tonton+hg@team1664.org>
parents: 1
diff changeset
     8
0df70b8735e3 Update Twitter bootstrap to 3.2.0
Vincent Tondellier <tonton+hg@team1664.org>
parents: 1
diff changeset
     9
/* ========================================================================
0df70b8735e3 Update Twitter bootstrap to 3.2.0
Vincent Tondellier <tonton+hg@team1664.org>
parents: 1
diff changeset
    10
 * Bootstrap: transition.js v3.2.0
0df70b8735e3 Update Twitter bootstrap to 3.2.0
Vincent Tondellier <tonton+hg@team1664.org>
parents: 1
diff changeset
    11
 * http://getbootstrap.com/javascript/#transitions
0df70b8735e3 Update Twitter bootstrap to 3.2.0
Vincent Tondellier <tonton+hg@team1664.org>
parents: 1
diff changeset
    12
 * ========================================================================
0df70b8735e3 Update Twitter bootstrap to 3.2.0
Vincent Tondellier <tonton+hg@team1664.org>
parents: 1
diff changeset
    13
 * Copyright 2011-2014 Twitter, Inc.
0df70b8735e3 Update Twitter bootstrap to 3.2.0
Vincent Tondellier <tonton+hg@team1664.org>
parents: 1
diff changeset
    14
 * Licensed under MIT (https://github.com/twbs/bootstrap/blob/master/LICENSE)
0df70b8735e3 Update Twitter bootstrap to 3.2.0
Vincent Tondellier <tonton+hg@team1664.org>
parents: 1
diff changeset
    15
 * ======================================================================== */
0df70b8735e3 Update Twitter bootstrap to 3.2.0
Vincent Tondellier <tonton+hg@team1664.org>
parents: 1
diff changeset
    16
0df70b8735e3 Update Twitter bootstrap to 3.2.0
Vincent Tondellier <tonton+hg@team1664.org>
parents: 1
diff changeset
    17
0df70b8735e3 Update Twitter bootstrap to 3.2.0
Vincent Tondellier <tonton+hg@team1664.org>
parents: 1
diff changeset
    18
+function ($) {
0df70b8735e3 Update Twitter bootstrap to 3.2.0
Vincent Tondellier <tonton+hg@team1664.org>
parents: 1
diff changeset
    19
  'use strict';
0df70b8735e3 Update Twitter bootstrap to 3.2.0
Vincent Tondellier <tonton+hg@team1664.org>
parents: 1
diff changeset
    20
0df70b8735e3 Update Twitter bootstrap to 3.2.0
Vincent Tondellier <tonton+hg@team1664.org>
parents: 1
diff changeset
    21
  // CSS TRANSITION SUPPORT (Shoutout: http://www.modernizr.com/)
0df70b8735e3 Update Twitter bootstrap to 3.2.0
Vincent Tondellier <tonton+hg@team1664.org>
parents: 1
diff changeset
    22
  // ============================================================
0df70b8735e3 Update Twitter bootstrap to 3.2.0
Vincent Tondellier <tonton+hg@team1664.org>
parents: 1
diff changeset
    23
0df70b8735e3 Update Twitter bootstrap to 3.2.0
Vincent Tondellier <tonton+hg@team1664.org>
parents: 1
diff changeset
    24
  function transitionEnd() {
0df70b8735e3 Update Twitter bootstrap to 3.2.0
Vincent Tondellier <tonton+hg@team1664.org>
parents: 1
diff changeset
    25
    var el = document.createElement('bootstrap')
0df70b8735e3 Update Twitter bootstrap to 3.2.0
Vincent Tondellier <tonton+hg@team1664.org>
parents: 1
diff changeset
    26
0df70b8735e3 Update Twitter bootstrap to 3.2.0
Vincent Tondellier <tonton+hg@team1664.org>
parents: 1
diff changeset
    27
    var transEndEventNames = {
0df70b8735e3 Update Twitter bootstrap to 3.2.0
Vincent Tondellier <tonton+hg@team1664.org>
parents: 1
diff changeset
    28
      WebkitTransition : 'webkitTransitionEnd',
0df70b8735e3 Update Twitter bootstrap to 3.2.0
Vincent Tondellier <tonton+hg@team1664.org>
parents: 1
diff changeset
    29
      MozTransition    : 'transitionend',
0df70b8735e3 Update Twitter bootstrap to 3.2.0
Vincent Tondellier <tonton+hg@team1664.org>
parents: 1
diff changeset
    30
      OTransition      : 'oTransitionEnd otransitionend',
0df70b8735e3 Update Twitter bootstrap to 3.2.0
Vincent Tondellier <tonton+hg@team1664.org>
parents: 1
diff changeset
    31
      transition       : 'transitionend'
0df70b8735e3 Update Twitter bootstrap to 3.2.0
Vincent Tondellier <tonton+hg@team1664.org>
parents: 1
diff changeset
    32
    }
0df70b8735e3 Update Twitter bootstrap to 3.2.0
Vincent Tondellier <tonton+hg@team1664.org>
parents: 1
diff changeset
    33
0df70b8735e3 Update Twitter bootstrap to 3.2.0
Vincent Tondellier <tonton+hg@team1664.org>
parents: 1
diff changeset
    34
    for (var name in transEndEventNames) {
0df70b8735e3 Update Twitter bootstrap to 3.2.0
Vincent Tondellier <tonton+hg@team1664.org>
parents: 1
diff changeset
    35
      if (el.style[name] !== undefined) {
0df70b8735e3 Update Twitter bootstrap to 3.2.0
Vincent Tondellier <tonton+hg@team1664.org>
parents: 1
diff changeset
    36
        return { end: transEndEventNames[name] }
0df70b8735e3 Update Twitter bootstrap to 3.2.0
Vincent Tondellier <tonton+hg@team1664.org>
parents: 1
diff changeset
    37
      }
0df70b8735e3 Update Twitter bootstrap to 3.2.0
Vincent Tondellier <tonton+hg@team1664.org>
parents: 1
diff changeset
    38
    }
0df70b8735e3 Update Twitter bootstrap to 3.2.0
Vincent Tondellier <tonton+hg@team1664.org>
parents: 1
diff changeset
    39
0df70b8735e3 Update Twitter bootstrap to 3.2.0
Vincent Tondellier <tonton+hg@team1664.org>
parents: 1
diff changeset
    40
    return false // explicit for ie8 (  ._.)
0df70b8735e3 Update Twitter bootstrap to 3.2.0
Vincent Tondellier <tonton+hg@team1664.org>
parents: 1
diff changeset
    41
  }
0df70b8735e3 Update Twitter bootstrap to 3.2.0
Vincent Tondellier <tonton+hg@team1664.org>
parents: 1
diff changeset
    42
0df70b8735e3 Update Twitter bootstrap to 3.2.0
Vincent Tondellier <tonton+hg@team1664.org>
parents: 1
diff changeset
    43
  // http://blog.alexmaccaw.com/css-transitions
0df70b8735e3 Update Twitter bootstrap to 3.2.0
Vincent Tondellier <tonton+hg@team1664.org>
parents: 1
diff changeset
    44
  $.fn.emulateTransitionEnd = function (duration) {
0df70b8735e3 Update Twitter bootstrap to 3.2.0
Vincent Tondellier <tonton+hg@team1664.org>
parents: 1
diff changeset
    45
    var called = false
0df70b8735e3 Update Twitter bootstrap to 3.2.0
Vincent Tondellier <tonton+hg@team1664.org>
parents: 1
diff changeset
    46
    var $el = this
0df70b8735e3 Update Twitter bootstrap to 3.2.0
Vincent Tondellier <tonton+hg@team1664.org>
parents: 1
diff changeset
    47
    $(this).one('bsTransitionEnd', function () { called = true })
0df70b8735e3 Update Twitter bootstrap to 3.2.0
Vincent Tondellier <tonton+hg@team1664.org>
parents: 1
diff changeset
    48
    var callback = function () { if (!called) $($el).trigger($.support.transition.end) }
0df70b8735e3 Update Twitter bootstrap to 3.2.0
Vincent Tondellier <tonton+hg@team1664.org>
parents: 1
diff changeset
    49
    setTimeout(callback, duration)
0df70b8735e3 Update Twitter bootstrap to 3.2.0
Vincent Tondellier <tonton+hg@team1664.org>
parents: 1
diff changeset
    50
    return this
0df70b8735e3 Update Twitter bootstrap to 3.2.0
Vincent Tondellier <tonton+hg@team1664.org>
parents: 1
diff changeset
    51
  }
0
5b78b8c79d9c Initial commit
Vincent Tondellier <tonton+hg@team1664.org>
parents:
diff changeset
    52
5b78b8c79d9c Initial commit
Vincent Tondellier <tonton+hg@team1664.org>
parents:
diff changeset
    53
  $(function () {
28
0df70b8735e3 Update Twitter bootstrap to 3.2.0
Vincent Tondellier <tonton+hg@team1664.org>
parents: 1
diff changeset
    54
    $.support.transition = transitionEnd()
0df70b8735e3 Update Twitter bootstrap to 3.2.0
Vincent Tondellier <tonton+hg@team1664.org>
parents: 1
diff changeset
    55
0df70b8735e3 Update Twitter bootstrap to 3.2.0
Vincent Tondellier <tonton+hg@team1664.org>
parents: 1
diff changeset
    56
    if (!$.support.transition) return
0df70b8735e3 Update Twitter bootstrap to 3.2.0
Vincent Tondellier <tonton+hg@team1664.org>
parents: 1
diff changeset
    57
0df70b8735e3 Update Twitter bootstrap to 3.2.0
Vincent Tondellier <tonton+hg@team1664.org>
parents: 1
diff changeset
    58
    $.event.special.bsTransitionEnd = {
0df70b8735e3 Update Twitter bootstrap to 3.2.0
Vincent Tondellier <tonton+hg@team1664.org>
parents: 1
diff changeset
    59
      bindType: $.support.transition.end,
0df70b8735e3 Update Twitter bootstrap to 3.2.0
Vincent Tondellier <tonton+hg@team1664.org>
parents: 1
diff changeset
    60
      delegateType: $.support.transition.end,
0df70b8735e3 Update Twitter bootstrap to 3.2.0
Vincent Tondellier <tonton+hg@team1664.org>
parents: 1
diff changeset
    61
      handle: function (e) {
0df70b8735e3 Update Twitter bootstrap to 3.2.0
Vincent Tondellier <tonton+hg@team1664.org>
parents: 1
diff changeset
    62
        if ($(e.target).is(this)) return e.handleObj.handler.apply(this, arguments)
1
c3726f733704 Use minimal bootstrap css and js
Vincent Tondellier <tonton+hg@team1664.org>
parents: 0
diff changeset
    63
      }
c3726f733704 Use minimal bootstrap css and js
Vincent Tondellier <tonton+hg@team1664.org>
parents: 0
diff changeset
    64
    }
c3726f733704 Use minimal bootstrap css and js
Vincent Tondellier <tonton+hg@team1664.org>
parents: 0
diff changeset
    65
  })
c3726f733704 Use minimal bootstrap css and js
Vincent Tondellier <tonton+hg@team1664.org>
parents: 0
diff changeset
    66
28
0df70b8735e3 Update Twitter bootstrap to 3.2.0
Vincent Tondellier <tonton+hg@team1664.org>
parents: 1
diff changeset
    67
}(jQuery);
0df70b8735e3 Update Twitter bootstrap to 3.2.0
Vincent Tondellier <tonton+hg@team1664.org>
parents: 1
diff changeset
    68
0df70b8735e3 Update Twitter bootstrap to 3.2.0
Vincent Tondellier <tonton+hg@team1664.org>
parents: 1
diff changeset
    69
/* ========================================================================
0df70b8735e3 Update Twitter bootstrap to 3.2.0
Vincent Tondellier <tonton+hg@team1664.org>
parents: 1
diff changeset
    70
 * Bootstrap: alert.js v3.2.0
0df70b8735e3 Update Twitter bootstrap to 3.2.0
Vincent Tondellier <tonton+hg@team1664.org>
parents: 1
diff changeset
    71
 * http://getbootstrap.com/javascript/#alerts
0df70b8735e3 Update Twitter bootstrap to 3.2.0
Vincent Tondellier <tonton+hg@team1664.org>
parents: 1
diff changeset
    72
 * ========================================================================
0df70b8735e3 Update Twitter bootstrap to 3.2.0
Vincent Tondellier <tonton+hg@team1664.org>
parents: 1
diff changeset
    73
 * Copyright 2011-2014 Twitter, Inc.
0df70b8735e3 Update Twitter bootstrap to 3.2.0
Vincent Tondellier <tonton+hg@team1664.org>
parents: 1
diff changeset
    74
 * Licensed under MIT (https://github.com/twbs/bootstrap/blob/master/LICENSE)
0df70b8735e3 Update Twitter bootstrap to 3.2.0
Vincent Tondellier <tonton+hg@team1664.org>
parents: 1
diff changeset
    75
 * ======================================================================== */
0df70b8735e3 Update Twitter bootstrap to 3.2.0
Vincent Tondellier <tonton+hg@team1664.org>
parents: 1
diff changeset
    76
0df70b8735e3 Update Twitter bootstrap to 3.2.0
Vincent Tondellier <tonton+hg@team1664.org>
parents: 1
diff changeset
    77
0df70b8735e3 Update Twitter bootstrap to 3.2.0
Vincent Tondellier <tonton+hg@team1664.org>
parents: 1
diff changeset
    78
+function ($) {
0df70b8735e3 Update Twitter bootstrap to 3.2.0
Vincent Tondellier <tonton+hg@team1664.org>
parents: 1
diff changeset
    79
  'use strict';
0df70b8735e3 Update Twitter bootstrap to 3.2.0
Vincent Tondellier <tonton+hg@team1664.org>
parents: 1
diff changeset
    80
0df70b8735e3 Update Twitter bootstrap to 3.2.0
Vincent Tondellier <tonton+hg@team1664.org>
parents: 1
diff changeset
    81
  // ALERT CLASS DEFINITION
0df70b8735e3 Update Twitter bootstrap to 3.2.0
Vincent Tondellier <tonton+hg@team1664.org>
parents: 1
diff changeset
    82
  // ======================
0
5b78b8c79d9c Initial commit
Vincent Tondellier <tonton+hg@team1664.org>
parents:
diff changeset
    83
5b78b8c79d9c Initial commit
Vincent Tondellier <tonton+hg@team1664.org>
parents:
diff changeset
    84
  var dismiss = '[data-dismiss="alert"]'
28
0df70b8735e3 Update Twitter bootstrap to 3.2.0
Vincent Tondellier <tonton+hg@team1664.org>
parents: 1
diff changeset
    85
  var Alert   = function (el) {
0df70b8735e3 Update Twitter bootstrap to 3.2.0
Vincent Tondellier <tonton+hg@team1664.org>
parents: 1
diff changeset
    86
    $(el).on('click', dismiss, this.close)
0df70b8735e3 Update Twitter bootstrap to 3.2.0
Vincent Tondellier <tonton+hg@team1664.org>
parents: 1
diff changeset
    87
  }
0df70b8735e3 Update Twitter bootstrap to 3.2.0
Vincent Tondellier <tonton+hg@team1664.org>
parents: 1
diff changeset
    88
0df70b8735e3 Update Twitter bootstrap to 3.2.0
Vincent Tondellier <tonton+hg@team1664.org>
parents: 1
diff changeset
    89
  Alert.VERSION = '3.2.0'
0
5b78b8c79d9c Initial commit
Vincent Tondellier <tonton+hg@team1664.org>
parents:
diff changeset
    90
5b78b8c79d9c Initial commit
Vincent Tondellier <tonton+hg@team1664.org>
parents:
diff changeset
    91
  Alert.prototype.close = function (e) {
28
0df70b8735e3 Update Twitter bootstrap to 3.2.0
Vincent Tondellier <tonton+hg@team1664.org>
parents: 1
diff changeset
    92
    var $this    = $(this)
0df70b8735e3 Update Twitter bootstrap to 3.2.0
Vincent Tondellier <tonton+hg@team1664.org>
parents: 1
diff changeset
    93
    var selector = $this.attr('data-target')
0
5b78b8c79d9c Initial commit
Vincent Tondellier <tonton+hg@team1664.org>
parents:
diff changeset
    94
5b78b8c79d9c Initial commit
Vincent Tondellier <tonton+hg@team1664.org>
parents:
diff changeset
    95
    if (!selector) {
5b78b8c79d9c Initial commit
Vincent Tondellier <tonton+hg@team1664.org>
parents:
diff changeset
    96
      selector = $this.attr('href')
28
0df70b8735e3 Update Twitter bootstrap to 3.2.0
Vincent Tondellier <tonton+hg@team1664.org>
parents: 1
diff changeset
    97
      selector = selector && selector.replace(/.*(?=#[^\s]*$)/, '') // strip for ie7
0
5b78b8c79d9c Initial commit
Vincent Tondellier <tonton+hg@team1664.org>
parents:
diff changeset
    98
    }
5b78b8c79d9c Initial commit
Vincent Tondellier <tonton+hg@team1664.org>
parents:
diff changeset
    99
28
0df70b8735e3 Update Twitter bootstrap to 3.2.0
Vincent Tondellier <tonton+hg@team1664.org>
parents: 1
diff changeset
   100
    var $parent = $(selector)
0df70b8735e3 Update Twitter bootstrap to 3.2.0
Vincent Tondellier <tonton+hg@team1664.org>
parents: 1
diff changeset
   101
0df70b8735e3 Update Twitter bootstrap to 3.2.0
Vincent Tondellier <tonton+hg@team1664.org>
parents: 1
diff changeset
   102
    if (e) e.preventDefault()
0df70b8735e3 Update Twitter bootstrap to 3.2.0
Vincent Tondellier <tonton+hg@team1664.org>
parents: 1
diff changeset
   103
0df70b8735e3 Update Twitter bootstrap to 3.2.0
Vincent Tondellier <tonton+hg@team1664.org>
parents: 1
diff changeset
   104
    if (!$parent.length) {
0df70b8735e3 Update Twitter bootstrap to 3.2.0
Vincent Tondellier <tonton+hg@team1664.org>
parents: 1
diff changeset
   105
      $parent = $this.hasClass('alert') ? $this : $this.parent()
0df70b8735e3 Update Twitter bootstrap to 3.2.0
Vincent Tondellier <tonton+hg@team1664.org>
parents: 1
diff changeset
   106
    }
0df70b8735e3 Update Twitter bootstrap to 3.2.0
Vincent Tondellier <tonton+hg@team1664.org>
parents: 1
diff changeset
   107
0df70b8735e3 Update Twitter bootstrap to 3.2.0
Vincent Tondellier <tonton+hg@team1664.org>
parents: 1
diff changeset
   108
    $parent.trigger(e = $.Event('close.bs.alert'))
0
5b78b8c79d9c Initial commit
Vincent Tondellier <tonton+hg@team1664.org>
parents:
diff changeset
   109
5b78b8c79d9c Initial commit
Vincent Tondellier <tonton+hg@team1664.org>
parents:
diff changeset
   110
    if (e.isDefaultPrevented()) return
5b78b8c79d9c Initial commit
Vincent Tondellier <tonton+hg@team1664.org>
parents:
diff changeset
   111
5b78b8c79d9c Initial commit
Vincent Tondellier <tonton+hg@team1664.org>
parents:
diff changeset
   112
    $parent.removeClass('in')
5b78b8c79d9c Initial commit
Vincent Tondellier <tonton+hg@team1664.org>
parents:
diff changeset
   113
5b78b8c79d9c Initial commit
Vincent Tondellier <tonton+hg@team1664.org>
parents:
diff changeset
   114
    function removeElement() {
28
0df70b8735e3 Update Twitter bootstrap to 3.2.0
Vincent Tondellier <tonton+hg@team1664.org>
parents: 1
diff changeset
   115
      // detach from parent, fire event then clean up data
0df70b8735e3 Update Twitter bootstrap to 3.2.0
Vincent Tondellier <tonton+hg@team1664.org>
parents: 1
diff changeset
   116
      $parent.detach().trigger('closed.bs.alert').remove()
0
5b78b8c79d9c Initial commit
Vincent Tondellier <tonton+hg@team1664.org>
parents:
diff changeset
   117
    }
5b78b8c79d9c Initial commit
Vincent Tondellier <tonton+hg@team1664.org>
parents:
diff changeset
   118
5b78b8c79d9c Initial commit
Vincent Tondellier <tonton+hg@team1664.org>
parents:
diff changeset
   119
    $.support.transition && $parent.hasClass('fade') ?
28
0df70b8735e3 Update Twitter bootstrap to 3.2.0
Vincent Tondellier <tonton+hg@team1664.org>
parents: 1
diff changeset
   120
      $parent
0df70b8735e3 Update Twitter bootstrap to 3.2.0
Vincent Tondellier <tonton+hg@team1664.org>
parents: 1
diff changeset
   121
        .one('bsTransitionEnd', removeElement)
0df70b8735e3 Update Twitter bootstrap to 3.2.0
Vincent Tondellier <tonton+hg@team1664.org>
parents: 1
diff changeset
   122
        .emulateTransitionEnd(150) :
0
5b78b8c79d9c Initial commit
Vincent Tondellier <tonton+hg@team1664.org>
parents:
diff changeset
   123
      removeElement()
5b78b8c79d9c Initial commit
Vincent Tondellier <tonton+hg@team1664.org>
parents:
diff changeset
   124
  }
5b78b8c79d9c Initial commit
Vincent Tondellier <tonton+hg@team1664.org>
parents:
diff changeset
   125
5b78b8c79d9c Initial commit
Vincent Tondellier <tonton+hg@team1664.org>
parents:
diff changeset
   126
28
0df70b8735e3 Update Twitter bootstrap to 3.2.0
Vincent Tondellier <tonton+hg@team1664.org>
parents: 1
diff changeset
   127
  // ALERT PLUGIN DEFINITION
0df70b8735e3 Update Twitter bootstrap to 3.2.0
Vincent Tondellier <tonton+hg@team1664.org>
parents: 1
diff changeset
   128
  // =======================
0df70b8735e3 Update Twitter bootstrap to 3.2.0
Vincent Tondellier <tonton+hg@team1664.org>
parents: 1
diff changeset
   129
0df70b8735e3 Update Twitter bootstrap to 3.2.0
Vincent Tondellier <tonton+hg@team1664.org>
parents: 1
diff changeset
   130
  function Plugin(option) {
0
5b78b8c79d9c Initial commit
Vincent Tondellier <tonton+hg@team1664.org>
parents:
diff changeset
   131
    return this.each(function () {
5b78b8c79d9c Initial commit
Vincent Tondellier <tonton+hg@team1664.org>
parents:
diff changeset
   132
      var $this = $(this)
28
0df70b8735e3 Update Twitter bootstrap to 3.2.0
Vincent Tondellier <tonton+hg@team1664.org>
parents: 1
diff changeset
   133
      var data  = $this.data('bs.alert')
0df70b8735e3 Update Twitter bootstrap to 3.2.0
Vincent Tondellier <tonton+hg@team1664.org>
parents: 1
diff changeset
   134
0df70b8735e3 Update Twitter bootstrap to 3.2.0
Vincent Tondellier <tonton+hg@team1664.org>
parents: 1
diff changeset
   135
      if (!data) $this.data('bs.alert', (data = new Alert(this)))
0df70b8735e3 Update Twitter bootstrap to 3.2.0
Vincent Tondellier <tonton+hg@team1664.org>
parents: 1
diff changeset
   136
      if (typeof option == 'string') data[option].call($this)
0df70b8735e3 Update Twitter bootstrap to 3.2.0
Vincent Tondellier <tonton+hg@team1664.org>
parents: 1
diff changeset
   137
    })
0df70b8735e3 Update Twitter bootstrap to 3.2.0
Vincent Tondellier <tonton+hg@team1664.org>
parents: 1
diff changeset
   138
  }
0df70b8735e3 Update Twitter bootstrap to 3.2.0
Vincent Tondellier <tonton+hg@team1664.org>
parents: 1
diff changeset
   139
0df70b8735e3 Update Twitter bootstrap to 3.2.0
Vincent Tondellier <tonton+hg@team1664.org>
parents: 1
diff changeset
   140
  var old = $.fn.alert
0df70b8735e3 Update Twitter bootstrap to 3.2.0
Vincent Tondellier <tonton+hg@team1664.org>
parents: 1
diff changeset
   141
0df70b8735e3 Update Twitter bootstrap to 3.2.0
Vincent Tondellier <tonton+hg@team1664.org>
parents: 1
diff changeset
   142
  $.fn.alert             = Plugin
0df70b8735e3 Update Twitter bootstrap to 3.2.0
Vincent Tondellier <tonton+hg@team1664.org>
parents: 1
diff changeset
   143
  $.fn.alert.Constructor = Alert
0df70b8735e3 Update Twitter bootstrap to 3.2.0
Vincent Tondellier <tonton+hg@team1664.org>
parents: 1
diff changeset
   144
0df70b8735e3 Update Twitter bootstrap to 3.2.0
Vincent Tondellier <tonton+hg@team1664.org>
parents: 1
diff changeset
   145
0df70b8735e3 Update Twitter bootstrap to 3.2.0
Vincent Tondellier <tonton+hg@team1664.org>
parents: 1
diff changeset
   146
  // ALERT NO CONFLICT
0df70b8735e3 Update Twitter bootstrap to 3.2.0
Vincent Tondellier <tonton+hg@team1664.org>
parents: 1
diff changeset
   147
  // =================
0df70b8735e3 Update Twitter bootstrap to 3.2.0
Vincent Tondellier <tonton+hg@team1664.org>
parents: 1
diff changeset
   148
0df70b8735e3 Update Twitter bootstrap to 3.2.0
Vincent Tondellier <tonton+hg@team1664.org>
parents: 1
diff changeset
   149
  $.fn.alert.noConflict = function () {
0df70b8735e3 Update Twitter bootstrap to 3.2.0
Vincent Tondellier <tonton+hg@team1664.org>
parents: 1
diff changeset
   150
    $.fn.alert = old
0df70b8735e3 Update Twitter bootstrap to 3.2.0
Vincent Tondellier <tonton+hg@team1664.org>
parents: 1
diff changeset
   151
    return this
0df70b8735e3 Update Twitter bootstrap to 3.2.0
Vincent Tondellier <tonton+hg@team1664.org>
parents: 1
diff changeset
   152
  }
0df70b8735e3 Update Twitter bootstrap to 3.2.0
Vincent Tondellier <tonton+hg@team1664.org>
parents: 1
diff changeset
   153
0df70b8735e3 Update Twitter bootstrap to 3.2.0
Vincent Tondellier <tonton+hg@team1664.org>
parents: 1
diff changeset
   154
0df70b8735e3 Update Twitter bootstrap to 3.2.0
Vincent Tondellier <tonton+hg@team1664.org>
parents: 1
diff changeset
   155
  // ALERT DATA-API
0df70b8735e3 Update Twitter bootstrap to 3.2.0
Vincent Tondellier <tonton+hg@team1664.org>
parents: 1
diff changeset
   156
  // ==============
0df70b8735e3 Update Twitter bootstrap to 3.2.0
Vincent Tondellier <tonton+hg@team1664.org>
parents: 1
diff changeset
   157
0df70b8735e3 Update Twitter bootstrap to 3.2.0
Vincent Tondellier <tonton+hg@team1664.org>
parents: 1
diff changeset
   158
  $(document).on('click.bs.alert.data-api', dismiss, Alert.prototype.close)
0df70b8735e3 Update Twitter bootstrap to 3.2.0
Vincent Tondellier <tonton+hg@team1664.org>
parents: 1
diff changeset
   159
0df70b8735e3 Update Twitter bootstrap to 3.2.0
Vincent Tondellier <tonton+hg@team1664.org>
parents: 1
diff changeset
   160
}(jQuery);
0df70b8735e3 Update Twitter bootstrap to 3.2.0
Vincent Tondellier <tonton+hg@team1664.org>
parents: 1
diff changeset
   161
0df70b8735e3 Update Twitter bootstrap to 3.2.0
Vincent Tondellier <tonton+hg@team1664.org>
parents: 1
diff changeset
   162
/* ========================================================================
0df70b8735e3 Update Twitter bootstrap to 3.2.0
Vincent Tondellier <tonton+hg@team1664.org>
parents: 1
diff changeset
   163
 * Bootstrap: button.js v3.2.0
0df70b8735e3 Update Twitter bootstrap to 3.2.0
Vincent Tondellier <tonton+hg@team1664.org>
parents: 1
diff changeset
   164
 * http://getbootstrap.com/javascript/#buttons
0df70b8735e3 Update Twitter bootstrap to 3.2.0
Vincent Tondellier <tonton+hg@team1664.org>
parents: 1
diff changeset
   165
 * ========================================================================
0df70b8735e3 Update Twitter bootstrap to 3.2.0
Vincent Tondellier <tonton+hg@team1664.org>
parents: 1
diff changeset
   166
 * Copyright 2011-2014 Twitter, Inc.
0df70b8735e3 Update Twitter bootstrap to 3.2.0
Vincent Tondellier <tonton+hg@team1664.org>
parents: 1
diff changeset
   167
 * Licensed under MIT (https://github.com/twbs/bootstrap/blob/master/LICENSE)
0df70b8735e3 Update Twitter bootstrap to 3.2.0
Vincent Tondellier <tonton+hg@team1664.org>
parents: 1
diff changeset
   168
 * ======================================================================== */
0df70b8735e3 Update Twitter bootstrap to 3.2.0
Vincent Tondellier <tonton+hg@team1664.org>
parents: 1
diff changeset
   169
0df70b8735e3 Update Twitter bootstrap to 3.2.0
Vincent Tondellier <tonton+hg@team1664.org>
parents: 1
diff changeset
   170
0df70b8735e3 Update Twitter bootstrap to 3.2.0
Vincent Tondellier <tonton+hg@team1664.org>
parents: 1
diff changeset
   171
+function ($) {
0df70b8735e3 Update Twitter bootstrap to 3.2.0
Vincent Tondellier <tonton+hg@team1664.org>
parents: 1
diff changeset
   172
  'use strict';
0df70b8735e3 Update Twitter bootstrap to 3.2.0
Vincent Tondellier <tonton+hg@team1664.org>
parents: 1
diff changeset
   173
0df70b8735e3 Update Twitter bootstrap to 3.2.0
Vincent Tondellier <tonton+hg@team1664.org>
parents: 1
diff changeset
   174
  // BUTTON PUBLIC CLASS DEFINITION
0df70b8735e3 Update Twitter bootstrap to 3.2.0
Vincent Tondellier <tonton+hg@team1664.org>
parents: 1
diff changeset
   175
  // ==============================
0df70b8735e3 Update Twitter bootstrap to 3.2.0
Vincent Tondellier <tonton+hg@team1664.org>
parents: 1
diff changeset
   176
0df70b8735e3 Update Twitter bootstrap to 3.2.0
Vincent Tondellier <tonton+hg@team1664.org>
parents: 1
diff changeset
   177
  var Button = function (element, options) {
0df70b8735e3 Update Twitter bootstrap to 3.2.0
Vincent Tondellier <tonton+hg@team1664.org>
parents: 1
diff changeset
   178
    this.$element  = $(element)
0df70b8735e3 Update Twitter bootstrap to 3.2.0
Vincent Tondellier <tonton+hg@team1664.org>
parents: 1
diff changeset
   179
    this.options   = $.extend({}, Button.DEFAULTS, options)
0df70b8735e3 Update Twitter bootstrap to 3.2.0
Vincent Tondellier <tonton+hg@team1664.org>
parents: 1
diff changeset
   180
    this.isLoading = false
0df70b8735e3 Update Twitter bootstrap to 3.2.0
Vincent Tondellier <tonton+hg@team1664.org>
parents: 1
diff changeset
   181
  }
0df70b8735e3 Update Twitter bootstrap to 3.2.0
Vincent Tondellier <tonton+hg@team1664.org>
parents: 1
diff changeset
   182
0df70b8735e3 Update Twitter bootstrap to 3.2.0
Vincent Tondellier <tonton+hg@team1664.org>
parents: 1
diff changeset
   183
  Button.VERSION  = '3.2.0'
0df70b8735e3 Update Twitter bootstrap to 3.2.0
Vincent Tondellier <tonton+hg@team1664.org>
parents: 1
diff changeset
   184
0df70b8735e3 Update Twitter bootstrap to 3.2.0
Vincent Tondellier <tonton+hg@team1664.org>
parents: 1
diff changeset
   185
  Button.DEFAULTS = {
0df70b8735e3 Update Twitter bootstrap to 3.2.0
Vincent Tondellier <tonton+hg@team1664.org>
parents: 1
diff changeset
   186
    loadingText: 'loading...'
0df70b8735e3 Update Twitter bootstrap to 3.2.0
Vincent Tondellier <tonton+hg@team1664.org>
parents: 1
diff changeset
   187
  }
0df70b8735e3 Update Twitter bootstrap to 3.2.0
Vincent Tondellier <tonton+hg@team1664.org>
parents: 1
diff changeset
   188
0df70b8735e3 Update Twitter bootstrap to 3.2.0
Vincent Tondellier <tonton+hg@team1664.org>
parents: 1
diff changeset
   189
  Button.prototype.setState = function (state) {
0df70b8735e3 Update Twitter bootstrap to 3.2.0
Vincent Tondellier <tonton+hg@team1664.org>
parents: 1
diff changeset
   190
    var d    = 'disabled'
0df70b8735e3 Update Twitter bootstrap to 3.2.0
Vincent Tondellier <tonton+hg@team1664.org>
parents: 1
diff changeset
   191
    var $el  = this.$element
0df70b8735e3 Update Twitter bootstrap to 3.2.0
Vincent Tondellier <tonton+hg@team1664.org>
parents: 1
diff changeset
   192
    var val  = $el.is('input') ? 'val' : 'html'
0df70b8735e3 Update Twitter bootstrap to 3.2.0
Vincent Tondellier <tonton+hg@team1664.org>
parents: 1
diff changeset
   193
    var data = $el.data()
0df70b8735e3 Update Twitter bootstrap to 3.2.0
Vincent Tondellier <tonton+hg@team1664.org>
parents: 1
diff changeset
   194
0df70b8735e3 Update Twitter bootstrap to 3.2.0
Vincent Tondellier <tonton+hg@team1664.org>
parents: 1
diff changeset
   195
    state = state + 'Text'
0df70b8735e3 Update Twitter bootstrap to 3.2.0
Vincent Tondellier <tonton+hg@team1664.org>
parents: 1
diff changeset
   196
0df70b8735e3 Update Twitter bootstrap to 3.2.0
Vincent Tondellier <tonton+hg@team1664.org>
parents: 1
diff changeset
   197
    if (data.resetText == null) $el.data('resetText', $el[val]())
0df70b8735e3 Update Twitter bootstrap to 3.2.0
Vincent Tondellier <tonton+hg@team1664.org>
parents: 1
diff changeset
   198
0df70b8735e3 Update Twitter bootstrap to 3.2.0
Vincent Tondellier <tonton+hg@team1664.org>
parents: 1
diff changeset
   199
    $el[val](data[state] == null ? this.options[state] : data[state])
0df70b8735e3 Update Twitter bootstrap to 3.2.0
Vincent Tondellier <tonton+hg@team1664.org>
parents: 1
diff changeset
   200
0df70b8735e3 Update Twitter bootstrap to 3.2.0
Vincent Tondellier <tonton+hg@team1664.org>
parents: 1
diff changeset
   201
    // push to event loop to allow forms to submit
0df70b8735e3 Update Twitter bootstrap to 3.2.0
Vincent Tondellier <tonton+hg@team1664.org>
parents: 1
diff changeset
   202
    setTimeout($.proxy(function () {
0df70b8735e3 Update Twitter bootstrap to 3.2.0
Vincent Tondellier <tonton+hg@team1664.org>
parents: 1
diff changeset
   203
      if (state == 'loadingText') {
0df70b8735e3 Update Twitter bootstrap to 3.2.0
Vincent Tondellier <tonton+hg@team1664.org>
parents: 1
diff changeset
   204
        this.isLoading = true
0df70b8735e3 Update Twitter bootstrap to 3.2.0
Vincent Tondellier <tonton+hg@team1664.org>
parents: 1
diff changeset
   205
        $el.addClass(d).attr(d, d)
0df70b8735e3 Update Twitter bootstrap to 3.2.0
Vincent Tondellier <tonton+hg@team1664.org>
parents: 1
diff changeset
   206
      } else if (this.isLoading) {
0df70b8735e3 Update Twitter bootstrap to 3.2.0
Vincent Tondellier <tonton+hg@team1664.org>
parents: 1
diff changeset
   207
        this.isLoading = false
0df70b8735e3 Update Twitter bootstrap to 3.2.0
Vincent Tondellier <tonton+hg@team1664.org>
parents: 1
diff changeset
   208
        $el.removeClass(d).removeAttr(d)
0df70b8735e3 Update Twitter bootstrap to 3.2.0
Vincent Tondellier <tonton+hg@team1664.org>
parents: 1
diff changeset
   209
      }
0df70b8735e3 Update Twitter bootstrap to 3.2.0
Vincent Tondellier <tonton+hg@team1664.org>
parents: 1
diff changeset
   210
    }, this), 0)
0df70b8735e3 Update Twitter bootstrap to 3.2.0
Vincent Tondellier <tonton+hg@team1664.org>
parents: 1
diff changeset
   211
  }
0df70b8735e3 Update Twitter bootstrap to 3.2.0
Vincent Tondellier <tonton+hg@team1664.org>
parents: 1
diff changeset
   212
0df70b8735e3 Update Twitter bootstrap to 3.2.0
Vincent Tondellier <tonton+hg@team1664.org>
parents: 1
diff changeset
   213
  Button.prototype.toggle = function () {
0df70b8735e3 Update Twitter bootstrap to 3.2.0
Vincent Tondellier <tonton+hg@team1664.org>
parents: 1
diff changeset
   214
    var changed = true
0df70b8735e3 Update Twitter bootstrap to 3.2.0
Vincent Tondellier <tonton+hg@team1664.org>
parents: 1
diff changeset
   215
    var $parent = this.$element.closest('[data-toggle="buttons"]')
0df70b8735e3 Update Twitter bootstrap to 3.2.0
Vincent Tondellier <tonton+hg@team1664.org>
parents: 1
diff changeset
   216
0df70b8735e3 Update Twitter bootstrap to 3.2.0
Vincent Tondellier <tonton+hg@team1664.org>
parents: 1
diff changeset
   217
    if ($parent.length) {
0df70b8735e3 Update Twitter bootstrap to 3.2.0
Vincent Tondellier <tonton+hg@team1664.org>
parents: 1
diff changeset
   218
      var $input = this.$element.find('input')
0df70b8735e3 Update Twitter bootstrap to 3.2.0
Vincent Tondellier <tonton+hg@team1664.org>
parents: 1
diff changeset
   219
      if ($input.prop('type') == 'radio') {
0df70b8735e3 Update Twitter bootstrap to 3.2.0
Vincent Tondellier <tonton+hg@team1664.org>
parents: 1
diff changeset
   220
        if ($input.prop('checked') && this.$element.hasClass('active')) changed = false
0df70b8735e3 Update Twitter bootstrap to 3.2.0
Vincent Tondellier <tonton+hg@team1664.org>
parents: 1
diff changeset
   221
        else $parent.find('.active').removeClass('active')
0df70b8735e3 Update Twitter bootstrap to 3.2.0
Vincent Tondellier <tonton+hg@team1664.org>
parents: 1
diff changeset
   222
      }
0df70b8735e3 Update Twitter bootstrap to 3.2.0
Vincent Tondellier <tonton+hg@team1664.org>
parents: 1
diff changeset
   223
      if (changed) $input.prop('checked', !this.$element.hasClass('active')).trigger('change')
0df70b8735e3 Update Twitter bootstrap to 3.2.0
Vincent Tondellier <tonton+hg@team1664.org>
parents: 1
diff changeset
   224
    }
0df70b8735e3 Update Twitter bootstrap to 3.2.0
Vincent Tondellier <tonton+hg@team1664.org>
parents: 1
diff changeset
   225
0df70b8735e3 Update Twitter bootstrap to 3.2.0
Vincent Tondellier <tonton+hg@team1664.org>
parents: 1
diff changeset
   226
    if (changed) this.$element.toggleClass('active')
0df70b8735e3 Update Twitter bootstrap to 3.2.0
Vincent Tondellier <tonton+hg@team1664.org>
parents: 1
diff changeset
   227
  }
0df70b8735e3 Update Twitter bootstrap to 3.2.0
Vincent Tondellier <tonton+hg@team1664.org>
parents: 1
diff changeset
   228
0df70b8735e3 Update Twitter bootstrap to 3.2.0
Vincent Tondellier <tonton+hg@team1664.org>
parents: 1
diff changeset
   229
0df70b8735e3 Update Twitter bootstrap to 3.2.0
Vincent Tondellier <tonton+hg@team1664.org>
parents: 1
diff changeset
   230
  // BUTTON PLUGIN DEFINITION
0df70b8735e3 Update Twitter bootstrap to 3.2.0
Vincent Tondellier <tonton+hg@team1664.org>
parents: 1
diff changeset
   231
  // ========================
0df70b8735e3 Update Twitter bootstrap to 3.2.0
Vincent Tondellier <tonton+hg@team1664.org>
parents: 1
diff changeset
   232
0df70b8735e3 Update Twitter bootstrap to 3.2.0
Vincent Tondellier <tonton+hg@team1664.org>
parents: 1
diff changeset
   233
  function Plugin(option) {
0df70b8735e3 Update Twitter bootstrap to 3.2.0
Vincent Tondellier <tonton+hg@team1664.org>
parents: 1
diff changeset
   234
    return this.each(function () {
0df70b8735e3 Update Twitter bootstrap to 3.2.0
Vincent Tondellier <tonton+hg@team1664.org>
parents: 1
diff changeset
   235
      var $this   = $(this)
0df70b8735e3 Update Twitter bootstrap to 3.2.0
Vincent Tondellier <tonton+hg@team1664.org>
parents: 1
diff changeset
   236
      var data    = $this.data('bs.button')
0df70b8735e3 Update Twitter bootstrap to 3.2.0
Vincent Tondellier <tonton+hg@team1664.org>
parents: 1
diff changeset
   237
      var options = typeof option == 'object' && option
0df70b8735e3 Update Twitter bootstrap to 3.2.0
Vincent Tondellier <tonton+hg@team1664.org>
parents: 1
diff changeset
   238
0df70b8735e3 Update Twitter bootstrap to 3.2.0
Vincent Tondellier <tonton+hg@team1664.org>
parents: 1
diff changeset
   239
      if (!data) $this.data('bs.button', (data = new Button(this, options)))
0df70b8735e3 Update Twitter bootstrap to 3.2.0
Vincent Tondellier <tonton+hg@team1664.org>
parents: 1
diff changeset
   240
0df70b8735e3 Update Twitter bootstrap to 3.2.0
Vincent Tondellier <tonton+hg@team1664.org>
parents: 1
diff changeset
   241
      if (option == 'toggle') data.toggle()
0df70b8735e3 Update Twitter bootstrap to 3.2.0
Vincent Tondellier <tonton+hg@team1664.org>
parents: 1
diff changeset
   242
      else if (option) data.setState(option)
0df70b8735e3 Update Twitter bootstrap to 3.2.0
Vincent Tondellier <tonton+hg@team1664.org>
parents: 1
diff changeset
   243
    })
0df70b8735e3 Update Twitter bootstrap to 3.2.0
Vincent Tondellier <tonton+hg@team1664.org>
parents: 1
diff changeset
   244
  }
0df70b8735e3 Update Twitter bootstrap to 3.2.0
Vincent Tondellier <tonton+hg@team1664.org>
parents: 1
diff changeset
   245
0df70b8735e3 Update Twitter bootstrap to 3.2.0
Vincent Tondellier <tonton+hg@team1664.org>
parents: 1
diff changeset
   246
  var old = $.fn.button
0df70b8735e3 Update Twitter bootstrap to 3.2.0
Vincent Tondellier <tonton+hg@team1664.org>
parents: 1
diff changeset
   247
0df70b8735e3 Update Twitter bootstrap to 3.2.0
Vincent Tondellier <tonton+hg@team1664.org>
parents: 1
diff changeset
   248
  $.fn.button             = Plugin
0df70b8735e3 Update Twitter bootstrap to 3.2.0
Vincent Tondellier <tonton+hg@team1664.org>
parents: 1
diff changeset
   249
  $.fn.button.Constructor = Button
0df70b8735e3 Update Twitter bootstrap to 3.2.0
Vincent Tondellier <tonton+hg@team1664.org>
parents: 1
diff changeset
   250
0df70b8735e3 Update Twitter bootstrap to 3.2.0
Vincent Tondellier <tonton+hg@team1664.org>
parents: 1
diff changeset
   251
0df70b8735e3 Update Twitter bootstrap to 3.2.0
Vincent Tondellier <tonton+hg@team1664.org>
parents: 1
diff changeset
   252
  // BUTTON NO CONFLICT
0df70b8735e3 Update Twitter bootstrap to 3.2.0
Vincent Tondellier <tonton+hg@team1664.org>
parents: 1
diff changeset
   253
  // ==================
0df70b8735e3 Update Twitter bootstrap to 3.2.0
Vincent Tondellier <tonton+hg@team1664.org>
parents: 1
diff changeset
   254
0df70b8735e3 Update Twitter bootstrap to 3.2.0
Vincent Tondellier <tonton+hg@team1664.org>
parents: 1
diff changeset
   255
  $.fn.button.noConflict = function () {
0df70b8735e3 Update Twitter bootstrap to 3.2.0
Vincent Tondellier <tonton+hg@team1664.org>
parents: 1
diff changeset
   256
    $.fn.button = old
0df70b8735e3 Update Twitter bootstrap to 3.2.0
Vincent Tondellier <tonton+hg@team1664.org>
parents: 1
diff changeset
   257
    return this
0df70b8735e3 Update Twitter bootstrap to 3.2.0
Vincent Tondellier <tonton+hg@team1664.org>
parents: 1
diff changeset
   258
  }
0df70b8735e3 Update Twitter bootstrap to 3.2.0
Vincent Tondellier <tonton+hg@team1664.org>
parents: 1
diff changeset
   259
0df70b8735e3 Update Twitter bootstrap to 3.2.0
Vincent Tondellier <tonton+hg@team1664.org>
parents: 1
diff changeset
   260
0df70b8735e3 Update Twitter bootstrap to 3.2.0
Vincent Tondellier <tonton+hg@team1664.org>
parents: 1
diff changeset
   261
  // BUTTON DATA-API
0df70b8735e3 Update Twitter bootstrap to 3.2.0
Vincent Tondellier <tonton+hg@team1664.org>
parents: 1
diff changeset
   262
  // ===============
0df70b8735e3 Update Twitter bootstrap to 3.2.0
Vincent Tondellier <tonton+hg@team1664.org>
parents: 1
diff changeset
   263
0df70b8735e3 Update Twitter bootstrap to 3.2.0
Vincent Tondellier <tonton+hg@team1664.org>
parents: 1
diff changeset
   264
  $(document).on('click.bs.button.data-api', '[data-toggle^="button"]', function (e) {
0df70b8735e3 Update Twitter bootstrap to 3.2.0
Vincent Tondellier <tonton+hg@team1664.org>
parents: 1
diff changeset
   265
    var $btn = $(e.target)
0df70b8735e3 Update Twitter bootstrap to 3.2.0
Vincent Tondellier <tonton+hg@team1664.org>
parents: 1
diff changeset
   266
    if (!$btn.hasClass('btn')) $btn = $btn.closest('.btn')
0df70b8735e3 Update Twitter bootstrap to 3.2.0
Vincent Tondellier <tonton+hg@team1664.org>
parents: 1
diff changeset
   267
    Plugin.call($btn, 'toggle')
0df70b8735e3 Update Twitter bootstrap to 3.2.0
Vincent Tondellier <tonton+hg@team1664.org>
parents: 1
diff changeset
   268
    e.preventDefault()
0df70b8735e3 Update Twitter bootstrap to 3.2.0
Vincent Tondellier <tonton+hg@team1664.org>
parents: 1
diff changeset
   269
  })
0df70b8735e3 Update Twitter bootstrap to 3.2.0
Vincent Tondellier <tonton+hg@team1664.org>
parents: 1
diff changeset
   270
0df70b8735e3 Update Twitter bootstrap to 3.2.0
Vincent Tondellier <tonton+hg@team1664.org>
parents: 1
diff changeset
   271
}(jQuery);
0df70b8735e3 Update Twitter bootstrap to 3.2.0
Vincent Tondellier <tonton+hg@team1664.org>
parents: 1
diff changeset
   272
0df70b8735e3 Update Twitter bootstrap to 3.2.0
Vincent Tondellier <tonton+hg@team1664.org>
parents: 1
diff changeset
   273
/* ========================================================================
0df70b8735e3 Update Twitter bootstrap to 3.2.0
Vincent Tondellier <tonton+hg@team1664.org>
parents: 1
diff changeset
   274
 * Bootstrap: carousel.js v3.2.0
0df70b8735e3 Update Twitter bootstrap to 3.2.0
Vincent Tondellier <tonton+hg@team1664.org>
parents: 1
diff changeset
   275
 * http://getbootstrap.com/javascript/#carousel
0df70b8735e3 Update Twitter bootstrap to 3.2.0
Vincent Tondellier <tonton+hg@team1664.org>
parents: 1
diff changeset
   276
 * ========================================================================
0df70b8735e3 Update Twitter bootstrap to 3.2.0
Vincent Tondellier <tonton+hg@team1664.org>
parents: 1
diff changeset
   277
 * Copyright 2011-2014 Twitter, Inc.
0df70b8735e3 Update Twitter bootstrap to 3.2.0
Vincent Tondellier <tonton+hg@team1664.org>
parents: 1
diff changeset
   278
 * Licensed under MIT (https://github.com/twbs/bootstrap/blob/master/LICENSE)
0df70b8735e3 Update Twitter bootstrap to 3.2.0
Vincent Tondellier <tonton+hg@team1664.org>
parents: 1
diff changeset
   279
 * ======================================================================== */
0df70b8735e3 Update Twitter bootstrap to 3.2.0
Vincent Tondellier <tonton+hg@team1664.org>
parents: 1
diff changeset
   280
0df70b8735e3 Update Twitter bootstrap to 3.2.0
Vincent Tondellier <tonton+hg@team1664.org>
parents: 1
diff changeset
   281
0df70b8735e3 Update Twitter bootstrap to 3.2.0
Vincent Tondellier <tonton+hg@team1664.org>
parents: 1
diff changeset
   282
+function ($) {
0df70b8735e3 Update Twitter bootstrap to 3.2.0
Vincent Tondellier <tonton+hg@team1664.org>
parents: 1
diff changeset
   283
  'use strict';
0df70b8735e3 Update Twitter bootstrap to 3.2.0
Vincent Tondellier <tonton+hg@team1664.org>
parents: 1
diff changeset
   284
0df70b8735e3 Update Twitter bootstrap to 3.2.0
Vincent Tondellier <tonton+hg@team1664.org>
parents: 1
diff changeset
   285
  // CAROUSEL CLASS DEFINITION
0df70b8735e3 Update Twitter bootstrap to 3.2.0
Vincent Tondellier <tonton+hg@team1664.org>
parents: 1
diff changeset
   286
  // =========================
0df70b8735e3 Update Twitter bootstrap to 3.2.0
Vincent Tondellier <tonton+hg@team1664.org>
parents: 1
diff changeset
   287
0df70b8735e3 Update Twitter bootstrap to 3.2.0
Vincent Tondellier <tonton+hg@team1664.org>
parents: 1
diff changeset
   288
  var Carousel = function (element, options) {
0df70b8735e3 Update Twitter bootstrap to 3.2.0
Vincent Tondellier <tonton+hg@team1664.org>
parents: 1
diff changeset
   289
    this.$element    = $(element).on('keydown.bs.carousel', $.proxy(this.keydown, this))
0df70b8735e3 Update Twitter bootstrap to 3.2.0
Vincent Tondellier <tonton+hg@team1664.org>
parents: 1
diff changeset
   290
    this.$indicators = this.$element.find('.carousel-indicators')
0df70b8735e3 Update Twitter bootstrap to 3.2.0
Vincent Tondellier <tonton+hg@team1664.org>
parents: 1
diff changeset
   291
    this.options     = options
0df70b8735e3 Update Twitter bootstrap to 3.2.0
Vincent Tondellier <tonton+hg@team1664.org>
parents: 1
diff changeset
   292
    this.paused      =
0df70b8735e3 Update Twitter bootstrap to 3.2.0
Vincent Tondellier <tonton+hg@team1664.org>
parents: 1
diff changeset
   293
    this.sliding     =
0df70b8735e3 Update Twitter bootstrap to 3.2.0
Vincent Tondellier <tonton+hg@team1664.org>
parents: 1
diff changeset
   294
    this.interval    =
0df70b8735e3 Update Twitter bootstrap to 3.2.0
Vincent Tondellier <tonton+hg@team1664.org>
parents: 1
diff changeset
   295
    this.$active     =
0df70b8735e3 Update Twitter bootstrap to 3.2.0
Vincent Tondellier <tonton+hg@team1664.org>
parents: 1
diff changeset
   296
    this.$items      = null
0df70b8735e3 Update Twitter bootstrap to 3.2.0
Vincent Tondellier <tonton+hg@team1664.org>
parents: 1
diff changeset
   297
0df70b8735e3 Update Twitter bootstrap to 3.2.0
Vincent Tondellier <tonton+hg@team1664.org>
parents: 1
diff changeset
   298
    this.options.pause == 'hover' && this.$element
0df70b8735e3 Update Twitter bootstrap to 3.2.0
Vincent Tondellier <tonton+hg@team1664.org>
parents: 1
diff changeset
   299
      .on('mouseenter.bs.carousel', $.proxy(this.pause, this))
0df70b8735e3 Update Twitter bootstrap to 3.2.0
Vincent Tondellier <tonton+hg@team1664.org>
parents: 1
diff changeset
   300
      .on('mouseleave.bs.carousel', $.proxy(this.cycle, this))
0df70b8735e3 Update Twitter bootstrap to 3.2.0
Vincent Tondellier <tonton+hg@team1664.org>
parents: 1
diff changeset
   301
  }
0df70b8735e3 Update Twitter bootstrap to 3.2.0
Vincent Tondellier <tonton+hg@team1664.org>
parents: 1
diff changeset
   302
0df70b8735e3 Update Twitter bootstrap to 3.2.0
Vincent Tondellier <tonton+hg@team1664.org>
parents: 1
diff changeset
   303
  Carousel.VERSION  = '3.2.0'
0df70b8735e3 Update Twitter bootstrap to 3.2.0
Vincent Tondellier <tonton+hg@team1664.org>
parents: 1
diff changeset
   304
0df70b8735e3 Update Twitter bootstrap to 3.2.0
Vincent Tondellier <tonton+hg@team1664.org>
parents: 1
diff changeset
   305
  Carousel.DEFAULTS = {
0df70b8735e3 Update Twitter bootstrap to 3.2.0
Vincent Tondellier <tonton+hg@team1664.org>
parents: 1
diff changeset
   306
    interval: 5000,
0df70b8735e3 Update Twitter bootstrap to 3.2.0
Vincent Tondellier <tonton+hg@team1664.org>
parents: 1
diff changeset
   307
    pause: 'hover',
0df70b8735e3 Update Twitter bootstrap to 3.2.0
Vincent Tondellier <tonton+hg@team1664.org>
parents: 1
diff changeset
   308
    wrap: true
0df70b8735e3 Update Twitter bootstrap to 3.2.0
Vincent Tondellier <tonton+hg@team1664.org>
parents: 1
diff changeset
   309
  }
0df70b8735e3 Update Twitter bootstrap to 3.2.0
Vincent Tondellier <tonton+hg@team1664.org>
parents: 1
diff changeset
   310
0df70b8735e3 Update Twitter bootstrap to 3.2.0
Vincent Tondellier <tonton+hg@team1664.org>
parents: 1
diff changeset
   311
  Carousel.prototype.keydown = function (e) {
0df70b8735e3 Update Twitter bootstrap to 3.2.0
Vincent Tondellier <tonton+hg@team1664.org>
parents: 1
diff changeset
   312
    switch (e.which) {
0df70b8735e3 Update Twitter bootstrap to 3.2.0
Vincent Tondellier <tonton+hg@team1664.org>
parents: 1
diff changeset
   313
      case 37: this.prev(); break
0df70b8735e3 Update Twitter bootstrap to 3.2.0
Vincent Tondellier <tonton+hg@team1664.org>
parents: 1
diff changeset
   314
      case 39: this.next(); break
0df70b8735e3 Update Twitter bootstrap to 3.2.0
Vincent Tondellier <tonton+hg@team1664.org>
parents: 1
diff changeset
   315
      default: return
0df70b8735e3 Update Twitter bootstrap to 3.2.0
Vincent Tondellier <tonton+hg@team1664.org>
parents: 1
diff changeset
   316
    }
0df70b8735e3 Update Twitter bootstrap to 3.2.0
Vincent Tondellier <tonton+hg@team1664.org>
parents: 1
diff changeset
   317
0df70b8735e3 Update Twitter bootstrap to 3.2.0
Vincent Tondellier <tonton+hg@team1664.org>
parents: 1
diff changeset
   318
    e.preventDefault()
0df70b8735e3 Update Twitter bootstrap to 3.2.0
Vincent Tondellier <tonton+hg@team1664.org>
parents: 1
diff changeset
   319
  }
0df70b8735e3 Update Twitter bootstrap to 3.2.0
Vincent Tondellier <tonton+hg@team1664.org>
parents: 1
diff changeset
   320
0df70b8735e3 Update Twitter bootstrap to 3.2.0
Vincent Tondellier <tonton+hg@team1664.org>
parents: 1
diff changeset
   321
  Carousel.prototype.cycle = function (e) {
0df70b8735e3 Update Twitter bootstrap to 3.2.0
Vincent Tondellier <tonton+hg@team1664.org>
parents: 1
diff changeset
   322
    e || (this.paused = false)
0df70b8735e3 Update Twitter bootstrap to 3.2.0
Vincent Tondellier <tonton+hg@team1664.org>
parents: 1
diff changeset
   323
0df70b8735e3 Update Twitter bootstrap to 3.2.0
Vincent Tondellier <tonton+hg@team1664.org>
parents: 1
diff changeset
   324
    this.interval && clearInterval(this.interval)
0df70b8735e3 Update Twitter bootstrap to 3.2.0
Vincent Tondellier <tonton+hg@team1664.org>
parents: 1
diff changeset
   325
0df70b8735e3 Update Twitter bootstrap to 3.2.0
Vincent Tondellier <tonton+hg@team1664.org>
parents: 1
diff changeset
   326
    this.options.interval
0df70b8735e3 Update Twitter bootstrap to 3.2.0
Vincent Tondellier <tonton+hg@team1664.org>
parents: 1
diff changeset
   327
      && !this.paused
0df70b8735e3 Update Twitter bootstrap to 3.2.0
Vincent Tondellier <tonton+hg@team1664.org>
parents: 1
diff changeset
   328
      && (this.interval = setInterval($.proxy(this.next, this), this.options.interval))
0df70b8735e3 Update Twitter bootstrap to 3.2.0
Vincent Tondellier <tonton+hg@team1664.org>
parents: 1
diff changeset
   329
0df70b8735e3 Update Twitter bootstrap to 3.2.0
Vincent Tondellier <tonton+hg@team1664.org>
parents: 1
diff changeset
   330
    return this
0df70b8735e3 Update Twitter bootstrap to 3.2.0
Vincent Tondellier <tonton+hg@team1664.org>
parents: 1
diff changeset
   331
  }
0df70b8735e3 Update Twitter bootstrap to 3.2.0
Vincent Tondellier <tonton+hg@team1664.org>
parents: 1
diff changeset
   332
0df70b8735e3 Update Twitter bootstrap to 3.2.0
Vincent Tondellier <tonton+hg@team1664.org>
parents: 1
diff changeset
   333
  Carousel.prototype.getItemIndex = function (item) {
0df70b8735e3 Update Twitter bootstrap to 3.2.0
Vincent Tondellier <tonton+hg@team1664.org>
parents: 1
diff changeset
   334
    this.$items = item.parent().children('.item')
0df70b8735e3 Update Twitter bootstrap to 3.2.0
Vincent Tondellier <tonton+hg@team1664.org>
parents: 1
diff changeset
   335
    return this.$items.index(item || this.$active)
0df70b8735e3 Update Twitter bootstrap to 3.2.0
Vincent Tondellier <tonton+hg@team1664.org>
parents: 1
diff changeset
   336
  }
0df70b8735e3 Update Twitter bootstrap to 3.2.0
Vincent Tondellier <tonton+hg@team1664.org>
parents: 1
diff changeset
   337
0df70b8735e3 Update Twitter bootstrap to 3.2.0
Vincent Tondellier <tonton+hg@team1664.org>
parents: 1
diff changeset
   338
  Carousel.prototype.to = function (pos) {
0df70b8735e3 Update Twitter bootstrap to 3.2.0
Vincent Tondellier <tonton+hg@team1664.org>
parents: 1
diff changeset
   339
    var that        = this
0df70b8735e3 Update Twitter bootstrap to 3.2.0
Vincent Tondellier <tonton+hg@team1664.org>
parents: 1
diff changeset
   340
    var activeIndex = this.getItemIndex(this.$active = this.$element.find('.item.active'))
0df70b8735e3 Update Twitter bootstrap to 3.2.0
Vincent Tondellier <tonton+hg@team1664.org>
parents: 1
diff changeset
   341
0df70b8735e3 Update Twitter bootstrap to 3.2.0
Vincent Tondellier <tonton+hg@team1664.org>
parents: 1
diff changeset
   342
    if (pos > (this.$items.length - 1) || pos < 0) return
0df70b8735e3 Update Twitter bootstrap to 3.2.0
Vincent Tondellier <tonton+hg@team1664.org>
parents: 1
diff changeset
   343
0df70b8735e3 Update Twitter bootstrap to 3.2.0
Vincent Tondellier <tonton+hg@team1664.org>
parents: 1
diff changeset
   344
    if (this.sliding)       return this.$element.one('slid.bs.carousel', function () { that.to(pos) }) // yes, "slid"
0df70b8735e3 Update Twitter bootstrap to 3.2.0
Vincent Tondellier <tonton+hg@team1664.org>
parents: 1
diff changeset
   345
    if (activeIndex == pos) return this.pause().cycle()
0df70b8735e3 Update Twitter bootstrap to 3.2.0
Vincent Tondellier <tonton+hg@team1664.org>
parents: 1
diff changeset
   346
0df70b8735e3 Update Twitter bootstrap to 3.2.0
Vincent Tondellier <tonton+hg@team1664.org>
parents: 1
diff changeset
   347
    return this.slide(pos > activeIndex ? 'next' : 'prev', $(this.$items[pos]))
0df70b8735e3 Update Twitter bootstrap to 3.2.0
Vincent Tondellier <tonton+hg@team1664.org>
parents: 1
diff changeset
   348
  }
0df70b8735e3 Update Twitter bootstrap to 3.2.0
Vincent Tondellier <tonton+hg@team1664.org>
parents: 1
diff changeset
   349
0df70b8735e3 Update Twitter bootstrap to 3.2.0
Vincent Tondellier <tonton+hg@team1664.org>
parents: 1
diff changeset
   350
  Carousel.prototype.pause = function (e) {
0df70b8735e3 Update Twitter bootstrap to 3.2.0
Vincent Tondellier <tonton+hg@team1664.org>
parents: 1
diff changeset
   351
    e || (this.paused = true)
0df70b8735e3 Update Twitter bootstrap to 3.2.0
Vincent Tondellier <tonton+hg@team1664.org>
parents: 1
diff changeset
   352
0df70b8735e3 Update Twitter bootstrap to 3.2.0
Vincent Tondellier <tonton+hg@team1664.org>
parents: 1
diff changeset
   353
    if (this.$element.find('.next, .prev').length && $.support.transition) {
0df70b8735e3 Update Twitter bootstrap to 3.2.0
Vincent Tondellier <tonton+hg@team1664.org>
parents: 1
diff changeset
   354
      this.$element.trigger($.support.transition.end)
0df70b8735e3 Update Twitter bootstrap to 3.2.0
Vincent Tondellier <tonton+hg@team1664.org>
parents: 1
diff changeset
   355
      this.cycle(true)
0df70b8735e3 Update Twitter bootstrap to 3.2.0
Vincent Tondellier <tonton+hg@team1664.org>
parents: 1
diff changeset
   356
    }
0df70b8735e3 Update Twitter bootstrap to 3.2.0
Vincent Tondellier <tonton+hg@team1664.org>
parents: 1
diff changeset
   357
0df70b8735e3 Update Twitter bootstrap to 3.2.0
Vincent Tondellier <tonton+hg@team1664.org>
parents: 1
diff changeset
   358
    this.interval = clearInterval(this.interval)
0df70b8735e3 Update Twitter bootstrap to 3.2.0
Vincent Tondellier <tonton+hg@team1664.org>
parents: 1
diff changeset
   359
0df70b8735e3 Update Twitter bootstrap to 3.2.0
Vincent Tondellier <tonton+hg@team1664.org>
parents: 1
diff changeset
   360
    return this
0df70b8735e3 Update Twitter bootstrap to 3.2.0
Vincent Tondellier <tonton+hg@team1664.org>
parents: 1
diff changeset
   361
  }
0df70b8735e3 Update Twitter bootstrap to 3.2.0
Vincent Tondellier <tonton+hg@team1664.org>
parents: 1
diff changeset
   362
0df70b8735e3 Update Twitter bootstrap to 3.2.0
Vincent Tondellier <tonton+hg@team1664.org>
parents: 1
diff changeset
   363
  Carousel.prototype.next = function () {
0df70b8735e3 Update Twitter bootstrap to 3.2.0
Vincent Tondellier <tonton+hg@team1664.org>
parents: 1
diff changeset
   364
    if (this.sliding) return
0df70b8735e3 Update Twitter bootstrap to 3.2.0
Vincent Tondellier <tonton+hg@team1664.org>
parents: 1
diff changeset
   365
    return this.slide('next')
0df70b8735e3 Update Twitter bootstrap to 3.2.0
Vincent Tondellier <tonton+hg@team1664.org>
parents: 1
diff changeset
   366
  }
0df70b8735e3 Update Twitter bootstrap to 3.2.0
Vincent Tondellier <tonton+hg@team1664.org>
parents: 1
diff changeset
   367
0df70b8735e3 Update Twitter bootstrap to 3.2.0
Vincent Tondellier <tonton+hg@team1664.org>
parents: 1
diff changeset
   368
  Carousel.prototype.prev = function () {
0df70b8735e3 Update Twitter bootstrap to 3.2.0
Vincent Tondellier <tonton+hg@team1664.org>
parents: 1
diff changeset
   369
    if (this.sliding) return
0df70b8735e3 Update Twitter bootstrap to 3.2.0
Vincent Tondellier <tonton+hg@team1664.org>
parents: 1
diff changeset
   370
    return this.slide('prev')
0df70b8735e3 Update Twitter bootstrap to 3.2.0
Vincent Tondellier <tonton+hg@team1664.org>
parents: 1
diff changeset
   371
  }
0df70b8735e3 Update Twitter bootstrap to 3.2.0
Vincent Tondellier <tonton+hg@team1664.org>
parents: 1
diff changeset
   372
0df70b8735e3 Update Twitter bootstrap to 3.2.0
Vincent Tondellier <tonton+hg@team1664.org>
parents: 1
diff changeset
   373
  Carousel.prototype.slide = function (type, next) {
0df70b8735e3 Update Twitter bootstrap to 3.2.0
Vincent Tondellier <tonton+hg@team1664.org>
parents: 1
diff changeset
   374
    var $active   = this.$element.find('.item.active')
0df70b8735e3 Update Twitter bootstrap to 3.2.0
Vincent Tondellier <tonton+hg@team1664.org>
parents: 1
diff changeset
   375
    var $next     = next || $active[type]()
0df70b8735e3 Update Twitter bootstrap to 3.2.0
Vincent Tondellier <tonton+hg@team1664.org>
parents: 1
diff changeset
   376
    var isCycling = this.interval
0df70b8735e3 Update Twitter bootstrap to 3.2.0
Vincent Tondellier <tonton+hg@team1664.org>
parents: 1
diff changeset
   377
    var direction = type == 'next' ? 'left' : 'right'
0df70b8735e3 Update Twitter bootstrap to 3.2.0
Vincent Tondellier <tonton+hg@team1664.org>
parents: 1
diff changeset
   378
    var fallback  = type == 'next' ? 'first' : 'last'
0df70b8735e3 Update Twitter bootstrap to 3.2.0
Vincent Tondellier <tonton+hg@team1664.org>
parents: 1
diff changeset
   379
    var that      = this
0df70b8735e3 Update Twitter bootstrap to 3.2.0
Vincent Tondellier <tonton+hg@team1664.org>
parents: 1
diff changeset
   380
0df70b8735e3 Update Twitter bootstrap to 3.2.0
Vincent Tondellier <tonton+hg@team1664.org>
parents: 1
diff changeset
   381
    if (!$next.length) {
0df70b8735e3 Update Twitter bootstrap to 3.2.0
Vincent Tondellier <tonton+hg@team1664.org>
parents: 1
diff changeset
   382
      if (!this.options.wrap) return
0df70b8735e3 Update Twitter bootstrap to 3.2.0
Vincent Tondellier <tonton+hg@team1664.org>
parents: 1
diff changeset
   383
      $next = this.$element.find('.item')[fallback]()
0df70b8735e3 Update Twitter bootstrap to 3.2.0
Vincent Tondellier <tonton+hg@team1664.org>
parents: 1
diff changeset
   384
    }
0df70b8735e3 Update Twitter bootstrap to 3.2.0
Vincent Tondellier <tonton+hg@team1664.org>
parents: 1
diff changeset
   385
0df70b8735e3 Update Twitter bootstrap to 3.2.0
Vincent Tondellier <tonton+hg@team1664.org>
parents: 1
diff changeset
   386
    if ($next.hasClass('active')) return (this.sliding = false)
0df70b8735e3 Update Twitter bootstrap to 3.2.0
Vincent Tondellier <tonton+hg@team1664.org>
parents: 1
diff changeset
   387
0df70b8735e3 Update Twitter bootstrap to 3.2.0
Vincent Tondellier <tonton+hg@team1664.org>
parents: 1
diff changeset
   388
    var relatedTarget = $next[0]
0df70b8735e3 Update Twitter bootstrap to 3.2.0
Vincent Tondellier <tonton+hg@team1664.org>
parents: 1
diff changeset
   389
    var slideEvent = $.Event('slide.bs.carousel', {
0df70b8735e3 Update Twitter bootstrap to 3.2.0
Vincent Tondellier <tonton+hg@team1664.org>
parents: 1
diff changeset
   390
      relatedTarget: relatedTarget,
0df70b8735e3 Update Twitter bootstrap to 3.2.0
Vincent Tondellier <tonton+hg@team1664.org>
parents: 1
diff changeset
   391
      direction: direction
0df70b8735e3 Update Twitter bootstrap to 3.2.0
Vincent Tondellier <tonton+hg@team1664.org>
parents: 1
diff changeset
   392
    })
0df70b8735e3 Update Twitter bootstrap to 3.2.0
Vincent Tondellier <tonton+hg@team1664.org>
parents: 1
diff changeset
   393
    this.$element.trigger(slideEvent)
0df70b8735e3 Update Twitter bootstrap to 3.2.0
Vincent Tondellier <tonton+hg@team1664.org>
parents: 1
diff changeset
   394
    if (slideEvent.isDefaultPrevented()) return
0df70b8735e3 Update Twitter bootstrap to 3.2.0
Vincent Tondellier <tonton+hg@team1664.org>
parents: 1
diff changeset
   395
0df70b8735e3 Update Twitter bootstrap to 3.2.0
Vincent Tondellier <tonton+hg@team1664.org>
parents: 1
diff changeset
   396
    this.sliding = true
0df70b8735e3 Update Twitter bootstrap to 3.2.0
Vincent Tondellier <tonton+hg@team1664.org>
parents: 1
diff changeset
   397
0df70b8735e3 Update Twitter bootstrap to 3.2.0
Vincent Tondellier <tonton+hg@team1664.org>
parents: 1
diff changeset
   398
    isCycling && this.pause()
0df70b8735e3 Update Twitter bootstrap to 3.2.0
Vincent Tondellier <tonton+hg@team1664.org>
parents: 1
diff changeset
   399
0df70b8735e3 Update Twitter bootstrap to 3.2.0
Vincent Tondellier <tonton+hg@team1664.org>
parents: 1
diff changeset
   400
    if (this.$indicators.length) {
0df70b8735e3 Update Twitter bootstrap to 3.2.0
Vincent Tondellier <tonton+hg@team1664.org>
parents: 1
diff changeset
   401
      this.$indicators.find('.active').removeClass('active')
0df70b8735e3 Update Twitter bootstrap to 3.2.0
Vincent Tondellier <tonton+hg@team1664.org>
parents: 1
diff changeset
   402
      var $nextIndicator = $(this.$indicators.children()[this.getItemIndex($next)])
0df70b8735e3 Update Twitter bootstrap to 3.2.0
Vincent Tondellier <tonton+hg@team1664.org>
parents: 1
diff changeset
   403
      $nextIndicator && $nextIndicator.addClass('active')
0df70b8735e3 Update Twitter bootstrap to 3.2.0
Vincent Tondellier <tonton+hg@team1664.org>
parents: 1
diff changeset
   404
    }
0df70b8735e3 Update Twitter bootstrap to 3.2.0
Vincent Tondellier <tonton+hg@team1664.org>
parents: 1
diff changeset
   405
0df70b8735e3 Update Twitter bootstrap to 3.2.0
Vincent Tondellier <tonton+hg@team1664.org>
parents: 1
diff changeset
   406
    var slidEvent = $.Event('slid.bs.carousel', { relatedTarget: relatedTarget, direction: direction }) // yes, "slid"
0df70b8735e3 Update Twitter bootstrap to 3.2.0
Vincent Tondellier <tonton+hg@team1664.org>
parents: 1
diff changeset
   407
    if ($.support.transition && this.$element.hasClass('slide')) {
0df70b8735e3 Update Twitter bootstrap to 3.2.0
Vincent Tondellier <tonton+hg@team1664.org>
parents: 1
diff changeset
   408
      $next.addClass(type)
0df70b8735e3 Update Twitter bootstrap to 3.2.0
Vincent Tondellier <tonton+hg@team1664.org>
parents: 1
diff changeset
   409
      $next[0].offsetWidth // force reflow
0df70b8735e3 Update Twitter bootstrap to 3.2.0
Vincent Tondellier <tonton+hg@team1664.org>
parents: 1
diff changeset
   410
      $active.addClass(direction)
0df70b8735e3 Update Twitter bootstrap to 3.2.0
Vincent Tondellier <tonton+hg@team1664.org>
parents: 1
diff changeset
   411
      $next.addClass(direction)
0df70b8735e3 Update Twitter bootstrap to 3.2.0
Vincent Tondellier <tonton+hg@team1664.org>
parents: 1
diff changeset
   412
      $active
0df70b8735e3 Update Twitter bootstrap to 3.2.0
Vincent Tondellier <tonton+hg@team1664.org>
parents: 1
diff changeset
   413
        .one('bsTransitionEnd', function () {
0df70b8735e3 Update Twitter bootstrap to 3.2.0
Vincent Tondellier <tonton+hg@team1664.org>
parents: 1
diff changeset
   414
          $next.removeClass([type, direction].join(' ')).addClass('active')
0df70b8735e3 Update Twitter bootstrap to 3.2.0
Vincent Tondellier <tonton+hg@team1664.org>
parents: 1
diff changeset
   415
          $active.removeClass(['active', direction].join(' '))
0df70b8735e3 Update Twitter bootstrap to 3.2.0
Vincent Tondellier <tonton+hg@team1664.org>
parents: 1
diff changeset
   416
          that.sliding = false
0df70b8735e3 Update Twitter bootstrap to 3.2.0
Vincent Tondellier <tonton+hg@team1664.org>
parents: 1
diff changeset
   417
          setTimeout(function () {
0df70b8735e3 Update Twitter bootstrap to 3.2.0
Vincent Tondellier <tonton+hg@team1664.org>
parents: 1
diff changeset
   418
            that.$element.trigger(slidEvent)
0df70b8735e3 Update Twitter bootstrap to 3.2.0
Vincent Tondellier <tonton+hg@team1664.org>
parents: 1
diff changeset
   419
          }, 0)
0df70b8735e3 Update Twitter bootstrap to 3.2.0
Vincent Tondellier <tonton+hg@team1664.org>
parents: 1
diff changeset
   420
        })
0df70b8735e3 Update Twitter bootstrap to 3.2.0
Vincent Tondellier <tonton+hg@team1664.org>
parents: 1
diff changeset
   421
        .emulateTransitionEnd($active.css('transition-duration').slice(0, -1) * 1000)
0df70b8735e3 Update Twitter bootstrap to 3.2.0
Vincent Tondellier <tonton+hg@team1664.org>
parents: 1
diff changeset
   422
    } else {
0df70b8735e3 Update Twitter bootstrap to 3.2.0
Vincent Tondellier <tonton+hg@team1664.org>
parents: 1
diff changeset
   423
      $active.removeClass('active')
0df70b8735e3 Update Twitter bootstrap to 3.2.0
Vincent Tondellier <tonton+hg@team1664.org>
parents: 1
diff changeset
   424
      $next.addClass('active')
0df70b8735e3 Update Twitter bootstrap to 3.2.0
Vincent Tondellier <tonton+hg@team1664.org>
parents: 1
diff changeset
   425
      this.sliding = false
0df70b8735e3 Update Twitter bootstrap to 3.2.0
Vincent Tondellier <tonton+hg@team1664.org>
parents: 1
diff changeset
   426
      this.$element.trigger(slidEvent)
0df70b8735e3 Update Twitter bootstrap to 3.2.0
Vincent Tondellier <tonton+hg@team1664.org>
parents: 1
diff changeset
   427
    }
0df70b8735e3 Update Twitter bootstrap to 3.2.0
Vincent Tondellier <tonton+hg@team1664.org>
parents: 1
diff changeset
   428
0df70b8735e3 Update Twitter bootstrap to 3.2.0
Vincent Tondellier <tonton+hg@team1664.org>
parents: 1
diff changeset
   429
    isCycling && this.cycle()
0df70b8735e3 Update Twitter bootstrap to 3.2.0
Vincent Tondellier <tonton+hg@team1664.org>
parents: 1
diff changeset
   430
0df70b8735e3 Update Twitter bootstrap to 3.2.0
Vincent Tondellier <tonton+hg@team1664.org>
parents: 1
diff changeset
   431
    return this
0df70b8735e3 Update Twitter bootstrap to 3.2.0
Vincent Tondellier <tonton+hg@team1664.org>
parents: 1
diff changeset
   432
  }
0df70b8735e3 Update Twitter bootstrap to 3.2.0
Vincent Tondellier <tonton+hg@team1664.org>
parents: 1
diff changeset
   433
0df70b8735e3 Update Twitter bootstrap to 3.2.0
Vincent Tondellier <tonton+hg@team1664.org>
parents: 1
diff changeset
   434
0df70b8735e3 Update Twitter bootstrap to 3.2.0
Vincent Tondellier <tonton+hg@team1664.org>
parents: 1
diff changeset
   435
  // CAROUSEL PLUGIN DEFINITION
0df70b8735e3 Update Twitter bootstrap to 3.2.0
Vincent Tondellier <tonton+hg@team1664.org>
parents: 1
diff changeset
   436
  // ==========================
0df70b8735e3 Update Twitter bootstrap to 3.2.0
Vincent Tondellier <tonton+hg@team1664.org>
parents: 1
diff changeset
   437
0df70b8735e3 Update Twitter bootstrap to 3.2.0
Vincent Tondellier <tonton+hg@team1664.org>
parents: 1
diff changeset
   438
  function Plugin(option) {
0df70b8735e3 Update Twitter bootstrap to 3.2.0
Vincent Tondellier <tonton+hg@team1664.org>
parents: 1
diff changeset
   439
    return this.each(function () {
0df70b8735e3 Update Twitter bootstrap to 3.2.0
Vincent Tondellier <tonton+hg@team1664.org>
parents: 1
diff changeset
   440
      var $this   = $(this)
0df70b8735e3 Update Twitter bootstrap to 3.2.0
Vincent Tondellier <tonton+hg@team1664.org>
parents: 1
diff changeset
   441
      var data    = $this.data('bs.carousel')
0df70b8735e3 Update Twitter bootstrap to 3.2.0
Vincent Tondellier <tonton+hg@team1664.org>
parents: 1
diff changeset
   442
      var options = $.extend({}, Carousel.DEFAULTS, $this.data(), typeof option == 'object' && option)
0df70b8735e3 Update Twitter bootstrap to 3.2.0
Vincent Tondellier <tonton+hg@team1664.org>
parents: 1
diff changeset
   443
      var action  = typeof option == 'string' ? option : options.slide
0df70b8735e3 Update Twitter bootstrap to 3.2.0
Vincent Tondellier <tonton+hg@team1664.org>
parents: 1
diff changeset
   444
0df70b8735e3 Update Twitter bootstrap to 3.2.0
Vincent Tondellier <tonton+hg@team1664.org>
parents: 1
diff changeset
   445
      if (!data) $this.data('bs.carousel', (data = new Carousel(this, options)))
0df70b8735e3 Update Twitter bootstrap to 3.2.0
Vincent Tondellier <tonton+hg@team1664.org>
parents: 1
diff changeset
   446
      if (typeof option == 'number') data.to(option)
0df70b8735e3 Update Twitter bootstrap to 3.2.0
Vincent Tondellier <tonton+hg@team1664.org>
parents: 1
diff changeset
   447
      else if (action) data[action]()
0df70b8735e3 Update Twitter bootstrap to 3.2.0
Vincent Tondellier <tonton+hg@team1664.org>
parents: 1
diff changeset
   448
      else if (options.interval) data.pause().cycle()
0df70b8735e3 Update Twitter bootstrap to 3.2.0
Vincent Tondellier <tonton+hg@team1664.org>
parents: 1
diff changeset
   449
    })
0df70b8735e3 Update Twitter bootstrap to 3.2.0
Vincent Tondellier <tonton+hg@team1664.org>
parents: 1
diff changeset
   450
  }
0df70b8735e3 Update Twitter bootstrap to 3.2.0
Vincent Tondellier <tonton+hg@team1664.org>
parents: 1
diff changeset
   451
0df70b8735e3 Update Twitter bootstrap to 3.2.0
Vincent Tondellier <tonton+hg@team1664.org>
parents: 1
diff changeset
   452
  var old = $.fn.carousel
0df70b8735e3 Update Twitter bootstrap to 3.2.0
Vincent Tondellier <tonton+hg@team1664.org>
parents: 1
diff changeset
   453
0df70b8735e3 Update Twitter bootstrap to 3.2.0
Vincent Tondellier <tonton+hg@team1664.org>
parents: 1
diff changeset
   454
  $.fn.carousel             = Plugin
0df70b8735e3 Update Twitter bootstrap to 3.2.0
Vincent Tondellier <tonton+hg@team1664.org>
parents: 1
diff changeset
   455
  $.fn.carousel.Constructor = Carousel
0df70b8735e3 Update Twitter bootstrap to 3.2.0
Vincent Tondellier <tonton+hg@team1664.org>
parents: 1
diff changeset
   456
0df70b8735e3 Update Twitter bootstrap to 3.2.0
Vincent Tondellier <tonton+hg@team1664.org>
parents: 1
diff changeset
   457
0df70b8735e3 Update Twitter bootstrap to 3.2.0
Vincent Tondellier <tonton+hg@team1664.org>
parents: 1
diff changeset
   458
  // CAROUSEL NO CONFLICT
0df70b8735e3 Update Twitter bootstrap to 3.2.0
Vincent Tondellier <tonton+hg@team1664.org>
parents: 1
diff changeset
   459
  // ====================
0df70b8735e3 Update Twitter bootstrap to 3.2.0
Vincent Tondellier <tonton+hg@team1664.org>
parents: 1
diff changeset
   460
0df70b8735e3 Update Twitter bootstrap to 3.2.0
Vincent Tondellier <tonton+hg@team1664.org>
parents: 1
diff changeset
   461
  $.fn.carousel.noConflict = function () {
0df70b8735e3 Update Twitter bootstrap to 3.2.0
Vincent Tondellier <tonton+hg@team1664.org>
parents: 1
diff changeset
   462
    $.fn.carousel = old
0df70b8735e3 Update Twitter bootstrap to 3.2.0
Vincent Tondellier <tonton+hg@team1664.org>
parents: 1
diff changeset
   463
    return this
0df70b8735e3 Update Twitter bootstrap to 3.2.0
Vincent Tondellier <tonton+hg@team1664.org>
parents: 1
diff changeset
   464
  }
0df70b8735e3 Update Twitter bootstrap to 3.2.0
Vincent Tondellier <tonton+hg@team1664.org>
parents: 1
diff changeset
   465
0df70b8735e3 Update Twitter bootstrap to 3.2.0
Vincent Tondellier <tonton+hg@team1664.org>
parents: 1
diff changeset
   466
0df70b8735e3 Update Twitter bootstrap to 3.2.0
Vincent Tondellier <tonton+hg@team1664.org>
parents: 1
diff changeset
   467
  // CAROUSEL DATA-API
0df70b8735e3 Update Twitter bootstrap to 3.2.0
Vincent Tondellier <tonton+hg@team1664.org>
parents: 1
diff changeset
   468
  // =================
0df70b8735e3 Update Twitter bootstrap to 3.2.0
Vincent Tondellier <tonton+hg@team1664.org>
parents: 1
diff changeset
   469
0df70b8735e3 Update Twitter bootstrap to 3.2.0
Vincent Tondellier <tonton+hg@team1664.org>
parents: 1
diff changeset
   470
  $(document).on('click.bs.carousel.data-api', '[data-slide], [data-slide-to]', function (e) {
0df70b8735e3 Update Twitter bootstrap to 3.2.0
Vincent Tondellier <tonton+hg@team1664.org>
parents: 1
diff changeset
   471
    var href
0df70b8735e3 Update Twitter bootstrap to 3.2.0
Vincent Tondellier <tonton+hg@team1664.org>
parents: 1
diff changeset
   472
    var $this   = $(this)
0df70b8735e3 Update Twitter bootstrap to 3.2.0
Vincent Tondellier <tonton+hg@team1664.org>
parents: 1
diff changeset
   473
    var $target = $($this.attr('data-target') || (href = $this.attr('href')) && href.replace(/.*(?=#[^\s]+$)/, '')) // strip for ie7
0df70b8735e3 Update Twitter bootstrap to 3.2.0
Vincent Tondellier <tonton+hg@team1664.org>
parents: 1
diff changeset
   474
    if (!$target.hasClass('carousel')) return
0df70b8735e3 Update Twitter bootstrap to 3.2.0
Vincent Tondellier <tonton+hg@team1664.org>
parents: 1
diff changeset
   475
    var options = $.extend({}, $target.data(), $this.data())
0df70b8735e3 Update Twitter bootstrap to 3.2.0
Vincent Tondellier <tonton+hg@team1664.org>
parents: 1
diff changeset
   476
    var slideIndex = $this.attr('data-slide-to')
0df70b8735e3 Update Twitter bootstrap to 3.2.0
Vincent Tondellier <tonton+hg@team1664.org>
parents: 1
diff changeset
   477
    if (slideIndex) options.interval = false
0df70b8735e3 Update Twitter bootstrap to 3.2.0
Vincent Tondellier <tonton+hg@team1664.org>
parents: 1
diff changeset
   478
0df70b8735e3 Update Twitter bootstrap to 3.2.0
Vincent Tondellier <tonton+hg@team1664.org>
parents: 1
diff changeset
   479
    Plugin.call($target, options)
0df70b8735e3 Update Twitter bootstrap to 3.2.0
Vincent Tondellier <tonton+hg@team1664.org>
parents: 1
diff changeset
   480
0df70b8735e3 Update Twitter bootstrap to 3.2.0
Vincent Tondellier <tonton+hg@team1664.org>
parents: 1
diff changeset
   481
    if (slideIndex) {
0df70b8735e3 Update Twitter bootstrap to 3.2.0
Vincent Tondellier <tonton+hg@team1664.org>
parents: 1
diff changeset
   482
      $target.data('bs.carousel').to(slideIndex)
0df70b8735e3 Update Twitter bootstrap to 3.2.0
Vincent Tondellier <tonton+hg@team1664.org>
parents: 1
diff changeset
   483
    }
0df70b8735e3 Update Twitter bootstrap to 3.2.0
Vincent Tondellier <tonton+hg@team1664.org>
parents: 1
diff changeset
   484
0df70b8735e3 Update Twitter bootstrap to 3.2.0
Vincent Tondellier <tonton+hg@team1664.org>
parents: 1
diff changeset
   485
    e.preventDefault()
0df70b8735e3 Update Twitter bootstrap to 3.2.0
Vincent Tondellier <tonton+hg@team1664.org>
parents: 1
diff changeset
   486
  })
0df70b8735e3 Update Twitter bootstrap to 3.2.0
Vincent Tondellier <tonton+hg@team1664.org>
parents: 1
diff changeset
   487
0df70b8735e3 Update Twitter bootstrap to 3.2.0
Vincent Tondellier <tonton+hg@team1664.org>
parents: 1
diff changeset
   488
  $(window).on('load', function () {
0df70b8735e3 Update Twitter bootstrap to 3.2.0
Vincent Tondellier <tonton+hg@team1664.org>
parents: 1
diff changeset
   489
    $('[data-ride="carousel"]').each(function () {
0df70b8735e3 Update Twitter bootstrap to 3.2.0
Vincent Tondellier <tonton+hg@team1664.org>
parents: 1
diff changeset
   490
      var $carousel = $(this)
0df70b8735e3 Update Twitter bootstrap to 3.2.0
Vincent Tondellier <tonton+hg@team1664.org>
parents: 1
diff changeset
   491
      Plugin.call($carousel, $carousel.data())
0df70b8735e3 Update Twitter bootstrap to 3.2.0
Vincent Tondellier <tonton+hg@team1664.org>
parents: 1
diff changeset
   492
    })
0df70b8735e3 Update Twitter bootstrap to 3.2.0
Vincent Tondellier <tonton+hg@team1664.org>
parents: 1
diff changeset
   493
  })
0df70b8735e3 Update Twitter bootstrap to 3.2.0
Vincent Tondellier <tonton+hg@team1664.org>
parents: 1
diff changeset
   494
0df70b8735e3 Update Twitter bootstrap to 3.2.0
Vincent Tondellier <tonton+hg@team1664.org>
parents: 1
diff changeset
   495
}(jQuery);
0df70b8735e3 Update Twitter bootstrap to 3.2.0
Vincent Tondellier <tonton+hg@team1664.org>
parents: 1
diff changeset
   496
0df70b8735e3 Update Twitter bootstrap to 3.2.0
Vincent Tondellier <tonton+hg@team1664.org>
parents: 1
diff changeset
   497
/* ========================================================================
0df70b8735e3 Update Twitter bootstrap to 3.2.0
Vincent Tondellier <tonton+hg@team1664.org>
parents: 1
diff changeset
   498
 * Bootstrap: collapse.js v3.2.0
0df70b8735e3 Update Twitter bootstrap to 3.2.0
Vincent Tondellier <tonton+hg@team1664.org>
parents: 1
diff changeset
   499
 * http://getbootstrap.com/javascript/#collapse
0df70b8735e3 Update Twitter bootstrap to 3.2.0
Vincent Tondellier <tonton+hg@team1664.org>
parents: 1
diff changeset
   500
 * ========================================================================
0df70b8735e3 Update Twitter bootstrap to 3.2.0
Vincent Tondellier <tonton+hg@team1664.org>
parents: 1
diff changeset
   501
 * Copyright 2011-2014 Twitter, Inc.
0df70b8735e3 Update Twitter bootstrap to 3.2.0
Vincent Tondellier <tonton+hg@team1664.org>
parents: 1
diff changeset
   502
 * Licensed under MIT (https://github.com/twbs/bootstrap/blob/master/LICENSE)
0df70b8735e3 Update Twitter bootstrap to 3.2.0
Vincent Tondellier <tonton+hg@team1664.org>
parents: 1
diff changeset
   503
 * ======================================================================== */
0df70b8735e3 Update Twitter bootstrap to 3.2.0
Vincent Tondellier <tonton+hg@team1664.org>
parents: 1
diff changeset
   504
0df70b8735e3 Update Twitter bootstrap to 3.2.0
Vincent Tondellier <tonton+hg@team1664.org>
parents: 1
diff changeset
   505
0df70b8735e3 Update Twitter bootstrap to 3.2.0
Vincent Tondellier <tonton+hg@team1664.org>
parents: 1
diff changeset
   506
+function ($) {
0df70b8735e3 Update Twitter bootstrap to 3.2.0
Vincent Tondellier <tonton+hg@team1664.org>
parents: 1
diff changeset
   507
  'use strict';
0df70b8735e3 Update Twitter bootstrap to 3.2.0
Vincent Tondellier <tonton+hg@team1664.org>
parents: 1
diff changeset
   508
0df70b8735e3 Update Twitter bootstrap to 3.2.0
Vincent Tondellier <tonton+hg@team1664.org>
parents: 1
diff changeset
   509
  // COLLAPSE PUBLIC CLASS DEFINITION
0df70b8735e3 Update Twitter bootstrap to 3.2.0
Vincent Tondellier <tonton+hg@team1664.org>
parents: 1
diff changeset
   510
  // ================================
0df70b8735e3 Update Twitter bootstrap to 3.2.0
Vincent Tondellier <tonton+hg@team1664.org>
parents: 1
diff changeset
   511
0df70b8735e3 Update Twitter bootstrap to 3.2.0
Vincent Tondellier <tonton+hg@team1664.org>
parents: 1
diff changeset
   512
  var Collapse = function (element, options) {
0df70b8735e3 Update Twitter bootstrap to 3.2.0
Vincent Tondellier <tonton+hg@team1664.org>
parents: 1
diff changeset
   513
    this.$element      = $(element)
0df70b8735e3 Update Twitter bootstrap to 3.2.0
Vincent Tondellier <tonton+hg@team1664.org>
parents: 1
diff changeset
   514
    this.options       = $.extend({}, Collapse.DEFAULTS, options)
0df70b8735e3 Update Twitter bootstrap to 3.2.0
Vincent Tondellier <tonton+hg@team1664.org>
parents: 1
diff changeset
   515
    this.transitioning = null
0df70b8735e3 Update Twitter bootstrap to 3.2.0
Vincent Tondellier <tonton+hg@team1664.org>
parents: 1
diff changeset
   516
0df70b8735e3 Update Twitter bootstrap to 3.2.0
Vincent Tondellier <tonton+hg@team1664.org>
parents: 1
diff changeset
   517
    if (this.options.parent) this.$parent = $(this.options.parent)
0df70b8735e3 Update Twitter bootstrap to 3.2.0
Vincent Tondellier <tonton+hg@team1664.org>
parents: 1
diff changeset
   518
    if (this.options.toggle) this.toggle()
0df70b8735e3 Update Twitter bootstrap to 3.2.0
Vincent Tondellier <tonton+hg@team1664.org>
parents: 1
diff changeset
   519
  }
0df70b8735e3 Update Twitter bootstrap to 3.2.0
Vincent Tondellier <tonton+hg@team1664.org>
parents: 1
diff changeset
   520
0df70b8735e3 Update Twitter bootstrap to 3.2.0
Vincent Tondellier <tonton+hg@team1664.org>
parents: 1
diff changeset
   521
  Collapse.VERSION  = '3.2.0'
0df70b8735e3 Update Twitter bootstrap to 3.2.0
Vincent Tondellier <tonton+hg@team1664.org>
parents: 1
diff changeset
   522
0df70b8735e3 Update Twitter bootstrap to 3.2.0
Vincent Tondellier <tonton+hg@team1664.org>
parents: 1
diff changeset
   523
  Collapse.DEFAULTS = {
0df70b8735e3 Update Twitter bootstrap to 3.2.0
Vincent Tondellier <tonton+hg@team1664.org>
parents: 1
diff changeset
   524
    toggle: true
0df70b8735e3 Update Twitter bootstrap to 3.2.0
Vincent Tondellier <tonton+hg@team1664.org>
parents: 1
diff changeset
   525
  }
0df70b8735e3 Update Twitter bootstrap to 3.2.0
Vincent Tondellier <tonton+hg@team1664.org>
parents: 1
diff changeset
   526
0df70b8735e3 Update Twitter bootstrap to 3.2.0
Vincent Tondellier <tonton+hg@team1664.org>
parents: 1
diff changeset
   527
  Collapse.prototype.dimension = function () {
0df70b8735e3 Update Twitter bootstrap to 3.2.0
Vincent Tondellier <tonton+hg@team1664.org>
parents: 1
diff changeset
   528
    var hasWidth = this.$element.hasClass('width')
0df70b8735e3 Update Twitter bootstrap to 3.2.0
Vincent Tondellier <tonton+hg@team1664.org>
parents: 1
diff changeset
   529
    return hasWidth ? 'width' : 'height'
0df70b8735e3 Update Twitter bootstrap to 3.2.0
Vincent Tondellier <tonton+hg@team1664.org>
parents: 1
diff changeset
   530
  }
0df70b8735e3 Update Twitter bootstrap to 3.2.0
Vincent Tondellier <tonton+hg@team1664.org>
parents: 1
diff changeset
   531
0df70b8735e3 Update Twitter bootstrap to 3.2.0
Vincent Tondellier <tonton+hg@team1664.org>
parents: 1
diff changeset
   532
  Collapse.prototype.show = function () {
0df70b8735e3 Update Twitter bootstrap to 3.2.0
Vincent Tondellier <tonton+hg@team1664.org>
parents: 1
diff changeset
   533
    if (this.transitioning || this.$element.hasClass('in')) return
0df70b8735e3 Update Twitter bootstrap to 3.2.0
Vincent Tondellier <tonton+hg@team1664.org>
parents: 1
diff changeset
   534
0df70b8735e3 Update Twitter bootstrap to 3.2.0
Vincent Tondellier <tonton+hg@team1664.org>
parents: 1
diff changeset
   535
    var startEvent = $.Event('show.bs.collapse')
0df70b8735e3 Update Twitter bootstrap to 3.2.0
Vincent Tondellier <tonton+hg@team1664.org>
parents: 1
diff changeset
   536
    this.$element.trigger(startEvent)
0df70b8735e3 Update Twitter bootstrap to 3.2.0
Vincent Tondellier <tonton+hg@team1664.org>
parents: 1
diff changeset
   537
    if (startEvent.isDefaultPrevented()) return
0df70b8735e3 Update Twitter bootstrap to 3.2.0
Vincent Tondellier <tonton+hg@team1664.org>
parents: 1
diff changeset
   538
0df70b8735e3 Update Twitter bootstrap to 3.2.0
Vincent Tondellier <tonton+hg@team1664.org>
parents: 1
diff changeset
   539
    var actives = this.$parent && this.$parent.find('> .panel > .in')
0df70b8735e3 Update Twitter bootstrap to 3.2.0
Vincent Tondellier <tonton+hg@team1664.org>
parents: 1
diff changeset
   540
0df70b8735e3 Update Twitter bootstrap to 3.2.0
Vincent Tondellier <tonton+hg@team1664.org>
parents: 1
diff changeset
   541
    if (actives && actives.length) {
0df70b8735e3 Update Twitter bootstrap to 3.2.0
Vincent Tondellier <tonton+hg@team1664.org>
parents: 1
diff changeset
   542
      var hasData = actives.data('bs.collapse')
0df70b8735e3 Update Twitter bootstrap to 3.2.0
Vincent Tondellier <tonton+hg@team1664.org>
parents: 1
diff changeset
   543
      if (hasData && hasData.transitioning) return
0df70b8735e3 Update Twitter bootstrap to 3.2.0
Vincent Tondellier <tonton+hg@team1664.org>
parents: 1
diff changeset
   544
      Plugin.call(actives, 'hide')
0df70b8735e3 Update Twitter bootstrap to 3.2.0
Vincent Tondellier <tonton+hg@team1664.org>
parents: 1
diff changeset
   545
      hasData || actives.data('bs.collapse', null)
0df70b8735e3 Update Twitter bootstrap to 3.2.0
Vincent Tondellier <tonton+hg@team1664.org>
parents: 1
diff changeset
   546
    }
0df70b8735e3 Update Twitter bootstrap to 3.2.0
Vincent Tondellier <tonton+hg@team1664.org>
parents: 1
diff changeset
   547
0df70b8735e3 Update Twitter bootstrap to 3.2.0
Vincent Tondellier <tonton+hg@team1664.org>
parents: 1
diff changeset
   548
    var dimension = this.dimension()
0df70b8735e3 Update Twitter bootstrap to 3.2.0
Vincent Tondellier <tonton+hg@team1664.org>
parents: 1
diff changeset
   549
0df70b8735e3 Update Twitter bootstrap to 3.2.0
Vincent Tondellier <tonton+hg@team1664.org>
parents: 1
diff changeset
   550
    this.$element
0df70b8735e3 Update Twitter bootstrap to 3.2.0
Vincent Tondellier <tonton+hg@team1664.org>
parents: 1
diff changeset
   551
      .removeClass('collapse')
0df70b8735e3 Update Twitter bootstrap to 3.2.0
Vincent Tondellier <tonton+hg@team1664.org>
parents: 1
diff changeset
   552
      .addClass('collapsing')[dimension](0)
0df70b8735e3 Update Twitter bootstrap to 3.2.0
Vincent Tondellier <tonton+hg@team1664.org>
parents: 1
diff changeset
   553
0df70b8735e3 Update Twitter bootstrap to 3.2.0
Vincent Tondellier <tonton+hg@team1664.org>
parents: 1
diff changeset
   554
    this.transitioning = 1
0df70b8735e3 Update Twitter bootstrap to 3.2.0
Vincent Tondellier <tonton+hg@team1664.org>
parents: 1
diff changeset
   555
0df70b8735e3 Update Twitter bootstrap to 3.2.0
Vincent Tondellier <tonton+hg@team1664.org>
parents: 1
diff changeset
   556
    var complete = function () {
0df70b8735e3 Update Twitter bootstrap to 3.2.0
Vincent Tondellier <tonton+hg@team1664.org>
parents: 1
diff changeset
   557
      this.$element
0df70b8735e3 Update Twitter bootstrap to 3.2.0
Vincent Tondellier <tonton+hg@team1664.org>
parents: 1
diff changeset
   558
        .removeClass('collapsing')
0df70b8735e3 Update Twitter bootstrap to 3.2.0
Vincent Tondellier <tonton+hg@team1664.org>
parents: 1
diff changeset
   559
        .addClass('collapse in')[dimension]('')
0df70b8735e3 Update Twitter bootstrap to 3.2.0
Vincent Tondellier <tonton+hg@team1664.org>
parents: 1
diff changeset
   560
      this.transitioning = 0
0df70b8735e3 Update Twitter bootstrap to 3.2.0
Vincent Tondellier <tonton+hg@team1664.org>
parents: 1
diff changeset
   561
      this.$element
0df70b8735e3 Update Twitter bootstrap to 3.2.0
Vincent Tondellier <tonton+hg@team1664.org>
parents: 1
diff changeset
   562
        .trigger('shown.bs.collapse')
0df70b8735e3 Update Twitter bootstrap to 3.2.0
Vincent Tondellier <tonton+hg@team1664.org>
parents: 1
diff changeset
   563
    }
0df70b8735e3 Update Twitter bootstrap to 3.2.0
Vincent Tondellier <tonton+hg@team1664.org>
parents: 1
diff changeset
   564
0df70b8735e3 Update Twitter bootstrap to 3.2.0
Vincent Tondellier <tonton+hg@team1664.org>
parents: 1
diff changeset
   565
    if (!$.support.transition) return complete.call(this)
0df70b8735e3 Update Twitter bootstrap to 3.2.0
Vincent Tondellier <tonton+hg@team1664.org>
parents: 1
diff changeset
   566
0df70b8735e3 Update Twitter bootstrap to 3.2.0
Vincent Tondellier <tonton+hg@team1664.org>
parents: 1
diff changeset
   567
    var scrollSize = $.camelCase(['scroll', dimension].join('-'))
0df70b8735e3 Update Twitter bootstrap to 3.2.0
Vincent Tondellier <tonton+hg@team1664.org>
parents: 1
diff changeset
   568
0df70b8735e3 Update Twitter bootstrap to 3.2.0
Vincent Tondellier <tonton+hg@team1664.org>
parents: 1
diff changeset
   569
    this.$element
0df70b8735e3 Update Twitter bootstrap to 3.2.0
Vincent Tondellier <tonton+hg@team1664.org>
parents: 1
diff changeset
   570
      .one('bsTransitionEnd', $.proxy(complete, this))
0df70b8735e3 Update Twitter bootstrap to 3.2.0
Vincent Tondellier <tonton+hg@team1664.org>
parents: 1
diff changeset
   571
      .emulateTransitionEnd(350)[dimension](this.$element[0][scrollSize])
0df70b8735e3 Update Twitter bootstrap to 3.2.0
Vincent Tondellier <tonton+hg@team1664.org>
parents: 1
diff changeset
   572
  }
0df70b8735e3 Update Twitter bootstrap to 3.2.0
Vincent Tondellier <tonton+hg@team1664.org>
parents: 1
diff changeset
   573
0df70b8735e3 Update Twitter bootstrap to 3.2.0
Vincent Tondellier <tonton+hg@team1664.org>
parents: 1
diff changeset
   574
  Collapse.prototype.hide = function () {
0df70b8735e3 Update Twitter bootstrap to 3.2.0
Vincent Tondellier <tonton+hg@team1664.org>
parents: 1
diff changeset
   575
    if (this.transitioning || !this.$element.hasClass('in')) return
0df70b8735e3 Update Twitter bootstrap to 3.2.0
Vincent Tondellier <tonton+hg@team1664.org>
parents: 1
diff changeset
   576
0df70b8735e3 Update Twitter bootstrap to 3.2.0
Vincent Tondellier <tonton+hg@team1664.org>
parents: 1
diff changeset
   577
    var startEvent = $.Event('hide.bs.collapse')
0df70b8735e3 Update Twitter bootstrap to 3.2.0
Vincent Tondellier <tonton+hg@team1664.org>
parents: 1
diff changeset
   578
    this.$element.trigger(startEvent)
0df70b8735e3 Update Twitter bootstrap to 3.2.0
Vincent Tondellier <tonton+hg@team1664.org>
parents: 1
diff changeset
   579
    if (startEvent.isDefaultPrevented()) return
0df70b8735e3 Update Twitter bootstrap to 3.2.0
Vincent Tondellier <tonton+hg@team1664.org>
parents: 1
diff changeset
   580
0df70b8735e3 Update Twitter bootstrap to 3.2.0
Vincent Tondellier <tonton+hg@team1664.org>
parents: 1
diff changeset
   581
    var dimension = this.dimension()
0df70b8735e3 Update Twitter bootstrap to 3.2.0
Vincent Tondellier <tonton+hg@team1664.org>
parents: 1
diff changeset
   582
0df70b8735e3 Update Twitter bootstrap to 3.2.0
Vincent Tondellier <tonton+hg@team1664.org>
parents: 1
diff changeset
   583
    this.$element[dimension](this.$element[dimension]())[0].offsetHeight
0df70b8735e3 Update Twitter bootstrap to 3.2.0
Vincent Tondellier <tonton+hg@team1664.org>
parents: 1
diff changeset
   584
0df70b8735e3 Update Twitter bootstrap to 3.2.0
Vincent Tondellier <tonton+hg@team1664.org>
parents: 1
diff changeset
   585
    this.$element
0df70b8735e3 Update Twitter bootstrap to 3.2.0
Vincent Tondellier <tonton+hg@team1664.org>
parents: 1
diff changeset
   586
      .addClass('collapsing')
0df70b8735e3 Update Twitter bootstrap to 3.2.0
Vincent Tondellier <tonton+hg@team1664.org>
parents: 1
diff changeset
   587
      .removeClass('collapse')
0df70b8735e3 Update Twitter bootstrap to 3.2.0
Vincent Tondellier <tonton+hg@team1664.org>
parents: 1
diff changeset
   588
      .removeClass('in')
0df70b8735e3 Update Twitter bootstrap to 3.2.0
Vincent Tondellier <tonton+hg@team1664.org>
parents: 1
diff changeset
   589
0df70b8735e3 Update Twitter bootstrap to 3.2.0
Vincent Tondellier <tonton+hg@team1664.org>
parents: 1
diff changeset
   590
    this.transitioning = 1
0df70b8735e3 Update Twitter bootstrap to 3.2.0
Vincent Tondellier <tonton+hg@team1664.org>
parents: 1
diff changeset
   591
0df70b8735e3 Update Twitter bootstrap to 3.2.0
Vincent Tondellier <tonton+hg@team1664.org>
parents: 1
diff changeset
   592
    var complete = function () {
0df70b8735e3 Update Twitter bootstrap to 3.2.0
Vincent Tondellier <tonton+hg@team1664.org>
parents: 1
diff changeset
   593
      this.transitioning = 0
0df70b8735e3 Update Twitter bootstrap to 3.2.0
Vincent Tondellier <tonton+hg@team1664.org>
parents: 1
diff changeset
   594
      this.$element
0df70b8735e3 Update Twitter bootstrap to 3.2.0
Vincent Tondellier <tonton+hg@team1664.org>
parents: 1
diff changeset
   595
        .trigger('hidden.bs.collapse')
0df70b8735e3 Update Twitter bootstrap to 3.2.0
Vincent Tondellier <tonton+hg@team1664.org>
parents: 1
diff changeset
   596
        .removeClass('collapsing')
0df70b8735e3 Update Twitter bootstrap to 3.2.0
Vincent Tondellier <tonton+hg@team1664.org>
parents: 1
diff changeset
   597
        .addClass('collapse')
0df70b8735e3 Update Twitter bootstrap to 3.2.0
Vincent Tondellier <tonton+hg@team1664.org>
parents: 1
diff changeset
   598
    }
0df70b8735e3 Update Twitter bootstrap to 3.2.0
Vincent Tondellier <tonton+hg@team1664.org>
parents: 1
diff changeset
   599
0df70b8735e3 Update Twitter bootstrap to 3.2.0
Vincent Tondellier <tonton+hg@team1664.org>
parents: 1
diff changeset
   600
    if (!$.support.transition) return complete.call(this)
0df70b8735e3 Update Twitter bootstrap to 3.2.0
Vincent Tondellier <tonton+hg@team1664.org>
parents: 1
diff changeset
   601
0df70b8735e3 Update Twitter bootstrap to 3.2.0
Vincent Tondellier <tonton+hg@team1664.org>
parents: 1
diff changeset
   602
    this.$element
0df70b8735e3 Update Twitter bootstrap to 3.2.0
Vincent Tondellier <tonton+hg@team1664.org>
parents: 1
diff changeset
   603
      [dimension](0)
0df70b8735e3 Update Twitter bootstrap to 3.2.0
Vincent Tondellier <tonton+hg@team1664.org>
parents: 1
diff changeset
   604
      .one('bsTransitionEnd', $.proxy(complete, this))
0df70b8735e3 Update Twitter bootstrap to 3.2.0
Vincent Tondellier <tonton+hg@team1664.org>
parents: 1
diff changeset
   605
      .emulateTransitionEnd(350)
0df70b8735e3 Update Twitter bootstrap to 3.2.0
Vincent Tondellier <tonton+hg@team1664.org>
parents: 1
diff changeset
   606
  }
0df70b8735e3 Update Twitter bootstrap to 3.2.0
Vincent Tondellier <tonton+hg@team1664.org>
parents: 1
diff changeset
   607
0df70b8735e3 Update Twitter bootstrap to 3.2.0
Vincent Tondellier <tonton+hg@team1664.org>
parents: 1
diff changeset
   608
  Collapse.prototype.toggle = function () {
0df70b8735e3 Update Twitter bootstrap to 3.2.0
Vincent Tondellier <tonton+hg@team1664.org>
parents: 1
diff changeset
   609
    this[this.$element.hasClass('in') ? 'hide' : 'show']()
0df70b8735e3 Update Twitter bootstrap to 3.2.0
Vincent Tondellier <tonton+hg@team1664.org>
parents: 1
diff changeset
   610
  }
0df70b8735e3 Update Twitter bootstrap to 3.2.0
Vincent Tondellier <tonton+hg@team1664.org>
parents: 1
diff changeset
   611
0df70b8735e3 Update Twitter bootstrap to 3.2.0
Vincent Tondellier <tonton+hg@team1664.org>
parents: 1
diff changeset
   612
0df70b8735e3 Update Twitter bootstrap to 3.2.0
Vincent Tondellier <tonton+hg@team1664.org>
parents: 1
diff changeset
   613
  // COLLAPSE PLUGIN DEFINITION
0df70b8735e3 Update Twitter bootstrap to 3.2.0
Vincent Tondellier <tonton+hg@team1664.org>
parents: 1
diff changeset
   614
  // ==========================
0df70b8735e3 Update Twitter bootstrap to 3.2.0
Vincent Tondellier <tonton+hg@team1664.org>
parents: 1
diff changeset
   615
0df70b8735e3 Update Twitter bootstrap to 3.2.0
Vincent Tondellier <tonton+hg@team1664.org>
parents: 1
diff changeset
   616
  function Plugin(option) {
0df70b8735e3 Update Twitter bootstrap to 3.2.0
Vincent Tondellier <tonton+hg@team1664.org>
parents: 1
diff changeset
   617
    return this.each(function () {
0df70b8735e3 Update Twitter bootstrap to 3.2.0
Vincent Tondellier <tonton+hg@team1664.org>
parents: 1
diff changeset
   618
      var $this   = $(this)
0df70b8735e3 Update Twitter bootstrap to 3.2.0
Vincent Tondellier <tonton+hg@team1664.org>
parents: 1
diff changeset
   619
      var data    = $this.data('bs.collapse')
0df70b8735e3 Update Twitter bootstrap to 3.2.0
Vincent Tondellier <tonton+hg@team1664.org>
parents: 1
diff changeset
   620
      var options = $.extend({}, Collapse.DEFAULTS, $this.data(), typeof option == 'object' && option)
0df70b8735e3 Update Twitter bootstrap to 3.2.0
Vincent Tondellier <tonton+hg@team1664.org>
parents: 1
diff changeset
   621
0df70b8735e3 Update Twitter bootstrap to 3.2.0
Vincent Tondellier <tonton+hg@team1664.org>
parents: 1
diff changeset
   622
      if (!data && options.toggle && option == 'show') option = !option
0df70b8735e3 Update Twitter bootstrap to 3.2.0
Vincent Tondellier <tonton+hg@team1664.org>
parents: 1
diff changeset
   623
      if (!data) $this.data('bs.collapse', (data = new Collapse(this, options)))
0df70b8735e3 Update Twitter bootstrap to 3.2.0
Vincent Tondellier <tonton+hg@team1664.org>
parents: 1
diff changeset
   624
      if (typeof option == 'string') data[option]()
0df70b8735e3 Update Twitter bootstrap to 3.2.0
Vincent Tondellier <tonton+hg@team1664.org>
parents: 1
diff changeset
   625
    })
0df70b8735e3 Update Twitter bootstrap to 3.2.0
Vincent Tondellier <tonton+hg@team1664.org>
parents: 1
diff changeset
   626
  }
0df70b8735e3 Update Twitter bootstrap to 3.2.0
Vincent Tondellier <tonton+hg@team1664.org>
parents: 1
diff changeset
   627
0df70b8735e3 Update Twitter bootstrap to 3.2.0
Vincent Tondellier <tonton+hg@team1664.org>
parents: 1
diff changeset
   628
  var old = $.fn.collapse
0df70b8735e3 Update Twitter bootstrap to 3.2.0
Vincent Tondellier <tonton+hg@team1664.org>
parents: 1
diff changeset
   629
0df70b8735e3 Update Twitter bootstrap to 3.2.0
Vincent Tondellier <tonton+hg@team1664.org>
parents: 1
diff changeset
   630
  $.fn.collapse             = Plugin
0df70b8735e3 Update Twitter bootstrap to 3.2.0
Vincent Tondellier <tonton+hg@team1664.org>
parents: 1
diff changeset
   631
  $.fn.collapse.Constructor = Collapse
0df70b8735e3 Update Twitter bootstrap to 3.2.0
Vincent Tondellier <tonton+hg@team1664.org>
parents: 1
diff changeset
   632
0df70b8735e3 Update Twitter bootstrap to 3.2.0
Vincent Tondellier <tonton+hg@team1664.org>
parents: 1
diff changeset
   633
0df70b8735e3 Update Twitter bootstrap to 3.2.0
Vincent Tondellier <tonton+hg@team1664.org>
parents: 1
diff changeset
   634
  // COLLAPSE NO CONFLICT
0df70b8735e3 Update Twitter bootstrap to 3.2.0
Vincent Tondellier <tonton+hg@team1664.org>
parents: 1
diff changeset
   635
  // ====================
0df70b8735e3 Update Twitter bootstrap to 3.2.0
Vincent Tondellier <tonton+hg@team1664.org>
parents: 1
diff changeset
   636
0df70b8735e3 Update Twitter bootstrap to 3.2.0
Vincent Tondellier <tonton+hg@team1664.org>
parents: 1
diff changeset
   637
  $.fn.collapse.noConflict = function () {
0df70b8735e3 Update Twitter bootstrap to 3.2.0
Vincent Tondellier <tonton+hg@team1664.org>
parents: 1
diff changeset
   638
    $.fn.collapse = old
0df70b8735e3 Update Twitter bootstrap to 3.2.0
Vincent Tondellier <tonton+hg@team1664.org>
parents: 1
diff changeset
   639
    return this
0df70b8735e3 Update Twitter bootstrap to 3.2.0
Vincent Tondellier <tonton+hg@team1664.org>
parents: 1
diff changeset
   640
  }
0df70b8735e3 Update Twitter bootstrap to 3.2.0
Vincent Tondellier <tonton+hg@team1664.org>
parents: 1
diff changeset
   641
0df70b8735e3 Update Twitter bootstrap to 3.2.0
Vincent Tondellier <tonton+hg@team1664.org>
parents: 1
diff changeset
   642
0df70b8735e3 Update Twitter bootstrap to 3.2.0
Vincent Tondellier <tonton+hg@team1664.org>
parents: 1
diff changeset
   643
  // COLLAPSE DATA-API
0df70b8735e3 Update Twitter bootstrap to 3.2.0
Vincent Tondellier <tonton+hg@team1664.org>
parents: 1
diff changeset
   644
  // =================
0df70b8735e3 Update Twitter bootstrap to 3.2.0
Vincent Tondellier <tonton+hg@team1664.org>
parents: 1
diff changeset
   645
0df70b8735e3 Update Twitter bootstrap to 3.2.0
Vincent Tondellier <tonton+hg@team1664.org>
parents: 1
diff changeset
   646
  $(document).on('click.bs.collapse.data-api', '[data-toggle="collapse"]', function (e) {
0df70b8735e3 Update Twitter bootstrap to 3.2.0
Vincent Tondellier <tonton+hg@team1664.org>
parents: 1
diff changeset
   647
    var href
0df70b8735e3 Update Twitter bootstrap to 3.2.0
Vincent Tondellier <tonton+hg@team1664.org>
parents: 1
diff changeset
   648
    var $this   = $(this)
0df70b8735e3 Update Twitter bootstrap to 3.2.0
Vincent Tondellier <tonton+hg@team1664.org>
parents: 1
diff changeset
   649
    var target  = $this.attr('data-target')
0df70b8735e3 Update Twitter bootstrap to 3.2.0
Vincent Tondellier <tonton+hg@team1664.org>
parents: 1
diff changeset
   650
        || e.preventDefault()
0df70b8735e3 Update Twitter bootstrap to 3.2.0
Vincent Tondellier <tonton+hg@team1664.org>
parents: 1
diff changeset
   651
        || (href = $this.attr('href')) && href.replace(/.*(?=#[^\s]+$)/, '') // strip for ie7
0df70b8735e3 Update Twitter bootstrap to 3.2.0
Vincent Tondellier <tonton+hg@team1664.org>
parents: 1
diff changeset
   652
    var $target = $(target)
0df70b8735e3 Update Twitter bootstrap to 3.2.0
Vincent Tondellier <tonton+hg@team1664.org>
parents: 1
diff changeset
   653
    var data    = $target.data('bs.collapse')
0df70b8735e3 Update Twitter bootstrap to 3.2.0
Vincent Tondellier <tonton+hg@team1664.org>
parents: 1
diff changeset
   654
    var option  = data ? 'toggle' : $this.data()
0df70b8735e3 Update Twitter bootstrap to 3.2.0
Vincent Tondellier <tonton+hg@team1664.org>
parents: 1
diff changeset
   655
    var parent  = $this.attr('data-parent')
0df70b8735e3 Update Twitter bootstrap to 3.2.0
Vincent Tondellier <tonton+hg@team1664.org>
parents: 1
diff changeset
   656
    var $parent = parent && $(parent)
0df70b8735e3 Update Twitter bootstrap to 3.2.0
Vincent Tondellier <tonton+hg@team1664.org>
parents: 1
diff changeset
   657
0df70b8735e3 Update Twitter bootstrap to 3.2.0
Vincent Tondellier <tonton+hg@team1664.org>
parents: 1
diff changeset
   658
    if (!data || !data.transitioning) {
0df70b8735e3 Update Twitter bootstrap to 3.2.0
Vincent Tondellier <tonton+hg@team1664.org>
parents: 1
diff changeset
   659
      if ($parent) $parent.find('[data-toggle="collapse"][data-parent="' + parent + '"]').not($this).addClass('collapsed')
0df70b8735e3 Update Twitter bootstrap to 3.2.0
Vincent Tondellier <tonton+hg@team1664.org>
parents: 1
diff changeset
   660
      $this[$target.hasClass('in') ? 'addClass' : 'removeClass']('collapsed')
0df70b8735e3 Update Twitter bootstrap to 3.2.0
Vincent Tondellier <tonton+hg@team1664.org>
parents: 1
diff changeset
   661
    }
0df70b8735e3 Update Twitter bootstrap to 3.2.0
Vincent Tondellier <tonton+hg@team1664.org>
parents: 1
diff changeset
   662
0df70b8735e3 Update Twitter bootstrap to 3.2.0
Vincent Tondellier <tonton+hg@team1664.org>
parents: 1
diff changeset
   663
    Plugin.call($target, option)
0df70b8735e3 Update Twitter bootstrap to 3.2.0
Vincent Tondellier <tonton+hg@team1664.org>
parents: 1
diff changeset
   664
  })
0df70b8735e3 Update Twitter bootstrap to 3.2.0
Vincent Tondellier <tonton+hg@team1664.org>
parents: 1
diff changeset
   665
0df70b8735e3 Update Twitter bootstrap to 3.2.0
Vincent Tondellier <tonton+hg@team1664.org>
parents: 1
diff changeset
   666
}(jQuery);
0df70b8735e3 Update Twitter bootstrap to 3.2.0
Vincent Tondellier <tonton+hg@team1664.org>
parents: 1
diff changeset
   667
0df70b8735e3 Update Twitter bootstrap to 3.2.0
Vincent Tondellier <tonton+hg@team1664.org>
parents: 1
diff changeset
   668
/* ========================================================================
0df70b8735e3 Update Twitter bootstrap to 3.2.0
Vincent Tondellier <tonton+hg@team1664.org>
parents: 1
diff changeset
   669
 * Bootstrap: dropdown.js v3.2.0
0df70b8735e3 Update Twitter bootstrap to 3.2.0
Vincent Tondellier <tonton+hg@team1664.org>
parents: 1
diff changeset
   670
 * http://getbootstrap.com/javascript/#dropdowns
0df70b8735e3 Update Twitter bootstrap to 3.2.0
Vincent Tondellier <tonton+hg@team1664.org>
parents: 1
diff changeset
   671
 * ========================================================================
0df70b8735e3 Update Twitter bootstrap to 3.2.0
Vincent Tondellier <tonton+hg@team1664.org>
parents: 1
diff changeset
   672
 * Copyright 2011-2014 Twitter, Inc.
0df70b8735e3 Update Twitter bootstrap to 3.2.0
Vincent Tondellier <tonton+hg@team1664.org>
parents: 1
diff changeset
   673
 * Licensed under MIT (https://github.com/twbs/bootstrap/blob/master/LICENSE)
0df70b8735e3 Update Twitter bootstrap to 3.2.0
Vincent Tondellier <tonton+hg@team1664.org>
parents: 1
diff changeset
   674
 * ======================================================================== */
0df70b8735e3 Update Twitter bootstrap to 3.2.0
Vincent Tondellier <tonton+hg@team1664.org>
parents: 1
diff changeset
   675
0df70b8735e3 Update Twitter bootstrap to 3.2.0
Vincent Tondellier <tonton+hg@team1664.org>
parents: 1
diff changeset
   676
0df70b8735e3 Update Twitter bootstrap to 3.2.0
Vincent Tondellier <tonton+hg@team1664.org>
parents: 1
diff changeset
   677
+function ($) {
0df70b8735e3 Update Twitter bootstrap to 3.2.0
Vincent Tondellier <tonton+hg@team1664.org>
parents: 1
diff changeset
   678
  'use strict';
0df70b8735e3 Update Twitter bootstrap to 3.2.0
Vincent Tondellier <tonton+hg@team1664.org>
parents: 1
diff changeset
   679
0df70b8735e3 Update Twitter bootstrap to 3.2.0
Vincent Tondellier <tonton+hg@team1664.org>
parents: 1
diff changeset
   680
  // DROPDOWN CLASS DEFINITION
0df70b8735e3 Update Twitter bootstrap to 3.2.0
Vincent Tondellier <tonton+hg@team1664.org>
parents: 1
diff changeset
   681
  // =========================
0df70b8735e3 Update Twitter bootstrap to 3.2.0
Vincent Tondellier <tonton+hg@team1664.org>
parents: 1
diff changeset
   682
0df70b8735e3 Update Twitter bootstrap to 3.2.0
Vincent Tondellier <tonton+hg@team1664.org>
parents: 1
diff changeset
   683
  var backdrop = '.dropdown-backdrop'
0df70b8735e3 Update Twitter bootstrap to 3.2.0
Vincent Tondellier <tonton+hg@team1664.org>
parents: 1
diff changeset
   684
  var toggle   = '[data-toggle="dropdown"]'
0df70b8735e3 Update Twitter bootstrap to 3.2.0
Vincent Tondellier <tonton+hg@team1664.org>
parents: 1
diff changeset
   685
  var Dropdown = function (element) {
0df70b8735e3 Update Twitter bootstrap to 3.2.0
Vincent Tondellier <tonton+hg@team1664.org>
parents: 1
diff changeset
   686
    $(element).on('click.bs.dropdown', this.toggle)
0df70b8735e3 Update Twitter bootstrap to 3.2.0
Vincent Tondellier <tonton+hg@team1664.org>
parents: 1
diff changeset
   687
  }
0df70b8735e3 Update Twitter bootstrap to 3.2.0
Vincent Tondellier <tonton+hg@team1664.org>
parents: 1
diff changeset
   688
0df70b8735e3 Update Twitter bootstrap to 3.2.0
Vincent Tondellier <tonton+hg@team1664.org>
parents: 1
diff changeset
   689
  Dropdown.VERSION = '3.2.0'
0df70b8735e3 Update Twitter bootstrap to 3.2.0
Vincent Tondellier <tonton+hg@team1664.org>
parents: 1
diff changeset
   690
0df70b8735e3 Update Twitter bootstrap to 3.2.0
Vincent Tondellier <tonton+hg@team1664.org>
parents: 1
diff changeset
   691
  Dropdown.prototype.toggle = function (e) {
0df70b8735e3 Update Twitter bootstrap to 3.2.0
Vincent Tondellier <tonton+hg@team1664.org>
parents: 1
diff changeset
   692
    var $this = $(this)
0df70b8735e3 Update Twitter bootstrap to 3.2.0
Vincent Tondellier <tonton+hg@team1664.org>
parents: 1
diff changeset
   693
0df70b8735e3 Update Twitter bootstrap to 3.2.0
Vincent Tondellier <tonton+hg@team1664.org>
parents: 1
diff changeset
   694
    if ($this.is('.disabled, :disabled')) return
0df70b8735e3 Update Twitter bootstrap to 3.2.0
Vincent Tondellier <tonton+hg@team1664.org>
parents: 1
diff changeset
   695
0df70b8735e3 Update Twitter bootstrap to 3.2.0
Vincent Tondellier <tonton+hg@team1664.org>
parents: 1
diff changeset
   696
    var $parent  = getParent($this)
0df70b8735e3 Update Twitter bootstrap to 3.2.0
Vincent Tondellier <tonton+hg@team1664.org>
parents: 1
diff changeset
   697
    var isActive = $parent.hasClass('open')
0df70b8735e3 Update Twitter bootstrap to 3.2.0
Vincent Tondellier <tonton+hg@team1664.org>
parents: 1
diff changeset
   698
0df70b8735e3 Update Twitter bootstrap to 3.2.0
Vincent Tondellier <tonton+hg@team1664.org>
parents: 1
diff changeset
   699
    clearMenus()
0df70b8735e3 Update Twitter bootstrap to 3.2.0
Vincent Tondellier <tonton+hg@team1664.org>
parents: 1
diff changeset
   700
0df70b8735e3 Update Twitter bootstrap to 3.2.0
Vincent Tondellier <tonton+hg@team1664.org>
parents: 1
diff changeset
   701
    if (!isActive) {
0df70b8735e3 Update Twitter bootstrap to 3.2.0
Vincent Tondellier <tonton+hg@team1664.org>
parents: 1
diff changeset
   702
      if ('ontouchstart' in document.documentElement && !$parent.closest('.navbar-nav').length) {
0df70b8735e3 Update Twitter bootstrap to 3.2.0
Vincent Tondellier <tonton+hg@team1664.org>
parents: 1
diff changeset
   703
        // if mobile we use a backdrop because click events don't delegate
0df70b8735e3 Update Twitter bootstrap to 3.2.0
Vincent Tondellier <tonton+hg@team1664.org>
parents: 1
diff changeset
   704
        $('<div class="dropdown-backdrop"/>').insertAfter($(this)).on('click', clearMenus)
0df70b8735e3 Update Twitter bootstrap to 3.2.0
Vincent Tondellier <tonton+hg@team1664.org>
parents: 1
diff changeset
   705
      }
0df70b8735e3 Update Twitter bootstrap to 3.2.0
Vincent Tondellier <tonton+hg@team1664.org>
parents: 1
diff changeset
   706
0df70b8735e3 Update Twitter bootstrap to 3.2.0
Vincent Tondellier <tonton+hg@team1664.org>
parents: 1
diff changeset
   707
      var relatedTarget = { relatedTarget: this }
0df70b8735e3 Update Twitter bootstrap to 3.2.0
Vincent Tondellier <tonton+hg@team1664.org>
parents: 1
diff changeset
   708
      $parent.trigger(e = $.Event('show.bs.dropdown', relatedTarget))
0df70b8735e3 Update Twitter bootstrap to 3.2.0
Vincent Tondellier <tonton+hg@team1664.org>
parents: 1
diff changeset
   709
0df70b8735e3 Update Twitter bootstrap to 3.2.0
Vincent Tondellier <tonton+hg@team1664.org>
parents: 1
diff changeset
   710
      if (e.isDefaultPrevented()) return
0df70b8735e3 Update Twitter bootstrap to 3.2.0
Vincent Tondellier <tonton+hg@team1664.org>
parents: 1
diff changeset
   711
0df70b8735e3 Update Twitter bootstrap to 3.2.0
Vincent Tondellier <tonton+hg@team1664.org>
parents: 1
diff changeset
   712
      $this.trigger('focus')
0df70b8735e3 Update Twitter bootstrap to 3.2.0
Vincent Tondellier <tonton+hg@team1664.org>
parents: 1
diff changeset
   713
0df70b8735e3 Update Twitter bootstrap to 3.2.0
Vincent Tondellier <tonton+hg@team1664.org>
parents: 1
diff changeset
   714
      $parent
0df70b8735e3 Update Twitter bootstrap to 3.2.0
Vincent Tondellier <tonton+hg@team1664.org>
parents: 1
diff changeset
   715
        .toggleClass('open')
0df70b8735e3 Update Twitter bootstrap to 3.2.0
Vincent Tondellier <tonton+hg@team1664.org>
parents: 1
diff changeset
   716
        .trigger('shown.bs.dropdown', relatedTarget)
0df70b8735e3 Update Twitter bootstrap to 3.2.0
Vincent Tondellier <tonton+hg@team1664.org>
parents: 1
diff changeset
   717
    }
0df70b8735e3 Update Twitter bootstrap to 3.2.0
Vincent Tondellier <tonton+hg@team1664.org>
parents: 1
diff changeset
   718
0df70b8735e3 Update Twitter bootstrap to 3.2.0
Vincent Tondellier <tonton+hg@team1664.org>
parents: 1
diff changeset
   719
    return false
0df70b8735e3 Update Twitter bootstrap to 3.2.0
Vincent Tondellier <tonton+hg@team1664.org>
parents: 1
diff changeset
   720
  }
0df70b8735e3 Update Twitter bootstrap to 3.2.0
Vincent Tondellier <tonton+hg@team1664.org>
parents: 1
diff changeset
   721
0df70b8735e3 Update Twitter bootstrap to 3.2.0
Vincent Tondellier <tonton+hg@team1664.org>
parents: 1
diff changeset
   722
  Dropdown.prototype.keydown = function (e) {
0df70b8735e3 Update Twitter bootstrap to 3.2.0
Vincent Tondellier <tonton+hg@team1664.org>
parents: 1
diff changeset
   723
    if (!/(38|40|27)/.test(e.keyCode)) return
0df70b8735e3 Update Twitter bootstrap to 3.2.0
Vincent Tondellier <tonton+hg@team1664.org>
parents: 1
diff changeset
   724
0df70b8735e3 Update Twitter bootstrap to 3.2.0
Vincent Tondellier <tonton+hg@team1664.org>
parents: 1
diff changeset
   725
    var $this = $(this)
0df70b8735e3 Update Twitter bootstrap to 3.2.0
Vincent Tondellier <tonton+hg@team1664.org>
parents: 1
diff changeset
   726
0df70b8735e3 Update Twitter bootstrap to 3.2.0
Vincent Tondellier <tonton+hg@team1664.org>
parents: 1
diff changeset
   727
    e.preventDefault()
0df70b8735e3 Update Twitter bootstrap to 3.2.0
Vincent Tondellier <tonton+hg@team1664.org>
parents: 1
diff changeset
   728
    e.stopPropagation()
0df70b8735e3 Update Twitter bootstrap to 3.2.0
Vincent Tondellier <tonton+hg@team1664.org>
parents: 1
diff changeset
   729
0df70b8735e3 Update Twitter bootstrap to 3.2.0
Vincent Tondellier <tonton+hg@team1664.org>
parents: 1
diff changeset
   730
    if ($this.is('.disabled, :disabled')) return
0df70b8735e3 Update Twitter bootstrap to 3.2.0
Vincent Tondellier <tonton+hg@team1664.org>
parents: 1
diff changeset
   731
0df70b8735e3 Update Twitter bootstrap to 3.2.0
Vincent Tondellier <tonton+hg@team1664.org>
parents: 1
diff changeset
   732
    var $parent  = getParent($this)
0df70b8735e3 Update Twitter bootstrap to 3.2.0
Vincent Tondellier <tonton+hg@team1664.org>
parents: 1
diff changeset
   733
    var isActive = $parent.hasClass('open')
0df70b8735e3 Update Twitter bootstrap to 3.2.0
Vincent Tondellier <tonton+hg@team1664.org>
parents: 1
diff changeset
   734
0df70b8735e3 Update Twitter bootstrap to 3.2.0
Vincent Tondellier <tonton+hg@team1664.org>
parents: 1
diff changeset
   735
    if (!isActive || (isActive && e.keyCode == 27)) {
0df70b8735e3 Update Twitter bootstrap to 3.2.0
Vincent Tondellier <tonton+hg@team1664.org>
parents: 1
diff changeset
   736
      if (e.which == 27) $parent.find(toggle).trigger('focus')
0df70b8735e3 Update Twitter bootstrap to 3.2.0
Vincent Tondellier <tonton+hg@team1664.org>
parents: 1
diff changeset
   737
      return $this.trigger('click')
0df70b8735e3 Update Twitter bootstrap to 3.2.0
Vincent Tondellier <tonton+hg@team1664.org>
parents: 1
diff changeset
   738
    }
0df70b8735e3 Update Twitter bootstrap to 3.2.0
Vincent Tondellier <tonton+hg@team1664.org>
parents: 1
diff changeset
   739
0df70b8735e3 Update Twitter bootstrap to 3.2.0
Vincent Tondellier <tonton+hg@team1664.org>
parents: 1
diff changeset
   740
    var desc = ' li:not(.divider):visible a'
0df70b8735e3 Update Twitter bootstrap to 3.2.0
Vincent Tondellier <tonton+hg@team1664.org>
parents: 1
diff changeset
   741
    var $items = $parent.find('[role="menu"]' + desc + ', [role="listbox"]' + desc)
0df70b8735e3 Update Twitter bootstrap to 3.2.0
Vincent Tondellier <tonton+hg@team1664.org>
parents: 1
diff changeset
   742
0df70b8735e3 Update Twitter bootstrap to 3.2.0
Vincent Tondellier <tonton+hg@team1664.org>
parents: 1
diff changeset
   743
    if (!$items.length) return
0df70b8735e3 Update Twitter bootstrap to 3.2.0
Vincent Tondellier <tonton+hg@team1664.org>
parents: 1
diff changeset
   744
0df70b8735e3 Update Twitter bootstrap to 3.2.0
Vincent Tondellier <tonton+hg@team1664.org>
parents: 1
diff changeset
   745
    var index = $items.index($items.filter(':focus'))
0df70b8735e3 Update Twitter bootstrap to 3.2.0
Vincent Tondellier <tonton+hg@team1664.org>
parents: 1
diff changeset
   746
0df70b8735e3 Update Twitter bootstrap to 3.2.0
Vincent Tondellier <tonton+hg@team1664.org>
parents: 1
diff changeset
   747
    if (e.keyCode == 38 && index > 0)                 index--                        // up
0df70b8735e3 Update Twitter bootstrap to 3.2.0
Vincent Tondellier <tonton+hg@team1664.org>
parents: 1
diff changeset
   748
    if (e.keyCode == 40 && index < $items.length - 1) index++                        // down
0df70b8735e3 Update Twitter bootstrap to 3.2.0
Vincent Tondellier <tonton+hg@team1664.org>
parents: 1
diff changeset
   749
    if (!~index)                                      index = 0
0df70b8735e3 Update Twitter bootstrap to 3.2.0
Vincent Tondellier <tonton+hg@team1664.org>
parents: 1
diff changeset
   750
0df70b8735e3 Update Twitter bootstrap to 3.2.0
Vincent Tondellier <tonton+hg@team1664.org>
parents: 1
diff changeset
   751
    $items.eq(index).trigger('focus')
0df70b8735e3 Update Twitter bootstrap to 3.2.0
Vincent Tondellier <tonton+hg@team1664.org>
parents: 1
diff changeset
   752
  }
0df70b8735e3 Update Twitter bootstrap to 3.2.0
Vincent Tondellier <tonton+hg@team1664.org>
parents: 1
diff changeset
   753
0df70b8735e3 Update Twitter bootstrap to 3.2.0
Vincent Tondellier <tonton+hg@team1664.org>
parents: 1
diff changeset
   754
  function clearMenus(e) {
0df70b8735e3 Update Twitter bootstrap to 3.2.0
Vincent Tondellier <tonton+hg@team1664.org>
parents: 1
diff changeset
   755
    if (e && e.which === 3) return
0df70b8735e3 Update Twitter bootstrap to 3.2.0
Vincent Tondellier <tonton+hg@team1664.org>
parents: 1
diff changeset
   756
    $(backdrop).remove()
0df70b8735e3 Update Twitter bootstrap to 3.2.0
Vincent Tondellier <tonton+hg@team1664.org>
parents: 1
diff changeset
   757
    $(toggle).each(function () {
0df70b8735e3 Update Twitter bootstrap to 3.2.0
Vincent Tondellier <tonton+hg@team1664.org>
parents: 1
diff changeset
   758
      var $parent = getParent($(this))
0df70b8735e3 Update Twitter bootstrap to 3.2.0
Vincent Tondellier <tonton+hg@team1664.org>
parents: 1
diff changeset
   759
      var relatedTarget = { relatedTarget: this }
0df70b8735e3 Update Twitter bootstrap to 3.2.0
Vincent Tondellier <tonton+hg@team1664.org>
parents: 1
diff changeset
   760
      if (!$parent.hasClass('open')) return
0df70b8735e3 Update Twitter bootstrap to 3.2.0
Vincent Tondellier <tonton+hg@team1664.org>
parents: 1
diff changeset
   761
      $parent.trigger(e = $.Event('hide.bs.dropdown', relatedTarget))
0df70b8735e3 Update Twitter bootstrap to 3.2.0
Vincent Tondellier <tonton+hg@team1664.org>
parents: 1
diff changeset
   762
      if (e.isDefaultPrevented()) return
0df70b8735e3 Update Twitter bootstrap to 3.2.0
Vincent Tondellier <tonton+hg@team1664.org>
parents: 1
diff changeset
   763
      $parent.removeClass('open').trigger('hidden.bs.dropdown', relatedTarget)
0df70b8735e3 Update Twitter bootstrap to 3.2.0
Vincent Tondellier <tonton+hg@team1664.org>
parents: 1
diff changeset
   764
    })
0df70b8735e3 Update Twitter bootstrap to 3.2.0
Vincent Tondellier <tonton+hg@team1664.org>
parents: 1
diff changeset
   765
  }
0df70b8735e3 Update Twitter bootstrap to 3.2.0
Vincent Tondellier <tonton+hg@team1664.org>
parents: 1
diff changeset
   766
0df70b8735e3 Update Twitter bootstrap to 3.2.0
Vincent Tondellier <tonton+hg@team1664.org>
parents: 1
diff changeset
   767
  function getParent($this) {
0df70b8735e3 Update Twitter bootstrap to 3.2.0
Vincent Tondellier <tonton+hg@team1664.org>
parents: 1
diff changeset
   768
    var selector = $this.attr('data-target')
0df70b8735e3 Update Twitter bootstrap to 3.2.0
Vincent Tondellier <tonton+hg@team1664.org>
parents: 1
diff changeset
   769
0df70b8735e3 Update Twitter bootstrap to 3.2.0
Vincent Tondellier <tonton+hg@team1664.org>
parents: 1
diff changeset
   770
    if (!selector) {
0df70b8735e3 Update Twitter bootstrap to 3.2.0
Vincent Tondellier <tonton+hg@team1664.org>
parents: 1
diff changeset
   771
      selector = $this.attr('href')
0df70b8735e3 Update Twitter bootstrap to 3.2.0
Vincent Tondellier <tonton+hg@team1664.org>
parents: 1
diff changeset
   772
      selector = selector && /#[A-Za-z]/.test(selector) && selector.replace(/.*(?=#[^\s]*$)/, '') // strip for ie7
0df70b8735e3 Update Twitter bootstrap to 3.2.0
Vincent Tondellier <tonton+hg@team1664.org>
parents: 1
diff changeset
   773
    }
0df70b8735e3 Update Twitter bootstrap to 3.2.0
Vincent Tondellier <tonton+hg@team1664.org>
parents: 1
diff changeset
   774
0df70b8735e3 Update Twitter bootstrap to 3.2.0
Vincent Tondellier <tonton+hg@team1664.org>
parents: 1
diff changeset
   775
    var $parent = selector && $(selector)
0df70b8735e3 Update Twitter bootstrap to 3.2.0
Vincent Tondellier <tonton+hg@team1664.org>
parents: 1
diff changeset
   776
0df70b8735e3 Update Twitter bootstrap to 3.2.0
Vincent Tondellier <tonton+hg@team1664.org>
parents: 1
diff changeset
   777
    return $parent && $parent.length ? $parent : $this.parent()
0df70b8735e3 Update Twitter bootstrap to 3.2.0
Vincent Tondellier <tonton+hg@team1664.org>
parents: 1
diff changeset
   778
  }
0df70b8735e3 Update Twitter bootstrap to 3.2.0
Vincent Tondellier <tonton+hg@team1664.org>
parents: 1
diff changeset
   779
0df70b8735e3 Update Twitter bootstrap to 3.2.0
Vincent Tondellier <tonton+hg@team1664.org>
parents: 1
diff changeset
   780
0df70b8735e3 Update Twitter bootstrap to 3.2.0
Vincent Tondellier <tonton+hg@team1664.org>
parents: 1
diff changeset
   781
  // DROPDOWN PLUGIN DEFINITION
0df70b8735e3 Update Twitter bootstrap to 3.2.0
Vincent Tondellier <tonton+hg@team1664.org>
parents: 1
diff changeset
   782
  // ==========================
0df70b8735e3 Update Twitter bootstrap to 3.2.0
Vincent Tondellier <tonton+hg@team1664.org>
parents: 1
diff changeset
   783
0df70b8735e3 Update Twitter bootstrap to 3.2.0
Vincent Tondellier <tonton+hg@team1664.org>
parents: 1
diff changeset
   784
  function Plugin(option) {
0df70b8735e3 Update Twitter bootstrap to 3.2.0
Vincent Tondellier <tonton+hg@team1664.org>
parents: 1
diff changeset
   785
    return this.each(function () {
0df70b8735e3 Update Twitter bootstrap to 3.2.0
Vincent Tondellier <tonton+hg@team1664.org>
parents: 1
diff changeset
   786
      var $this = $(this)
0df70b8735e3 Update Twitter bootstrap to 3.2.0
Vincent Tondellier <tonton+hg@team1664.org>
parents: 1
diff changeset
   787
      var data  = $this.data('bs.dropdown')
0df70b8735e3 Update Twitter bootstrap to 3.2.0
Vincent Tondellier <tonton+hg@team1664.org>
parents: 1
diff changeset
   788
0df70b8735e3 Update Twitter bootstrap to 3.2.0
Vincent Tondellier <tonton+hg@team1664.org>
parents: 1
diff changeset
   789
      if (!data) $this.data('bs.dropdown', (data = new Dropdown(this)))
0
5b78b8c79d9c Initial commit
Vincent Tondellier <tonton+hg@team1664.org>
parents:
diff changeset
   790
      if (typeof option == 'string') data[option].call($this)
5b78b8c79d9c Initial commit
Vincent Tondellier <tonton+hg@team1664.org>
parents:
diff changeset
   791
    })
5b78b8c79d9c Initial commit
Vincent Tondellier <tonton+hg@team1664.org>
parents:
diff changeset
   792
  }
5b78b8c79d9c Initial commit
Vincent Tondellier <tonton+hg@team1664.org>
parents:
diff changeset
   793
28
0df70b8735e3 Update Twitter bootstrap to 3.2.0
Vincent Tondellier <tonton+hg@team1664.org>
parents: 1
diff changeset
   794
  var old = $.fn.dropdown
0df70b8735e3 Update Twitter bootstrap to 3.2.0
Vincent Tondellier <tonton+hg@team1664.org>
parents: 1
diff changeset
   795
0df70b8735e3 Update Twitter bootstrap to 3.2.0
Vincent Tondellier <tonton+hg@team1664.org>
parents: 1
diff changeset
   796
  $.fn.dropdown             = Plugin
0df70b8735e3 Update Twitter bootstrap to 3.2.0
Vincent Tondellier <tonton+hg@team1664.org>
parents: 1
diff changeset
   797
  $.fn.dropdown.Constructor = Dropdown
0df70b8735e3 Update Twitter bootstrap to 3.2.0
Vincent Tondellier <tonton+hg@team1664.org>
parents: 1
diff changeset
   798
0df70b8735e3 Update Twitter bootstrap to 3.2.0
Vincent Tondellier <tonton+hg@team1664.org>
parents: 1
diff changeset
   799
0df70b8735e3 Update Twitter bootstrap to 3.2.0
Vincent Tondellier <tonton+hg@team1664.org>
parents: 1
diff changeset
   800
  // DROPDOWN NO CONFLICT
0df70b8735e3 Update Twitter bootstrap to 3.2.0
Vincent Tondellier <tonton+hg@team1664.org>
parents: 1
diff changeset
   801
  // ====================
0df70b8735e3 Update Twitter bootstrap to 3.2.0
Vincent Tondellier <tonton+hg@team1664.org>
parents: 1
diff changeset
   802
0df70b8735e3 Update Twitter bootstrap to 3.2.0
Vincent Tondellier <tonton+hg@team1664.org>
parents: 1
diff changeset
   803
  $.fn.dropdown.noConflict = function () {
0df70b8735e3 Update Twitter bootstrap to 3.2.0
Vincent Tondellier <tonton+hg@team1664.org>
parents: 1
diff changeset
   804
    $.fn.dropdown = old
0df70b8735e3 Update Twitter bootstrap to 3.2.0
Vincent Tondellier <tonton+hg@team1664.org>
parents: 1
diff changeset
   805
    return this
0df70b8735e3 Update Twitter bootstrap to 3.2.0
Vincent Tondellier <tonton+hg@team1664.org>
parents: 1
diff changeset
   806
  }
0df70b8735e3 Update Twitter bootstrap to 3.2.0
Vincent Tondellier <tonton+hg@team1664.org>
parents: 1
diff changeset
   807
0df70b8735e3 Update Twitter bootstrap to 3.2.0
Vincent Tondellier <tonton+hg@team1664.org>
parents: 1
diff changeset
   808
0df70b8735e3 Update Twitter bootstrap to 3.2.0
Vincent Tondellier <tonton+hg@team1664.org>
parents: 1
diff changeset
   809
  // APPLY TO STANDARD DROPDOWN ELEMENTS
0df70b8735e3 Update Twitter bootstrap to 3.2.0
Vincent Tondellier <tonton+hg@team1664.org>
parents: 1
diff changeset
   810
  // ===================================
0df70b8735e3 Update Twitter bootstrap to 3.2.0
Vincent Tondellier <tonton+hg@team1664.org>
parents: 1
diff changeset
   811
0df70b8735e3 Update Twitter bootstrap to 3.2.0
Vincent Tondellier <tonton+hg@team1664.org>
parents: 1
diff changeset
   812
  $(document)
0df70b8735e3 Update Twitter bootstrap to 3.2.0
Vincent Tondellier <tonton+hg@team1664.org>
parents: 1
diff changeset
   813
    .on('click.bs.dropdown.data-api', clearMenus)
0df70b8735e3 Update Twitter bootstrap to 3.2.0
Vincent Tondellier <tonton+hg@team1664.org>
parents: 1
diff changeset
   814
    .on('click.bs.dropdown.data-api', '.dropdown form', function (e) { e.stopPropagation() })
0df70b8735e3 Update Twitter bootstrap to 3.2.0
Vincent Tondellier <tonton+hg@team1664.org>
parents: 1
diff changeset
   815
    .on('click.bs.dropdown.data-api', toggle, Dropdown.prototype.toggle)
0df70b8735e3 Update Twitter bootstrap to 3.2.0
Vincent Tondellier <tonton+hg@team1664.org>
parents: 1
diff changeset
   816
    .on('keydown.bs.dropdown.data-api', toggle + ', [role="menu"], [role="listbox"]', Dropdown.prototype.keydown)
0df70b8735e3 Update Twitter bootstrap to 3.2.0
Vincent Tondellier <tonton+hg@team1664.org>
parents: 1
diff changeset
   817
0df70b8735e3 Update Twitter bootstrap to 3.2.0
Vincent Tondellier <tonton+hg@team1664.org>
parents: 1
diff changeset
   818
}(jQuery);
0df70b8735e3 Update Twitter bootstrap to 3.2.0
Vincent Tondellier <tonton+hg@team1664.org>
parents: 1
diff changeset
   819
0df70b8735e3 Update Twitter bootstrap to 3.2.0
Vincent Tondellier <tonton+hg@team1664.org>
parents: 1
diff changeset
   820
/* ========================================================================
0df70b8735e3 Update Twitter bootstrap to 3.2.0
Vincent Tondellier <tonton+hg@team1664.org>
parents: 1
diff changeset
   821
 * Bootstrap: modal.js v3.2.0
0df70b8735e3 Update Twitter bootstrap to 3.2.0
Vincent Tondellier <tonton+hg@team1664.org>
parents: 1
diff changeset
   822
 * http://getbootstrap.com/javascript/#modals
0df70b8735e3 Update Twitter bootstrap to 3.2.0
Vincent Tondellier <tonton+hg@team1664.org>
parents: 1
diff changeset
   823
 * ========================================================================
0df70b8735e3 Update Twitter bootstrap to 3.2.0
Vincent Tondellier <tonton+hg@team1664.org>
parents: 1
diff changeset
   824
 * Copyright 2011-2014 Twitter, Inc.
0df70b8735e3 Update Twitter bootstrap to 3.2.0
Vincent Tondellier <tonton+hg@team1664.org>
parents: 1
diff changeset
   825
 * Licensed under MIT (https://github.com/twbs/bootstrap/blob/master/LICENSE)
0df70b8735e3 Update Twitter bootstrap to 3.2.0
Vincent Tondellier <tonton+hg@team1664.org>
parents: 1
diff changeset
   826
 * ======================================================================== */
0df70b8735e3 Update Twitter bootstrap to 3.2.0
Vincent Tondellier <tonton+hg@team1664.org>
parents: 1
diff changeset
   827
0df70b8735e3 Update Twitter bootstrap to 3.2.0
Vincent Tondellier <tonton+hg@team1664.org>
parents: 1
diff changeset
   828
0df70b8735e3 Update Twitter bootstrap to 3.2.0
Vincent Tondellier <tonton+hg@team1664.org>
parents: 1
diff changeset
   829
+function ($) {
0df70b8735e3 Update Twitter bootstrap to 3.2.0
Vincent Tondellier <tonton+hg@team1664.org>
parents: 1
diff changeset
   830
  'use strict';
0df70b8735e3 Update Twitter bootstrap to 3.2.0
Vincent Tondellier <tonton+hg@team1664.org>
parents: 1
diff changeset
   831
0df70b8735e3 Update Twitter bootstrap to 3.2.0
Vincent Tondellier <tonton+hg@team1664.org>
parents: 1
diff changeset
   832
  // MODAL CLASS DEFINITION
0df70b8735e3 Update Twitter bootstrap to 3.2.0
Vincent Tondellier <tonton+hg@team1664.org>
parents: 1
diff changeset
   833
  // ======================
0df70b8735e3 Update Twitter bootstrap to 3.2.0
Vincent Tondellier <tonton+hg@team1664.org>
parents: 1
diff changeset
   834
0df70b8735e3 Update Twitter bootstrap to 3.2.0
Vincent Tondellier <tonton+hg@team1664.org>
parents: 1
diff changeset
   835
  var Modal = function (element, options) {
0df70b8735e3 Update Twitter bootstrap to 3.2.0
Vincent Tondellier <tonton+hg@team1664.org>
parents: 1
diff changeset
   836
    this.options        = options
0df70b8735e3 Update Twitter bootstrap to 3.2.0
Vincent Tondellier <tonton+hg@team1664.org>
parents: 1
diff changeset
   837
    this.$body          = $(document.body)
0df70b8735e3 Update Twitter bootstrap to 3.2.0
Vincent Tondellier <tonton+hg@team1664.org>
parents: 1
diff changeset
   838
    this.$element       = $(element)
0df70b8735e3 Update Twitter bootstrap to 3.2.0
Vincent Tondellier <tonton+hg@team1664.org>
parents: 1
diff changeset
   839
    this.$backdrop      =
0df70b8735e3 Update Twitter bootstrap to 3.2.0
Vincent Tondellier <tonton+hg@team1664.org>
parents: 1
diff changeset
   840
    this.isShown        = null
0df70b8735e3 Update Twitter bootstrap to 3.2.0
Vincent Tondellier <tonton+hg@team1664.org>
parents: 1
diff changeset
   841
    this.scrollbarWidth = 0
0df70b8735e3 Update Twitter bootstrap to 3.2.0
Vincent Tondellier <tonton+hg@team1664.org>
parents: 1
diff changeset
   842
0df70b8735e3 Update Twitter bootstrap to 3.2.0
Vincent Tondellier <tonton+hg@team1664.org>
parents: 1
diff changeset
   843
    if (this.options.remote) {
0df70b8735e3 Update Twitter bootstrap to 3.2.0
Vincent Tondellier <tonton+hg@team1664.org>
parents: 1
diff changeset
   844
      this.$element
0df70b8735e3 Update Twitter bootstrap to 3.2.0
Vincent Tondellier <tonton+hg@team1664.org>
parents: 1
diff changeset
   845
        .find('.modal-content')
0df70b8735e3 Update Twitter bootstrap to 3.2.0
Vincent Tondellier <tonton+hg@team1664.org>
parents: 1
diff changeset
   846
        .load(this.options.remote, $.proxy(function () {
0df70b8735e3 Update Twitter bootstrap to 3.2.0
Vincent Tondellier <tonton+hg@team1664.org>
parents: 1
diff changeset
   847
          this.$element.trigger('loaded.bs.modal')
0df70b8735e3 Update Twitter bootstrap to 3.2.0
Vincent Tondellier <tonton+hg@team1664.org>
parents: 1
diff changeset
   848
        }, this))
0
5b78b8c79d9c Initial commit
Vincent Tondellier <tonton+hg@team1664.org>
parents:
diff changeset
   849
    }
28
0df70b8735e3 Update Twitter bootstrap to 3.2.0
Vincent Tondellier <tonton+hg@team1664.org>
parents: 1
diff changeset
   850
  }
0df70b8735e3 Update Twitter bootstrap to 3.2.0
Vincent Tondellier <tonton+hg@team1664.org>
parents: 1
diff changeset
   851
0df70b8735e3 Update Twitter bootstrap to 3.2.0
Vincent Tondellier <tonton+hg@team1664.org>
parents: 1
diff changeset
   852
  Modal.VERSION  = '3.2.0'
0df70b8735e3 Update Twitter bootstrap to 3.2.0
Vincent Tondellier <tonton+hg@team1664.org>
parents: 1
diff changeset
   853
0df70b8735e3 Update Twitter bootstrap to 3.2.0
Vincent Tondellier <tonton+hg@team1664.org>
parents: 1
diff changeset
   854
  Modal.DEFAULTS = {
0df70b8735e3 Update Twitter bootstrap to 3.2.0
Vincent Tondellier <tonton+hg@team1664.org>
parents: 1
diff changeset
   855
    backdrop: true,
0df70b8735e3 Update Twitter bootstrap to 3.2.0
Vincent Tondellier <tonton+hg@team1664.org>
parents: 1
diff changeset
   856
    keyboard: true,
0df70b8735e3 Update Twitter bootstrap to 3.2.0
Vincent Tondellier <tonton+hg@team1664.org>
parents: 1
diff changeset
   857
    show: true
0df70b8735e3 Update Twitter bootstrap to 3.2.0
Vincent Tondellier <tonton+hg@team1664.org>
parents: 1
diff changeset
   858
  }
0df70b8735e3 Update Twitter bootstrap to 3.2.0
Vincent Tondellier <tonton+hg@team1664.org>
parents: 1
diff changeset
   859
0df70b8735e3 Update Twitter bootstrap to 3.2.0
Vincent Tondellier <tonton+hg@team1664.org>
parents: 1
diff changeset
   860
  Modal.prototype.toggle = function (_relatedTarget) {
0df70b8735e3 Update Twitter bootstrap to 3.2.0
Vincent Tondellier <tonton+hg@team1664.org>
parents: 1
diff changeset
   861
    return this.isShown ? this.hide() : this.show(_relatedTarget)
0df70b8735e3 Update Twitter bootstrap to 3.2.0
Vincent Tondellier <tonton+hg@team1664.org>
parents: 1
diff changeset
   862
  }
0df70b8735e3 Update Twitter bootstrap to 3.2.0
Vincent Tondellier <tonton+hg@team1664.org>
parents: 1
diff changeset
   863
0df70b8735e3 Update Twitter bootstrap to 3.2.0
Vincent Tondellier <tonton+hg@team1664.org>
parents: 1
diff changeset
   864
  Modal.prototype.show = function (_relatedTarget) {
0df70b8735e3 Update Twitter bootstrap to 3.2.0
Vincent Tondellier <tonton+hg@team1664.org>
parents: 1
diff changeset
   865
    var that = this
0df70b8735e3 Update Twitter bootstrap to 3.2.0
Vincent Tondellier <tonton+hg@team1664.org>
parents: 1
diff changeset
   866
    var e    = $.Event('show.bs.modal', { relatedTarget: _relatedTarget })
0df70b8735e3 Update Twitter bootstrap to 3.2.0
Vincent Tondellier <tonton+hg@team1664.org>
parents: 1
diff changeset
   867
0df70b8735e3 Update Twitter bootstrap to 3.2.0
Vincent Tondellier <tonton+hg@team1664.org>
parents: 1
diff changeset
   868
    this.$element.trigger(e)
0df70b8735e3 Update Twitter bootstrap to 3.2.0
Vincent Tondellier <tonton+hg@team1664.org>
parents: 1
diff changeset
   869
0df70b8735e3 Update Twitter bootstrap to 3.2.0
Vincent Tondellier <tonton+hg@team1664.org>
parents: 1
diff changeset
   870
    if (this.isShown || e.isDefaultPrevented()) return
0df70b8735e3 Update Twitter bootstrap to 3.2.0
Vincent Tondellier <tonton+hg@team1664.org>
parents: 1
diff changeset
   871
0df70b8735e3 Update Twitter bootstrap to 3.2.0
Vincent Tondellier <tonton+hg@team1664.org>
parents: 1
diff changeset
   872
    this.isShown = true
0df70b8735e3 Update Twitter bootstrap to 3.2.0
Vincent Tondellier <tonton+hg@team1664.org>
parents: 1
diff changeset
   873
0df70b8735e3 Update Twitter bootstrap to 3.2.0
Vincent Tondellier <tonton+hg@team1664.org>
parents: 1
diff changeset
   874
    this.checkScrollbar()
0df70b8735e3 Update Twitter bootstrap to 3.2.0
Vincent Tondellier <tonton+hg@team1664.org>
parents: 1
diff changeset
   875
    this.$body.addClass('modal-open')
0df70b8735e3 Update Twitter bootstrap to 3.2.0
Vincent Tondellier <tonton+hg@team1664.org>
parents: 1
diff changeset
   876
0df70b8735e3 Update Twitter bootstrap to 3.2.0
Vincent Tondellier <tonton+hg@team1664.org>
parents: 1
diff changeset
   877
    this.setScrollbar()
0df70b8735e3 Update Twitter bootstrap to 3.2.0
Vincent Tondellier <tonton+hg@team1664.org>
parents: 1
diff changeset
   878
    this.escape()
0df70b8735e3 Update Twitter bootstrap to 3.2.0
Vincent Tondellier <tonton+hg@team1664.org>
parents: 1
diff changeset
   879
0df70b8735e3 Update Twitter bootstrap to 3.2.0
Vincent Tondellier <tonton+hg@team1664.org>
parents: 1
diff changeset
   880
    this.$element.on('click.dismiss.bs.modal', '[data-dismiss="modal"]', $.proxy(this.hide, this))
0df70b8735e3 Update Twitter bootstrap to 3.2.0
Vincent Tondellier <tonton+hg@team1664.org>
parents: 1
diff changeset
   881
0df70b8735e3 Update Twitter bootstrap to 3.2.0
Vincent Tondellier <tonton+hg@team1664.org>
parents: 1
diff changeset
   882
    this.backdrop(function () {
0df70b8735e3 Update Twitter bootstrap to 3.2.0
Vincent Tondellier <tonton+hg@team1664.org>
parents: 1
diff changeset
   883
      var transition = $.support.transition && that.$element.hasClass('fade')
0df70b8735e3 Update Twitter bootstrap to 3.2.0
Vincent Tondellier <tonton+hg@team1664.org>
parents: 1
diff changeset
   884
0df70b8735e3 Update Twitter bootstrap to 3.2.0
Vincent Tondellier <tonton+hg@team1664.org>
parents: 1
diff changeset
   885
      if (!that.$element.parent().length) {
0df70b8735e3 Update Twitter bootstrap to 3.2.0
Vincent Tondellier <tonton+hg@team1664.org>
parents: 1
diff changeset
   886
        that.$element.appendTo(that.$body) // don't move modals dom position
0df70b8735e3 Update Twitter bootstrap to 3.2.0
Vincent Tondellier <tonton+hg@team1664.org>
parents: 1
diff changeset
   887
      }
0df70b8735e3 Update Twitter bootstrap to 3.2.0
Vincent Tondellier <tonton+hg@team1664.org>
parents: 1
diff changeset
   888
0df70b8735e3 Update Twitter bootstrap to 3.2.0
Vincent Tondellier <tonton+hg@team1664.org>
parents: 1
diff changeset
   889
      that.$element
0df70b8735e3 Update Twitter bootstrap to 3.2.0
Vincent Tondellier <tonton+hg@team1664.org>
parents: 1
diff changeset
   890
        .show()
0df70b8735e3 Update Twitter bootstrap to 3.2.0
Vincent Tondellier <tonton+hg@team1664.org>
parents: 1
diff changeset
   891
        .scrollTop(0)
0df70b8735e3 Update Twitter bootstrap to 3.2.0
Vincent Tondellier <tonton+hg@team1664.org>
parents: 1
diff changeset
   892
0df70b8735e3 Update Twitter bootstrap to 3.2.0
Vincent Tondellier <tonton+hg@team1664.org>
parents: 1
diff changeset
   893
      if (transition) {
0df70b8735e3 Update Twitter bootstrap to 3.2.0
Vincent Tondellier <tonton+hg@team1664.org>
parents: 1
diff changeset
   894
        that.$element[0].offsetWidth // force reflow
0df70b8735e3 Update Twitter bootstrap to 3.2.0
Vincent Tondellier <tonton+hg@team1664.org>
parents: 1
diff changeset
   895
      }
0df70b8735e3 Update Twitter bootstrap to 3.2.0
Vincent Tondellier <tonton+hg@team1664.org>
parents: 1
diff changeset
   896
0df70b8735e3 Update Twitter bootstrap to 3.2.0
Vincent Tondellier <tonton+hg@team1664.org>
parents: 1
diff changeset
   897
      that.$element
0df70b8735e3 Update Twitter bootstrap to 3.2.0
Vincent Tondellier <tonton+hg@team1664.org>
parents: 1
diff changeset
   898
        .addClass('in')
0df70b8735e3 Update Twitter bootstrap to 3.2.0
Vincent Tondellier <tonton+hg@team1664.org>
parents: 1
diff changeset
   899
        .attr('aria-hidden', false)
0df70b8735e3 Update Twitter bootstrap to 3.2.0
Vincent Tondellier <tonton+hg@team1664.org>
parents: 1
diff changeset
   900
0df70b8735e3 Update Twitter bootstrap to 3.2.0
Vincent Tondellier <tonton+hg@team1664.org>
parents: 1
diff changeset
   901
      that.enforceFocus()
0df70b8735e3 Update Twitter bootstrap to 3.2.0
Vincent Tondellier <tonton+hg@team1664.org>
parents: 1
diff changeset
   902
0df70b8735e3 Update Twitter bootstrap to 3.2.0
Vincent Tondellier <tonton+hg@team1664.org>
parents: 1
diff changeset
   903
      var e = $.Event('shown.bs.modal', { relatedTarget: _relatedTarget })
0df70b8735e3 Update Twitter bootstrap to 3.2.0
Vincent Tondellier <tonton+hg@team1664.org>
parents: 1
diff changeset
   904
0df70b8735e3 Update Twitter bootstrap to 3.2.0
Vincent Tondellier <tonton+hg@team1664.org>
parents: 1
diff changeset
   905
      transition ?
0df70b8735e3 Update Twitter bootstrap to 3.2.0
Vincent Tondellier <tonton+hg@team1664.org>
parents: 1
diff changeset
   906
        that.$element.find('.modal-dialog') // wait for modal to slide in
0df70b8735e3 Update Twitter bootstrap to 3.2.0
Vincent Tondellier <tonton+hg@team1664.org>
parents: 1
diff changeset
   907
          .one('bsTransitionEnd', function () {
0df70b8735e3 Update Twitter bootstrap to 3.2.0
Vincent Tondellier <tonton+hg@team1664.org>
parents: 1
diff changeset
   908
            that.$element.trigger('focus').trigger(e)
0df70b8735e3 Update Twitter bootstrap to 3.2.0
Vincent Tondellier <tonton+hg@team1664.org>
parents: 1
diff changeset
   909
          })
0df70b8735e3 Update Twitter bootstrap to 3.2.0
Vincent Tondellier <tonton+hg@team1664.org>
parents: 1
diff changeset
   910
          .emulateTransitionEnd(300) :
0df70b8735e3 Update Twitter bootstrap to 3.2.0
Vincent Tondellier <tonton+hg@team1664.org>
parents: 1
diff changeset
   911
        that.$element.trigger('focus').trigger(e)
0df70b8735e3 Update Twitter bootstrap to 3.2.0
Vincent Tondellier <tonton+hg@team1664.org>
parents: 1
diff changeset
   912
    })
0
5b78b8c79d9c Initial commit
Vincent Tondellier <tonton+hg@team1664.org>
parents:
diff changeset
   913
  }
5b78b8c79d9c Initial commit
Vincent Tondellier <tonton+hg@team1664.org>
parents:
diff changeset
   914
28
0df70b8735e3 Update Twitter bootstrap to 3.2.0
Vincent Tondellier <tonton+hg@team1664.org>
parents: 1
diff changeset
   915
  Modal.prototype.hide = function (e) {
0df70b8735e3 Update Twitter bootstrap to 3.2.0
Vincent Tondellier <tonton+hg@team1664.org>
parents: 1
diff changeset
   916
    if (e) e.preventDefault()
0df70b8735e3 Update Twitter bootstrap to 3.2.0
Vincent Tondellier <tonton+hg@team1664.org>
parents: 1
diff changeset
   917
0df70b8735e3 Update Twitter bootstrap to 3.2.0
Vincent Tondellier <tonton+hg@team1664.org>
parents: 1
diff changeset
   918
    e = $.Event('hide.bs.modal')
0df70b8735e3 Update Twitter bootstrap to 3.2.0
Vincent Tondellier <tonton+hg@team1664.org>
parents: 1
diff changeset
   919
0df70b8735e3 Update Twitter bootstrap to 3.2.0
Vincent Tondellier <tonton+hg@team1664.org>
parents: 1
diff changeset
   920
    this.$element.trigger(e)
0df70b8735e3 Update Twitter bootstrap to 3.2.0
Vincent Tondellier <tonton+hg@team1664.org>
parents: 1
diff changeset
   921
0df70b8735e3 Update Twitter bootstrap to 3.2.0
Vincent Tondellier <tonton+hg@team1664.org>
parents: 1
diff changeset
   922
    if (!this.isShown || e.isDefaultPrevented()) return
0df70b8735e3 Update Twitter bootstrap to 3.2.0
Vincent Tondellier <tonton+hg@team1664.org>
parents: 1
diff changeset
   923
0df70b8735e3 Update Twitter bootstrap to 3.2.0
Vincent Tondellier <tonton+hg@team1664.org>
parents: 1
diff changeset
   924
    this.isShown = false
0df70b8735e3 Update Twitter bootstrap to 3.2.0
Vincent Tondellier <tonton+hg@team1664.org>
parents: 1
diff changeset
   925
0df70b8735e3 Update Twitter bootstrap to 3.2.0
Vincent Tondellier <tonton+hg@team1664.org>
parents: 1
diff changeset
   926
    this.$body.removeClass('modal-open')
0df70b8735e3 Update Twitter bootstrap to 3.2.0
Vincent Tondellier <tonton+hg@team1664.org>
parents: 1
diff changeset
   927
0df70b8735e3 Update Twitter bootstrap to 3.2.0
Vincent Tondellier <tonton+hg@team1664.org>
parents: 1
diff changeset
   928
    this.resetScrollbar()
0df70b8735e3 Update Twitter bootstrap to 3.2.0
Vincent Tondellier <tonton+hg@team1664.org>
parents: 1
diff changeset
   929
    this.escape()
0df70b8735e3 Update Twitter bootstrap to 3.2.0
Vincent Tondellier <tonton+hg@team1664.org>
parents: 1
diff changeset
   930
0df70b8735e3 Update Twitter bootstrap to 3.2.0
Vincent Tondellier <tonton+hg@team1664.org>
parents: 1
diff changeset
   931
    $(document).off('focusin.bs.modal')
0df70b8735e3 Update Twitter bootstrap to 3.2.0
Vincent Tondellier <tonton+hg@team1664.org>
parents: 1
diff changeset
   932
0df70b8735e3 Update Twitter bootstrap to 3.2.0
Vincent Tondellier <tonton+hg@team1664.org>
parents: 1
diff changeset
   933
    this.$element
0df70b8735e3 Update Twitter bootstrap to 3.2.0
Vincent Tondellier <tonton+hg@team1664.org>
parents: 1
diff changeset
   934
      .removeClass('in')
0df70b8735e3 Update Twitter bootstrap to 3.2.0
Vincent Tondellier <tonton+hg@team1664.org>
parents: 1
diff changeset
   935
      .attr('aria-hidden', true)
0df70b8735e3 Update Twitter bootstrap to 3.2.0
Vincent Tondellier <tonton+hg@team1664.org>
parents: 1
diff changeset
   936
      .off('click.dismiss.bs.modal')
0df70b8735e3 Update Twitter bootstrap to 3.2.0
Vincent Tondellier <tonton+hg@team1664.org>
parents: 1
diff changeset
   937
0df70b8735e3 Update Twitter bootstrap to 3.2.0
Vincent Tondellier <tonton+hg@team1664.org>
parents: 1
diff changeset
   938
    $.support.transition && this.$element.hasClass('fade') ?
0df70b8735e3 Update Twitter bootstrap to 3.2.0
Vincent Tondellier <tonton+hg@team1664.org>
parents: 1
diff changeset
   939
      this.$element
0df70b8735e3 Update Twitter bootstrap to 3.2.0
Vincent Tondellier <tonton+hg@team1664.org>
parents: 1
diff changeset
   940
        .one('bsTransitionEnd', $.proxy(this.hideModal, this))
0df70b8735e3 Update Twitter bootstrap to 3.2.0
Vincent Tondellier <tonton+hg@team1664.org>
parents: 1
diff changeset
   941
        .emulateTransitionEnd(300) :
0df70b8735e3 Update Twitter bootstrap to 3.2.0
Vincent Tondellier <tonton+hg@team1664.org>
parents: 1
diff changeset
   942
      this.hideModal()
0df70b8735e3 Update Twitter bootstrap to 3.2.0
Vincent Tondellier <tonton+hg@team1664.org>
parents: 1
diff changeset
   943
  }
0df70b8735e3 Update Twitter bootstrap to 3.2.0
Vincent Tondellier <tonton+hg@team1664.org>
parents: 1
diff changeset
   944
0df70b8735e3 Update Twitter bootstrap to 3.2.0
Vincent Tondellier <tonton+hg@team1664.org>
parents: 1
diff changeset
   945
  Modal.prototype.enforceFocus = function () {
0df70b8735e3 Update Twitter bootstrap to 3.2.0
Vincent Tondellier <tonton+hg@team1664.org>
parents: 1
diff changeset
   946
    $(document)
0df70b8735e3 Update Twitter bootstrap to 3.2.0
Vincent Tondellier <tonton+hg@team1664.org>
parents: 1
diff changeset
   947
      .off('focusin.bs.modal') // guard against infinite focus loop
0df70b8735e3 Update Twitter bootstrap to 3.2.0
Vincent Tondellier <tonton+hg@team1664.org>
parents: 1
diff changeset
   948
      .on('focusin.bs.modal', $.proxy(function (e) {
0df70b8735e3 Update Twitter bootstrap to 3.2.0
Vincent Tondellier <tonton+hg@team1664.org>
parents: 1
diff changeset
   949
        if (this.$element[0] !== e.target && !this.$element.has(e.target).length) {
0df70b8735e3 Update Twitter bootstrap to 3.2.0
Vincent Tondellier <tonton+hg@team1664.org>
parents: 1
diff changeset
   950
          this.$element.trigger('focus')
0df70b8735e3 Update Twitter bootstrap to 3.2.0
Vincent Tondellier <tonton+hg@team1664.org>
parents: 1
diff changeset
   951
        }
0df70b8735e3 Update Twitter bootstrap to 3.2.0
Vincent Tondellier <tonton+hg@team1664.org>
parents: 1
diff changeset
   952
      }, this))
0df70b8735e3 Update Twitter bootstrap to 3.2.0
Vincent Tondellier <tonton+hg@team1664.org>
parents: 1
diff changeset
   953
  }
0df70b8735e3 Update Twitter bootstrap to 3.2.0
Vincent Tondellier <tonton+hg@team1664.org>
parents: 1
diff changeset
   954
0df70b8735e3 Update Twitter bootstrap to 3.2.0
Vincent Tondellier <tonton+hg@team1664.org>
parents: 1
diff changeset
   955
  Modal.prototype.escape = function () {
0df70b8735e3 Update Twitter bootstrap to 3.2.0
Vincent Tondellier <tonton+hg@team1664.org>
parents: 1
diff changeset
   956
    if (this.isShown && this.options.keyboard) {
0df70b8735e3 Update Twitter bootstrap to 3.2.0
Vincent Tondellier <tonton+hg@team1664.org>
parents: 1
diff changeset
   957
      this.$element.on('keyup.dismiss.bs.modal', $.proxy(function (e) {
0df70b8735e3 Update Twitter bootstrap to 3.2.0
Vincent Tondellier <tonton+hg@team1664.org>
parents: 1
diff changeset
   958
        e.which == 27 && this.hide()
0df70b8735e3 Update Twitter bootstrap to 3.2.0
Vincent Tondellier <tonton+hg@team1664.org>
parents: 1
diff changeset
   959
      }, this))
0df70b8735e3 Update Twitter bootstrap to 3.2.0
Vincent Tondellier <tonton+hg@team1664.org>
parents: 1
diff changeset
   960
    } else if (!this.isShown) {
0df70b8735e3 Update Twitter bootstrap to 3.2.0
Vincent Tondellier <tonton+hg@team1664.org>
parents: 1
diff changeset
   961
      this.$element.off('keyup.dismiss.bs.modal')
0df70b8735e3 Update Twitter bootstrap to 3.2.0
Vincent Tondellier <tonton+hg@team1664.org>
parents: 1
diff changeset
   962
    }
0df70b8735e3 Update Twitter bootstrap to 3.2.0
Vincent Tondellier <tonton+hg@team1664.org>
parents: 1
diff changeset
   963
  }
0df70b8735e3 Update Twitter bootstrap to 3.2.0
Vincent Tondellier <tonton+hg@team1664.org>
parents: 1
diff changeset
   964
0df70b8735e3 Update Twitter bootstrap to 3.2.0
Vincent Tondellier <tonton+hg@team1664.org>
parents: 1
diff changeset
   965
  Modal.prototype.hideModal = function () {
0df70b8735e3 Update Twitter bootstrap to 3.2.0
Vincent Tondellier <tonton+hg@team1664.org>
parents: 1
diff changeset
   966
    var that = this
0df70b8735e3 Update Twitter bootstrap to 3.2.0
Vincent Tondellier <tonton+hg@team1664.org>
parents: 1
diff changeset
   967
    this.$element.hide()
0df70b8735e3 Update Twitter bootstrap to 3.2.0
Vincent Tondellier <tonton+hg@team1664.org>
parents: 1
diff changeset
   968
    this.backdrop(function () {
0df70b8735e3 Update Twitter bootstrap to 3.2.0
Vincent Tondellier <tonton+hg@team1664.org>
parents: 1
diff changeset
   969
      that.$element.trigger('hidden.bs.modal')
0df70b8735e3 Update Twitter bootstrap to 3.2.0
Vincent Tondellier <tonton+hg@team1664.org>
parents: 1
diff changeset
   970
    })
0df70b8735e3 Update Twitter bootstrap to 3.2.0
Vincent Tondellier <tonton+hg@team1664.org>
parents: 1
diff changeset
   971
  }
0df70b8735e3 Update Twitter bootstrap to 3.2.0
Vincent Tondellier <tonton+hg@team1664.org>
parents: 1
diff changeset
   972
0df70b8735e3 Update Twitter bootstrap to 3.2.0
Vincent Tondellier <tonton+hg@team1664.org>
parents: 1
diff changeset
   973
  Modal.prototype.removeBackdrop = function () {
0df70b8735e3 Update Twitter bootstrap to 3.2.0
Vincent Tondellier <tonton+hg@team1664.org>
parents: 1
diff changeset
   974
    this.$backdrop && this.$backdrop.remove()
0df70b8735e3 Update Twitter bootstrap to 3.2.0
Vincent Tondellier <tonton+hg@team1664.org>
parents: 1
diff changeset
   975
    this.$backdrop = null
0df70b8735e3 Update Twitter bootstrap to 3.2.0
Vincent Tondellier <tonton+hg@team1664.org>
parents: 1
diff changeset
   976
  }
0df70b8735e3 Update Twitter bootstrap to 3.2.0
Vincent Tondellier <tonton+hg@team1664.org>
parents: 1
diff changeset
   977
0df70b8735e3 Update Twitter bootstrap to 3.2.0
Vincent Tondellier <tonton+hg@team1664.org>
parents: 1
diff changeset
   978
  Modal.prototype.backdrop = function (callback) {
0df70b8735e3 Update Twitter bootstrap to 3.2.0
Vincent Tondellier <tonton+hg@team1664.org>
parents: 1
diff changeset
   979
    var that = this
0df70b8735e3 Update Twitter bootstrap to 3.2.0
Vincent Tondellier <tonton+hg@team1664.org>
parents: 1
diff changeset
   980
    var animate = this.$element.hasClass('fade') ? 'fade' : ''
0df70b8735e3 Update Twitter bootstrap to 3.2.0
Vincent Tondellier <tonton+hg@team1664.org>
parents: 1
diff changeset
   981
0df70b8735e3 Update Twitter bootstrap to 3.2.0
Vincent Tondellier <tonton+hg@team1664.org>
parents: 1
diff changeset
   982
    if (this.isShown && this.options.backdrop) {
0df70b8735e3 Update Twitter bootstrap to 3.2.0
Vincent Tondellier <tonton+hg@team1664.org>
parents: 1
diff changeset
   983
      var doAnimate = $.support.transition && animate
0df70b8735e3 Update Twitter bootstrap to 3.2.0
Vincent Tondellier <tonton+hg@team1664.org>
parents: 1
diff changeset
   984
0df70b8735e3 Update Twitter bootstrap to 3.2.0
Vincent Tondellier <tonton+hg@team1664.org>
parents: 1
diff changeset
   985
      this.$backdrop = $('<div class="modal-backdrop ' + animate + '" />')
0df70b8735e3 Update Twitter bootstrap to 3.2.0
Vincent Tondellier <tonton+hg@team1664.org>
parents: 1
diff changeset
   986
        .appendTo(this.$body)
0df70b8735e3 Update Twitter bootstrap to 3.2.0
Vincent Tondellier <tonton+hg@team1664.org>
parents: 1
diff changeset
   987
0df70b8735e3 Update Twitter bootstrap to 3.2.0
Vincent Tondellier <tonton+hg@team1664.org>
parents: 1
diff changeset
   988
      this.$element.on('click.dismiss.bs.modal', $.proxy(function (e) {
0df70b8735e3 Update Twitter bootstrap to 3.2.0
Vincent Tondellier <tonton+hg@team1664.org>
parents: 1
diff changeset
   989
        if (e.target !== e.currentTarget) return
0df70b8735e3 Update Twitter bootstrap to 3.2.0
Vincent Tondellier <tonton+hg@team1664.org>
parents: 1
diff changeset
   990
        this.options.backdrop == 'static'
0df70b8735e3 Update Twitter bootstrap to 3.2.0
Vincent Tondellier <tonton+hg@team1664.org>
parents: 1
diff changeset
   991
          ? this.$element[0].focus.call(this.$element[0])
0df70b8735e3 Update Twitter bootstrap to 3.2.0
Vincent Tondellier <tonton+hg@team1664.org>
parents: 1
diff changeset
   992
          : this.hide.call(this)
0df70b8735e3 Update Twitter bootstrap to 3.2.0
Vincent Tondellier <tonton+hg@team1664.org>
parents: 1
diff changeset
   993
      }, this))
0df70b8735e3 Update Twitter bootstrap to 3.2.0
Vincent Tondellier <tonton+hg@team1664.org>
parents: 1
diff changeset
   994
0df70b8735e3 Update Twitter bootstrap to 3.2.0
Vincent Tondellier <tonton+hg@team1664.org>
parents: 1
diff changeset
   995
      if (doAnimate) this.$backdrop[0].offsetWidth // force reflow
0df70b8735e3 Update Twitter bootstrap to 3.2.0
Vincent Tondellier <tonton+hg@team1664.org>
parents: 1
diff changeset
   996
0df70b8735e3 Update Twitter bootstrap to 3.2.0
Vincent Tondellier <tonton+hg@team1664.org>
parents: 1
diff changeset
   997
      this.$backdrop.addClass('in')
0df70b8735e3 Update Twitter bootstrap to 3.2.0
Vincent Tondellier <tonton+hg@team1664.org>
parents: 1
diff changeset
   998
0df70b8735e3 Update Twitter bootstrap to 3.2.0
Vincent Tondellier <tonton+hg@team1664.org>
parents: 1
diff changeset
   999
      if (!callback) return
0df70b8735e3 Update Twitter bootstrap to 3.2.0
Vincent Tondellier <tonton+hg@team1664.org>
parents: 1
diff changeset
  1000
0df70b8735e3 Update Twitter bootstrap to 3.2.0
Vincent Tondellier <tonton+hg@team1664.org>
parents: 1
diff changeset
  1001
      doAnimate ?
0df70b8735e3 Update Twitter bootstrap to 3.2.0
Vincent Tondellier <tonton+hg@team1664.org>
parents: 1
diff changeset
  1002
        this.$backdrop
0df70b8735e3 Update Twitter bootstrap to 3.2.0
Vincent Tondellier <tonton+hg@team1664.org>
parents: 1
diff changeset
  1003
          .one('bsTransitionEnd', callback)
0df70b8735e3 Update Twitter bootstrap to 3.2.0
Vincent Tondellier <tonton+hg@team1664.org>
parents: 1
diff changeset
  1004
          .emulateTransitionEnd(150) :
0df70b8735e3 Update Twitter bootstrap to 3.2.0
Vincent Tondellier <tonton+hg@team1664.org>
parents: 1
diff changeset
  1005
        callback()
0df70b8735e3 Update Twitter bootstrap to 3.2.0
Vincent Tondellier <tonton+hg@team1664.org>
parents: 1
diff changeset
  1006
0df70b8735e3 Update Twitter bootstrap to 3.2.0
Vincent Tondellier <tonton+hg@team1664.org>
parents: 1
diff changeset
  1007
    } else if (!this.isShown && this.$backdrop) {
0df70b8735e3 Update Twitter bootstrap to 3.2.0
Vincent Tondellier <tonton+hg@team1664.org>
parents: 1
diff changeset
  1008
      this.$backdrop.removeClass('in')
0df70b8735e3 Update Twitter bootstrap to 3.2.0
Vincent Tondellier <tonton+hg@team1664.org>
parents: 1
diff changeset
  1009
0df70b8735e3 Update Twitter bootstrap to 3.2.0
Vincent Tondellier <tonton+hg@team1664.org>
parents: 1
diff changeset
  1010
      var callbackRemove = function () {
0df70b8735e3 Update Twitter bootstrap to 3.2.0
Vincent Tondellier <tonton+hg@team1664.org>
parents: 1
diff changeset
  1011
        that.removeBackdrop()
0df70b8735e3 Update Twitter bootstrap to 3.2.0
Vincent Tondellier <tonton+hg@team1664.org>
parents: 1
diff changeset
  1012
        callback && callback()
0df70b8735e3 Update Twitter bootstrap to 3.2.0
Vincent Tondellier <tonton+hg@team1664.org>
parents: 1
diff changeset
  1013
      }
0df70b8735e3 Update Twitter bootstrap to 3.2.0
Vincent Tondellier <tonton+hg@team1664.org>
parents: 1
diff changeset
  1014
      $.support.transition && this.$element.hasClass('fade') ?
0df70b8735e3 Update Twitter bootstrap to 3.2.0
Vincent Tondellier <tonton+hg@team1664.org>
parents: 1
diff changeset
  1015
        this.$backdrop
0df70b8735e3 Update Twitter bootstrap to 3.2.0
Vincent Tondellier <tonton+hg@team1664.org>
parents: 1
diff changeset
  1016
          .one('bsTransitionEnd', callbackRemove)
0df70b8735e3 Update Twitter bootstrap to 3.2.0
Vincent Tondellier <tonton+hg@team1664.org>
parents: 1
diff changeset
  1017
          .emulateTransitionEnd(150) :
0df70b8735e3 Update Twitter bootstrap to 3.2.0
Vincent Tondellier <tonton+hg@team1664.org>
parents: 1
diff changeset
  1018
        callbackRemove()
0df70b8735e3 Update Twitter bootstrap to 3.2.0
Vincent Tondellier <tonton+hg@team1664.org>
parents: 1
diff changeset
  1019
0df70b8735e3 Update Twitter bootstrap to 3.2.0
Vincent Tondellier <tonton+hg@team1664.org>
parents: 1
diff changeset
  1020
    } else if (callback) {
0df70b8735e3 Update Twitter bootstrap to 3.2.0
Vincent Tondellier <tonton+hg@team1664.org>
parents: 1
diff changeset
  1021
      callback()
0
5b78b8c79d9c Initial commit
Vincent Tondellier <tonton+hg@team1664.org>
parents:
diff changeset
  1022
    }
28
0df70b8735e3 Update Twitter bootstrap to 3.2.0
Vincent Tondellier <tonton+hg@team1664.org>
parents: 1
diff changeset
  1023
  }
0df70b8735e3 Update Twitter bootstrap to 3.2.0
Vincent Tondellier <tonton+hg@team1664.org>
parents: 1
diff changeset
  1024
0df70b8735e3 Update Twitter bootstrap to 3.2.0
Vincent Tondellier <tonton+hg@team1664.org>
parents: 1
diff changeset
  1025
  Modal.prototype.checkScrollbar = function () {
0df70b8735e3 Update Twitter bootstrap to 3.2.0
Vincent Tondellier <tonton+hg@team1664.org>
parents: 1
diff changeset
  1026
    if (document.body.clientWidth >= window.innerWidth) return
0df70b8735e3 Update Twitter bootstrap to 3.2.0
Vincent Tondellier <tonton+hg@team1664.org>
parents: 1
diff changeset
  1027
    this.scrollbarWidth = this.scrollbarWidth || this.measureScrollbar()
0df70b8735e3 Update Twitter bootstrap to 3.2.0
Vincent Tondellier <tonton+hg@team1664.org>
parents: 1
diff changeset
  1028
  }
0df70b8735e3 Update Twitter bootstrap to 3.2.0
Vincent Tondellier <tonton+hg@team1664.org>
parents: 1
diff changeset
  1029
0df70b8735e3 Update Twitter bootstrap to 3.2.0
Vincent Tondellier <tonton+hg@team1664.org>
parents: 1
diff changeset
  1030
  Modal.prototype.setScrollbar = function () {
0df70b8735e3 Update Twitter bootstrap to 3.2.0
Vincent Tondellier <tonton+hg@team1664.org>
parents: 1
diff changeset
  1031
    var bodyPad = parseInt((this.$body.css('padding-right') || 0), 10)
0df70b8735e3 Update Twitter bootstrap to 3.2.0
Vincent Tondellier <tonton+hg@team1664.org>
parents: 1
diff changeset
  1032
    if (this.scrollbarWidth) this.$body.css('padding-right', bodyPad + this.scrollbarWidth)
0df70b8735e3 Update Twitter bootstrap to 3.2.0
Vincent Tondellier <tonton+hg@team1664.org>
parents: 1
diff changeset
  1033
  }
0df70b8735e3 Update Twitter bootstrap to 3.2.0
Vincent Tondellier <tonton+hg@team1664.org>
parents: 1
diff changeset
  1034
0df70b8735e3 Update Twitter bootstrap to 3.2.0
Vincent Tondellier <tonton+hg@team1664.org>
parents: 1
diff changeset
  1035
  Modal.prototype.resetScrollbar = function () {
0df70b8735e3 Update Twitter bootstrap to 3.2.0
Vincent Tondellier <tonton+hg@team1664.org>
parents: 1
diff changeset
  1036
    this.$body.css('padding-right', '')
0df70b8735e3 Update Twitter bootstrap to 3.2.0
Vincent Tondellier <tonton+hg@team1664.org>
parents: 1
diff changeset
  1037
  }
0df70b8735e3 Update Twitter bootstrap to 3.2.0
Vincent Tondellier <tonton+hg@team1664.org>
parents: 1
diff changeset
  1038
0df70b8735e3 Update Twitter bootstrap to 3.2.0
Vincent Tondellier <tonton+hg@team1664.org>
parents: 1
diff changeset
  1039
  Modal.prototype.measureScrollbar = function () { // thx walsh
0df70b8735e3 Update Twitter bootstrap to 3.2.0
Vincent Tondellier <tonton+hg@team1664.org>
parents: 1
diff changeset
  1040
    var scrollDiv = document.createElement('div')
0df70b8735e3 Update Twitter bootstrap to 3.2.0
Vincent Tondellier <tonton+hg@team1664.org>
parents: 1
diff changeset
  1041
    scrollDiv.className = 'modal-scrollbar-measure'
0df70b8735e3 Update Twitter bootstrap to 3.2.0
Vincent Tondellier <tonton+hg@team1664.org>
parents: 1
diff changeset
  1042
    this.$body.append(scrollDiv)
0df70b8735e3 Update Twitter bootstrap to 3.2.0
Vincent Tondellier <tonton+hg@team1664.org>
parents: 1
diff changeset
  1043
    var scrollbarWidth = scrollDiv.offsetWidth - scrollDiv.clientWidth
0df70b8735e3 Update Twitter bootstrap to 3.2.0
Vincent Tondellier <tonton+hg@team1664.org>
parents: 1
diff changeset
  1044
    this.$body[0].removeChild(scrollDiv)
0df70b8735e3 Update Twitter bootstrap to 3.2.0
Vincent Tondellier <tonton+hg@team1664.org>
parents: 1
diff changeset
  1045
    return scrollbarWidth
0df70b8735e3 Update Twitter bootstrap to 3.2.0
Vincent Tondellier <tonton+hg@team1664.org>
parents: 1
diff changeset
  1046
  }
0df70b8735e3 Update Twitter bootstrap to 3.2.0
Vincent Tondellier <tonton+hg@team1664.org>
parents: 1
diff changeset
  1047
0df70b8735e3 Update Twitter bootstrap to 3.2.0
Vincent Tondellier <tonton+hg@team1664.org>
parents: 1
diff changeset
  1048
0df70b8735e3 Update Twitter bootstrap to 3.2.0
Vincent Tondellier <tonton+hg@team1664.org>
parents: 1
diff changeset
  1049
  // MODAL PLUGIN DEFINITION
0df70b8735e3 Update Twitter bootstrap to 3.2.0
Vincent Tondellier <tonton+hg@team1664.org>
parents: 1
diff changeset
  1050
  // =======================
0df70b8735e3 Update Twitter bootstrap to 3.2.0
Vincent Tondellier <tonton+hg@team1664.org>
parents: 1
diff changeset
  1051
0df70b8735e3 Update Twitter bootstrap to 3.2.0
Vincent Tondellier <tonton+hg@team1664.org>
parents: 1
diff changeset
  1052
  function Plugin(option, _relatedTarget) {
0df70b8735e3 Update Twitter bootstrap to 3.2.0
Vincent Tondellier <tonton+hg@team1664.org>
parents: 1
diff changeset
  1053
    return this.each(function () {
0df70b8735e3 Update Twitter bootstrap to 3.2.0
Vincent Tondellier <tonton+hg@team1664.org>
parents: 1
diff changeset
  1054
      var $this   = $(this)
0df70b8735e3 Update Twitter bootstrap to 3.2.0
Vincent Tondellier <tonton+hg@team1664.org>
parents: 1
diff changeset
  1055
      var data    = $this.data('bs.modal')
0df70b8735e3 Update Twitter bootstrap to 3.2.0
Vincent Tondellier <tonton+hg@team1664.org>
parents: 1
diff changeset
  1056
      var options = $.extend({}, Modal.DEFAULTS, $this.data(), typeof option == 'object' && option)
0df70b8735e3 Update Twitter bootstrap to 3.2.0
Vincent Tondellier <tonton+hg@team1664.org>
parents: 1
diff changeset
  1057
0df70b8735e3 Update Twitter bootstrap to 3.2.0
Vincent Tondellier <tonton+hg@team1664.org>
parents: 1
diff changeset
  1058
      if (!data) $this.data('bs.modal', (data = new Modal(this, options)))
0df70b8735e3 Update Twitter bootstrap to 3.2.0
Vincent Tondellier <tonton+hg@team1664.org>
parents: 1
diff changeset
  1059
      if (typeof option == 'string') data[option](_relatedTarget)
0df70b8735e3 Update Twitter bootstrap to 3.2.0
Vincent Tondellier <tonton+hg@team1664.org>
parents: 1
diff changeset
  1060
      else if (options.show) data.show(_relatedTarget)
0df70b8735e3 Update Twitter bootstrap to 3.2.0
Vincent Tondellier <tonton+hg@team1664.org>
parents: 1
diff changeset
  1061
    })
0df70b8735e3 Update Twitter bootstrap to 3.2.0
Vincent Tondellier <tonton+hg@team1664.org>
parents: 1
diff changeset
  1062
  }
0df70b8735e3 Update Twitter bootstrap to 3.2.0
Vincent Tondellier <tonton+hg@team1664.org>
parents: 1
diff changeset
  1063
0df70b8735e3 Update Twitter bootstrap to 3.2.0
Vincent Tondellier <tonton+hg@team1664.org>
parents: 1
diff changeset
  1064
  var old = $.fn.modal
0df70b8735e3 Update Twitter bootstrap to 3.2.0
Vincent Tondellier <tonton+hg@team1664.org>
parents: 1
diff changeset
  1065
0df70b8735e3 Update Twitter bootstrap to 3.2.0
Vincent Tondellier <tonton+hg@team1664.org>
parents: 1
diff changeset
  1066
  $.fn.modal             = Plugin
0df70b8735e3 Update Twitter bootstrap to 3.2.0
Vincent Tondellier <tonton+hg@team1664.org>
parents: 1
diff changeset
  1067
  $.fn.modal.Constructor = Modal
0df70b8735e3 Update Twitter bootstrap to 3.2.0
Vincent Tondellier <tonton+hg@team1664.org>
parents: 1
diff changeset
  1068
0df70b8735e3 Update Twitter bootstrap to 3.2.0
Vincent Tondellier <tonton+hg@team1664.org>
parents: 1
diff changeset
  1069
0df70b8735e3 Update Twitter bootstrap to 3.2.0
Vincent Tondellier <tonton+hg@team1664.org>
parents: 1
diff changeset
  1070
  // MODAL NO CONFLICT
0df70b8735e3 Update Twitter bootstrap to 3.2.0
Vincent Tondellier <tonton+hg@team1664.org>
parents: 1
diff changeset
  1071
  // =================
0df70b8735e3 Update Twitter bootstrap to 3.2.0
Vincent Tondellier <tonton+hg@team1664.org>
parents: 1
diff changeset
  1072
0df70b8735e3 Update Twitter bootstrap to 3.2.0
Vincent Tondellier <tonton+hg@team1664.org>
parents: 1
diff changeset
  1073
  $.fn.modal.noConflict = function () {
0df70b8735e3 Update Twitter bootstrap to 3.2.0
Vincent Tondellier <tonton+hg@team1664.org>
parents: 1
diff changeset
  1074
    $.fn.modal = old
0df70b8735e3 Update Twitter bootstrap to 3.2.0
Vincent Tondellier <tonton+hg@team1664.org>
parents: 1
diff changeset
  1075
    return this
0df70b8735e3 Update Twitter bootstrap to 3.2.0
Vincent Tondellier <tonton+hg@team1664.org>
parents: 1
diff changeset
  1076
  }
0df70b8735e3 Update Twitter bootstrap to 3.2.0
Vincent Tondellier <tonton+hg@team1664.org>
parents: 1
diff changeset
  1077
0df70b8735e3 Update Twitter bootstrap to 3.2.0
Vincent Tondellier <tonton+hg@team1664.org>
parents: 1
diff changeset
  1078
0df70b8735e3 Update Twitter bootstrap to 3.2.0
Vincent Tondellier <tonton+hg@team1664.org>
parents: 1
diff changeset
  1079
  // MODAL DATA-API
0df70b8735e3 Update Twitter bootstrap to 3.2.0
Vincent Tondellier <tonton+hg@team1664.org>
parents: 1
diff changeset
  1080
  // ==============
0df70b8735e3 Update Twitter bootstrap to 3.2.0
Vincent Tondellier <tonton+hg@team1664.org>
parents: 1
diff changeset
  1081
0df70b8735e3 Update Twitter bootstrap to 3.2.0
Vincent Tondellier <tonton+hg@team1664.org>
parents: 1
diff changeset
  1082
  $(document).on('click.bs.modal.data-api', '[data-toggle="modal"]', function (e) {
0df70b8735e3 Update Twitter bootstrap to 3.2.0
Vincent Tondellier <tonton+hg@team1664.org>
parents: 1
diff changeset
  1083
    var $this   = $(this)
0df70b8735e3 Update Twitter bootstrap to 3.2.0
Vincent Tondellier <tonton+hg@team1664.org>
parents: 1
diff changeset
  1084
    var href    = $this.attr('href')
0df70b8735e3 Update Twitter bootstrap to 3.2.0
Vincent Tondellier <tonton+hg@team1664.org>
parents: 1
diff changeset
  1085
    var $target = $($this.attr('data-target') || (href && href.replace(/.*(?=#[^\s]+$)/, ''))) // strip for ie7
0df70b8735e3 Update Twitter bootstrap to 3.2.0
Vincent Tondellier <tonton+hg@team1664.org>
parents: 1
diff changeset
  1086
    var option  = $target.data('bs.modal') ? 'toggle' : $.extend({ remote: !/#/.test(href) && href }, $target.data(), $this.data())
0df70b8735e3 Update Twitter bootstrap to 3.2.0
Vincent Tondellier <tonton+hg@team1664.org>
parents: 1
diff changeset
  1087
0df70b8735e3 Update Twitter bootstrap to 3.2.0
Vincent Tondellier <tonton+hg@team1664.org>
parents: 1
diff changeset
  1088
    if ($this.is('a')) e.preventDefault()
0df70b8735e3 Update Twitter bootstrap to 3.2.0
Vincent Tondellier <tonton+hg@team1664.org>
parents: 1
diff changeset
  1089
0df70b8735e3 Update Twitter bootstrap to 3.2.0
Vincent Tondellier <tonton+hg@team1664.org>
parents: 1
diff changeset
  1090
    $target.one('show.bs.modal', function (showEvent) {
0df70b8735e3 Update Twitter bootstrap to 3.2.0
Vincent Tondellier <tonton+hg@team1664.org>
parents: 1
diff changeset
  1091
      if (showEvent.isDefaultPrevented()) return // only register focus restorer if modal will actually get shown
0df70b8735e3 Update Twitter bootstrap to 3.2.0
Vincent Tondellier <tonton+hg@team1664.org>
parents: 1
diff changeset
  1092
      $target.one('hidden.bs.modal', function () {
0df70b8735e3 Update Twitter bootstrap to 3.2.0
Vincent Tondellier <tonton+hg@team1664.org>
parents: 1
diff changeset
  1093
        $this.is(':visible') && $this.trigger('focus')
0df70b8735e3 Update Twitter bootstrap to 3.2.0
Vincent Tondellier <tonton+hg@team1664.org>
parents: 1
diff changeset
  1094
      })
0df70b8735e3 Update Twitter bootstrap to 3.2.0
Vincent Tondellier <tonton+hg@team1664.org>
parents: 1
diff changeset
  1095
    })
0df70b8735e3 Update Twitter bootstrap to 3.2.0
Vincent Tondellier <tonton+hg@team1664.org>
parents: 1
diff changeset
  1096
    Plugin.call($target, option, this)
0df70b8735e3 Update Twitter bootstrap to 3.2.0
Vincent Tondellier <tonton+hg@team1664.org>
parents: 1
diff changeset
  1097
  })
0df70b8735e3 Update Twitter bootstrap to 3.2.0
Vincent Tondellier <tonton+hg@team1664.org>
parents: 1
diff changeset
  1098
0df70b8735e3 Update Twitter bootstrap to 3.2.0
Vincent Tondellier <tonton+hg@team1664.org>
parents: 1
diff changeset
  1099
}(jQuery);
0df70b8735e3 Update Twitter bootstrap to 3.2.0
Vincent Tondellier <tonton+hg@team1664.org>
parents: 1
diff changeset
  1100
0df70b8735e3 Update Twitter bootstrap to 3.2.0
Vincent Tondellier <tonton+hg@team1664.org>
parents: 1
diff changeset
  1101
/* ========================================================================
0df70b8735e3 Update Twitter bootstrap to 3.2.0
Vincent Tondellier <tonton+hg@team1664.org>
parents: 1
diff changeset
  1102
 * Bootstrap: tooltip.js v3.2.0
0df70b8735e3 Update Twitter bootstrap to 3.2.0
Vincent Tondellier <tonton+hg@team1664.org>
parents: 1
diff changeset
  1103
 * http://getbootstrap.com/javascript/#tooltip
0df70b8735e3 Update Twitter bootstrap to 3.2.0
Vincent Tondellier <tonton+hg@team1664.org>
parents: 1
diff changeset
  1104
 * Inspired by the original jQuery.tipsy by Jason Frame
0df70b8735e3 Update Twitter bootstrap to 3.2.0
Vincent Tondellier <tonton+hg@team1664.org>
parents: 1
diff changeset
  1105
 * ========================================================================
0df70b8735e3 Update Twitter bootstrap to 3.2.0
Vincent Tondellier <tonton+hg@team1664.org>
parents: 1
diff changeset
  1106
 * Copyright 2011-2014 Twitter, Inc.
0df70b8735e3 Update Twitter bootstrap to 3.2.0
Vincent Tondellier <tonton+hg@team1664.org>
parents: 1
diff changeset
  1107
 * Licensed under MIT (https://github.com/twbs/bootstrap/blob/master/LICENSE)
0df70b8735e3 Update Twitter bootstrap to 3.2.0
Vincent Tondellier <tonton+hg@team1664.org>
parents: 1
diff changeset
  1108
 * ======================================================================== */
0df70b8735e3 Update Twitter bootstrap to 3.2.0
Vincent Tondellier <tonton+hg@team1664.org>
parents: 1
diff changeset
  1109
0df70b8735e3 Update Twitter bootstrap to 3.2.0
Vincent Tondellier <tonton+hg@team1664.org>
parents: 1
diff changeset
  1110
0df70b8735e3 Update Twitter bootstrap to 3.2.0
Vincent Tondellier <tonton+hg@team1664.org>
parents: 1
diff changeset
  1111
+function ($) {
0df70b8735e3 Update Twitter bootstrap to 3.2.0
Vincent Tondellier <tonton+hg@team1664.org>
parents: 1
diff changeset
  1112
  'use strict';
0df70b8735e3 Update Twitter bootstrap to 3.2.0
Vincent Tondellier <tonton+hg@team1664.org>
parents: 1
diff changeset
  1113
0df70b8735e3 Update Twitter bootstrap to 3.2.0
Vincent Tondellier <tonton+hg@team1664.org>
parents: 1
diff changeset
  1114
  // TOOLTIP PUBLIC CLASS DEFINITION
0df70b8735e3 Update Twitter bootstrap to 3.2.0
Vincent Tondellier <tonton+hg@team1664.org>
parents: 1
diff changeset
  1115
  // ===============================
0df70b8735e3 Update Twitter bootstrap to 3.2.0
Vincent Tondellier <tonton+hg@team1664.org>
parents: 1
diff changeset
  1116
0df70b8735e3 Update Twitter bootstrap to 3.2.0
Vincent Tondellier <tonton+hg@team1664.org>
parents: 1
diff changeset
  1117
  var Tooltip = function (element, options) {
0df70b8735e3 Update Twitter bootstrap to 3.2.0
Vincent Tondellier <tonton+hg@team1664.org>
parents: 1
diff changeset
  1118
    this.type       =
0df70b8735e3 Update Twitter bootstrap to 3.2.0
Vincent Tondellier <tonton+hg@team1664.org>
parents: 1
diff changeset
  1119
    this.options    =
0df70b8735e3 Update Twitter bootstrap to 3.2.0
Vincent Tondellier <tonton+hg@team1664.org>
parents: 1
diff changeset
  1120
    this.enabled    =
0df70b8735e3 Update Twitter bootstrap to 3.2.0
Vincent Tondellier <tonton+hg@team1664.org>
parents: 1
diff changeset
  1121
    this.timeout    =
0df70b8735e3 Update Twitter bootstrap to 3.2.0
Vincent Tondellier <tonton+hg@team1664.org>
parents: 1
diff changeset
  1122
    this.hoverState =
0df70b8735e3 Update Twitter bootstrap to 3.2.0
Vincent Tondellier <tonton+hg@team1664.org>
parents: 1
diff changeset
  1123
    this.$element   = null
0df70b8735e3 Update Twitter bootstrap to 3.2.0
Vincent Tondellier <tonton+hg@team1664.org>
parents: 1
diff changeset
  1124
0df70b8735e3 Update Twitter bootstrap to 3.2.0
Vincent Tondellier <tonton+hg@team1664.org>
parents: 1
diff changeset
  1125
    this.init('tooltip', element, options)
0df70b8735e3 Update Twitter bootstrap to 3.2.0
Vincent Tondellier <tonton+hg@team1664.org>
parents: 1
diff changeset
  1126
  }
0df70b8735e3 Update Twitter bootstrap to 3.2.0
Vincent Tondellier <tonton+hg@team1664.org>
parents: 1
diff changeset
  1127
0df70b8735e3 Update Twitter bootstrap to 3.2.0
Vincent Tondellier <tonton+hg@team1664.org>
parents: 1
diff changeset
  1128
  Tooltip.VERSION  = '3.2.0'
0df70b8735e3 Update Twitter bootstrap to 3.2.0
Vincent Tondellier <tonton+hg@team1664.org>
parents: 1
diff changeset
  1129
0df70b8735e3 Update Twitter bootstrap to 3.2.0
Vincent Tondellier <tonton+hg@team1664.org>
parents: 1
diff changeset
  1130
  Tooltip.DEFAULTS = {
0df70b8735e3 Update Twitter bootstrap to 3.2.0
Vincent Tondellier <tonton+hg@team1664.org>
parents: 1
diff changeset
  1131
    animation: true,
0df70b8735e3 Update Twitter bootstrap to 3.2.0
Vincent Tondellier <tonton+hg@team1664.org>
parents: 1
diff changeset
  1132
    placement: 'top',
0df70b8735e3 Update Twitter bootstrap to 3.2.0
Vincent Tondellier <tonton+hg@team1664.org>
parents: 1
diff changeset
  1133
    selector: false,
0df70b8735e3 Update Twitter bootstrap to 3.2.0
Vincent Tondellier <tonton+hg@team1664.org>
parents: 1
diff changeset
  1134
    template: '<div class="tooltip" role="tooltip"><div class="tooltip-arrow"></div><div class="tooltip-inner"></div></div>',
0df70b8735e3 Update Twitter bootstrap to 3.2.0
Vincent Tondellier <tonton+hg@team1664.org>
parents: 1
diff changeset
  1135
    trigger: 'hover focus',
0df70b8735e3 Update Twitter bootstrap to 3.2.0
Vincent Tondellier <tonton+hg@team1664.org>
parents: 1
diff changeset
  1136
    title: '',
0df70b8735e3 Update Twitter bootstrap to 3.2.0
Vincent Tondellier <tonton+hg@team1664.org>
parents: 1
diff changeset
  1137
    delay: 0,
0df70b8735e3 Update Twitter bootstrap to 3.2.0
Vincent Tondellier <tonton+hg@team1664.org>
parents: 1
diff changeset
  1138
    html: false,
0df70b8735e3 Update Twitter bootstrap to 3.2.0
Vincent Tondellier <tonton+hg@team1664.org>
parents: 1
diff changeset
  1139
    container: false,
0df70b8735e3 Update Twitter bootstrap to 3.2.0
Vincent Tondellier <tonton+hg@team1664.org>
parents: 1
diff changeset
  1140
    viewport: {
0df70b8735e3 Update Twitter bootstrap to 3.2.0
Vincent Tondellier <tonton+hg@team1664.org>
parents: 1
diff changeset
  1141
      selector: 'body',
0df70b8735e3 Update Twitter bootstrap to 3.2.0
Vincent Tondellier <tonton+hg@team1664.org>
parents: 1
diff changeset
  1142
      padding: 0
0
5b78b8c79d9c Initial commit
Vincent Tondellier <tonton+hg@team1664.org>
parents:
diff changeset
  1143
    }
28
0df70b8735e3 Update Twitter bootstrap to 3.2.0
Vincent Tondellier <tonton+hg@team1664.org>
parents: 1
diff changeset
  1144
  }
0df70b8735e3 Update Twitter bootstrap to 3.2.0
Vincent Tondellier <tonton+hg@team1664.org>
parents: 1
diff changeset
  1145
0df70b8735e3 Update Twitter bootstrap to 3.2.0
Vincent Tondellier <tonton+hg@team1664.org>
parents: 1
diff changeset
  1146
  Tooltip.prototype.init = function (type, element, options) {
0df70b8735e3 Update Twitter bootstrap to 3.2.0
Vincent Tondellier <tonton+hg@team1664.org>
parents: 1
diff changeset
  1147
    this.enabled   = true
0df70b8735e3 Update Twitter bootstrap to 3.2.0
Vincent Tondellier <tonton+hg@team1664.org>
parents: 1
diff changeset
  1148
    this.type      = type
0df70b8735e3 Update Twitter bootstrap to 3.2.0
Vincent Tondellier <tonton+hg@team1664.org>
parents: 1
diff changeset
  1149
    this.$element  = $(element)
0df70b8735e3 Update Twitter bootstrap to 3.2.0
Vincent Tondellier <tonton+hg@team1664.org>
parents: 1
diff changeset
  1150
    this.options   = this.getOptions(options)
0df70b8735e3 Update Twitter bootstrap to 3.2.0
Vincent Tondellier <tonton+hg@team1664.org>
parents: 1
diff changeset
  1151
    this.$viewport = this.options.viewport && $(this.options.viewport.selector || this.options.viewport)
0df70b8735e3 Update Twitter bootstrap to 3.2.0
Vincent Tondellier <tonton+hg@team1664.org>
parents: 1
diff changeset
  1152
0df70b8735e3 Update Twitter bootstrap to 3.2.0
Vincent Tondellier <tonton+hg@team1664.org>
parents: 1
diff changeset
  1153
    var triggers = this.options.trigger.split(' ')
0df70b8735e3 Update Twitter bootstrap to 3.2.0
Vincent Tondellier <tonton+hg@team1664.org>
parents: 1
diff changeset
  1154
0df70b8735e3 Update Twitter bootstrap to 3.2.0
Vincent Tondellier <tonton+hg@team1664.org>
parents: 1
diff changeset
  1155
    for (var i = triggers.length; i--;) {
0df70b8735e3 Update Twitter bootstrap to 3.2.0
Vincent Tondellier <tonton+hg@team1664.org>
parents: 1
diff changeset
  1156
      var trigger = triggers[i]
0df70b8735e3 Update Twitter bootstrap to 3.2.0
Vincent Tondellier <tonton+hg@team1664.org>
parents: 1
diff changeset
  1157
0df70b8735e3 Update Twitter bootstrap to 3.2.0
Vincent Tondellier <tonton+hg@team1664.org>
parents: 1
diff changeset
  1158
      if (trigger == 'click') {
0df70b8735e3 Update Twitter bootstrap to 3.2.0
Vincent Tondellier <tonton+hg@team1664.org>
parents: 1
diff changeset
  1159
        this.$element.on('click.' + this.type, this.options.selector, $.proxy(this.toggle, this))
0df70b8735e3 Update Twitter bootstrap to 3.2.0
Vincent Tondellier <tonton+hg@team1664.org>
parents: 1
diff changeset
  1160
      } else if (trigger != 'manual') {
0df70b8735e3 Update Twitter bootstrap to 3.2.0
Vincent Tondellier <tonton+hg@team1664.org>
parents: 1
diff changeset
  1161
        var eventIn  = trigger == 'hover' ? 'mouseenter' : 'focusin'
0df70b8735e3 Update Twitter bootstrap to 3.2.0
Vincent Tondellier <tonton+hg@team1664.org>
parents: 1
diff changeset
  1162
        var eventOut = trigger == 'hover' ? 'mouseleave' : 'focusout'
0df70b8735e3 Update Twitter bootstrap to 3.2.0
Vincent Tondellier <tonton+hg@team1664.org>
parents: 1
diff changeset
  1163
0df70b8735e3 Update Twitter bootstrap to 3.2.0
Vincent Tondellier <tonton+hg@team1664.org>
parents: 1
diff changeset
  1164
        this.$element.on(eventIn  + '.' + this.type, this.options.selector, $.proxy(this.enter, this))
0df70b8735e3 Update Twitter bootstrap to 3.2.0
Vincent Tondellier <tonton+hg@team1664.org>
parents: 1
diff changeset
  1165
        this.$element.on(eventOut + '.' + this.type, this.options.selector, $.proxy(this.leave, this))
0df70b8735e3 Update Twitter bootstrap to 3.2.0
Vincent Tondellier <tonton+hg@team1664.org>
parents: 1
diff changeset
  1166
      }
0df70b8735e3 Update Twitter bootstrap to 3.2.0
Vincent Tondellier <tonton+hg@team1664.org>
parents: 1
diff changeset
  1167
    }
0df70b8735e3 Update Twitter bootstrap to 3.2.0
Vincent Tondellier <tonton+hg@team1664.org>
parents: 1
diff changeset
  1168
0df70b8735e3 Update Twitter bootstrap to 3.2.0
Vincent Tondellier <tonton+hg@team1664.org>
parents: 1
diff changeset
  1169
    this.options.selector ?
0df70b8735e3 Update Twitter bootstrap to 3.2.0
Vincent Tondellier <tonton+hg@team1664.org>
parents: 1
diff changeset
  1170
      (this._options = $.extend({}, this.options, { trigger: 'manual', selector: '' })) :
0df70b8735e3 Update Twitter bootstrap to 3.2.0
Vincent Tondellier <tonton+hg@team1664.org>
parents: 1
diff changeset
  1171
      this.fixTitle()
0df70b8735e3 Update Twitter bootstrap to 3.2.0
Vincent Tondellier <tonton+hg@team1664.org>
parents: 1
diff changeset
  1172
  }
0df70b8735e3 Update Twitter bootstrap to 3.2.0
Vincent Tondellier <tonton+hg@team1664.org>
parents: 1
diff changeset
  1173
0df70b8735e3 Update Twitter bootstrap to 3.2.0
Vincent Tondellier <tonton+hg@team1664.org>
parents: 1
diff changeset
  1174
  Tooltip.prototype.getDefaults = function () {
0df70b8735e3 Update Twitter bootstrap to 3.2.0
Vincent Tondellier <tonton+hg@team1664.org>
parents: 1
diff changeset
  1175
    return Tooltip.DEFAULTS
0df70b8735e3 Update Twitter bootstrap to 3.2.0
Vincent Tondellier <tonton+hg@team1664.org>
parents: 1
diff changeset
  1176
  }
0df70b8735e3 Update Twitter bootstrap to 3.2.0
Vincent Tondellier <tonton+hg@team1664.org>
parents: 1
diff changeset
  1177
0df70b8735e3 Update Twitter bootstrap to 3.2.0
Vincent Tondellier <tonton+hg@team1664.org>
parents: 1
diff changeset
  1178
  Tooltip.prototype.getOptions = function (options) {
0df70b8735e3 Update Twitter bootstrap to 3.2.0
Vincent Tondellier <tonton+hg@team1664.org>
parents: 1
diff changeset
  1179
    options = $.extend({}, this.getDefaults(), this.$element.data(), options)
0df70b8735e3 Update Twitter bootstrap to 3.2.0
Vincent Tondellier <tonton+hg@team1664.org>
parents: 1
diff changeset
  1180
0df70b8735e3 Update Twitter bootstrap to 3.2.0
Vincent Tondellier <tonton+hg@team1664.org>
parents: 1
diff changeset
  1181
    if (options.delay && typeof options.delay == 'number') {
0df70b8735e3 Update Twitter bootstrap to 3.2.0
Vincent Tondellier <tonton+hg@team1664.org>
parents: 1
diff changeset
  1182
      options.delay = {
0df70b8735e3 Update Twitter bootstrap to 3.2.0
Vincent Tondellier <tonton+hg@team1664.org>
parents: 1
diff changeset
  1183
        show: options.delay,
0df70b8735e3 Update Twitter bootstrap to 3.2.0
Vincent Tondellier <tonton+hg@team1664.org>
parents: 1
diff changeset
  1184
        hide: options.delay
0df70b8735e3 Update Twitter bootstrap to 3.2.0
Vincent Tondellier <tonton+hg@team1664.org>
parents: 1
diff changeset
  1185
      }
0
5b78b8c79d9c Initial commit
Vincent Tondellier <tonton+hg@team1664.org>
parents:
diff changeset
  1186
    }
5b78b8c79d9c Initial commit
Vincent Tondellier <tonton+hg@team1664.org>
parents:
diff changeset
  1187
28
0df70b8735e3 Update Twitter bootstrap to 3.2.0
Vincent Tondellier <tonton+hg@team1664.org>
parents: 1
diff changeset
  1188
    return options
0df70b8735e3 Update Twitter bootstrap to 3.2.0
Vincent Tondellier <tonton+hg@team1664.org>
parents: 1
diff changeset
  1189
  }
0df70b8735e3 Update Twitter bootstrap to 3.2.0
Vincent Tondellier <tonton+hg@team1664.org>
parents: 1
diff changeset
  1190
0df70b8735e3 Update Twitter bootstrap to 3.2.0
Vincent Tondellier <tonton+hg@team1664.org>
parents: 1
diff changeset
  1191
  Tooltip.prototype.getDelegateOptions = function () {
0df70b8735e3 Update Twitter bootstrap to 3.2.0
Vincent Tondellier <tonton+hg@team1664.org>
parents: 1
diff changeset
  1192
    var options  = {}
0df70b8735e3 Update Twitter bootstrap to 3.2.0
Vincent Tondellier <tonton+hg@team1664.org>
parents: 1
diff changeset
  1193
    var defaults = this.getDefaults()
0df70b8735e3 Update Twitter bootstrap to 3.2.0
Vincent Tondellier <tonton+hg@team1664.org>
parents: 1
diff changeset
  1194
0df70b8735e3 Update Twitter bootstrap to 3.2.0
Vincent Tondellier <tonton+hg@team1664.org>
parents: 1
diff changeset
  1195
    this._options && $.each(this._options, function (key, value) {
0df70b8735e3 Update Twitter bootstrap to 3.2.0
Vincent Tondellier <tonton+hg@team1664.org>
parents: 1
diff changeset
  1196
      if (defaults[key] != value) options[key] = value
0df70b8735e3 Update Twitter bootstrap to 3.2.0
Vincent Tondellier <tonton+hg@team1664.org>
parents: 1
diff changeset
  1197
    })
0df70b8735e3 Update Twitter bootstrap to 3.2.0
Vincent Tondellier <tonton+hg@team1664.org>
parents: 1
diff changeset
  1198
0df70b8735e3 Update Twitter bootstrap to 3.2.0
Vincent Tondellier <tonton+hg@team1664.org>
parents: 1
diff changeset
  1199
    return options
0df70b8735e3 Update Twitter bootstrap to 3.2.0
Vincent Tondellier <tonton+hg@team1664.org>
parents: 1
diff changeset
  1200
  }
0df70b8735e3 Update Twitter bootstrap to 3.2.0
Vincent Tondellier <tonton+hg@team1664.org>
parents: 1
diff changeset
  1201
0df70b8735e3 Update Twitter bootstrap to 3.2.0
Vincent Tondellier <tonton+hg@team1664.org>
parents: 1
diff changeset
  1202
  Tooltip.prototype.enter = function (obj) {
0df70b8735e3 Update Twitter bootstrap to 3.2.0
Vincent Tondellier <tonton+hg@team1664.org>
parents: 1
diff changeset
  1203
    var self = obj instanceof this.constructor ?
0df70b8735e3 Update Twitter bootstrap to 3.2.0
Vincent Tondellier <tonton+hg@team1664.org>
parents: 1
diff changeset
  1204
      obj : $(obj.currentTarget).data('bs.' + this.type)
0df70b8735e3 Update Twitter bootstrap to 3.2.0
Vincent Tondellier <tonton+hg@team1664.org>
parents: 1
diff changeset
  1205
0df70b8735e3 Update Twitter bootstrap to 3.2.0
Vincent Tondellier <tonton+hg@team1664.org>
parents: 1
diff changeset
  1206
    if (!self) {
0df70b8735e3 Update Twitter bootstrap to 3.2.0
Vincent Tondellier <tonton+hg@team1664.org>
parents: 1
diff changeset
  1207
      self = new this.constructor(obj.currentTarget, this.getDelegateOptions())
0df70b8735e3 Update Twitter bootstrap to 3.2.0
Vincent Tondellier <tonton+hg@team1664.org>
parents: 1
diff changeset
  1208
      $(obj.currentTarget).data('bs.' + this.type, self)
0df70b8735e3 Update Twitter bootstrap to 3.2.0
Vincent Tondellier <tonton+hg@team1664.org>
parents: 1
diff changeset
  1209
    }
0df70b8735e3 Update Twitter bootstrap to 3.2.0
Vincent Tondellier <tonton+hg@team1664.org>
parents: 1
diff changeset
  1210
0df70b8735e3 Update Twitter bootstrap to 3.2.0
Vincent Tondellier <tonton+hg@team1664.org>
parents: 1
diff changeset
  1211
    clearTimeout(self.timeout)
0df70b8735e3 Update Twitter bootstrap to 3.2.0
Vincent Tondellier <tonton+hg@team1664.org>
parents: 1
diff changeset
  1212
0df70b8735e3 Update Twitter bootstrap to 3.2.0
Vincent Tondellier <tonton+hg@team1664.org>
parents: 1
diff changeset
  1213
    self.hoverState = 'in'
0df70b8735e3 Update Twitter bootstrap to 3.2.0
Vincent Tondellier <tonton+hg@team1664.org>
parents: 1
diff changeset
  1214
0df70b8735e3 Update Twitter bootstrap to 3.2.0
Vincent Tondellier <tonton+hg@team1664.org>
parents: 1
diff changeset
  1215
    if (!self.options.delay || !self.options.delay.show) return self.show()
0df70b8735e3 Update Twitter bootstrap to 3.2.0
Vincent Tondellier <tonton+hg@team1664.org>
parents: 1
diff changeset
  1216
0df70b8735e3 Update Twitter bootstrap to 3.2.0
Vincent Tondellier <tonton+hg@team1664.org>
parents: 1
diff changeset
  1217
    self.timeout = setTimeout(function () {
0df70b8735e3 Update Twitter bootstrap to 3.2.0
Vincent Tondellier <tonton+hg@team1664.org>
parents: 1
diff changeset
  1218
      if (self.hoverState == 'in') self.show()
0df70b8735e3 Update Twitter bootstrap to 3.2.0
Vincent Tondellier <tonton+hg@team1664.org>
parents: 1
diff changeset
  1219
    }, self.options.delay.show)
0df70b8735e3 Update Twitter bootstrap to 3.2.0
Vincent Tondellier <tonton+hg@team1664.org>
parents: 1
diff changeset
  1220
  }
0df70b8735e3 Update Twitter bootstrap to 3.2.0
Vincent Tondellier <tonton+hg@team1664.org>
parents: 1
diff changeset
  1221
0df70b8735e3 Update Twitter bootstrap to 3.2.0
Vincent Tondellier <tonton+hg@team1664.org>
parents: 1
diff changeset
  1222
  Tooltip.prototype.leave = function (obj) {
0df70b8735e3 Update Twitter bootstrap to 3.2.0
Vincent Tondellier <tonton+hg@team1664.org>
parents: 1
diff changeset
  1223
    var self = obj instanceof this.constructor ?
0df70b8735e3 Update Twitter bootstrap to 3.2.0
Vincent Tondellier <tonton+hg@team1664.org>
parents: 1
diff changeset
  1224
      obj : $(obj.currentTarget).data('bs.' + this.type)
0df70b8735e3 Update Twitter bootstrap to 3.2.0
Vincent Tondellier <tonton+hg@team1664.org>
parents: 1
diff changeset
  1225
0df70b8735e3 Update Twitter bootstrap to 3.2.0
Vincent Tondellier <tonton+hg@team1664.org>
parents: 1
diff changeset
  1226
    if (!self) {
0df70b8735e3 Update Twitter bootstrap to 3.2.0
Vincent Tondellier <tonton+hg@team1664.org>
parents: 1
diff changeset
  1227
      self = new this.constructor(obj.currentTarget, this.getDelegateOptions())
0df70b8735e3 Update Twitter bootstrap to 3.2.0
Vincent Tondellier <tonton+hg@team1664.org>
parents: 1
diff changeset
  1228
      $(obj.currentTarget).data('bs.' + this.type, self)
0df70b8735e3 Update Twitter bootstrap to 3.2.0
Vincent Tondellier <tonton+hg@team1664.org>
parents: 1
diff changeset
  1229
    }
0df70b8735e3 Update Twitter bootstrap to 3.2.0
Vincent Tondellier <tonton+hg@team1664.org>
parents: 1
diff changeset
  1230
0df70b8735e3 Update Twitter bootstrap to 3.2.0
Vincent Tondellier <tonton+hg@team1664.org>
parents: 1
diff changeset
  1231
    clearTimeout(self.timeout)
0df70b8735e3 Update Twitter bootstrap to 3.2.0
Vincent Tondellier <tonton+hg@team1664.org>
parents: 1
diff changeset
  1232
0df70b8735e3 Update Twitter bootstrap to 3.2.0
Vincent Tondellier <tonton+hg@team1664.org>
parents: 1
diff changeset
  1233
    self.hoverState = 'out'
0df70b8735e3 Update Twitter bootstrap to 3.2.0
Vincent Tondellier <tonton+hg@team1664.org>
parents: 1
diff changeset
  1234
0df70b8735e3 Update Twitter bootstrap to 3.2.0
Vincent Tondellier <tonton+hg@team1664.org>
parents: 1
diff changeset
  1235
    if (!self.options.delay || !self.options.delay.hide) return self.hide()
0df70b8735e3 Update Twitter bootstrap to 3.2.0
Vincent Tondellier <tonton+hg@team1664.org>
parents: 1
diff changeset
  1236
0df70b8735e3 Update Twitter bootstrap to 3.2.0
Vincent Tondellier <tonton+hg@team1664.org>
parents: 1
diff changeset
  1237
    self.timeout = setTimeout(function () {
0df70b8735e3 Update Twitter bootstrap to 3.2.0
Vincent Tondellier <tonton+hg@team1664.org>
parents: 1
diff changeset
  1238
      if (self.hoverState == 'out') self.hide()
0df70b8735e3 Update Twitter bootstrap to 3.2.0
Vincent Tondellier <tonton+hg@team1664.org>
parents: 1
diff changeset
  1239
    }, self.options.delay.hide)
0df70b8735e3 Update Twitter bootstrap to 3.2.0
Vincent Tondellier <tonton+hg@team1664.org>
parents: 1
diff changeset
  1240
  }
0df70b8735e3 Update Twitter bootstrap to 3.2.0
Vincent Tondellier <tonton+hg@team1664.org>
parents: 1
diff changeset
  1241
0df70b8735e3 Update Twitter bootstrap to 3.2.0
Vincent Tondellier <tonton+hg@team1664.org>
parents: 1
diff changeset
  1242
  Tooltip.prototype.show = function () {
0df70b8735e3 Update Twitter bootstrap to 3.2.0
Vincent Tondellier <tonton+hg@team1664.org>
parents: 1
diff changeset
  1243
    var e = $.Event('show.bs.' + this.type)
0df70b8735e3 Update Twitter bootstrap to 3.2.0
Vincent Tondellier <tonton+hg@team1664.org>
parents: 1
diff changeset
  1244
0df70b8735e3 Update Twitter bootstrap to 3.2.0
Vincent Tondellier <tonton+hg@team1664.org>
parents: 1
diff changeset
  1245
    if (this.hasContent() && this.enabled) {
0df70b8735e3 Update Twitter bootstrap to 3.2.0
Vincent Tondellier <tonton+hg@team1664.org>
parents: 1
diff changeset
  1246
      this.$element.trigger(e)
0df70b8735e3 Update Twitter bootstrap to 3.2.0
Vincent Tondellier <tonton+hg@team1664.org>
parents: 1
diff changeset
  1247
0df70b8735e3 Update Twitter bootstrap to 3.2.0
Vincent Tondellier <tonton+hg@team1664.org>
parents: 1
diff changeset
  1248
      var inDom = $.contains(document.documentElement, this.$element[0])
0df70b8735e3 Update Twitter bootstrap to 3.2.0
Vincent Tondellier <tonton+hg@team1664.org>
parents: 1
diff changeset
  1249
      if (e.isDefaultPrevented() || !inDom) return
0
5b78b8c79d9c Initial commit
Vincent Tondellier <tonton+hg@team1664.org>
parents:
diff changeset
  1250
      var that = this
28
0df70b8735e3 Update Twitter bootstrap to 3.2.0
Vincent Tondellier <tonton+hg@team1664.org>
parents: 1
diff changeset
  1251
0df70b8735e3 Update Twitter bootstrap to 3.2.0
Vincent Tondellier <tonton+hg@team1664.org>
parents: 1
diff changeset
  1252
      var $tip = this.tip()
0df70b8735e3 Update Twitter bootstrap to 3.2.0
Vincent Tondellier <tonton+hg@team1664.org>
parents: 1
diff changeset
  1253
0df70b8735e3 Update Twitter bootstrap to 3.2.0
Vincent Tondellier <tonton+hg@team1664.org>
parents: 1
diff changeset
  1254
      var tipId = this.getUID(this.type)
0df70b8735e3 Update Twitter bootstrap to 3.2.0
Vincent Tondellier <tonton+hg@team1664.org>
parents: 1
diff changeset
  1255
0df70b8735e3 Update Twitter bootstrap to 3.2.0
Vincent Tondellier <tonton+hg@team1664.org>
parents: 1
diff changeset
  1256
      this.setContent()
0df70b8735e3 Update Twitter bootstrap to 3.2.0
Vincent Tondellier <tonton+hg@team1664.org>
parents: 1
diff changeset
  1257
      $tip.attr('id', tipId)
0df70b8735e3 Update Twitter bootstrap to 3.2.0
Vincent Tondellier <tonton+hg@team1664.org>
parents: 1
diff changeset
  1258
      this.$element.attr('aria-describedby', tipId)
0df70b8735e3 Update Twitter bootstrap to 3.2.0
Vincent Tondellier <tonton+hg@team1664.org>
parents: 1
diff changeset
  1259
0df70b8735e3 Update Twitter bootstrap to 3.2.0
Vincent Tondellier <tonton+hg@team1664.org>
parents: 1
diff changeset
  1260
      if (this.options.animation) $tip.addClass('fade')
0df70b8735e3 Update Twitter bootstrap to 3.2.0
Vincent Tondellier <tonton+hg@team1664.org>
parents: 1
diff changeset
  1261
0df70b8735e3 Update Twitter bootstrap to 3.2.0
Vincent Tondellier <tonton+hg@team1664.org>
parents: 1
diff changeset
  1262
      var placement = typeof this.options.placement == 'function' ?
0df70b8735e3 Update Twitter bootstrap to 3.2.0
Vincent Tondellier <tonton+hg@team1664.org>
parents: 1
diff changeset
  1263
        this.options.placement.call(this, $tip[0], this.$element[0]) :
0df70b8735e3 Update Twitter bootstrap to 3.2.0
Vincent Tondellier <tonton+hg@team1664.org>
parents: 1
diff changeset
  1264
        this.options.placement
0df70b8735e3 Update Twitter bootstrap to 3.2.0
Vincent Tondellier <tonton+hg@team1664.org>
parents: 1
diff changeset
  1265
0df70b8735e3 Update Twitter bootstrap to 3.2.0
Vincent Tondellier <tonton+hg@team1664.org>
parents: 1
diff changeset
  1266
      var autoToken = /\s?auto?\s?/i
0df70b8735e3 Update Twitter bootstrap to 3.2.0
Vincent Tondellier <tonton+hg@team1664.org>
parents: 1
diff changeset
  1267
      var autoPlace = autoToken.test(placement)
0df70b8735e3 Update Twitter bootstrap to 3.2.0
Vincent Tondellier <tonton+hg@team1664.org>
parents: 1
diff changeset
  1268
      if (autoPlace) placement = placement.replace(autoToken, '') || 'top'
0df70b8735e3 Update Twitter bootstrap to 3.2.0
Vincent Tondellier <tonton+hg@team1664.org>
parents: 1
diff changeset
  1269
0df70b8735e3 Update Twitter bootstrap to 3.2.0
Vincent Tondellier <tonton+hg@team1664.org>
parents: 1
diff changeset
  1270
      $tip
0df70b8735e3 Update Twitter bootstrap to 3.2.0
Vincent Tondellier <tonton+hg@team1664.org>
parents: 1
diff changeset
  1271
        .detach()
0df70b8735e3 Update Twitter bootstrap to 3.2.0
Vincent Tondellier <tonton+hg@team1664.org>
parents: 1
diff changeset
  1272
        .css({ top: 0, left: 0, display: 'block' })
0df70b8735e3 Update Twitter bootstrap to 3.2.0
Vincent Tondellier <tonton+hg@team1664.org>
parents: 1
diff changeset
  1273
        .addClass(placement)
0df70b8735e3 Update Twitter bootstrap to 3.2.0
Vincent Tondellier <tonton+hg@team1664.org>
parents: 1
diff changeset
  1274
        .data('bs.' + this.type, this)
0df70b8735e3 Update Twitter bootstrap to 3.2.0
Vincent Tondellier <tonton+hg@team1664.org>
parents: 1
diff changeset
  1275
0df70b8735e3 Update Twitter bootstrap to 3.2.0
Vincent Tondellier <tonton+hg@team1664.org>
parents: 1
diff changeset
  1276
      this.options.container ? $tip.appendTo(this.options.container) : $tip.insertAfter(this.$element)
0df70b8735e3 Update Twitter bootstrap to 3.2.0
Vincent Tondellier <tonton+hg@team1664.org>
parents: 1
diff changeset
  1277
0df70b8735e3 Update Twitter bootstrap to 3.2.0
Vincent Tondellier <tonton+hg@team1664.org>
parents: 1
diff changeset
  1278
      var pos          = this.getPosition()
0df70b8735e3 Update Twitter bootstrap to 3.2.0
Vincent Tondellier <tonton+hg@team1664.org>
parents: 1
diff changeset
  1279
      var actualWidth  = $tip[0].offsetWidth
0df70b8735e3 Update Twitter bootstrap to 3.2.0
Vincent Tondellier <tonton+hg@team1664.org>
parents: 1
diff changeset
  1280
      var actualHeight = $tip[0].offsetHeight
0df70b8735e3 Update Twitter bootstrap to 3.2.0
Vincent Tondellier <tonton+hg@team1664.org>
parents: 1
diff changeset
  1281
0df70b8735e3 Update Twitter bootstrap to 3.2.0
Vincent Tondellier <tonton+hg@team1664.org>
parents: 1
diff changeset
  1282
      if (autoPlace) {
0df70b8735e3 Update Twitter bootstrap to 3.2.0
Vincent Tondellier <tonton+hg@team1664.org>
parents: 1
diff changeset
  1283
        var orgPlacement = placement
0df70b8735e3 Update Twitter bootstrap to 3.2.0
Vincent Tondellier <tonton+hg@team1664.org>
parents: 1
diff changeset
  1284
        var $parent      = this.$element.parent()
0df70b8735e3 Update Twitter bootstrap to 3.2.0
Vincent Tondellier <tonton+hg@team1664.org>
parents: 1
diff changeset
  1285
        var parentDim    = this.getPosition($parent)
0df70b8735e3 Update Twitter bootstrap to 3.2.0
Vincent Tondellier <tonton+hg@team1664.org>
parents: 1
diff changeset
  1286
0df70b8735e3 Update Twitter bootstrap to 3.2.0
Vincent Tondellier <tonton+hg@team1664.org>
parents: 1
diff changeset
  1287
        placement = placement == 'bottom' && pos.top   + pos.height       + actualHeight - parentDim.scroll > parentDim.height ? 'top'    :
0df70b8735e3 Update Twitter bootstrap to 3.2.0
Vincent Tondellier <tonton+hg@team1664.org>
parents: 1
diff changeset
  1288
                    placement == 'top'    && pos.top   - parentDim.scroll - actualHeight < 0                                   ? 'bottom' :
0df70b8735e3 Update Twitter bootstrap to 3.2.0
Vincent Tondellier <tonton+hg@team1664.org>
parents: 1
diff changeset
  1289
                    placement == 'right'  && pos.right + actualWidth      > parentDim.width                                    ? 'left'   :
0df70b8735e3 Update Twitter bootstrap to 3.2.0
Vincent Tondellier <tonton+hg@team1664.org>
parents: 1
diff changeset
  1290
                    placement == 'left'   && pos.left  - actualWidth      < parentDim.left                                     ? 'right'  :
0df70b8735e3 Update Twitter bootstrap to 3.2.0
Vincent Tondellier <tonton+hg@team1664.org>
parents: 1
diff changeset
  1291
                    placement
0df70b8735e3 Update Twitter bootstrap to 3.2.0
Vincent Tondellier <tonton+hg@team1664.org>
parents: 1
diff changeset
  1292
0df70b8735e3 Update Twitter bootstrap to 3.2.0
Vincent Tondellier <tonton+hg@team1664.org>
parents: 1
diff changeset
  1293
        $tip
0df70b8735e3 Update Twitter bootstrap to 3.2.0
Vincent Tondellier <tonton+hg@team1664.org>
parents: 1
diff changeset
  1294
          .removeClass(orgPlacement)
0df70b8735e3 Update Twitter bootstrap to 3.2.0
Vincent Tondellier <tonton+hg@team1664.org>
parents: 1
diff changeset
  1295
          .addClass(placement)
0df70b8735e3 Update Twitter bootstrap to 3.2.0
Vincent Tondellier <tonton+hg@team1664.org>
parents: 1
diff changeset
  1296
      }
0df70b8735e3 Update Twitter bootstrap to 3.2.0
Vincent Tondellier <tonton+hg@team1664.org>
parents: 1
diff changeset
  1297
0df70b8735e3 Update Twitter bootstrap to 3.2.0
Vincent Tondellier <tonton+hg@team1664.org>
parents: 1
diff changeset
  1298
      var calculatedOffset = this.getCalculatedOffset(placement, pos, actualWidth, actualHeight)
0df70b8735e3 Update Twitter bootstrap to 3.2.0
Vincent Tondellier <tonton+hg@team1664.org>
parents: 1
diff changeset
  1299
0df70b8735e3 Update Twitter bootstrap to 3.2.0
Vincent Tondellier <tonton+hg@team1664.org>
parents: 1
diff changeset
  1300
      this.applyPlacement(calculatedOffset, placement)
0df70b8735e3 Update Twitter bootstrap to 3.2.0
Vincent Tondellier <tonton+hg@team1664.org>
parents: 1
diff changeset
  1301
0df70b8735e3 Update Twitter bootstrap to 3.2.0
Vincent Tondellier <tonton+hg@team1664.org>
parents: 1
diff changeset
  1302
      var complete = function () {
0df70b8735e3 Update Twitter bootstrap to 3.2.0
Vincent Tondellier <tonton+hg@team1664.org>
parents: 1
diff changeset
  1303
        that.$element.trigger('shown.bs.' + that.type)
0df70b8735e3 Update Twitter bootstrap to 3.2.0
Vincent Tondellier <tonton+hg@team1664.org>
parents: 1
diff changeset
  1304
        that.hoverState = null
0df70b8735e3 Update Twitter bootstrap to 3.2.0
Vincent Tondellier <tonton+hg@team1664.org>
parents: 1
diff changeset
  1305
      }
0df70b8735e3 Update Twitter bootstrap to 3.2.0
Vincent Tondellier <tonton+hg@team1664.org>
parents: 1
diff changeset
  1306
0df70b8735e3 Update Twitter bootstrap to 3.2.0
Vincent Tondellier <tonton+hg@team1664.org>
parents: 1
diff changeset
  1307
      $.support.transition && this.$tip.hasClass('fade') ?
0df70b8735e3 Update Twitter bootstrap to 3.2.0
Vincent Tondellier <tonton+hg@team1664.org>
parents: 1
diff changeset
  1308
        $tip
0df70b8735e3 Update Twitter bootstrap to 3.2.0
Vincent Tondellier <tonton+hg@team1664.org>
parents: 1
diff changeset
  1309
          .one('bsTransitionEnd', complete)
0df70b8735e3 Update Twitter bootstrap to 3.2.0
Vincent Tondellier <tonton+hg@team1664.org>
parents: 1
diff changeset
  1310
          .emulateTransitionEnd(150) :
0
5b78b8c79d9c Initial commit
Vincent Tondellier <tonton+hg@team1664.org>
parents:
diff changeset
  1311
        complete()
5b78b8c79d9c Initial commit
Vincent Tondellier <tonton+hg@team1664.org>
parents:
diff changeset
  1312
    }
28
0df70b8735e3 Update Twitter bootstrap to 3.2.0
Vincent Tondellier <tonton+hg@team1664.org>
parents: 1
diff changeset
  1313
  }
0df70b8735e3 Update Twitter bootstrap to 3.2.0
Vincent Tondellier <tonton+hg@team1664.org>
parents: 1
diff changeset
  1314
0df70b8735e3 Update Twitter bootstrap to 3.2.0
Vincent Tondellier <tonton+hg@team1664.org>
parents: 1
diff changeset
  1315
  Tooltip.prototype.applyPlacement = function (offset, placement) {
0df70b8735e3 Update Twitter bootstrap to 3.2.0
Vincent Tondellier <tonton+hg@team1664.org>
parents: 1
diff changeset
  1316
    var $tip   = this.tip()
0df70b8735e3 Update Twitter bootstrap to 3.2.0
Vincent Tondellier <tonton+hg@team1664.org>
parents: 1
diff changeset
  1317
    var width  = $tip[0].offsetWidth
0df70b8735e3 Update Twitter bootstrap to 3.2.0
Vincent Tondellier <tonton+hg@team1664.org>
parents: 1
diff changeset
  1318
    var height = $tip[0].offsetHeight
0df70b8735e3 Update Twitter bootstrap to 3.2.0
Vincent Tondellier <tonton+hg@team1664.org>
parents: 1
diff changeset
  1319
0df70b8735e3 Update Twitter bootstrap to 3.2.0
Vincent Tondellier <tonton+hg@team1664.org>
parents: 1
diff changeset
  1320
    // manually read margins because getBoundingClientRect includes difference
0df70b8735e3 Update Twitter bootstrap to 3.2.0
Vincent Tondellier <tonton+hg@team1664.org>
parents: 1
diff changeset
  1321
    var marginTop = parseInt($tip.css('margin-top'), 10)
0df70b8735e3 Update Twitter bootstrap to 3.2.0
Vincent Tondellier <tonton+hg@team1664.org>
parents: 1
diff changeset
  1322
    var marginLeft = parseInt($tip.css('margin-left'), 10)
0df70b8735e3 Update Twitter bootstrap to 3.2.0
Vincent Tondellier <tonton+hg@team1664.org>
parents: 1
diff changeset
  1323
0df70b8735e3 Update Twitter bootstrap to 3.2.0
Vincent Tondellier <tonton+hg@team1664.org>
parents: 1
diff changeset
  1324
    // we must check for NaN for ie 8/9
0df70b8735e3 Update Twitter bootstrap to 3.2.0
Vincent Tondellier <tonton+hg@team1664.org>
parents: 1
diff changeset
  1325
    if (isNaN(marginTop))  marginTop  = 0
0df70b8735e3 Update Twitter bootstrap to 3.2.0
Vincent Tondellier <tonton+hg@team1664.org>
parents: 1
diff changeset
  1326
    if (isNaN(marginLeft)) marginLeft = 0
0df70b8735e3 Update Twitter bootstrap to 3.2.0
Vincent Tondellier <tonton+hg@team1664.org>
parents: 1
diff changeset
  1327
0df70b8735e3 Update Twitter bootstrap to 3.2.0
Vincent Tondellier <tonton+hg@team1664.org>
parents: 1
diff changeset
  1328
    offset.top  = offset.top  + marginTop
0df70b8735e3 Update Twitter bootstrap to 3.2.0
Vincent Tondellier <tonton+hg@team1664.org>
parents: 1
diff changeset
  1329
    offset.left = offset.left + marginLeft
0df70b8735e3 Update Twitter bootstrap to 3.2.0
Vincent Tondellier <tonton+hg@team1664.org>
parents: 1
diff changeset
  1330
0df70b8735e3 Update Twitter bootstrap to 3.2.0
Vincent Tondellier <tonton+hg@team1664.org>
parents: 1
diff changeset
  1331
    // $.fn.offset doesn't round pixel values
0df70b8735e3 Update Twitter bootstrap to 3.2.0
Vincent Tondellier <tonton+hg@team1664.org>
parents: 1
diff changeset
  1332
    // so we use setOffset directly with our own function B-0
0df70b8735e3 Update Twitter bootstrap to 3.2.0
Vincent Tondellier <tonton+hg@team1664.org>
parents: 1
diff changeset
  1333
    $.offset.setOffset($tip[0], $.extend({
0df70b8735e3 Update Twitter bootstrap to 3.2.0
Vincent Tondellier <tonton+hg@team1664.org>
parents: 1
diff changeset
  1334
      using: function (props) {
0df70b8735e3 Update Twitter bootstrap to 3.2.0
Vincent Tondellier <tonton+hg@team1664.org>
parents: 1
diff changeset
  1335
        $tip.css({
0df70b8735e3 Update Twitter bootstrap to 3.2.0
Vincent Tondellier <tonton+hg@team1664.org>
parents: 1
diff changeset
  1336
          top: Math.round(props.top),
0df70b8735e3 Update Twitter bootstrap to 3.2.0
Vincent Tondellier <tonton+hg@team1664.org>
parents: 1
diff changeset
  1337
          left: Math.round(props.left)
0df70b8735e3 Update Twitter bootstrap to 3.2.0
Vincent Tondellier <tonton+hg@team1664.org>
parents: 1
diff changeset
  1338
        })
0df70b8735e3 Update Twitter bootstrap to 3.2.0
Vincent Tondellier <tonton+hg@team1664.org>
parents: 1
diff changeset
  1339
      }
0df70b8735e3 Update Twitter bootstrap to 3.2.0
Vincent Tondellier <tonton+hg@team1664.org>
parents: 1
diff changeset
  1340
    }, offset), 0)
0df70b8735e3 Update Twitter bootstrap to 3.2.0
Vincent Tondellier <tonton+hg@team1664.org>
parents: 1
diff changeset
  1341
0df70b8735e3 Update Twitter bootstrap to 3.2.0
Vincent Tondellier <tonton+hg@team1664.org>
parents: 1
diff changeset
  1342
    $tip.addClass('in')
0df70b8735e3 Update Twitter bootstrap to 3.2.0
Vincent Tondellier <tonton+hg@team1664.org>
parents: 1
diff changeset
  1343
0df70b8735e3 Update Twitter bootstrap to 3.2.0
Vincent Tondellier <tonton+hg@team1664.org>
parents: 1
diff changeset
  1344
    // check to see if placing tip in new offset caused the tip to resize itself
0df70b8735e3 Update Twitter bootstrap to 3.2.0
Vincent Tondellier <tonton+hg@team1664.org>
parents: 1
diff changeset
  1345
    var actualWidth  = $tip[0].offsetWidth
0df70b8735e3 Update Twitter bootstrap to 3.2.0
Vincent Tondellier <tonton+hg@team1664.org>
parents: 1
diff changeset
  1346
    var actualHeight = $tip[0].offsetHeight
0df70b8735e3 Update Twitter bootstrap to 3.2.0
Vincent Tondellier <tonton+hg@team1664.org>
parents: 1
diff changeset
  1347
0df70b8735e3 Update Twitter bootstrap to 3.2.0
Vincent Tondellier <tonton+hg@team1664.org>
parents: 1
diff changeset
  1348
    if (placement == 'top' && actualHeight != height) {
0df70b8735e3 Update Twitter bootstrap to 3.2.0
Vincent Tondellier <tonton+hg@team1664.org>
parents: 1
diff changeset
  1349
      offset.top = offset.top + height - actualHeight
0
5b78b8c79d9c Initial commit
Vincent Tondellier <tonton+hg@team1664.org>
parents:
diff changeset
  1350
    }
5b78b8c79d9c Initial commit
Vincent Tondellier <tonton+hg@team1664.org>
parents:
diff changeset
  1351
28
0df70b8735e3 Update Twitter bootstrap to 3.2.0
Vincent Tondellier <tonton+hg@team1664.org>
parents: 1
diff changeset
  1352
    var delta = this.getViewportAdjustedDelta(placement, offset, actualWidth, actualHeight)
0df70b8735e3 Update Twitter bootstrap to 3.2.0
Vincent Tondellier <tonton+hg@team1664.org>
parents: 1
diff changeset
  1353
0df70b8735e3 Update Twitter bootstrap to 3.2.0
Vincent Tondellier <tonton+hg@team1664.org>
parents: 1
diff changeset
  1354
    if (delta.left) offset.left += delta.left
0df70b8735e3 Update Twitter bootstrap to 3.2.0
Vincent Tondellier <tonton+hg@team1664.org>
parents: 1
diff changeset
  1355
    else offset.top += delta.top
0df70b8735e3 Update Twitter bootstrap to 3.2.0
Vincent Tondellier <tonton+hg@team1664.org>
parents: 1
diff changeset
  1356
0df70b8735e3 Update Twitter bootstrap to 3.2.0
Vincent Tondellier <tonton+hg@team1664.org>
parents: 1
diff changeset
  1357
    var arrowDelta          = delta.left ? delta.left * 2 - width + actualWidth : delta.top * 2 - height + actualHeight
0df70b8735e3 Update Twitter bootstrap to 3.2.0
Vincent Tondellier <tonton+hg@team1664.org>
parents: 1
diff changeset
  1358
    var arrowPosition       = delta.left ? 'left'        : 'top'
0df70b8735e3 Update Twitter bootstrap to 3.2.0
Vincent Tondellier <tonton+hg@team1664.org>
parents: 1
diff changeset
  1359
    var arrowOffsetPosition = delta.left ? 'offsetWidth' : 'offsetHeight'
0df70b8735e3 Update Twitter bootstrap to 3.2.0
Vincent Tondellier <tonton+hg@team1664.org>
parents: 1
diff changeset
  1360
0df70b8735e3 Update Twitter bootstrap to 3.2.0
Vincent Tondellier <tonton+hg@team1664.org>
parents: 1
diff changeset
  1361
    $tip.offset(offset)
0df70b8735e3 Update Twitter bootstrap to 3.2.0
Vincent Tondellier <tonton+hg@team1664.org>
parents: 1
diff changeset
  1362
    this.replaceArrow(arrowDelta, $tip[0][arrowOffsetPosition], arrowPosition)
0df70b8735e3 Update Twitter bootstrap to 3.2.0
Vincent Tondellier <tonton+hg@team1664.org>
parents: 1
diff changeset
  1363
  }
0df70b8735e3 Update Twitter bootstrap to 3.2.0
Vincent Tondellier <tonton+hg@team1664.org>
parents: 1
diff changeset
  1364
0df70b8735e3 Update Twitter bootstrap to 3.2.0
Vincent Tondellier <tonton+hg@team1664.org>
parents: 1
diff changeset
  1365
  Tooltip.prototype.replaceArrow = function (delta, dimension, position) {
0df70b8735e3 Update Twitter bootstrap to 3.2.0
Vincent Tondellier <tonton+hg@team1664.org>
parents: 1
diff changeset
  1366
    this.arrow().css(position, delta ? (50 * (1 - delta / dimension) + '%') : '')
0df70b8735e3 Update Twitter bootstrap to 3.2.0
Vincent Tondellier <tonton+hg@team1664.org>
parents: 1
diff changeset
  1367
  }
0df70b8735e3 Update Twitter bootstrap to 3.2.0
Vincent Tondellier <tonton+hg@team1664.org>
parents: 1
diff changeset
  1368
0df70b8735e3 Update Twitter bootstrap to 3.2.0
Vincent Tondellier <tonton+hg@team1664.org>
parents: 1
diff changeset
  1369
  Tooltip.prototype.setContent = function () {
0df70b8735e3 Update Twitter bootstrap to 3.2.0
Vincent Tondellier <tonton+hg@team1664.org>
parents: 1
diff changeset
  1370
    var $tip  = this.tip()
0df70b8735e3 Update Twitter bootstrap to 3.2.0
Vincent Tondellier <tonton+hg@team1664.org>
parents: 1
diff changeset
  1371
    var title = this.getTitle()
0df70b8735e3 Update Twitter bootstrap to 3.2.0
Vincent Tondellier <tonton+hg@team1664.org>
parents: 1
diff changeset
  1372
0df70b8735e3 Update Twitter bootstrap to 3.2.0
Vincent Tondellier <tonton+hg@team1664.org>
parents: 1
diff changeset
  1373
    $tip.find('.tooltip-inner')[this.options.html ? 'html' : 'text'](title)
0df70b8735e3 Update Twitter bootstrap to 3.2.0
Vincent Tondellier <tonton+hg@team1664.org>
parents: 1
diff changeset
  1374
    $tip.removeClass('fade in top bottom left right')
0df70b8735e3 Update Twitter bootstrap to 3.2.0
Vincent Tondellier <tonton+hg@team1664.org>
parents: 1
diff changeset
  1375
  }
0df70b8735e3 Update Twitter bootstrap to 3.2.0
Vincent Tondellier <tonton+hg@team1664.org>
parents: 1
diff changeset
  1376
0df70b8735e3 Update Twitter bootstrap to 3.2.0
Vincent Tondellier <tonton+hg@team1664.org>
parents: 1
diff changeset
  1377
  Tooltip.prototype.hide = function () {
0df70b8735e3 Update Twitter bootstrap to 3.2.0
Vincent Tondellier <tonton+hg@team1664.org>
parents: 1
diff changeset
  1378
    var that = this
0df70b8735e3 Update Twitter bootstrap to 3.2.0
Vincent Tondellier <tonton+hg@team1664.org>
parents: 1
diff changeset
  1379
    var $tip = this.tip()
0df70b8735e3 Update Twitter bootstrap to 3.2.0
Vincent Tondellier <tonton+hg@team1664.org>
parents: 1
diff changeset
  1380
    var e    = $.Event('hide.bs.' + this.type)
0df70b8735e3 Update Twitter bootstrap to 3.2.0
Vincent Tondellier <tonton+hg@team1664.org>
parents: 1
diff changeset
  1381
0df70b8735e3 Update Twitter bootstrap to 3.2.0
Vincent Tondellier <tonton+hg@team1664.org>
parents: 1
diff changeset
  1382
    this.$element.removeAttr('aria-describedby')
0df70b8735e3 Update Twitter bootstrap to 3.2.0
Vincent Tondellier <tonton+hg@team1664.org>
parents: 1
diff changeset
  1383
0df70b8735e3 Update Twitter bootstrap to 3.2.0
Vincent Tondellier <tonton+hg@team1664.org>
parents: 1
diff changeset
  1384
    function complete() {
0df70b8735e3 Update Twitter bootstrap to 3.2.0
Vincent Tondellier <tonton+hg@team1664.org>
parents: 1
diff changeset
  1385
      if (that.hoverState != 'in') $tip.detach()
0df70b8735e3 Update Twitter bootstrap to 3.2.0
Vincent Tondellier <tonton+hg@team1664.org>
parents: 1
diff changeset
  1386
      that.$element.trigger('hidden.bs.' + that.type)
0df70b8735e3 Update Twitter bootstrap to 3.2.0
Vincent Tondellier <tonton+hg@team1664.org>
parents: 1
diff changeset
  1387
    }
0df70b8735e3 Update Twitter bootstrap to 3.2.0
Vincent Tondellier <tonton+hg@team1664.org>
parents: 1
diff changeset
  1388
0df70b8735e3 Update Twitter bootstrap to 3.2.0
Vincent Tondellier <tonton+hg@team1664.org>
parents: 1
diff changeset
  1389
    this.$element.trigger(e)
0df70b8735e3 Update Twitter bootstrap to 3.2.0
Vincent Tondellier <tonton+hg@team1664.org>
parents: 1
diff changeset
  1390
0df70b8735e3 Update Twitter bootstrap to 3.2.0
Vincent Tondellier <tonton+hg@team1664.org>
parents: 1
diff changeset
  1391
    if (e.isDefaultPrevented()) return
0df70b8735e3 Update Twitter bootstrap to 3.2.0
Vincent Tondellier <tonton+hg@team1664.org>
parents: 1
diff changeset
  1392
0df70b8735e3 Update Twitter bootstrap to 3.2.0
Vincent Tondellier <tonton+hg@team1664.org>
parents: 1
diff changeset
  1393
    $tip.removeClass('in')
0df70b8735e3 Update Twitter bootstrap to 3.2.0
Vincent Tondellier <tonton+hg@team1664.org>
parents: 1
diff changeset
  1394
0df70b8735e3 Update Twitter bootstrap to 3.2.0
Vincent Tondellier <tonton+hg@team1664.org>
parents: 1
diff changeset
  1395
    $.support.transition && this.$tip.hasClass('fade') ?
0df70b8735e3 Update Twitter bootstrap to 3.2.0
Vincent Tondellier <tonton+hg@team1664.org>
parents: 1
diff changeset
  1396
      $tip
0df70b8735e3 Update Twitter bootstrap to 3.2.0
Vincent Tondellier <tonton+hg@team1664.org>
parents: 1
diff changeset
  1397
        .one('bsTransitionEnd', complete)
0df70b8735e3 Update Twitter bootstrap to 3.2.0
Vincent Tondellier <tonton+hg@team1664.org>
parents: 1
diff changeset
  1398
        .emulateTransitionEnd(150) :
0df70b8735e3 Update Twitter bootstrap to 3.2.0
Vincent Tondellier <tonton+hg@team1664.org>
parents: 1
diff changeset
  1399
      complete()
0df70b8735e3 Update Twitter bootstrap to 3.2.0
Vincent Tondellier <tonton+hg@team1664.org>
parents: 1
diff changeset
  1400
0df70b8735e3 Update Twitter bootstrap to 3.2.0
Vincent Tondellier <tonton+hg@team1664.org>
parents: 1
diff changeset
  1401
    this.hoverState = null
0df70b8735e3 Update Twitter bootstrap to 3.2.0
Vincent Tondellier <tonton+hg@team1664.org>
parents: 1
diff changeset
  1402
0df70b8735e3 Update Twitter bootstrap to 3.2.0
Vincent Tondellier <tonton+hg@team1664.org>
parents: 1
diff changeset
  1403
    return this
0df70b8735e3 Update Twitter bootstrap to 3.2.0
Vincent Tondellier <tonton+hg@team1664.org>
parents: 1
diff changeset
  1404
  }
0df70b8735e3 Update Twitter bootstrap to 3.2.0
Vincent Tondellier <tonton+hg@team1664.org>
parents: 1
diff changeset
  1405
0df70b8735e3 Update Twitter bootstrap to 3.2.0
Vincent Tondellier <tonton+hg@team1664.org>
parents: 1
diff changeset
  1406
  Tooltip.prototype.fixTitle = function () {
0df70b8735e3 Update Twitter bootstrap to 3.2.0
Vincent Tondellier <tonton+hg@team1664.org>
parents: 1
diff changeset
  1407
    var $e = this.$element
0df70b8735e3 Update Twitter bootstrap to 3.2.0
Vincent Tondellier <tonton+hg@team1664.org>
parents: 1
diff changeset
  1408
    if ($e.attr('title') || typeof ($e.attr('data-original-title')) != 'string') {
0df70b8735e3 Update Twitter bootstrap to 3.2.0
Vincent Tondellier <tonton+hg@team1664.org>
parents: 1
diff changeset
  1409
      $e.attr('data-original-title', $e.attr('title') || '').attr('title', '')
0df70b8735e3 Update Twitter bootstrap to 3.2.0
Vincent Tondellier <tonton+hg@team1664.org>
parents: 1
diff changeset
  1410
    }
0df70b8735e3 Update Twitter bootstrap to 3.2.0
Vincent Tondellier <tonton+hg@team1664.org>
parents: 1
diff changeset
  1411
  }
0df70b8735e3 Update Twitter bootstrap to 3.2.0
Vincent Tondellier <tonton+hg@team1664.org>
parents: 1
diff changeset
  1412
0df70b8735e3 Update Twitter bootstrap to 3.2.0
Vincent Tondellier <tonton+hg@team1664.org>
parents: 1
diff changeset
  1413
  Tooltip.prototype.hasContent = function () {
0df70b8735e3 Update Twitter bootstrap to 3.2.0
Vincent Tondellier <tonton+hg@team1664.org>
parents: 1
diff changeset
  1414
    return this.getTitle()
0df70b8735e3 Update Twitter bootstrap to 3.2.0
Vincent Tondellier <tonton+hg@team1664.org>
parents: 1
diff changeset
  1415
  }
0df70b8735e3 Update Twitter bootstrap to 3.2.0
Vincent Tondellier <tonton+hg@team1664.org>
parents: 1
diff changeset
  1416
0df70b8735e3 Update Twitter bootstrap to 3.2.0
Vincent Tondellier <tonton+hg@team1664.org>
parents: 1
diff changeset
  1417
  Tooltip.prototype.getPosition = function ($element) {
0df70b8735e3 Update Twitter bootstrap to 3.2.0
Vincent Tondellier <tonton+hg@team1664.org>
parents: 1
diff changeset
  1418
    $element   = $element || this.$element
0df70b8735e3 Update Twitter bootstrap to 3.2.0
Vincent Tondellier <tonton+hg@team1664.org>
parents: 1
diff changeset
  1419
    var el     = $element[0]
0df70b8735e3 Update Twitter bootstrap to 3.2.0
Vincent Tondellier <tonton+hg@team1664.org>
parents: 1
diff changeset
  1420
    var isBody = el.tagName == 'BODY'
0df70b8735e3 Update Twitter bootstrap to 3.2.0
Vincent Tondellier <tonton+hg@team1664.org>
parents: 1
diff changeset
  1421
    return $.extend({}, (typeof el.getBoundingClientRect == 'function') ? el.getBoundingClientRect() : null, {
0df70b8735e3 Update Twitter bootstrap to 3.2.0
Vincent Tondellier <tonton+hg@team1664.org>
parents: 1
diff changeset
  1422
      scroll: isBody ? document.documentElement.scrollTop || document.body.scrollTop : $element.scrollTop(),
0df70b8735e3 Update Twitter bootstrap to 3.2.0
Vincent Tondellier <tonton+hg@team1664.org>
parents: 1
diff changeset
  1423
      width:  isBody ? $(window).width()  : $element.outerWidth(),
0df70b8735e3 Update Twitter bootstrap to 3.2.0
Vincent Tondellier <tonton+hg@team1664.org>
parents: 1
diff changeset
  1424
      height: isBody ? $(window).height() : $element.outerHeight()
0df70b8735e3 Update Twitter bootstrap to 3.2.0
Vincent Tondellier <tonton+hg@team1664.org>
parents: 1
diff changeset
  1425
    }, isBody ? { top: 0, left: 0 } : $element.offset())
0df70b8735e3 Update Twitter bootstrap to 3.2.0
Vincent Tondellier <tonton+hg@team1664.org>
parents: 1
diff changeset
  1426
  }
0df70b8735e3 Update Twitter bootstrap to 3.2.0
Vincent Tondellier <tonton+hg@team1664.org>
parents: 1
diff changeset
  1427
0df70b8735e3 Update Twitter bootstrap to 3.2.0
Vincent Tondellier <tonton+hg@team1664.org>
parents: 1
diff changeset
  1428
  Tooltip.prototype.getCalculatedOffset = function (placement, pos, actualWidth, actualHeight) {
0df70b8735e3 Update Twitter bootstrap to 3.2.0
Vincent Tondellier <tonton+hg@team1664.org>
parents: 1
diff changeset
  1429
    return placement == 'bottom' ? { top: pos.top + pos.height,   left: pos.left + pos.width / 2 - actualWidth / 2  } :
0df70b8735e3 Update Twitter bootstrap to 3.2.0
Vincent Tondellier <tonton+hg@team1664.org>
parents: 1
diff changeset
  1430
           placement == 'top'    ? { top: pos.top - actualHeight, left: pos.left + pos.width / 2 - actualWidth / 2  } :
0df70b8735e3 Update Twitter bootstrap to 3.2.0
Vincent Tondellier <tonton+hg@team1664.org>
parents: 1
diff changeset
  1431
           placement == 'left'   ? { top: pos.top + pos.height / 2 - actualHeight / 2, left: pos.left - actualWidth } :
0df70b8735e3 Update Twitter bootstrap to 3.2.0
Vincent Tondellier <tonton+hg@team1664.org>
parents: 1
diff changeset
  1432
        /* placement == 'right' */ { top: pos.top + pos.height / 2 - actualHeight / 2, left: pos.left + pos.width   }
0df70b8735e3 Update Twitter bootstrap to 3.2.0
Vincent Tondellier <tonton+hg@team1664.org>
parents: 1
diff changeset
  1433
0
5b78b8c79d9c Initial commit
Vincent Tondellier <tonton+hg@team1664.org>
parents:
diff changeset
  1434
  }
5b78b8c79d9c Initial commit
Vincent Tondellier <tonton+hg@team1664.org>
parents:
diff changeset
  1435
28
0df70b8735e3 Update Twitter bootstrap to 3.2.0
Vincent Tondellier <tonton+hg@team1664.org>
parents: 1
diff changeset
  1436
  Tooltip.prototype.getViewportAdjustedDelta = function (placement, pos, actualWidth, actualHeight) {
0df70b8735e3 Update Twitter bootstrap to 3.2.0
Vincent Tondellier <tonton+hg@team1664.org>
parents: 1
diff changeset
  1437
    var delta = { top: 0, left: 0 }
0df70b8735e3 Update Twitter bootstrap to 3.2.0
Vincent Tondellier <tonton+hg@team1664.org>
parents: 1
diff changeset
  1438
    if (!this.$viewport) return delta
0df70b8735e3 Update Twitter bootstrap to 3.2.0
Vincent Tondellier <tonton+hg@team1664.org>
parents: 1
diff changeset
  1439
0df70b8735e3 Update Twitter bootstrap to 3.2.0
Vincent Tondellier <tonton+hg@team1664.org>
parents: 1
diff changeset
  1440
    var viewportPadding = this.options.viewport && this.options.viewport.padding || 0
0df70b8735e3 Update Twitter bootstrap to 3.2.0
Vincent Tondellier <tonton+hg@team1664.org>
parents: 1
diff changeset
  1441
    var viewportDimensions = this.getPosition(this.$viewport)
0df70b8735e3 Update Twitter bootstrap to 3.2.0
Vincent Tondellier <tonton+hg@team1664.org>
parents: 1
diff changeset
  1442
0df70b8735e3 Update Twitter bootstrap to 3.2.0
Vincent Tondellier <tonton+hg@team1664.org>
parents: 1
diff changeset
  1443
    if (/right|left/.test(placement)) {
0df70b8735e3 Update Twitter bootstrap to 3.2.0
Vincent Tondellier <tonton+hg@team1664.org>
parents: 1
diff changeset
  1444
      var topEdgeOffset    = pos.top - viewportPadding - viewportDimensions.scroll
0df70b8735e3 Update Twitter bootstrap to 3.2.0
Vincent Tondellier <tonton+hg@team1664.org>
parents: 1
diff changeset
  1445
      var bottomEdgeOffset = pos.top + viewportPadding - viewportDimensions.scroll + actualHeight
0df70b8735e3 Update Twitter bootstrap to 3.2.0
Vincent Tondellier <tonton+hg@team1664.org>
parents: 1
diff changeset
  1446
      if (topEdgeOffset < viewportDimensions.top) { // top overflow
0df70b8735e3 Update Twitter bootstrap to 3.2.0
Vincent Tondellier <tonton+hg@team1664.org>
parents: 1
diff changeset
  1447
        delta.top = viewportDimensions.top - topEdgeOffset
0df70b8735e3 Update Twitter bootstrap to 3.2.0
Vincent Tondellier <tonton+hg@team1664.org>
parents: 1
diff changeset
  1448
      } else if (bottomEdgeOffset > viewportDimensions.top + viewportDimensions.height) { // bottom overflow
0df70b8735e3 Update Twitter bootstrap to 3.2.0
Vincent Tondellier <tonton+hg@team1664.org>
parents: 1
diff changeset
  1449
        delta.top = viewportDimensions.top + viewportDimensions.height - bottomEdgeOffset
0df70b8735e3 Update Twitter bootstrap to 3.2.0
Vincent Tondellier <tonton+hg@team1664.org>
parents: 1
diff changeset
  1450
      }
0df70b8735e3 Update Twitter bootstrap to 3.2.0
Vincent Tondellier <tonton+hg@team1664.org>
parents: 1
diff changeset
  1451
    } else {
0df70b8735e3 Update Twitter bootstrap to 3.2.0
Vincent Tondellier <tonton+hg@team1664.org>
parents: 1
diff changeset
  1452
      var leftEdgeOffset  = pos.left - viewportPadding
0df70b8735e3 Update Twitter bootstrap to 3.2.0
Vincent Tondellier <tonton+hg@team1664.org>
parents: 1
diff changeset
  1453
      var rightEdgeOffset = pos.left + viewportPadding + actualWidth
0df70b8735e3 Update Twitter bootstrap to 3.2.0
Vincent Tondellier <tonton+hg@team1664.org>
parents: 1
diff changeset
  1454
      if (leftEdgeOffset < viewportDimensions.left) { // left overflow
0df70b8735e3 Update Twitter bootstrap to 3.2.0
Vincent Tondellier <tonton+hg@team1664.org>
parents: 1
diff changeset
  1455
        delta.left = viewportDimensions.left - leftEdgeOffset
0df70b8735e3 Update Twitter bootstrap to 3.2.0
Vincent Tondellier <tonton+hg@team1664.org>
parents: 1
diff changeset
  1456
      } else if (rightEdgeOffset > viewportDimensions.width) { // right overflow
0df70b8735e3 Update Twitter bootstrap to 3.2.0
Vincent Tondellier <tonton+hg@team1664.org>
parents: 1
diff changeset
  1457
        delta.left = viewportDimensions.left + viewportDimensions.width - rightEdgeOffset
0df70b8735e3 Update Twitter bootstrap to 3.2.0
Vincent Tondellier <tonton+hg@team1664.org>
parents: 1
diff changeset
  1458
      }
0df70b8735e3 Update Twitter bootstrap to 3.2.0
Vincent Tondellier <tonton+hg@team1664.org>
parents: 1
diff changeset
  1459
    }
0df70b8735e3 Update Twitter bootstrap to 3.2.0
Vincent Tondellier <tonton+hg@team1664.org>
parents: 1
diff changeset
  1460
0df70b8735e3 Update Twitter bootstrap to 3.2.0
Vincent Tondellier <tonton+hg@team1664.org>
parents: 1
diff changeset
  1461
    return delta
0df70b8735e3 Update Twitter bootstrap to 3.2.0
Vincent Tondellier <tonton+hg@team1664.org>
parents: 1
diff changeset
  1462
  }
0df70b8735e3 Update Twitter bootstrap to 3.2.0
Vincent Tondellier <tonton+hg@team1664.org>
parents: 1
diff changeset
  1463
0df70b8735e3 Update Twitter bootstrap to 3.2.0
Vincent Tondellier <tonton+hg@team1664.org>
parents: 1
diff changeset
  1464
  Tooltip.prototype.getTitle = function () {
0df70b8735e3 Update Twitter bootstrap to 3.2.0
Vincent Tondellier <tonton+hg@team1664.org>
parents: 1
diff changeset
  1465
    var title
0df70b8735e3 Update Twitter bootstrap to 3.2.0
Vincent Tondellier <tonton+hg@team1664.org>
parents: 1
diff changeset
  1466
    var $e = this.$element
0df70b8735e3 Update Twitter bootstrap to 3.2.0
Vincent Tondellier <tonton+hg@team1664.org>
parents: 1
diff changeset
  1467
    var o  = this.options
0df70b8735e3 Update Twitter bootstrap to 3.2.0
Vincent Tondellier <tonton+hg@team1664.org>
parents: 1
diff changeset
  1468
0df70b8735e3 Update Twitter bootstrap to 3.2.0
Vincent Tondellier <tonton+hg@team1664.org>
parents: 1
diff changeset
  1469
    title = $e.attr('data-original-title')
0df70b8735e3 Update Twitter bootstrap to 3.2.0
Vincent Tondellier <tonton+hg@team1664.org>
parents: 1
diff changeset
  1470
      || (typeof o.title == 'function' ? o.title.call($e[0]) :  o.title)
0df70b8735e3 Update Twitter bootstrap to 3.2.0
Vincent Tondellier <tonton+hg@team1664.org>
parents: 1
diff changeset
  1471
0df70b8735e3 Update Twitter bootstrap to 3.2.0
Vincent Tondellier <tonton+hg@team1664.org>
parents: 1
diff changeset
  1472
    return title
0df70b8735e3 Update Twitter bootstrap to 3.2.0
Vincent Tondellier <tonton+hg@team1664.org>
parents: 1
diff changeset
  1473
  }
0df70b8735e3 Update Twitter bootstrap to 3.2.0
Vincent Tondellier <tonton+hg@team1664.org>
parents: 1
diff changeset
  1474
0df70b8735e3 Update Twitter bootstrap to 3.2.0
Vincent Tondellier <tonton+hg@team1664.org>
parents: 1
diff changeset
  1475
  Tooltip.prototype.getUID = function (prefix) {
0df70b8735e3 Update Twitter bootstrap to 3.2.0
Vincent Tondellier <tonton+hg@team1664.org>
parents: 1
diff changeset
  1476
    do prefix += ~~(Math.random() * 1000000)
0df70b8735e3 Update Twitter bootstrap to 3.2.0
Vincent Tondellier <tonton+hg@team1664.org>
parents: 1
diff changeset
  1477
    while (document.getElementById(prefix))
0df70b8735e3 Update Twitter bootstrap to 3.2.0
Vincent Tondellier <tonton+hg@team1664.org>
parents: 1
diff changeset
  1478
    return prefix
0df70b8735e3 Update Twitter bootstrap to 3.2.0
Vincent Tondellier <tonton+hg@team1664.org>
parents: 1
diff changeset
  1479
  }
0df70b8735e3 Update Twitter bootstrap to 3.2.0
Vincent Tondellier <tonton+hg@team1664.org>
parents: 1
diff changeset
  1480
0df70b8735e3 Update Twitter bootstrap to 3.2.0
Vincent Tondellier <tonton+hg@team1664.org>
parents: 1
diff changeset
  1481
  Tooltip.prototype.tip = function () {
0df70b8735e3 Update Twitter bootstrap to 3.2.0
Vincent Tondellier <tonton+hg@team1664.org>
parents: 1
diff changeset
  1482
    return (this.$tip = this.$tip || $(this.options.template))
0df70b8735e3 Update Twitter bootstrap to 3.2.0
Vincent Tondellier <tonton+hg@team1664.org>
parents: 1
diff changeset
  1483
  }
0df70b8735e3 Update Twitter bootstrap to 3.2.0
Vincent Tondellier <tonton+hg@team1664.org>
parents: 1
diff changeset
  1484
0df70b8735e3 Update Twitter bootstrap to 3.2.0
Vincent Tondellier <tonton+hg@team1664.org>
parents: 1
diff changeset
  1485
  Tooltip.prototype.arrow = function () {
0df70b8735e3 Update Twitter bootstrap to 3.2.0
Vincent Tondellier <tonton+hg@team1664.org>
parents: 1
diff changeset
  1486
    return (this.$arrow = this.$arrow || this.tip().find('.tooltip-arrow'))
0df70b8735e3 Update Twitter bootstrap to 3.2.0
Vincent Tondellier <tonton+hg@team1664.org>
parents: 1
diff changeset
  1487
  }
0df70b8735e3 Update Twitter bootstrap to 3.2.0
Vincent Tondellier <tonton+hg@team1664.org>
parents: 1
diff changeset
  1488
0df70b8735e3 Update Twitter bootstrap to 3.2.0
Vincent Tondellier <tonton+hg@team1664.org>
parents: 1
diff changeset
  1489
  Tooltip.prototype.validate = function () {
0df70b8735e3 Update Twitter bootstrap to 3.2.0
Vincent Tondellier <tonton+hg@team1664.org>
parents: 1
diff changeset
  1490
    if (!this.$element[0].parentNode) {
0df70b8735e3 Update Twitter bootstrap to 3.2.0
Vincent Tondellier <tonton+hg@team1664.org>
parents: 1
diff changeset
  1491
      this.hide()
0df70b8735e3 Update Twitter bootstrap to 3.2.0
Vincent Tondellier <tonton+hg@team1664.org>
parents: 1
diff changeset
  1492
      this.$element = null
0df70b8735e3 Update Twitter bootstrap to 3.2.0
Vincent Tondellier <tonton+hg@team1664.org>
parents: 1
diff changeset
  1493
      this.options  = null
0df70b8735e3 Update Twitter bootstrap to 3.2.0
Vincent Tondellier <tonton+hg@team1664.org>
parents: 1
diff changeset
  1494
    }
0df70b8735e3 Update Twitter bootstrap to 3.2.0
Vincent Tondellier <tonton+hg@team1664.org>
parents: 1
diff changeset
  1495
  }
0df70b8735e3 Update Twitter bootstrap to 3.2.0
Vincent Tondellier <tonton+hg@team1664.org>
parents: 1
diff changeset
  1496
0df70b8735e3 Update Twitter bootstrap to 3.2.0
Vincent Tondellier <tonton+hg@team1664.org>
parents: 1
diff changeset
  1497
  Tooltip.prototype.enable = function () {
0df70b8735e3 Update Twitter bootstrap to 3.2.0
Vincent Tondellier <tonton+hg@team1664.org>
parents: 1
diff changeset
  1498
    this.enabled = true
0df70b8735e3 Update Twitter bootstrap to 3.2.0
Vincent Tondellier <tonton+hg@team1664.org>
parents: 1
diff changeset
  1499
  }
0df70b8735e3 Update Twitter bootstrap to 3.2.0
Vincent Tondellier <tonton+hg@team1664.org>
parents: 1
diff changeset
  1500
0df70b8735e3 Update Twitter bootstrap to 3.2.0
Vincent Tondellier <tonton+hg@team1664.org>
parents: 1
diff changeset
  1501
  Tooltip.prototype.disable = function () {
0df70b8735e3 Update Twitter bootstrap to 3.2.0
Vincent Tondellier <tonton+hg@team1664.org>
parents: 1
diff changeset
  1502
    this.enabled = false
0df70b8735e3 Update Twitter bootstrap to 3.2.0
Vincent Tondellier <tonton+hg@team1664.org>
parents: 1
diff changeset
  1503
  }
0df70b8735e3 Update Twitter bootstrap to 3.2.0
Vincent Tondellier <tonton+hg@team1664.org>
parents: 1
diff changeset
  1504
0df70b8735e3 Update Twitter bootstrap to 3.2.0
Vincent Tondellier <tonton+hg@team1664.org>
parents: 1
diff changeset
  1505
  Tooltip.prototype.toggleEnabled = function () {
0df70b8735e3 Update Twitter bootstrap to 3.2.0
Vincent Tondellier <tonton+hg@team1664.org>
parents: 1
diff changeset
  1506
    this.enabled = !this.enabled
0df70b8735e3 Update Twitter bootstrap to 3.2.0
Vincent Tondellier <tonton+hg@team1664.org>
parents: 1
diff changeset
  1507
  }
0df70b8735e3 Update Twitter bootstrap to 3.2.0
Vincent Tondellier <tonton+hg@team1664.org>
parents: 1
diff changeset
  1508
0df70b8735e3 Update Twitter bootstrap to 3.2.0
Vincent Tondellier <tonton+hg@team1664.org>
parents: 1
diff changeset
  1509
  Tooltip.prototype.toggle = function (e) {
0df70b8735e3 Update Twitter bootstrap to 3.2.0
Vincent Tondellier <tonton+hg@team1664.org>
parents: 1
diff changeset
  1510
    var self = this
0df70b8735e3 Update Twitter bootstrap to 3.2.0
Vincent Tondellier <tonton+hg@team1664.org>
parents: 1
diff changeset
  1511
    if (e) {
0df70b8735e3 Update Twitter bootstrap to 3.2.0
Vincent Tondellier <tonton+hg@team1664.org>
parents: 1
diff changeset
  1512
      self = $(e.currentTarget).data('bs.' + this.type)
0df70b8735e3 Update Twitter bootstrap to 3.2.0
Vincent Tondellier <tonton+hg@team1664.org>
parents: 1
diff changeset
  1513
      if (!self) {
0df70b8735e3 Update Twitter bootstrap to 3.2.0
Vincent Tondellier <tonton+hg@team1664.org>
parents: 1
diff changeset
  1514
        self = new this.constructor(e.currentTarget, this.getDelegateOptions())
0df70b8735e3 Update Twitter bootstrap to 3.2.0
Vincent Tondellier <tonton+hg@team1664.org>
parents: 1
diff changeset
  1515
        $(e.currentTarget).data('bs.' + this.type, self)
0df70b8735e3 Update Twitter bootstrap to 3.2.0
Vincent Tondellier <tonton+hg@team1664.org>
parents: 1
diff changeset
  1516
      }
0df70b8735e3 Update Twitter bootstrap to 3.2.0
Vincent Tondellier <tonton+hg@team1664.org>
parents: 1
diff changeset
  1517
    }
0df70b8735e3 Update Twitter bootstrap to 3.2.0
Vincent Tondellier <tonton+hg@team1664.org>
parents: 1
diff changeset
  1518
0df70b8735e3 Update Twitter bootstrap to 3.2.0
Vincent Tondellier <tonton+hg@team1664.org>
parents: 1
diff changeset
  1519
    self.tip().hasClass('in') ? self.leave(self) : self.enter(self)
0df70b8735e3 Update Twitter bootstrap to 3.2.0
Vincent Tondellier <tonton+hg@team1664.org>
parents: 1
diff changeset
  1520
  }
0df70b8735e3 Update Twitter bootstrap to 3.2.0
Vincent Tondellier <tonton+hg@team1664.org>
parents: 1
diff changeset
  1521
0df70b8735e3 Update Twitter bootstrap to 3.2.0
Vincent Tondellier <tonton+hg@team1664.org>
parents: 1
diff changeset
  1522
  Tooltip.prototype.destroy = function () {
0df70b8735e3 Update Twitter bootstrap to 3.2.0
Vincent Tondellier <tonton+hg@team1664.org>
parents: 1
diff changeset
  1523
    clearTimeout(this.timeout)
0df70b8735e3 Update Twitter bootstrap to 3.2.0
Vincent Tondellier <tonton+hg@team1664.org>
parents: 1
diff changeset
  1524
    this.hide().$element.off('.' + this.type).removeData('bs.' + this.type)
0df70b8735e3 Update Twitter bootstrap to 3.2.0
Vincent Tondellier <tonton+hg@team1664.org>
parents: 1
diff changeset
  1525
  }
0df70b8735e3 Update Twitter bootstrap to 3.2.0
Vincent Tondellier <tonton+hg@team1664.org>
parents: 1
diff changeset
  1526
0df70b8735e3 Update Twitter bootstrap to 3.2.0
Vincent Tondellier <tonton+hg@team1664.org>
parents: 1
diff changeset
  1527
0df70b8735e3 Update Twitter bootstrap to 3.2.0
Vincent Tondellier <tonton+hg@team1664.org>
parents: 1
diff changeset
  1528
  // TOOLTIP PLUGIN DEFINITION
0df70b8735e3 Update Twitter bootstrap to 3.2.0
Vincent Tondellier <tonton+hg@team1664.org>
parents: 1
diff changeset
  1529
  // =========================
0df70b8735e3 Update Twitter bootstrap to 3.2.0
Vincent Tondellier <tonton+hg@team1664.org>
parents: 1
diff changeset
  1530
0df70b8735e3 Update Twitter bootstrap to 3.2.0
Vincent Tondellier <tonton+hg@team1664.org>
parents: 1
diff changeset
  1531
  function Plugin(option) {
0
5b78b8c79d9c Initial commit
Vincent Tondellier <tonton+hg@team1664.org>
parents:
diff changeset
  1532
    return this.each(function () {
28
0df70b8735e3 Update Twitter bootstrap to 3.2.0
Vincent Tondellier <tonton+hg@team1664.org>
parents: 1
diff changeset
  1533
      var $this   = $(this)
0df70b8735e3 Update Twitter bootstrap to 3.2.0
Vincent Tondellier <tonton+hg@team1664.org>
parents: 1
diff changeset
  1534
      var data    = $this.data('bs.tooltip')
0df70b8735e3 Update Twitter bootstrap to 3.2.0
Vincent Tondellier <tonton+hg@team1664.org>
parents: 1
diff changeset
  1535
      var options = typeof option == 'object' && option
0df70b8735e3 Update Twitter bootstrap to 3.2.0
Vincent Tondellier <tonton+hg@team1664.org>
parents: 1
diff changeset
  1536
0df70b8735e3 Update Twitter bootstrap to 3.2.0
Vincent Tondellier <tonton+hg@team1664.org>
parents: 1
diff changeset
  1537
      if (!data && option == 'destroy') return
0df70b8735e3 Update Twitter bootstrap to 3.2.0
Vincent Tondellier <tonton+hg@team1664.org>
parents: 1
diff changeset
  1538
      if (!data) $this.data('bs.tooltip', (data = new Tooltip(this, options)))
0
5b78b8c79d9c Initial commit
Vincent Tondellier <tonton+hg@team1664.org>
parents:
diff changeset
  1539
      if (typeof option == 'string') data[option]()
5b78b8c79d9c Initial commit
Vincent Tondellier <tonton+hg@team1664.org>
parents:
diff changeset
  1540
    })
5b78b8c79d9c Initial commit
Vincent Tondellier <tonton+hg@team1664.org>
parents:
diff changeset
  1541
  }
5b78b8c79d9c Initial commit
Vincent Tondellier <tonton+hg@team1664.org>
parents:
diff changeset
  1542
28
0df70b8735e3 Update Twitter bootstrap to 3.2.0
Vincent Tondellier <tonton+hg@team1664.org>
parents: 1
diff changeset
  1543
  var old = $.fn.tooltip
0df70b8735e3 Update Twitter bootstrap to 3.2.0
Vincent Tondellier <tonton+hg@team1664.org>
parents: 1
diff changeset
  1544
0df70b8735e3 Update Twitter bootstrap to 3.2.0
Vincent Tondellier <tonton+hg@team1664.org>
parents: 1
diff changeset
  1545
  $.fn.tooltip             = Plugin
0df70b8735e3 Update Twitter bootstrap to 3.2.0
Vincent Tondellier <tonton+hg@team1664.org>
parents: 1
diff changeset
  1546
  $.fn.tooltip.Constructor = Tooltip
0df70b8735e3 Update Twitter bootstrap to 3.2.0
Vincent Tondellier <tonton+hg@team1664.org>
parents: 1
diff changeset
  1547
0df70b8735e3 Update Twitter bootstrap to 3.2.0
Vincent Tondellier <tonton+hg@team1664.org>
parents: 1
diff changeset
  1548
0df70b8735e3 Update Twitter bootstrap to 3.2.0
Vincent Tondellier <tonton+hg@team1664.org>
parents: 1
diff changeset
  1549
  // TOOLTIP NO CONFLICT
0df70b8735e3 Update Twitter bootstrap to 3.2.0
Vincent Tondellier <tonton+hg@team1664.org>
parents: 1
diff changeset
  1550
  // ===================
0df70b8735e3 Update Twitter bootstrap to 3.2.0
Vincent Tondellier <tonton+hg@team1664.org>
parents: 1
diff changeset
  1551
0df70b8735e3 Update Twitter bootstrap to 3.2.0
Vincent Tondellier <tonton+hg@team1664.org>
parents: 1
diff changeset
  1552
  $.fn.tooltip.noConflict = function () {
0df70b8735e3 Update Twitter bootstrap to 3.2.0
Vincent Tondellier <tonton+hg@team1664.org>
parents: 1
diff changeset
  1553
    $.fn.tooltip = old
0df70b8735e3 Update Twitter bootstrap to 3.2.0
Vincent Tondellier <tonton+hg@team1664.org>
parents: 1
diff changeset
  1554
    return this
0df70b8735e3 Update Twitter bootstrap to 3.2.0
Vincent Tondellier <tonton+hg@team1664.org>
parents: 1
diff changeset
  1555
  }
0df70b8735e3 Update Twitter bootstrap to 3.2.0
Vincent Tondellier <tonton+hg@team1664.org>
parents: 1
diff changeset
  1556
0df70b8735e3 Update Twitter bootstrap to 3.2.0
Vincent Tondellier <tonton+hg@team1664.org>
parents: 1
diff changeset
  1557
}(jQuery);
0df70b8735e3 Update Twitter bootstrap to 3.2.0
Vincent Tondellier <tonton+hg@team1664.org>
parents: 1
diff changeset
  1558
0df70b8735e3 Update Twitter bootstrap to 3.2.0
Vincent Tondellier <tonton+hg@team1664.org>
parents: 1
diff changeset
  1559
/* ========================================================================
0df70b8735e3 Update Twitter bootstrap to 3.2.0
Vincent Tondellier <tonton+hg@team1664.org>
parents: 1
diff changeset
  1560
 * Bootstrap: popover.js v3.2.0
0df70b8735e3 Update Twitter bootstrap to 3.2.0
Vincent Tondellier <tonton+hg@team1664.org>
parents: 1
diff changeset
  1561
 * http://getbootstrap.com/javascript/#popovers
0df70b8735e3 Update Twitter bootstrap to 3.2.0
Vincent Tondellier <tonton+hg@team1664.org>
parents: 1
diff changeset
  1562
 * ========================================================================
0df70b8735e3 Update Twitter bootstrap to 3.2.0
Vincent Tondellier <tonton+hg@team1664.org>
parents: 1
diff changeset
  1563
 * Copyright 2011-2014 Twitter, Inc.
0df70b8735e3 Update Twitter bootstrap to 3.2.0
Vincent Tondellier <tonton+hg@team1664.org>
parents: 1
diff changeset
  1564
 * Licensed under MIT (https://github.com/twbs/bootstrap/blob/master/LICENSE)
0df70b8735e3 Update Twitter bootstrap to 3.2.0
Vincent Tondellier <tonton+hg@team1664.org>
parents: 1
diff changeset
  1565
 * ======================================================================== */
0df70b8735e3 Update Twitter bootstrap to 3.2.0
Vincent Tondellier <tonton+hg@team1664.org>
parents: 1
diff changeset
  1566
0df70b8735e3 Update Twitter bootstrap to 3.2.0
Vincent Tondellier <tonton+hg@team1664.org>
parents: 1
diff changeset
  1567
0df70b8735e3 Update Twitter bootstrap to 3.2.0
Vincent Tondellier <tonton+hg@team1664.org>
parents: 1
diff changeset
  1568
+function ($) {
0df70b8735e3 Update Twitter bootstrap to 3.2.0
Vincent Tondellier <tonton+hg@team1664.org>
parents: 1
diff changeset
  1569
  'use strict';
0df70b8735e3 Update Twitter bootstrap to 3.2.0
Vincent Tondellier <tonton+hg@team1664.org>
parents: 1
diff changeset
  1570
0df70b8735e3 Update Twitter bootstrap to 3.2.0
Vincent Tondellier <tonton+hg@team1664.org>
parents: 1
diff changeset
  1571
  // POPOVER PUBLIC CLASS DEFINITION
0df70b8735e3 Update Twitter bootstrap to 3.2.0
Vincent Tondellier <tonton+hg@team1664.org>
parents: 1
diff changeset
  1572
  // ===============================
0df70b8735e3 Update Twitter bootstrap to 3.2.0
Vincent Tondellier <tonton+hg@team1664.org>
parents: 1
diff changeset
  1573
0df70b8735e3 Update Twitter bootstrap to 3.2.0
Vincent Tondellier <tonton+hg@team1664.org>
parents: 1
diff changeset
  1574
  var Popover = function (element, options) {
0df70b8735e3 Update Twitter bootstrap to 3.2.0
Vincent Tondellier <tonton+hg@team1664.org>
parents: 1
diff changeset
  1575
    this.init('popover', element, options)
0df70b8735e3 Update Twitter bootstrap to 3.2.0
Vincent Tondellier <tonton+hg@team1664.org>
parents: 1
diff changeset
  1576
  }
0df70b8735e3 Update Twitter bootstrap to 3.2.0
Vincent Tondellier <tonton+hg@team1664.org>
parents: 1
diff changeset
  1577
0df70b8735e3 Update Twitter bootstrap to 3.2.0
Vincent Tondellier <tonton+hg@team1664.org>
parents: 1
diff changeset
  1578
  if (!$.fn.tooltip) throw new Error('Popover requires tooltip.js')
0df70b8735e3 Update Twitter bootstrap to 3.2.0
Vincent Tondellier <tonton+hg@team1664.org>
parents: 1
diff changeset
  1579
0df70b8735e3 Update Twitter bootstrap to 3.2.0
Vincent Tondellier <tonton+hg@team1664.org>
parents: 1
diff changeset
  1580
  Popover.VERSION  = '3.2.0'
0df70b8735e3 Update Twitter bootstrap to 3.2.0
Vincent Tondellier <tonton+hg@team1664.org>
parents: 1
diff changeset
  1581
0df70b8735e3 Update Twitter bootstrap to 3.2.0
Vincent Tondellier <tonton+hg@team1664.org>
parents: 1
diff changeset
  1582
  Popover.DEFAULTS = $.extend({}, $.fn.tooltip.Constructor.DEFAULTS, {
0df70b8735e3 Update Twitter bootstrap to 3.2.0
Vincent Tondellier <tonton+hg@team1664.org>
parents: 1
diff changeset
  1583
    placement: 'right',
0df70b8735e3 Update Twitter bootstrap to 3.2.0
Vincent Tondellier <tonton+hg@team1664.org>
parents: 1
diff changeset
  1584
    trigger: 'click',
0df70b8735e3 Update Twitter bootstrap to 3.2.0
Vincent Tondellier <tonton+hg@team1664.org>
parents: 1
diff changeset
  1585
    content: '',
0df70b8735e3 Update Twitter bootstrap to 3.2.0
Vincent Tondellier <tonton+hg@team1664.org>
parents: 1
diff changeset
  1586
    template: '<div class="popover" role="tooltip"><div class="arrow"></div><h3 class="popover-title"></h3><div class="popover-content"></div></div>'
0df70b8735e3 Update Twitter bootstrap to 3.2.0
Vincent Tondellier <tonton+hg@team1664.org>
parents: 1
diff changeset
  1587
  })
0df70b8735e3 Update Twitter bootstrap to 3.2.0
Vincent Tondellier <tonton+hg@team1664.org>
parents: 1
diff changeset
  1588
0df70b8735e3 Update Twitter bootstrap to 3.2.0
Vincent Tondellier <tonton+hg@team1664.org>
parents: 1
diff changeset
  1589
0df70b8735e3 Update Twitter bootstrap to 3.2.0
Vincent Tondellier <tonton+hg@team1664.org>
parents: 1
diff changeset
  1590
  // NOTE: POPOVER EXTENDS tooltip.js
0df70b8735e3 Update Twitter bootstrap to 3.2.0
Vincent Tondellier <tonton+hg@team1664.org>
parents: 1
diff changeset
  1591
  // ================================
0df70b8735e3 Update Twitter bootstrap to 3.2.0
Vincent Tondellier <tonton+hg@team1664.org>
parents: 1
diff changeset
  1592
0df70b8735e3 Update Twitter bootstrap to 3.2.0
Vincent Tondellier <tonton+hg@team1664.org>
parents: 1
diff changeset
  1593
  Popover.prototype = $.extend({}, $.fn.tooltip.Constructor.prototype)
0df70b8735e3 Update Twitter bootstrap to 3.2.0
Vincent Tondellier <tonton+hg@team1664.org>
parents: 1
diff changeset
  1594
0df70b8735e3 Update Twitter bootstrap to 3.2.0
Vincent Tondellier <tonton+hg@team1664.org>
parents: 1
diff changeset
  1595
  Popover.prototype.constructor = Popover
0df70b8735e3 Update Twitter bootstrap to 3.2.0
Vincent Tondellier <tonton+hg@team1664.org>
parents: 1
diff changeset
  1596
0df70b8735e3 Update Twitter bootstrap to 3.2.0
Vincent Tondellier <tonton+hg@team1664.org>
parents: 1
diff changeset
  1597
  Popover.prototype.getDefaults = function () {
0df70b8735e3 Update Twitter bootstrap to 3.2.0
Vincent Tondellier <tonton+hg@team1664.org>
parents: 1
diff changeset
  1598
    return Popover.DEFAULTS
0df70b8735e3 Update Twitter bootstrap to 3.2.0
Vincent Tondellier <tonton+hg@team1664.org>
parents: 1
diff changeset
  1599
  }
0df70b8735e3 Update Twitter bootstrap to 3.2.0
Vincent Tondellier <tonton+hg@team1664.org>
parents: 1
diff changeset
  1600
0df70b8735e3 Update Twitter bootstrap to 3.2.0
Vincent Tondellier <tonton+hg@team1664.org>
parents: 1
diff changeset
  1601
  Popover.prototype.setContent = function () {
0df70b8735e3 Update Twitter bootstrap to 3.2.0
Vincent Tondellier <tonton+hg@team1664.org>
parents: 1
diff changeset
  1602
    var $tip    = this.tip()
0df70b8735e3 Update Twitter bootstrap to 3.2.0
Vincent Tondellier <tonton+hg@team1664.org>
parents: 1
diff changeset
  1603
    var title   = this.getTitle()
0df70b8735e3 Update Twitter bootstrap to 3.2.0
Vincent Tondellier <tonton+hg@team1664.org>
parents: 1
diff changeset
  1604
    var content = this.getContent()
0df70b8735e3 Update Twitter bootstrap to 3.2.0
Vincent Tondellier <tonton+hg@team1664.org>
parents: 1
diff changeset
  1605
0df70b8735e3 Update Twitter bootstrap to 3.2.0
Vincent Tondellier <tonton+hg@team1664.org>
parents: 1
diff changeset
  1606
    $tip.find('.popover-title')[this.options.html ? 'html' : 'text'](title)
0df70b8735e3 Update Twitter bootstrap to 3.2.0
Vincent Tondellier <tonton+hg@team1664.org>
parents: 1
diff changeset
  1607
    $tip.find('.popover-content').empty()[ // we use append for html objects to maintain js events
0df70b8735e3 Update Twitter bootstrap to 3.2.0
Vincent Tondellier <tonton+hg@team1664.org>
parents: 1
diff changeset
  1608
      this.options.html ? (typeof content == 'string' ? 'html' : 'append') : 'text'
0df70b8735e3 Update Twitter bootstrap to 3.2.0
Vincent Tondellier <tonton+hg@team1664.org>
parents: 1
diff changeset
  1609
    ](content)
0df70b8735e3 Update Twitter bootstrap to 3.2.0
Vincent Tondellier <tonton+hg@team1664.org>
parents: 1
diff changeset
  1610
0df70b8735e3 Update Twitter bootstrap to 3.2.0
Vincent Tondellier <tonton+hg@team1664.org>
parents: 1
diff changeset
  1611
    $tip.removeClass('fade top bottom left right in')
0df70b8735e3 Update Twitter bootstrap to 3.2.0
Vincent Tondellier <tonton+hg@team1664.org>
parents: 1
diff changeset
  1612
0df70b8735e3 Update Twitter bootstrap to 3.2.0
Vincent Tondellier <tonton+hg@team1664.org>
parents: 1
diff changeset
  1613
    // IE8 doesn't accept hiding via the `:empty` pseudo selector, we have to do
0df70b8735e3 Update Twitter bootstrap to 3.2.0
Vincent Tondellier <tonton+hg@team1664.org>
parents: 1
diff changeset
  1614
    // this manually by checking the contents.
0df70b8735e3 Update Twitter bootstrap to 3.2.0
Vincent Tondellier <tonton+hg@team1664.org>
parents: 1
diff changeset
  1615
    if (!$tip.find('.popover-title').html()) $tip.find('.popover-title').hide()
0df70b8735e3 Update Twitter bootstrap to 3.2.0
Vincent Tondellier <tonton+hg@team1664.org>
parents: 1
diff changeset
  1616
  }
0df70b8735e3 Update Twitter bootstrap to 3.2.0
Vincent Tondellier <tonton+hg@team1664.org>
parents: 1
diff changeset
  1617
0df70b8735e3 Update Twitter bootstrap to 3.2.0
Vincent Tondellier <tonton+hg@team1664.org>
parents: 1
diff changeset
  1618
  Popover.prototype.hasContent = function () {
0df70b8735e3 Update Twitter bootstrap to 3.2.0
Vincent Tondellier <tonton+hg@team1664.org>
parents: 1
diff changeset
  1619
    return this.getTitle() || this.getContent()
0df70b8735e3 Update Twitter bootstrap to 3.2.0
Vincent Tondellier <tonton+hg@team1664.org>
parents: 1
diff changeset
  1620
  }
0df70b8735e3 Update Twitter bootstrap to 3.2.0
Vincent Tondellier <tonton+hg@team1664.org>
parents: 1
diff changeset
  1621
0df70b8735e3 Update Twitter bootstrap to 3.2.0
Vincent Tondellier <tonton+hg@team1664.org>
parents: 1
diff changeset
  1622
  Popover.prototype.getContent = function () {
0df70b8735e3 Update Twitter bootstrap to 3.2.0
Vincent Tondellier <tonton+hg@team1664.org>
parents: 1
diff changeset
  1623
    var $e = this.$element
0df70b8735e3 Update Twitter bootstrap to 3.2.0
Vincent Tondellier <tonton+hg@team1664.org>
parents: 1
diff changeset
  1624
    var o  = this.options
0df70b8735e3 Update Twitter bootstrap to 3.2.0
Vincent Tondellier <tonton+hg@team1664.org>
parents: 1
diff changeset
  1625
0df70b8735e3 Update Twitter bootstrap to 3.2.0
Vincent Tondellier <tonton+hg@team1664.org>
parents: 1
diff changeset
  1626
    return $e.attr('data-content')
0df70b8735e3 Update Twitter bootstrap to 3.2.0
Vincent Tondellier <tonton+hg@team1664.org>
parents: 1
diff changeset
  1627
      || (typeof o.content == 'function' ?
0df70b8735e3 Update Twitter bootstrap to 3.2.0
Vincent Tondellier <tonton+hg@team1664.org>
parents: 1
diff changeset
  1628
            o.content.call($e[0]) :
0df70b8735e3 Update Twitter bootstrap to 3.2.0
Vincent Tondellier <tonton+hg@team1664.org>
parents: 1
diff changeset
  1629
            o.content)
0df70b8735e3 Update Twitter bootstrap to 3.2.0
Vincent Tondellier <tonton+hg@team1664.org>
parents: 1
diff changeset
  1630
  }
0df70b8735e3 Update Twitter bootstrap to 3.2.0
Vincent Tondellier <tonton+hg@team1664.org>
parents: 1
diff changeset
  1631
0df70b8735e3 Update Twitter bootstrap to 3.2.0
Vincent Tondellier <tonton+hg@team1664.org>
parents: 1
diff changeset
  1632
  Popover.prototype.arrow = function () {
0df70b8735e3 Update Twitter bootstrap to 3.2.0
Vincent Tondellier <tonton+hg@team1664.org>
parents: 1
diff changeset
  1633
    return (this.$arrow = this.$arrow || this.tip().find('.arrow'))
0df70b8735e3 Update Twitter bootstrap to 3.2.0
Vincent Tondellier <tonton+hg@team1664.org>
parents: 1
diff changeset
  1634
  }
0df70b8735e3 Update Twitter bootstrap to 3.2.0
Vincent Tondellier <tonton+hg@team1664.org>
parents: 1
diff changeset
  1635
0df70b8735e3 Update Twitter bootstrap to 3.2.0
Vincent Tondellier <tonton+hg@team1664.org>
parents: 1
diff changeset
  1636
  Popover.prototype.tip = function () {
0df70b8735e3 Update Twitter bootstrap to 3.2.0
Vincent Tondellier <tonton+hg@team1664.org>
parents: 1
diff changeset
  1637
    if (!this.$tip) this.$tip = $(this.options.template)
0df70b8735e3 Update Twitter bootstrap to 3.2.0
Vincent Tondellier <tonton+hg@team1664.org>
parents: 1
diff changeset
  1638
    return this.$tip
0df70b8735e3 Update Twitter bootstrap to 3.2.0
Vincent Tondellier <tonton+hg@team1664.org>
parents: 1
diff changeset
  1639
  }
0df70b8735e3 Update Twitter bootstrap to 3.2.0
Vincent Tondellier <tonton+hg@team1664.org>
parents: 1
diff changeset
  1640
0df70b8735e3 Update Twitter bootstrap to 3.2.0
Vincent Tondellier <tonton+hg@team1664.org>
parents: 1
diff changeset
  1641
0df70b8735e3 Update Twitter bootstrap to 3.2.0
Vincent Tondellier <tonton+hg@team1664.org>
parents: 1
diff changeset
  1642
  // POPOVER PLUGIN DEFINITION
0df70b8735e3 Update Twitter bootstrap to 3.2.0
Vincent Tondellier <tonton+hg@team1664.org>
parents: 1
diff changeset
  1643
  // =========================
0df70b8735e3 Update Twitter bootstrap to 3.2.0
Vincent Tondellier <tonton+hg@team1664.org>
parents: 1
diff changeset
  1644
0df70b8735e3 Update Twitter bootstrap to 3.2.0
Vincent Tondellier <tonton+hg@team1664.org>
parents: 1
diff changeset
  1645
  function Plugin(option) {
0df70b8735e3 Update Twitter bootstrap to 3.2.0
Vincent Tondellier <tonton+hg@team1664.org>
parents: 1
diff changeset
  1646
    return this.each(function () {
0df70b8735e3 Update Twitter bootstrap to 3.2.0
Vincent Tondellier <tonton+hg@team1664.org>
parents: 1
diff changeset
  1647
      var $this   = $(this)
0df70b8735e3 Update Twitter bootstrap to 3.2.0
Vincent Tondellier <tonton+hg@team1664.org>
parents: 1
diff changeset
  1648
      var data    = $this.data('bs.popover')
0df70b8735e3 Update Twitter bootstrap to 3.2.0
Vincent Tondellier <tonton+hg@team1664.org>
parents: 1
diff changeset
  1649
      var options = typeof option == 'object' && option
0df70b8735e3 Update Twitter bootstrap to 3.2.0
Vincent Tondellier <tonton+hg@team1664.org>
parents: 1
diff changeset
  1650
0df70b8735e3 Update Twitter bootstrap to 3.2.0
Vincent Tondellier <tonton+hg@team1664.org>
parents: 1
diff changeset
  1651
      if (!data && option == 'destroy') return
0df70b8735e3 Update Twitter bootstrap to 3.2.0
Vincent Tondellier <tonton+hg@team1664.org>
parents: 1
diff changeset
  1652
      if (!data) $this.data('bs.popover', (data = new Popover(this, options)))
0df70b8735e3 Update Twitter bootstrap to 3.2.0
Vincent Tondellier <tonton+hg@team1664.org>
parents: 1
diff changeset
  1653
      if (typeof option == 'string') data[option]()
0df70b8735e3 Update Twitter bootstrap to 3.2.0
Vincent Tondellier <tonton+hg@team1664.org>
parents: 1
diff changeset
  1654
    })
0df70b8735e3 Update Twitter bootstrap to 3.2.0
Vincent Tondellier <tonton+hg@team1664.org>
parents: 1
diff changeset
  1655
  }
0df70b8735e3 Update Twitter bootstrap to 3.2.0
Vincent Tondellier <tonton+hg@team1664.org>
parents: 1
diff changeset
  1656
0df70b8735e3 Update Twitter bootstrap to 3.2.0
Vincent Tondellier <tonton+hg@team1664.org>
parents: 1
diff changeset
  1657
  var old = $.fn.popover
0df70b8735e3 Update Twitter bootstrap to 3.2.0
Vincent Tondellier <tonton+hg@team1664.org>
parents: 1
diff changeset
  1658
0df70b8735e3 Update Twitter bootstrap to 3.2.0
Vincent Tondellier <tonton+hg@team1664.org>
parents: 1
diff changeset
  1659
  $.fn.popover             = Plugin
0df70b8735e3 Update Twitter bootstrap to 3.2.0
Vincent Tondellier <tonton+hg@team1664.org>
parents: 1
diff changeset
  1660
  $.fn.popover.Constructor = Popover
0df70b8735e3 Update Twitter bootstrap to 3.2.0
Vincent Tondellier <tonton+hg@team1664.org>
parents: 1
diff changeset
  1661
0df70b8735e3 Update Twitter bootstrap to 3.2.0
Vincent Tondellier <tonton+hg@team1664.org>
parents: 1
diff changeset
  1662
0df70b8735e3 Update Twitter bootstrap to 3.2.0
Vincent Tondellier <tonton+hg@team1664.org>
parents: 1
diff changeset
  1663
  // POPOVER NO CONFLICT
0df70b8735e3 Update Twitter bootstrap to 3.2.0
Vincent Tondellier <tonton+hg@team1664.org>
parents: 1
diff changeset
  1664
  // ===================
0df70b8735e3 Update Twitter bootstrap to 3.2.0
Vincent Tondellier <tonton+hg@team1664.org>
parents: 1
diff changeset
  1665
0df70b8735e3 Update Twitter bootstrap to 3.2.0
Vincent Tondellier <tonton+hg@team1664.org>
parents: 1
diff changeset
  1666
  $.fn.popover.noConflict = function () {
0df70b8735e3 Update Twitter bootstrap to 3.2.0
Vincent Tondellier <tonton+hg@team1664.org>
parents: 1
diff changeset
  1667
    $.fn.popover = old
0df70b8735e3 Update Twitter bootstrap to 3.2.0
Vincent Tondellier <tonton+hg@team1664.org>
parents: 1
diff changeset
  1668
    return this
0
5b78b8c79d9c Initial commit
Vincent Tondellier <tonton+hg@team1664.org>
parents:
diff changeset
  1669
  }
5b78b8c79d9c Initial commit
Vincent Tondellier <tonton+hg@team1664.org>
parents:
diff changeset
  1670
28
0df70b8735e3 Update Twitter bootstrap to 3.2.0
Vincent Tondellier <tonton+hg@team1664.org>
parents: 1
diff changeset
  1671
}(jQuery);
0df70b8735e3 Update Twitter bootstrap to 3.2.0
Vincent Tondellier <tonton+hg@team1664.org>
parents: 1
diff changeset
  1672
0df70b8735e3 Update Twitter bootstrap to 3.2.0
Vincent Tondellier <tonton+hg@team1664.org>
parents: 1
diff changeset
  1673
/* ========================================================================
0df70b8735e3 Update Twitter bootstrap to 3.2.0
Vincent Tondellier <tonton+hg@team1664.org>
parents: 1
diff changeset
  1674
 * Bootstrap: scrollspy.js v3.2.0
0df70b8735e3 Update Twitter bootstrap to 3.2.0
Vincent Tondellier <tonton+hg@team1664.org>
parents: 1
diff changeset
  1675
 * http://getbootstrap.com/javascript/#scrollspy
0df70b8735e3 Update Twitter bootstrap to 3.2.0
Vincent Tondellier <tonton+hg@team1664.org>
parents: 1
diff changeset
  1676
 * ========================================================================
0df70b8735e3 Update Twitter bootstrap to 3.2.0
Vincent Tondellier <tonton+hg@team1664.org>
parents: 1
diff changeset
  1677
 * Copyright 2011-2014 Twitter, Inc.
0df70b8735e3 Update Twitter bootstrap to 3.2.0
Vincent Tondellier <tonton+hg@team1664.org>
parents: 1
diff changeset
  1678
 * Licensed under MIT (https://github.com/twbs/bootstrap/blob/master/LICENSE)
0df70b8735e3 Update Twitter bootstrap to 3.2.0
Vincent Tondellier <tonton+hg@team1664.org>
parents: 1
diff changeset
  1679
 * ======================================================================== */
0df70b8735e3 Update Twitter bootstrap to 3.2.0
Vincent Tondellier <tonton+hg@team1664.org>
parents: 1
diff changeset
  1680
0df70b8735e3 Update Twitter bootstrap to 3.2.0
Vincent Tondellier <tonton+hg@team1664.org>
parents: 1
diff changeset
  1681
0df70b8735e3 Update Twitter bootstrap to 3.2.0
Vincent Tondellier <tonton+hg@team1664.org>
parents: 1
diff changeset
  1682
+function ($) {
0df70b8735e3 Update Twitter bootstrap to 3.2.0
Vincent Tondellier <tonton+hg@team1664.org>
parents: 1
diff changeset
  1683
  'use strict';
0df70b8735e3 Update Twitter bootstrap to 3.2.0
Vincent Tondellier <tonton+hg@team1664.org>
parents: 1
diff changeset
  1684
0df70b8735e3 Update Twitter bootstrap to 3.2.0
Vincent Tondellier <tonton+hg@team1664.org>
parents: 1
diff changeset
  1685
  // SCROLLSPY CLASS DEFINITION
0df70b8735e3 Update Twitter bootstrap to 3.2.0
Vincent Tondellier <tonton+hg@team1664.org>
parents: 1
diff changeset
  1686
  // ==========================
0df70b8735e3 Update Twitter bootstrap to 3.2.0
Vincent Tondellier <tonton+hg@team1664.org>
parents: 1
diff changeset
  1687
0df70b8735e3 Update Twitter bootstrap to 3.2.0
Vincent Tondellier <tonton+hg@team1664.org>
parents: 1
diff changeset
  1688
  function ScrollSpy(element, options) {
0df70b8735e3 Update Twitter bootstrap to 3.2.0
Vincent Tondellier <tonton+hg@team1664.org>
parents: 1
diff changeset
  1689
    var process  = $.proxy(this.process, this)
0df70b8735e3 Update Twitter bootstrap to 3.2.0
Vincent Tondellier <tonton+hg@team1664.org>
parents: 1
diff changeset
  1690
0df70b8735e3 Update Twitter bootstrap to 3.2.0
Vincent Tondellier <tonton+hg@team1664.org>
parents: 1
diff changeset
  1691
    this.$body          = $('body')
0df70b8735e3 Update Twitter bootstrap to 3.2.0
Vincent Tondellier <tonton+hg@team1664.org>
parents: 1
diff changeset
  1692
    this.$scrollElement = $(element).is('body') ? $(window) : $(element)
0df70b8735e3 Update Twitter bootstrap to 3.2.0
Vincent Tondellier <tonton+hg@team1664.org>
parents: 1
diff changeset
  1693
    this.options        = $.extend({}, ScrollSpy.DEFAULTS, options)
0df70b8735e3 Update Twitter bootstrap to 3.2.0
Vincent Tondellier <tonton+hg@team1664.org>
parents: 1
diff changeset
  1694
    this.selector       = (this.options.target || '') + ' .nav li > a'
0df70b8735e3 Update Twitter bootstrap to 3.2.0
Vincent Tondellier <tonton+hg@team1664.org>
parents: 1
diff changeset
  1695
    this.offsets        = []
0df70b8735e3 Update Twitter bootstrap to 3.2.0
Vincent Tondellier <tonton+hg@team1664.org>
parents: 1
diff changeset
  1696
    this.targets        = []
0df70b8735e3 Update Twitter bootstrap to 3.2.0
Vincent Tondellier <tonton+hg@team1664.org>
parents: 1
diff changeset
  1697
    this.activeTarget   = null
0df70b8735e3 Update Twitter bootstrap to 3.2.0
Vincent Tondellier <tonton+hg@team1664.org>
parents: 1
diff changeset
  1698
    this.scrollHeight   = 0
0df70b8735e3 Update Twitter bootstrap to 3.2.0
Vincent Tondellier <tonton+hg@team1664.org>
parents: 1
diff changeset
  1699
0df70b8735e3 Update Twitter bootstrap to 3.2.0
Vincent Tondellier <tonton+hg@team1664.org>
parents: 1
diff changeset
  1700
    this.$scrollElement.on('scroll.bs.scrollspy', process)
0df70b8735e3 Update Twitter bootstrap to 3.2.0
Vincent Tondellier <tonton+hg@team1664.org>
parents: 1
diff changeset
  1701
    this.refresh()
0df70b8735e3 Update Twitter bootstrap to 3.2.0
Vincent Tondellier <tonton+hg@team1664.org>
parents: 1
diff changeset
  1702
    this.process()
0df70b8735e3 Update Twitter bootstrap to 3.2.0
Vincent Tondellier <tonton+hg@team1664.org>
parents: 1
diff changeset
  1703
  }
0df70b8735e3 Update Twitter bootstrap to 3.2.0
Vincent Tondellier <tonton+hg@team1664.org>
parents: 1
diff changeset
  1704
0df70b8735e3 Update Twitter bootstrap to 3.2.0
Vincent Tondellier <tonton+hg@team1664.org>
parents: 1
diff changeset
  1705
  ScrollSpy.VERSION  = '3.2.0'
0df70b8735e3 Update Twitter bootstrap to 3.2.0
Vincent Tondellier <tonton+hg@team1664.org>
parents: 1
diff changeset
  1706
0df70b8735e3 Update Twitter bootstrap to 3.2.0
Vincent Tondellier <tonton+hg@team1664.org>
parents: 1
diff changeset
  1707
  ScrollSpy.DEFAULTS = {
0df70b8735e3 Update Twitter bootstrap to 3.2.0
Vincent Tondellier <tonton+hg@team1664.org>
parents: 1
diff changeset
  1708
    offset: 10
0df70b8735e3 Update Twitter bootstrap to 3.2.0
Vincent Tondellier <tonton+hg@team1664.org>
parents: 1
diff changeset
  1709
  }
0df70b8735e3 Update Twitter bootstrap to 3.2.0
Vincent Tondellier <tonton+hg@team1664.org>
parents: 1
diff changeset
  1710
0df70b8735e3 Update Twitter bootstrap to 3.2.0
Vincent Tondellier <tonton+hg@team1664.org>
parents: 1
diff changeset
  1711
  ScrollSpy.prototype.getScrollHeight = function () {
0df70b8735e3 Update Twitter bootstrap to 3.2.0
Vincent Tondellier <tonton+hg@team1664.org>
parents: 1
diff changeset
  1712
    return this.$scrollElement[0].scrollHeight || Math.max(this.$body[0].scrollHeight, document.documentElement.scrollHeight)
0df70b8735e3 Update Twitter bootstrap to 3.2.0
Vincent Tondellier <tonton+hg@team1664.org>
parents: 1
diff changeset
  1713
  }
0df70b8735e3 Update Twitter bootstrap to 3.2.0
Vincent Tondellier <tonton+hg@team1664.org>
parents: 1
diff changeset
  1714
0df70b8735e3 Update Twitter bootstrap to 3.2.0
Vincent Tondellier <tonton+hg@team1664.org>
parents: 1
diff changeset
  1715
  ScrollSpy.prototype.refresh = function () {
0df70b8735e3 Update Twitter bootstrap to 3.2.0
Vincent Tondellier <tonton+hg@team1664.org>
parents: 1
diff changeset
  1716
    var offsetMethod = 'offset'
0df70b8735e3 Update Twitter bootstrap to 3.2.0
Vincent Tondellier <tonton+hg@team1664.org>
parents: 1
diff changeset
  1717
    var offsetBase   = 0
0df70b8735e3 Update Twitter bootstrap to 3.2.0
Vincent Tondellier <tonton+hg@team1664.org>
parents: 1
diff changeset
  1718
0df70b8735e3 Update Twitter bootstrap to 3.2.0
Vincent Tondellier <tonton+hg@team1664.org>
parents: 1
diff changeset
  1719
    if (!$.isWindow(this.$scrollElement[0])) {
0df70b8735e3 Update Twitter bootstrap to 3.2.0
Vincent Tondellier <tonton+hg@team1664.org>
parents: 1
diff changeset
  1720
      offsetMethod = 'position'
0df70b8735e3 Update Twitter bootstrap to 3.2.0
Vincent Tondellier <tonton+hg@team1664.org>
parents: 1
diff changeset
  1721
      offsetBase   = this.$scrollElement.scrollTop()
0df70b8735e3 Update Twitter bootstrap to 3.2.0
Vincent Tondellier <tonton+hg@team1664.org>
parents: 1
diff changeset
  1722
    }
0df70b8735e3 Update Twitter bootstrap to 3.2.0
Vincent Tondellier <tonton+hg@team1664.org>
parents: 1
diff changeset
  1723
0df70b8735e3 Update Twitter bootstrap to 3.2.0
Vincent Tondellier <tonton+hg@team1664.org>
parents: 1
diff changeset
  1724
    this.offsets = []
0df70b8735e3 Update Twitter bootstrap to 3.2.0
Vincent Tondellier <tonton+hg@team1664.org>
parents: 1
diff changeset
  1725
    this.targets = []
0df70b8735e3 Update Twitter bootstrap to 3.2.0
Vincent Tondellier <tonton+hg@team1664.org>
parents: 1
diff changeset
  1726
    this.scrollHeight = this.getScrollHeight()
0df70b8735e3 Update Twitter bootstrap to 3.2.0
Vincent Tondellier <tonton+hg@team1664.org>
parents: 1
diff changeset
  1727
0df70b8735e3 Update Twitter bootstrap to 3.2.0
Vincent Tondellier <tonton+hg@team1664.org>
parents: 1
diff changeset
  1728
    var self     = this
0df70b8735e3 Update Twitter bootstrap to 3.2.0
Vincent Tondellier <tonton+hg@team1664.org>
parents: 1
diff changeset
  1729
0df70b8735e3 Update Twitter bootstrap to 3.2.0
Vincent Tondellier <tonton+hg@team1664.org>
parents: 1
diff changeset
  1730
    this.$body
0df70b8735e3 Update Twitter bootstrap to 3.2.0
Vincent Tondellier <tonton+hg@team1664.org>
parents: 1
diff changeset
  1731
      .find(this.selector)
0df70b8735e3 Update Twitter bootstrap to 3.2.0
Vincent Tondellier <tonton+hg@team1664.org>
parents: 1
diff changeset
  1732
      .map(function () {
0df70b8735e3 Update Twitter bootstrap to 3.2.0
Vincent Tondellier <tonton+hg@team1664.org>
parents: 1
diff changeset
  1733
        var $el   = $(this)
0df70b8735e3 Update Twitter bootstrap to 3.2.0
Vincent Tondellier <tonton+hg@team1664.org>
parents: 1
diff changeset
  1734
        var href  = $el.data('target') || $el.attr('href')
0df70b8735e3 Update Twitter bootstrap to 3.2.0
Vincent Tondellier <tonton+hg@team1664.org>
parents: 1
diff changeset
  1735
        var $href = /^#./.test(href) && $(href)
0df70b8735e3 Update Twitter bootstrap to 3.2.0
Vincent Tondellier <tonton+hg@team1664.org>
parents: 1
diff changeset
  1736
0df70b8735e3 Update Twitter bootstrap to 3.2.0
Vincent Tondellier <tonton+hg@team1664.org>
parents: 1
diff changeset
  1737
        return ($href
0df70b8735e3 Update Twitter bootstrap to 3.2.0
Vincent Tondellier <tonton+hg@team1664.org>
parents: 1
diff changeset
  1738
          && $href.length
0df70b8735e3 Update Twitter bootstrap to 3.2.0
Vincent Tondellier <tonton+hg@team1664.org>
parents: 1
diff changeset
  1739
          && $href.is(':visible')
0df70b8735e3 Update Twitter bootstrap to 3.2.0
Vincent Tondellier <tonton+hg@team1664.org>
parents: 1
diff changeset
  1740
          && [[$href[offsetMethod]().top + offsetBase, href]]) || null
0df70b8735e3 Update Twitter bootstrap to 3.2.0
Vincent Tondellier <tonton+hg@team1664.org>
parents: 1
diff changeset
  1741
      })
0df70b8735e3 Update Twitter bootstrap to 3.2.0
Vincent Tondellier <tonton+hg@team1664.org>
parents: 1
diff changeset
  1742
      .sort(function (a, b) { return a[0] - b[0] })
0df70b8735e3 Update Twitter bootstrap to 3.2.0
Vincent Tondellier <tonton+hg@team1664.org>
parents: 1
diff changeset
  1743
      .each(function () {
0df70b8735e3 Update Twitter bootstrap to 3.2.0
Vincent Tondellier <tonton+hg@team1664.org>
parents: 1
diff changeset
  1744
        self.offsets.push(this[0])
0df70b8735e3 Update Twitter bootstrap to 3.2.0
Vincent Tondellier <tonton+hg@team1664.org>
parents: 1
diff changeset
  1745
        self.targets.push(this[1])
0df70b8735e3 Update Twitter bootstrap to 3.2.0
Vincent Tondellier <tonton+hg@team1664.org>
parents: 1
diff changeset
  1746
      })
0df70b8735e3 Update Twitter bootstrap to 3.2.0
Vincent Tondellier <tonton+hg@team1664.org>
parents: 1
diff changeset
  1747
  }
0df70b8735e3 Update Twitter bootstrap to 3.2.0
Vincent Tondellier <tonton+hg@team1664.org>
parents: 1
diff changeset
  1748
0df70b8735e3 Update Twitter bootstrap to 3.2.0
Vincent Tondellier <tonton+hg@team1664.org>
parents: 1
diff changeset
  1749
  ScrollSpy.prototype.process = function () {
0df70b8735e3 Update Twitter bootstrap to 3.2.0
Vincent Tondellier <tonton+hg@team1664.org>
parents: 1
diff changeset
  1750
    var scrollTop    = this.$scrollElement.scrollTop() + this.options.offset
0df70b8735e3 Update Twitter bootstrap to 3.2.0
Vincent Tondellier <tonton+hg@team1664.org>
parents: 1
diff changeset
  1751
    var scrollHeight = this.getScrollHeight()
0df70b8735e3 Update Twitter bootstrap to 3.2.0
Vincent Tondellier <tonton+hg@team1664.org>
parents: 1
diff changeset
  1752
    var maxScroll    = this.options.offset + scrollHeight - this.$scrollElement.height()
0df70b8735e3 Update Twitter bootstrap to 3.2.0
Vincent Tondellier <tonton+hg@team1664.org>
parents: 1
diff changeset
  1753
    var offsets      = this.offsets
0df70b8735e3 Update Twitter bootstrap to 3.2.0
Vincent Tondellier <tonton+hg@team1664.org>
parents: 1
diff changeset
  1754
    var targets      = this.targets
0df70b8735e3 Update Twitter bootstrap to 3.2.0
Vincent Tondellier <tonton+hg@team1664.org>
parents: 1
diff changeset
  1755
    var activeTarget = this.activeTarget
0df70b8735e3 Update Twitter bootstrap to 3.2.0
Vincent Tondellier <tonton+hg@team1664.org>
parents: 1
diff changeset
  1756
    var i
0df70b8735e3 Update Twitter bootstrap to 3.2.0
Vincent Tondellier <tonton+hg@team1664.org>
parents: 1
diff changeset
  1757
0df70b8735e3 Update Twitter bootstrap to 3.2.0
Vincent Tondellier <tonton+hg@team1664.org>
parents: 1
diff changeset
  1758
    if (this.scrollHeight != scrollHeight) {
0df70b8735e3 Update Twitter bootstrap to 3.2.0
Vincent Tondellier <tonton+hg@team1664.org>
parents: 1
diff changeset
  1759
      this.refresh()
0df70b8735e3 Update Twitter bootstrap to 3.2.0
Vincent Tondellier <tonton+hg@team1664.org>
parents: 1
diff changeset
  1760
    }
0df70b8735e3 Update Twitter bootstrap to 3.2.0
Vincent Tondellier <tonton+hg@team1664.org>
parents: 1
diff changeset
  1761
0df70b8735e3 Update Twitter bootstrap to 3.2.0
Vincent Tondellier <tonton+hg@team1664.org>
parents: 1
diff changeset
  1762
    if (scrollTop >= maxScroll) {
0df70b8735e3 Update Twitter bootstrap to 3.2.0
Vincent Tondellier <tonton+hg@team1664.org>
parents: 1
diff changeset
  1763
      return activeTarget != (i = targets[targets.length - 1]) && this.activate(i)
0df70b8735e3 Update Twitter bootstrap to 3.2.0
Vincent Tondellier <tonton+hg@team1664.org>
parents: 1
diff changeset
  1764
    }
0df70b8735e3 Update Twitter bootstrap to 3.2.0
Vincent Tondellier <tonton+hg@team1664.org>
parents: 1
diff changeset
  1765
0df70b8735e3 Update Twitter bootstrap to 3.2.0
Vincent Tondellier <tonton+hg@team1664.org>
parents: 1
diff changeset
  1766
    if (activeTarget && scrollTop <= offsets[0]) {
0df70b8735e3 Update Twitter bootstrap to 3.2.0
Vincent Tondellier <tonton+hg@team1664.org>
parents: 1
diff changeset
  1767
      return activeTarget != (i = targets[0]) && this.activate(i)
0df70b8735e3 Update Twitter bootstrap to 3.2.0
Vincent Tondellier <tonton+hg@team1664.org>
parents: 1
diff changeset
  1768
    }
0df70b8735e3 Update Twitter bootstrap to 3.2.0
Vincent Tondellier <tonton+hg@team1664.org>
parents: 1
diff changeset
  1769
0df70b8735e3 Update Twitter bootstrap to 3.2.0
Vincent Tondellier <tonton+hg@team1664.org>
parents: 1
diff changeset
  1770
    for (i = offsets.length; i--;) {
0df70b8735e3 Update Twitter bootstrap to 3.2.0
Vincent Tondellier <tonton+hg@team1664.org>
parents: 1
diff changeset
  1771
      activeTarget != targets[i]
0df70b8735e3 Update Twitter bootstrap to 3.2.0
Vincent Tondellier <tonton+hg@team1664.org>
parents: 1
diff changeset
  1772
        && scrollTop >= offsets[i]
0df70b8735e3 Update Twitter bootstrap to 3.2.0
Vincent Tondellier <tonton+hg@team1664.org>
parents: 1
diff changeset
  1773
        && (!offsets[i + 1] || scrollTop <= offsets[i + 1])
0df70b8735e3 Update Twitter bootstrap to 3.2.0
Vincent Tondellier <tonton+hg@team1664.org>
parents: 1
diff changeset
  1774
        && this.activate(targets[i])
0df70b8735e3 Update Twitter bootstrap to 3.2.0
Vincent Tondellier <tonton+hg@team1664.org>
parents: 1
diff changeset
  1775
    }
0df70b8735e3 Update Twitter bootstrap to 3.2.0
Vincent Tondellier <tonton+hg@team1664.org>
parents: 1
diff changeset
  1776
  }
0df70b8735e3 Update Twitter bootstrap to 3.2.0
Vincent Tondellier <tonton+hg@team1664.org>
parents: 1
diff changeset
  1777
0df70b8735e3 Update Twitter bootstrap to 3.2.0
Vincent Tondellier <tonton+hg@team1664.org>
parents: 1
diff changeset
  1778
  ScrollSpy.prototype.activate = function (target) {
0df70b8735e3 Update Twitter bootstrap to 3.2.0
Vincent Tondellier <tonton+hg@team1664.org>
parents: 1
diff changeset
  1779
    this.activeTarget = target
0df70b8735e3 Update Twitter bootstrap to 3.2.0
Vincent Tondellier <tonton+hg@team1664.org>
parents: 1
diff changeset
  1780
0df70b8735e3 Update Twitter bootstrap to 3.2.0
Vincent Tondellier <tonton+hg@team1664.org>
parents: 1
diff changeset
  1781
    $(this.selector)
0df70b8735e3 Update Twitter bootstrap to 3.2.0
Vincent Tondellier <tonton+hg@team1664.org>
parents: 1
diff changeset
  1782
      .parentsUntil(this.options.target, '.active')
0df70b8735e3 Update Twitter bootstrap to 3.2.0
Vincent Tondellier <tonton+hg@team1664.org>
parents: 1
diff changeset
  1783
      .removeClass('active')
0df70b8735e3 Update Twitter bootstrap to 3.2.0
Vincent Tondellier <tonton+hg@team1664.org>
parents: 1
diff changeset
  1784
0df70b8735e3 Update Twitter bootstrap to 3.2.0
Vincent Tondellier <tonton+hg@team1664.org>
parents: 1
diff changeset
  1785
    var selector = this.selector +
0df70b8735e3 Update Twitter bootstrap to 3.2.0
Vincent Tondellier <tonton+hg@team1664.org>
parents: 1
diff changeset
  1786
        '[data-target="' + target + '"],' +
0df70b8735e3 Update Twitter bootstrap to 3.2.0
Vincent Tondellier <tonton+hg@team1664.org>
parents: 1
diff changeset
  1787
        this.selector + '[href="' + target + '"]'
0df70b8735e3 Update Twitter bootstrap to 3.2.0
Vincent Tondellier <tonton+hg@team1664.org>
parents: 1
diff changeset
  1788
0df70b8735e3 Update Twitter bootstrap to 3.2.0
Vincent Tondellier <tonton+hg@team1664.org>
parents: 1
diff changeset
  1789
    var active = $(selector)
0df70b8735e3 Update Twitter bootstrap to 3.2.0
Vincent Tondellier <tonton+hg@team1664.org>
parents: 1
diff changeset
  1790
      .parents('li')
0df70b8735e3 Update Twitter bootstrap to 3.2.0
Vincent Tondellier <tonton+hg@team1664.org>
parents: 1
diff changeset
  1791
      .addClass('active')
0df70b8735e3 Update Twitter bootstrap to 3.2.0
Vincent Tondellier <tonton+hg@team1664.org>
parents: 1
diff changeset
  1792
0df70b8735e3 Update Twitter bootstrap to 3.2.0
Vincent Tondellier <tonton+hg@team1664.org>
parents: 1
diff changeset
  1793
    if (active.parent('.dropdown-menu').length) {
0df70b8735e3 Update Twitter bootstrap to 3.2.0
Vincent Tondellier <tonton+hg@team1664.org>
parents: 1
diff changeset
  1794
      active = active
0df70b8735e3 Update Twitter bootstrap to 3.2.0
Vincent Tondellier <tonton+hg@team1664.org>
parents: 1
diff changeset
  1795
        .closest('li.dropdown')
0df70b8735e3 Update Twitter bootstrap to 3.2.0
Vincent Tondellier <tonton+hg@team1664.org>
parents: 1
diff changeset
  1796
        .addClass('active')
0df70b8735e3 Update Twitter bootstrap to 3.2.0
Vincent Tondellier <tonton+hg@team1664.org>
parents: 1
diff changeset
  1797
    }
0df70b8735e3 Update Twitter bootstrap to 3.2.0
Vincent Tondellier <tonton+hg@team1664.org>
parents: 1
diff changeset
  1798
0df70b8735e3 Update Twitter bootstrap to 3.2.0
Vincent Tondellier <tonton+hg@team1664.org>
parents: 1
diff changeset
  1799
    active.trigger('activate.bs.scrollspy')
0df70b8735e3 Update Twitter bootstrap to 3.2.0
Vincent Tondellier <tonton+hg@team1664.org>
parents: 1
diff changeset
  1800
  }
0df70b8735e3 Update Twitter bootstrap to 3.2.0
Vincent Tondellier <tonton+hg@team1664.org>
parents: 1
diff changeset
  1801
0df70b8735e3 Update Twitter bootstrap to 3.2.0
Vincent Tondellier <tonton+hg@team1664.org>
parents: 1
diff changeset
  1802
0df70b8735e3 Update Twitter bootstrap to 3.2.0
Vincent Tondellier <tonton+hg@team1664.org>
parents: 1
diff changeset
  1803
  // SCROLLSPY PLUGIN DEFINITION
0df70b8735e3 Update Twitter bootstrap to 3.2.0
Vincent Tondellier <tonton+hg@team1664.org>
parents: 1
diff changeset
  1804
  // ===========================
0df70b8735e3 Update Twitter bootstrap to 3.2.0
Vincent Tondellier <tonton+hg@team1664.org>
parents: 1
diff changeset
  1805
0df70b8735e3 Update Twitter bootstrap to 3.2.0
Vincent Tondellier <tonton+hg@team1664.org>
parents: 1
diff changeset
  1806
  function Plugin(option) {
0df70b8735e3 Update Twitter bootstrap to 3.2.0
Vincent Tondellier <tonton+hg@team1664.org>
parents: 1
diff changeset
  1807
    return this.each(function () {
0df70b8735e3 Update Twitter bootstrap to 3.2.0
Vincent Tondellier <tonton+hg@team1664.org>
parents: 1
diff changeset
  1808
      var $this   = $(this)
0df70b8735e3 Update Twitter bootstrap to 3.2.0
Vincent Tondellier <tonton+hg@team1664.org>
parents: 1
diff changeset
  1809
      var data    = $this.data('bs.scrollspy')
0df70b8735e3 Update Twitter bootstrap to 3.2.0
Vincent Tondellier <tonton+hg@team1664.org>
parents: 1
diff changeset
  1810
      var options = typeof option == 'object' && option
0df70b8735e3 Update Twitter bootstrap to 3.2.0
Vincent Tondellier <tonton+hg@team1664.org>
parents: 1
diff changeset
  1811
0df70b8735e3 Update Twitter bootstrap to 3.2.0
Vincent Tondellier <tonton+hg@team1664.org>
parents: 1
diff changeset
  1812
      if (!data) $this.data('bs.scrollspy', (data = new ScrollSpy(this, options)))
0df70b8735e3 Update Twitter bootstrap to 3.2.0
Vincent Tondellier <tonton+hg@team1664.org>
parents: 1
diff changeset
  1813
      if (typeof option == 'string') data[option]()
0df70b8735e3 Update Twitter bootstrap to 3.2.0
Vincent Tondellier <tonton+hg@team1664.org>
parents: 1
diff changeset
  1814
    })
0df70b8735e3 Update Twitter bootstrap to 3.2.0
Vincent Tondellier <tonton+hg@team1664.org>
parents: 1
diff changeset
  1815
  }
0df70b8735e3 Update Twitter bootstrap to 3.2.0
Vincent Tondellier <tonton+hg@team1664.org>
parents: 1
diff changeset
  1816
0df70b8735e3 Update Twitter bootstrap to 3.2.0
Vincent Tondellier <tonton+hg@team1664.org>
parents: 1
diff changeset
  1817
  var old = $.fn.scrollspy
0df70b8735e3 Update Twitter bootstrap to 3.2.0
Vincent Tondellier <tonton+hg@team1664.org>
parents: 1
diff changeset
  1818
0df70b8735e3 Update Twitter bootstrap to 3.2.0
Vincent Tondellier <tonton+hg@team1664.org>
parents: 1
diff changeset
  1819
  $.fn.scrollspy             = Plugin
0df70b8735e3 Update Twitter bootstrap to 3.2.0
Vincent Tondellier <tonton+hg@team1664.org>
parents: 1
diff changeset
  1820
  $.fn.scrollspy.Constructor = ScrollSpy
0df70b8735e3 Update Twitter bootstrap to 3.2.0
Vincent Tondellier <tonton+hg@team1664.org>
parents: 1
diff changeset
  1821
0df70b8735e3 Update Twitter bootstrap to 3.2.0
Vincent Tondellier <tonton+hg@team1664.org>
parents: 1
diff changeset
  1822
0df70b8735e3 Update Twitter bootstrap to 3.2.0
Vincent Tondellier <tonton+hg@team1664.org>
parents: 1
diff changeset
  1823
  // SCROLLSPY NO CONFLICT
0df70b8735e3 Update Twitter bootstrap to 3.2.0
Vincent Tondellier <tonton+hg@team1664.org>
parents: 1
diff changeset
  1824
  // =====================
0df70b8735e3 Update Twitter bootstrap to 3.2.0
Vincent Tondellier <tonton+hg@team1664.org>
parents: 1
diff changeset
  1825
0df70b8735e3 Update Twitter bootstrap to 3.2.0
Vincent Tondellier <tonton+hg@team1664.org>
parents: 1
diff changeset
  1826
  $.fn.scrollspy.noConflict = function () {
0df70b8735e3 Update Twitter bootstrap to 3.2.0
Vincent Tondellier <tonton+hg@team1664.org>
parents: 1
diff changeset
  1827
    $.fn.scrollspy = old
0df70b8735e3 Update Twitter bootstrap to 3.2.0
Vincent Tondellier <tonton+hg@team1664.org>
parents: 1
diff changeset
  1828
    return this
0df70b8735e3 Update Twitter bootstrap to 3.2.0
Vincent Tondellier <tonton+hg@team1664.org>
parents: 1
diff changeset
  1829
  }
0df70b8735e3 Update Twitter bootstrap to 3.2.0
Vincent Tondellier <tonton+hg@team1664.org>
parents: 1
diff changeset
  1830
0df70b8735e3 Update Twitter bootstrap to 3.2.0
Vincent Tondellier <tonton+hg@team1664.org>
parents: 1
diff changeset
  1831
0df70b8735e3 Update Twitter bootstrap to 3.2.0
Vincent Tondellier <tonton+hg@team1664.org>
parents: 1
diff changeset
  1832
  // SCROLLSPY DATA-API
0df70b8735e3 Update Twitter bootstrap to 3.2.0
Vincent Tondellier <tonton+hg@team1664.org>
parents: 1
diff changeset
  1833
  // ==================
0df70b8735e3 Update Twitter bootstrap to 3.2.0
Vincent Tondellier <tonton+hg@team1664.org>
parents: 1
diff changeset
  1834
0df70b8735e3 Update Twitter bootstrap to 3.2.0
Vincent Tondellier <tonton+hg@team1664.org>
parents: 1
diff changeset
  1835
  $(window).on('load.bs.scrollspy.data-api', function () {
0df70b8735e3 Update Twitter bootstrap to 3.2.0
Vincent Tondellier <tonton+hg@team1664.org>
parents: 1
diff changeset
  1836
    $('[data-spy="scroll"]').each(function () {
0df70b8735e3 Update Twitter bootstrap to 3.2.0
Vincent Tondellier <tonton+hg@team1664.org>
parents: 1
diff changeset
  1837
      var $spy = $(this)
0df70b8735e3 Update Twitter bootstrap to 3.2.0
Vincent Tondellier <tonton+hg@team1664.org>
parents: 1
diff changeset
  1838
      Plugin.call($spy, $spy.data())
0
5b78b8c79d9c Initial commit
Vincent Tondellier <tonton+hg@team1664.org>
parents:
diff changeset
  1839
    })
5b78b8c79d9c Initial commit
Vincent Tondellier <tonton+hg@team1664.org>
parents:
diff changeset
  1840
  })
5b78b8c79d9c Initial commit
Vincent Tondellier <tonton+hg@team1664.org>
parents:
diff changeset
  1841
28
0df70b8735e3 Update Twitter bootstrap to 3.2.0
Vincent Tondellier <tonton+hg@team1664.org>
parents: 1
diff changeset
  1842
}(jQuery);
0df70b8735e3 Update Twitter bootstrap to 3.2.0
Vincent Tondellier <tonton+hg@team1664.org>
parents: 1
diff changeset
  1843
0df70b8735e3 Update Twitter bootstrap to 3.2.0
Vincent Tondellier <tonton+hg@team1664.org>
parents: 1
diff changeset
  1844
/* ========================================================================
0df70b8735e3 Update Twitter bootstrap to 3.2.0
Vincent Tondellier <tonton+hg@team1664.org>
parents: 1
diff changeset
  1845
 * Bootstrap: tab.js v3.2.0
0df70b8735e3 Update Twitter bootstrap to 3.2.0
Vincent Tondellier <tonton+hg@team1664.org>
parents: 1
diff changeset
  1846
 * http://getbootstrap.com/javascript/#tabs
0df70b8735e3 Update Twitter bootstrap to 3.2.0
Vincent Tondellier <tonton+hg@team1664.org>
parents: 1
diff changeset
  1847
 * ========================================================================
0df70b8735e3 Update Twitter bootstrap to 3.2.0
Vincent Tondellier <tonton+hg@team1664.org>
parents: 1
diff changeset
  1848
 * Copyright 2011-2014 Twitter, Inc.
0df70b8735e3 Update Twitter bootstrap to 3.2.0
Vincent Tondellier <tonton+hg@team1664.org>
parents: 1
diff changeset
  1849
 * Licensed under MIT (https://github.com/twbs/bootstrap/blob/master/LICENSE)
0df70b8735e3 Update Twitter bootstrap to 3.2.0
Vincent Tondellier <tonton+hg@team1664.org>
parents: 1
diff changeset
  1850
 * ======================================================================== */
0df70b8735e3 Update Twitter bootstrap to 3.2.0
Vincent Tondellier <tonton+hg@team1664.org>
parents: 1
diff changeset
  1851
0df70b8735e3 Update Twitter bootstrap to 3.2.0
Vincent Tondellier <tonton+hg@team1664.org>
parents: 1
diff changeset
  1852
0df70b8735e3 Update Twitter bootstrap to 3.2.0
Vincent Tondellier <tonton+hg@team1664.org>
parents: 1
diff changeset
  1853
+function ($) {
0df70b8735e3 Update Twitter bootstrap to 3.2.0
Vincent Tondellier <tonton+hg@team1664.org>
parents: 1
diff changeset
  1854
  'use strict';
0df70b8735e3 Update Twitter bootstrap to 3.2.0
Vincent Tondellier <tonton+hg@team1664.org>
parents: 1
diff changeset
  1855
0df70b8735e3 Update Twitter bootstrap to 3.2.0
Vincent Tondellier <tonton+hg@team1664.org>
parents: 1
diff changeset
  1856
  // TAB CLASS DEFINITION
0df70b8735e3 Update Twitter bootstrap to 3.2.0
Vincent Tondellier <tonton+hg@team1664.org>
parents: 1
diff changeset
  1857
  // ====================
0df70b8735e3 Update Twitter bootstrap to 3.2.0
Vincent Tondellier <tonton+hg@team1664.org>
parents: 1
diff changeset
  1858
0df70b8735e3 Update Twitter bootstrap to 3.2.0
Vincent Tondellier <tonton+hg@team1664.org>
parents: 1
diff changeset
  1859
  var Tab = function (element) {
0df70b8735e3 Update Twitter bootstrap to 3.2.0
Vincent Tondellier <tonton+hg@team1664.org>
parents: 1
diff changeset
  1860
    this.element = $(element)
0df70b8735e3 Update Twitter bootstrap to 3.2.0
Vincent Tondellier <tonton+hg@team1664.org>
parents: 1
diff changeset
  1861
  }
0df70b8735e3 Update Twitter bootstrap to 3.2.0
Vincent Tondellier <tonton+hg@team1664.org>
parents: 1
diff changeset
  1862
0df70b8735e3 Update Twitter bootstrap to 3.2.0
Vincent Tondellier <tonton+hg@team1664.org>
parents: 1
diff changeset
  1863
  Tab.VERSION = '3.2.0'
0df70b8735e3 Update Twitter bootstrap to 3.2.0
Vincent Tondellier <tonton+hg@team1664.org>
parents: 1
diff changeset
  1864
0df70b8735e3 Update Twitter bootstrap to 3.2.0
Vincent Tondellier <tonton+hg@team1664.org>
parents: 1
diff changeset
  1865
  Tab.prototype.show = function () {
0df70b8735e3 Update Twitter bootstrap to 3.2.0
Vincent Tondellier <tonton+hg@team1664.org>
parents: 1
diff changeset
  1866
    var $this    = this.element
0df70b8735e3 Update Twitter bootstrap to 3.2.0
Vincent Tondellier <tonton+hg@team1664.org>
parents: 1
diff changeset
  1867
    var $ul      = $this.closest('ul:not(.dropdown-menu)')
0df70b8735e3 Update Twitter bootstrap to 3.2.0
Vincent Tondellier <tonton+hg@team1664.org>
parents: 1
diff changeset
  1868
    var selector = $this.data('target')
0df70b8735e3 Update Twitter bootstrap to 3.2.0
Vincent Tondellier <tonton+hg@team1664.org>
parents: 1
diff changeset
  1869
0df70b8735e3 Update Twitter bootstrap to 3.2.0
Vincent Tondellier <tonton+hg@team1664.org>
parents: 1
diff changeset
  1870
    if (!selector) {
0df70b8735e3 Update Twitter bootstrap to 3.2.0
Vincent Tondellier <tonton+hg@team1664.org>
parents: 1
diff changeset
  1871
      selector = $this.attr('href')
0df70b8735e3 Update Twitter bootstrap to 3.2.0
Vincent Tondellier <tonton+hg@team1664.org>
parents: 1
diff changeset
  1872
      selector = selector && selector.replace(/.*(?=#[^\s]*$)/, '') // strip for ie7
0df70b8735e3 Update Twitter bootstrap to 3.2.0
Vincent Tondellier <tonton+hg@team1664.org>
parents: 1
diff changeset
  1873
    }
0df70b8735e3 Update Twitter bootstrap to 3.2.0
Vincent Tondellier <tonton+hg@team1664.org>
parents: 1
diff changeset
  1874
0df70b8735e3 Update Twitter bootstrap to 3.2.0
Vincent Tondellier <tonton+hg@team1664.org>
parents: 1
diff changeset
  1875
    if ($this.parent('li').hasClass('active')) return
0df70b8735e3 Update Twitter bootstrap to 3.2.0
Vincent Tondellier <tonton+hg@team1664.org>
parents: 1
diff changeset
  1876
0df70b8735e3 Update Twitter bootstrap to 3.2.0
Vincent Tondellier <tonton+hg@team1664.org>
parents: 1
diff changeset
  1877
    var previous = $ul.find('.active:last a')[0]
0df70b8735e3 Update Twitter bootstrap to 3.2.0
Vincent Tondellier <tonton+hg@team1664.org>
parents: 1
diff changeset
  1878
    var e        = $.Event('show.bs.tab', {
0df70b8735e3 Update Twitter bootstrap to 3.2.0
Vincent Tondellier <tonton+hg@team1664.org>
parents: 1
diff changeset
  1879
      relatedTarget: previous
0df70b8735e3 Update Twitter bootstrap to 3.2.0
Vincent Tondellier <tonton+hg@team1664.org>
parents: 1
diff changeset
  1880
    })
0df70b8735e3 Update Twitter bootstrap to 3.2.0
Vincent Tondellier <tonton+hg@team1664.org>
parents: 1
diff changeset
  1881
0df70b8735e3 Update Twitter bootstrap to 3.2.0
Vincent Tondellier <tonton+hg@team1664.org>
parents: 1
diff changeset
  1882
    $this.trigger(e)
0df70b8735e3 Update Twitter bootstrap to 3.2.0
Vincent Tondellier <tonton+hg@team1664.org>
parents: 1
diff changeset
  1883
0df70b8735e3 Update Twitter bootstrap to 3.2.0
Vincent Tondellier <tonton+hg@team1664.org>
parents: 1
diff changeset
  1884
    if (e.isDefaultPrevented()) return
0df70b8735e3 Update Twitter bootstrap to 3.2.0
Vincent Tondellier <tonton+hg@team1664.org>
parents: 1
diff changeset
  1885
0df70b8735e3 Update Twitter bootstrap to 3.2.0
Vincent Tondellier <tonton+hg@team1664.org>
parents: 1
diff changeset
  1886
    var $target = $(selector)
0df70b8735e3 Update Twitter bootstrap to 3.2.0
Vincent Tondellier <tonton+hg@team1664.org>
parents: 1
diff changeset
  1887
0df70b8735e3 Update Twitter bootstrap to 3.2.0
Vincent Tondellier <tonton+hg@team1664.org>
parents: 1
diff changeset
  1888
    this.activate($this.closest('li'), $ul)
0df70b8735e3 Update Twitter bootstrap to 3.2.0
Vincent Tondellier <tonton+hg@team1664.org>
parents: 1
diff changeset
  1889
    this.activate($target, $target.parent(), function () {
0df70b8735e3 Update Twitter bootstrap to 3.2.0
Vincent Tondellier <tonton+hg@team1664.org>
parents: 1
diff changeset
  1890
      $this.trigger({
0df70b8735e3 Update Twitter bootstrap to 3.2.0
Vincent Tondellier <tonton+hg@team1664.org>
parents: 1
diff changeset
  1891
        type: 'shown.bs.tab',
0df70b8735e3 Update Twitter bootstrap to 3.2.0
Vincent Tondellier <tonton+hg@team1664.org>
parents: 1
diff changeset
  1892
        relatedTarget: previous
0df70b8735e3 Update Twitter bootstrap to 3.2.0
Vincent Tondellier <tonton+hg@team1664.org>
parents: 1
diff changeset
  1893
      })
0df70b8735e3 Update Twitter bootstrap to 3.2.0
Vincent Tondellier <tonton+hg@team1664.org>
parents: 1
diff changeset
  1894
    })
0df70b8735e3 Update Twitter bootstrap to 3.2.0
Vincent Tondellier <tonton+hg@team1664.org>
parents: 1
diff changeset
  1895
  }
0df70b8735e3 Update Twitter bootstrap to 3.2.0
Vincent Tondellier <tonton+hg@team1664.org>
parents: 1
diff changeset
  1896
0df70b8735e3 Update Twitter bootstrap to 3.2.0
Vincent Tondellier <tonton+hg@team1664.org>
parents: 1
diff changeset
  1897
  Tab.prototype.activate = function (element, container, callback) {
0df70b8735e3 Update Twitter bootstrap to 3.2.0
Vincent Tondellier <tonton+hg@team1664.org>
parents: 1
diff changeset
  1898
    var $active    = container.find('> .active')
0df70b8735e3 Update Twitter bootstrap to 3.2.0
Vincent Tondellier <tonton+hg@team1664.org>
parents: 1
diff changeset
  1899
    var transition = callback
0df70b8735e3 Update Twitter bootstrap to 3.2.0
Vincent Tondellier <tonton+hg@team1664.org>
parents: 1
diff changeset
  1900
      && $.support.transition
0df70b8735e3 Update Twitter bootstrap to 3.2.0
Vincent Tondellier <tonton+hg@team1664.org>
parents: 1
diff changeset
  1901
      && $active.hasClass('fade')
0df70b8735e3 Update Twitter bootstrap to 3.2.0
Vincent Tondellier <tonton+hg@team1664.org>
parents: 1
diff changeset
  1902
0df70b8735e3 Update Twitter bootstrap to 3.2.0
Vincent Tondellier <tonton+hg@team1664.org>
parents: 1
diff changeset
  1903
    function next() {
0df70b8735e3 Update Twitter bootstrap to 3.2.0
Vincent Tondellier <tonton+hg@team1664.org>
parents: 1
diff changeset
  1904
      $active
0df70b8735e3 Update Twitter bootstrap to 3.2.0
Vincent Tondellier <tonton+hg@team1664.org>
parents: 1
diff changeset
  1905
        .removeClass('active')
0df70b8735e3 Update Twitter bootstrap to 3.2.0
Vincent Tondellier <tonton+hg@team1664.org>
parents: 1
diff changeset
  1906
        .find('> .dropdown-menu > .active')
0df70b8735e3 Update Twitter bootstrap to 3.2.0
Vincent Tondellier <tonton+hg@team1664.org>
parents: 1
diff changeset
  1907
        .removeClass('active')
0df70b8735e3 Update Twitter bootstrap to 3.2.0
Vincent Tondellier <tonton+hg@team1664.org>
parents: 1
diff changeset
  1908
0df70b8735e3 Update Twitter bootstrap to 3.2.0
Vincent Tondellier <tonton+hg@team1664.org>
parents: 1
diff changeset
  1909
      element.addClass('active')
0df70b8735e3 Update Twitter bootstrap to 3.2.0
Vincent Tondellier <tonton+hg@team1664.org>
parents: 1
diff changeset
  1910
0df70b8735e3 Update Twitter bootstrap to 3.2.0
Vincent Tondellier <tonton+hg@team1664.org>
parents: 1
diff changeset
  1911
      if (transition) {
0df70b8735e3 Update Twitter bootstrap to 3.2.0
Vincent Tondellier <tonton+hg@team1664.org>
parents: 1
diff changeset
  1912
        element[0].offsetWidth // reflow for transition
0df70b8735e3 Update Twitter bootstrap to 3.2.0
Vincent Tondellier <tonton+hg@team1664.org>
parents: 1
diff changeset
  1913
        element.addClass('in')
0df70b8735e3 Update Twitter bootstrap to 3.2.0
Vincent Tondellier <tonton+hg@team1664.org>
parents: 1
diff changeset
  1914
      } else {
0df70b8735e3 Update Twitter bootstrap to 3.2.0
Vincent Tondellier <tonton+hg@team1664.org>
parents: 1
diff changeset
  1915
        element.removeClass('fade')
0df70b8735e3 Update Twitter bootstrap to 3.2.0
Vincent Tondellier <tonton+hg@team1664.org>
parents: 1
diff changeset
  1916
      }
0df70b8735e3 Update Twitter bootstrap to 3.2.0
Vincent Tondellier <tonton+hg@team1664.org>
parents: 1
diff changeset
  1917
0df70b8735e3 Update Twitter bootstrap to 3.2.0
Vincent Tondellier <tonton+hg@team1664.org>
parents: 1
diff changeset
  1918
      if (element.parent('.dropdown-menu')) {
0df70b8735e3 Update Twitter bootstrap to 3.2.0
Vincent Tondellier <tonton+hg@team1664.org>
parents: 1
diff changeset
  1919
        element.closest('li.dropdown').addClass('active')
0df70b8735e3 Update Twitter bootstrap to 3.2.0
Vincent Tondellier <tonton+hg@team1664.org>
parents: 1
diff changeset
  1920
      }
0df70b8735e3 Update Twitter bootstrap to 3.2.0
Vincent Tondellier <tonton+hg@team1664.org>
parents: 1
diff changeset
  1921
0df70b8735e3 Update Twitter bootstrap to 3.2.0
Vincent Tondellier <tonton+hg@team1664.org>
parents: 1
diff changeset
  1922
      callback && callback()
0df70b8735e3 Update Twitter bootstrap to 3.2.0
Vincent Tondellier <tonton+hg@team1664.org>
parents: 1
diff changeset
  1923
    }
0df70b8735e3 Update Twitter bootstrap to 3.2.0
Vincent Tondellier <tonton+hg@team1664.org>
parents: 1
diff changeset
  1924
0df70b8735e3 Update Twitter bootstrap to 3.2.0
Vincent Tondellier <tonton+hg@team1664.org>
parents: 1
diff changeset
  1925
    transition ?
0df70b8735e3 Update Twitter bootstrap to 3.2.0
Vincent Tondellier <tonton+hg@team1664.org>
parents: 1
diff changeset
  1926
      $active
0df70b8735e3 Update Twitter bootstrap to 3.2.0
Vincent Tondellier <tonton+hg@team1664.org>
parents: 1
diff changeset
  1927
        .one('bsTransitionEnd', next)
0df70b8735e3 Update Twitter bootstrap to 3.2.0
Vincent Tondellier <tonton+hg@team1664.org>
parents: 1
diff changeset
  1928
        .emulateTransitionEnd(150) :
0df70b8735e3 Update Twitter bootstrap to 3.2.0
Vincent Tondellier <tonton+hg@team1664.org>
parents: 1
diff changeset
  1929
      next()
0df70b8735e3 Update Twitter bootstrap to 3.2.0
Vincent Tondellier <tonton+hg@team1664.org>
parents: 1
diff changeset
  1930
0df70b8735e3 Update Twitter bootstrap to 3.2.0
Vincent Tondellier <tonton+hg@team1664.org>
parents: 1
diff changeset
  1931
    $active.removeClass('in')
0df70b8735e3 Update Twitter bootstrap to 3.2.0
Vincent Tondellier <tonton+hg@team1664.org>
parents: 1
diff changeset
  1932
  }
0df70b8735e3 Update Twitter bootstrap to 3.2.0
Vincent Tondellier <tonton+hg@team1664.org>
parents: 1
diff changeset
  1933
0df70b8735e3 Update Twitter bootstrap to 3.2.0
Vincent Tondellier <tonton+hg@team1664.org>
parents: 1
diff changeset
  1934
0df70b8735e3 Update Twitter bootstrap to 3.2.0
Vincent Tondellier <tonton+hg@team1664.org>
parents: 1
diff changeset
  1935
  // TAB PLUGIN DEFINITION
0df70b8735e3 Update Twitter bootstrap to 3.2.0
Vincent Tondellier <tonton+hg@team1664.org>
parents: 1
diff changeset
  1936
  // =====================
0df70b8735e3 Update Twitter bootstrap to 3.2.0
Vincent Tondellier <tonton+hg@team1664.org>
parents: 1
diff changeset
  1937
0df70b8735e3 Update Twitter bootstrap to 3.2.0
Vincent Tondellier <tonton+hg@team1664.org>
parents: 1
diff changeset
  1938
  function Plugin(option) {
0df70b8735e3 Update Twitter bootstrap to 3.2.0
Vincent Tondellier <tonton+hg@team1664.org>
parents: 1
diff changeset
  1939
    return this.each(function () {
0df70b8735e3 Update Twitter bootstrap to 3.2.0
Vincent Tondellier <tonton+hg@team1664.org>
parents: 1
diff changeset
  1940
      var $this = $(this)
0df70b8735e3 Update Twitter bootstrap to 3.2.0
Vincent Tondellier <tonton+hg@team1664.org>
parents: 1
diff changeset
  1941
      var data  = $this.data('bs.tab')
0df70b8735e3 Update Twitter bootstrap to 3.2.0
Vincent Tondellier <tonton+hg@team1664.org>
parents: 1
diff changeset
  1942
0df70b8735e3 Update Twitter bootstrap to 3.2.0
Vincent Tondellier <tonton+hg@team1664.org>
parents: 1
diff changeset
  1943
      if (!data) $this.data('bs.tab', (data = new Tab(this)))
0df70b8735e3 Update Twitter bootstrap to 3.2.0
Vincent Tondellier <tonton+hg@team1664.org>
parents: 1
diff changeset
  1944
      if (typeof option == 'string') data[option]()
0df70b8735e3 Update Twitter bootstrap to 3.2.0
Vincent Tondellier <tonton+hg@team1664.org>
parents: 1
diff changeset
  1945
    })
0df70b8735e3 Update Twitter bootstrap to 3.2.0
Vincent Tondellier <tonton+hg@team1664.org>
parents: 1
diff changeset
  1946
  }
0df70b8735e3 Update Twitter bootstrap to 3.2.0
Vincent Tondellier <tonton+hg@team1664.org>
parents: 1
diff changeset
  1947
0df70b8735e3 Update Twitter bootstrap to 3.2.0
Vincent Tondellier <tonton+hg@team1664.org>
parents: 1
diff changeset
  1948
  var old = $.fn.tab
0df70b8735e3 Update Twitter bootstrap to 3.2.0
Vincent Tondellier <tonton+hg@team1664.org>
parents: 1
diff changeset
  1949
0df70b8735e3 Update Twitter bootstrap to 3.2.0
Vincent Tondellier <tonton+hg@team1664.org>
parents: 1
diff changeset
  1950
  $.fn.tab             = Plugin
0df70b8735e3 Update Twitter bootstrap to 3.2.0
Vincent Tondellier <tonton+hg@team1664.org>
parents: 1
diff changeset
  1951
  $.fn.tab.Constructor = Tab
0df70b8735e3 Update Twitter bootstrap to 3.2.0
Vincent Tondellier <tonton+hg@team1664.org>
parents: 1
diff changeset
  1952
0df70b8735e3 Update Twitter bootstrap to 3.2.0
Vincent Tondellier <tonton+hg@team1664.org>
parents: 1
diff changeset
  1953
0df70b8735e3 Update Twitter bootstrap to 3.2.0
Vincent Tondellier <tonton+hg@team1664.org>
parents: 1
diff changeset
  1954
  // TAB NO CONFLICT
0df70b8735e3 Update Twitter bootstrap to 3.2.0
Vincent Tondellier <tonton+hg@team1664.org>
parents: 1
diff changeset
  1955
  // ===============
0df70b8735e3 Update Twitter bootstrap to 3.2.0
Vincent Tondellier <tonton+hg@team1664.org>
parents: 1
diff changeset
  1956
0df70b8735e3 Update Twitter bootstrap to 3.2.0
Vincent Tondellier <tonton+hg@team1664.org>
parents: 1
diff changeset
  1957
  $.fn.tab.noConflict = function () {
0df70b8735e3 Update Twitter bootstrap to 3.2.0
Vincent Tondellier <tonton+hg@team1664.org>
parents: 1
diff changeset
  1958
    $.fn.tab = old
0df70b8735e3 Update Twitter bootstrap to 3.2.0
Vincent Tondellier <tonton+hg@team1664.org>
parents: 1
diff changeset
  1959
    return this
0df70b8735e3 Update Twitter bootstrap to 3.2.0
Vincent Tondellier <tonton+hg@team1664.org>
parents: 1
diff changeset
  1960
  }
0df70b8735e3 Update Twitter bootstrap to 3.2.0
Vincent Tondellier <tonton+hg@team1664.org>
parents: 1
diff changeset
  1961
0df70b8735e3 Update Twitter bootstrap to 3.2.0
Vincent Tondellier <tonton+hg@team1664.org>
parents: 1
diff changeset
  1962
0df70b8735e3 Update Twitter bootstrap to 3.2.0
Vincent Tondellier <tonton+hg@team1664.org>
parents: 1
diff changeset
  1963
  // TAB DATA-API
0df70b8735e3 Update Twitter bootstrap to 3.2.0
Vincent Tondellier <tonton+hg@team1664.org>
parents: 1
diff changeset
  1964
  // ============
0df70b8735e3 Update Twitter bootstrap to 3.2.0
Vincent Tondellier <tonton+hg@team1664.org>
parents: 1
diff changeset
  1965
0df70b8735e3 Update Twitter bootstrap to 3.2.0
Vincent Tondellier <tonton+hg@team1664.org>
parents: 1
diff changeset
  1966
  $(document).on('click.bs.tab.data-api', '[data-toggle="tab"], [data-toggle="pill"]', function (e) {
0df70b8735e3 Update Twitter bootstrap to 3.2.0
Vincent Tondellier <tonton+hg@team1664.org>
parents: 1
diff changeset
  1967
    e.preventDefault()
0df70b8735e3 Update Twitter bootstrap to 3.2.0
Vincent Tondellier <tonton+hg@team1664.org>
parents: 1
diff changeset
  1968
    Plugin.call($(this), 'show')
0df70b8735e3 Update Twitter bootstrap to 3.2.0
Vincent Tondellier <tonton+hg@team1664.org>
parents: 1
diff changeset
  1969
  })
0df70b8735e3 Update Twitter bootstrap to 3.2.0
Vincent Tondellier <tonton+hg@team1664.org>
parents: 1
diff changeset
  1970
0df70b8735e3 Update Twitter bootstrap to 3.2.0
Vincent Tondellier <tonton+hg@team1664.org>
parents: 1
diff changeset
  1971
}(jQuery);
0df70b8735e3 Update Twitter bootstrap to 3.2.0
Vincent Tondellier <tonton+hg@team1664.org>
parents: 1
diff changeset
  1972
0df70b8735e3 Update Twitter bootstrap to 3.2.0
Vincent Tondellier <tonton+hg@team1664.org>
parents: 1
diff changeset
  1973
/* ========================================================================
0df70b8735e3 Update Twitter bootstrap to 3.2.0
Vincent Tondellier <tonton+hg@team1664.org>
parents: 1
diff changeset
  1974
 * Bootstrap: affix.js v3.2.0
0df70b8735e3 Update Twitter bootstrap to 3.2.0
Vincent Tondellier <tonton+hg@team1664.org>
parents: 1
diff changeset
  1975
 * http://getbootstrap.com/javascript/#affix
0df70b8735e3 Update Twitter bootstrap to 3.2.0
Vincent Tondellier <tonton+hg@team1664.org>
parents: 1
diff changeset
  1976
 * ========================================================================
0df70b8735e3 Update Twitter bootstrap to 3.2.0
Vincent Tondellier <tonton+hg@team1664.org>
parents: 1
diff changeset
  1977
 * Copyright 2011-2014 Twitter, Inc.
0df70b8735e3 Update Twitter bootstrap to 3.2.0
Vincent Tondellier <tonton+hg@team1664.org>
parents: 1
diff changeset
  1978
 * Licensed under MIT (https://github.com/twbs/bootstrap/blob/master/LICENSE)
0df70b8735e3 Update Twitter bootstrap to 3.2.0
Vincent Tondellier <tonton+hg@team1664.org>
parents: 1
diff changeset
  1979
 * ======================================================================== */
0df70b8735e3 Update Twitter bootstrap to 3.2.0
Vincent Tondellier <tonton+hg@team1664.org>
parents: 1
diff changeset
  1980
0df70b8735e3 Update Twitter bootstrap to 3.2.0
Vincent Tondellier <tonton+hg@team1664.org>
parents: 1
diff changeset
  1981
0df70b8735e3 Update Twitter bootstrap to 3.2.0
Vincent Tondellier <tonton+hg@team1664.org>
parents: 1
diff changeset
  1982
+function ($) {
0df70b8735e3 Update Twitter bootstrap to 3.2.0
Vincent Tondellier <tonton+hg@team1664.org>
parents: 1
diff changeset
  1983
  'use strict';
0df70b8735e3 Update Twitter bootstrap to 3.2.0
Vincent Tondellier <tonton+hg@team1664.org>
parents: 1
diff changeset
  1984
0df70b8735e3 Update Twitter bootstrap to 3.2.0
Vincent Tondellier <tonton+hg@team1664.org>
parents: 1
diff changeset
  1985
  // AFFIX CLASS DEFINITION
0df70b8735e3 Update Twitter bootstrap to 3.2.0
Vincent Tondellier <tonton+hg@team1664.org>
parents: 1
diff changeset
  1986
  // ======================
0df70b8735e3 Update Twitter bootstrap to 3.2.0
Vincent Tondellier <tonton+hg@team1664.org>
parents: 1
diff changeset
  1987
0df70b8735e3 Update Twitter bootstrap to 3.2.0
Vincent Tondellier <tonton+hg@team1664.org>
parents: 1
diff changeset
  1988
  var Affix = function (element, options) {
0df70b8735e3 Update Twitter bootstrap to 3.2.0
Vincent Tondellier <tonton+hg@team1664.org>
parents: 1
diff changeset
  1989
    this.options = $.extend({}, Affix.DEFAULTS, options)
0df70b8735e3 Update Twitter bootstrap to 3.2.0
Vincent Tondellier <tonton+hg@team1664.org>
parents: 1
diff changeset
  1990
0df70b8735e3 Update Twitter bootstrap to 3.2.0
Vincent Tondellier <tonton+hg@team1664.org>
parents: 1
diff changeset
  1991
    this.$target = $(this.options.target)
0df70b8735e3 Update Twitter bootstrap to 3.2.0
Vincent Tondellier <tonton+hg@team1664.org>
parents: 1
diff changeset
  1992
      .on('scroll.bs.affix.data-api', $.proxy(this.checkPosition, this))
0df70b8735e3 Update Twitter bootstrap to 3.2.0
Vincent Tondellier <tonton+hg@team1664.org>
parents: 1
diff changeset
  1993
      .on('click.bs.affix.data-api',  $.proxy(this.checkPositionWithEventLoop, this))
0df70b8735e3 Update Twitter bootstrap to 3.2.0
Vincent Tondellier <tonton+hg@team1664.org>
parents: 1
diff changeset
  1994
0df70b8735e3 Update Twitter bootstrap to 3.2.0
Vincent Tondellier <tonton+hg@team1664.org>
parents: 1
diff changeset
  1995
    this.$element     = $(element)
0df70b8735e3 Update Twitter bootstrap to 3.2.0
Vincent Tondellier <tonton+hg@team1664.org>
parents: 1
diff changeset
  1996
    this.affixed      =
0df70b8735e3 Update Twitter bootstrap to 3.2.0
Vincent Tondellier <tonton+hg@team1664.org>
parents: 1
diff changeset
  1997
    this.unpin        =
0df70b8735e3 Update Twitter bootstrap to 3.2.0
Vincent Tondellier <tonton+hg@team1664.org>
parents: 1
diff changeset
  1998
    this.pinnedOffset = null
0df70b8735e3 Update Twitter bootstrap to 3.2.0
Vincent Tondellier <tonton+hg@team1664.org>
parents: 1
diff changeset
  1999
0df70b8735e3 Update Twitter bootstrap to 3.2.0
Vincent Tondellier <tonton+hg@team1664.org>
parents: 1
diff changeset
  2000
    this.checkPosition()
0df70b8735e3 Update Twitter bootstrap to 3.2.0
Vincent Tondellier <tonton+hg@team1664.org>
parents: 1
diff changeset
  2001
  }
0df70b8735e3 Update Twitter bootstrap to 3.2.0
Vincent Tondellier <tonton+hg@team1664.org>
parents: 1
diff changeset
  2002
0df70b8735e3 Update Twitter bootstrap to 3.2.0
Vincent Tondellier <tonton+hg@team1664.org>
parents: 1
diff changeset
  2003
  Affix.VERSION  = '3.2.0'
0df70b8735e3 Update Twitter bootstrap to 3.2.0
Vincent Tondellier <tonton+hg@team1664.org>
parents: 1
diff changeset
  2004
0df70b8735e3 Update Twitter bootstrap to 3.2.0
Vincent Tondellier <tonton+hg@team1664.org>
parents: 1
diff changeset
  2005
  Affix.RESET    = 'affix affix-top affix-bottom'
0df70b8735e3 Update Twitter bootstrap to 3.2.0
Vincent Tondellier <tonton+hg@team1664.org>
parents: 1
diff changeset
  2006
0df70b8735e3 Update Twitter bootstrap to 3.2.0
Vincent Tondellier <tonton+hg@team1664.org>
parents: 1
diff changeset
  2007
  Affix.DEFAULTS = {
0df70b8735e3 Update Twitter bootstrap to 3.2.0
Vincent Tondellier <tonton+hg@team1664.org>
parents: 1
diff changeset
  2008
    offset: 0,
0df70b8735e3 Update Twitter bootstrap to 3.2.0
Vincent Tondellier <tonton+hg@team1664.org>
parents: 1
diff changeset
  2009
    target: window
0df70b8735e3 Update Twitter bootstrap to 3.2.0
Vincent Tondellier <tonton+hg@team1664.org>
parents: 1
diff changeset
  2010
  }
0df70b8735e3 Update Twitter bootstrap to 3.2.0
Vincent Tondellier <tonton+hg@team1664.org>
parents: 1
diff changeset
  2011
0df70b8735e3 Update Twitter bootstrap to 3.2.0
Vincent Tondellier <tonton+hg@team1664.org>
parents: 1
diff changeset
  2012
  Affix.prototype.getPinnedOffset = function () {
0df70b8735e3 Update Twitter bootstrap to 3.2.0
Vincent Tondellier <tonton+hg@team1664.org>
parents: 1
diff changeset
  2013
    if (this.pinnedOffset) return this.pinnedOffset
0df70b8735e3 Update Twitter bootstrap to 3.2.0
Vincent Tondellier <tonton+hg@team1664.org>
parents: 1
diff changeset
  2014
    this.$element.removeClass(Affix.RESET).addClass('affix')
0df70b8735e3 Update Twitter bootstrap to 3.2.0
Vincent Tondellier <tonton+hg@team1664.org>
parents: 1
diff changeset
  2015
    var scrollTop = this.$target.scrollTop()
0df70b8735e3 Update Twitter bootstrap to 3.2.0
Vincent Tondellier <tonton+hg@team1664.org>
parents: 1
diff changeset
  2016
    var position  = this.$element.offset()
0df70b8735e3 Update Twitter bootstrap to 3.2.0
Vincent Tondellier <tonton+hg@team1664.org>
parents: 1
diff changeset
  2017
    return (this.pinnedOffset = position.top - scrollTop)
0df70b8735e3 Update Twitter bootstrap to 3.2.0
Vincent Tondellier <tonton+hg@team1664.org>
parents: 1
diff changeset
  2018
  }
0df70b8735e3 Update Twitter bootstrap to 3.2.0
Vincent Tondellier <tonton+hg@team1664.org>
parents: 1
diff changeset
  2019
0df70b8735e3 Update Twitter bootstrap to 3.2.0
Vincent Tondellier <tonton+hg@team1664.org>
parents: 1
diff changeset
  2020
  Affix.prototype.checkPositionWithEventLoop = function () {
0df70b8735e3 Update Twitter bootstrap to 3.2.0
Vincent Tondellier <tonton+hg@team1664.org>
parents: 1
diff changeset
  2021
    setTimeout($.proxy(this.checkPosition, this), 1)
0df70b8735e3 Update Twitter bootstrap to 3.2.0
Vincent Tondellier <tonton+hg@team1664.org>
parents: 1
diff changeset
  2022
  }
0df70b8735e3 Update Twitter bootstrap to 3.2.0
Vincent Tondellier <tonton+hg@team1664.org>
parents: 1
diff changeset
  2023
0df70b8735e3 Update Twitter bootstrap to 3.2.0
Vincent Tondellier <tonton+hg@team1664.org>
parents: 1
diff changeset
  2024
  Affix.prototype.checkPosition = function () {
0df70b8735e3 Update Twitter bootstrap to 3.2.0
Vincent Tondellier <tonton+hg@team1664.org>
parents: 1
diff changeset
  2025
    if (!this.$element.is(':visible')) return
0df70b8735e3 Update Twitter bootstrap to 3.2.0
Vincent Tondellier <tonton+hg@team1664.org>
parents: 1
diff changeset
  2026
0df70b8735e3 Update Twitter bootstrap to 3.2.0
Vincent Tondellier <tonton+hg@team1664.org>
parents: 1
diff changeset
  2027
    var scrollHeight = $(document).height()
0df70b8735e3 Update Twitter bootstrap to 3.2.0
Vincent Tondellier <tonton+hg@team1664.org>
parents: 1
diff changeset
  2028
    var scrollTop    = this.$target.scrollTop()
0df70b8735e3 Update Twitter bootstrap to 3.2.0
Vincent Tondellier <tonton+hg@team1664.org>
parents: 1
diff changeset
  2029
    var position     = this.$element.offset()
0df70b8735e3 Update Twitter bootstrap to 3.2.0
Vincent Tondellier <tonton+hg@team1664.org>
parents: 1
diff changeset
  2030
    var offset       = this.options.offset
0df70b8735e3 Update Twitter bootstrap to 3.2.0
Vincent Tondellier <tonton+hg@team1664.org>
parents: 1
diff changeset
  2031
    var offsetTop    = offset.top
0df70b8735e3 Update Twitter bootstrap to 3.2.0
Vincent Tondellier <tonton+hg@team1664.org>
parents: 1
diff changeset
  2032
    var offsetBottom = offset.bottom
0df70b8735e3 Update Twitter bootstrap to 3.2.0
Vincent Tondellier <tonton+hg@team1664.org>
parents: 1
diff changeset
  2033
0df70b8735e3 Update Twitter bootstrap to 3.2.0
Vincent Tondellier <tonton+hg@team1664.org>
parents: 1
diff changeset
  2034
    if (typeof offset != 'object')         offsetBottom = offsetTop = offset
0df70b8735e3 Update Twitter bootstrap to 3.2.0
Vincent Tondellier <tonton+hg@team1664.org>
parents: 1
diff changeset
  2035
    if (typeof offsetTop == 'function')    offsetTop    = offset.top(this.$element)
0df70b8735e3 Update Twitter bootstrap to 3.2.0
Vincent Tondellier <tonton+hg@team1664.org>
parents: 1
diff changeset
  2036
    if (typeof offsetBottom == 'function') offsetBottom = offset.bottom(this.$element)
0df70b8735e3 Update Twitter bootstrap to 3.2.0
Vincent Tondellier <tonton+hg@team1664.org>
parents: 1
diff changeset
  2037
0df70b8735e3 Update Twitter bootstrap to 3.2.0
Vincent Tondellier <tonton+hg@team1664.org>
parents: 1
diff changeset
  2038
    var affix = this.unpin   != null && (scrollTop + this.unpin <= position.top) ? false :
0df70b8735e3 Update Twitter bootstrap to 3.2.0
Vincent Tondellier <tonton+hg@team1664.org>
parents: 1
diff changeset
  2039
                offsetBottom != null && (position.top + this.$element.height() >= scrollHeight - offsetBottom) ? 'bottom' :
0df70b8735e3 Update Twitter bootstrap to 3.2.0
Vincent Tondellier <tonton+hg@team1664.org>
parents: 1
diff changeset
  2040
                offsetTop    != null && (scrollTop <= offsetTop) ? 'top' : false
0df70b8735e3 Update Twitter bootstrap to 3.2.0
Vincent Tondellier <tonton+hg@team1664.org>
parents: 1
diff changeset
  2041
0df70b8735e3 Update Twitter bootstrap to 3.2.0
Vincent Tondellier <tonton+hg@team1664.org>
parents: 1
diff changeset
  2042
    if (this.affixed === affix) return
0df70b8735e3 Update Twitter bootstrap to 3.2.0
Vincent Tondellier <tonton+hg@team1664.org>
parents: 1
diff changeset
  2043
    if (this.unpin != null) this.$element.css('top', '')
0df70b8735e3 Update Twitter bootstrap to 3.2.0
Vincent Tondellier <tonton+hg@team1664.org>
parents: 1
diff changeset
  2044
0df70b8735e3 Update Twitter bootstrap to 3.2.0
Vincent Tondellier <tonton+hg@team1664.org>
parents: 1
diff changeset
  2045
    var affixType = 'affix' + (affix ? '-' + affix : '')
0df70b8735e3 Update Twitter bootstrap to 3.2.0
Vincent Tondellier <tonton+hg@team1664.org>
parents: 1
diff changeset
  2046
    var e         = $.Event(affixType + '.bs.affix')
0df70b8735e3 Update Twitter bootstrap to 3.2.0
Vincent Tondellier <tonton+hg@team1664.org>
parents: 1
diff changeset
  2047
0df70b8735e3 Update Twitter bootstrap to 3.2.0
Vincent Tondellier <tonton+hg@team1664.org>
parents: 1
diff changeset
  2048
    this.$element.trigger(e)
0df70b8735e3 Update Twitter bootstrap to 3.2.0
Vincent Tondellier <tonton+hg@team1664.org>
parents: 1
diff changeset
  2049
0df70b8735e3 Update Twitter bootstrap to 3.2.0
Vincent Tondellier <tonton+hg@team1664.org>
parents: 1
diff changeset
  2050
    if (e.isDefaultPrevented()) return
0df70b8735e3 Update Twitter bootstrap to 3.2.0
Vincent Tondellier <tonton+hg@team1664.org>
parents: 1
diff changeset
  2051
0df70b8735e3 Update Twitter bootstrap to 3.2.0
Vincent Tondellier <tonton+hg@team1664.org>
parents: 1
diff changeset
  2052
    this.affixed = affix
0df70b8735e3 Update Twitter bootstrap to 3.2.0
Vincent Tondellier <tonton+hg@team1664.org>
parents: 1
diff changeset
  2053
    this.unpin = affix == 'bottom' ? this.getPinnedOffset() : null
0df70b8735e3 Update Twitter bootstrap to 3.2.0
Vincent Tondellier <tonton+hg@team1664.org>
parents: 1
diff changeset
  2054
0df70b8735e3 Update Twitter bootstrap to 3.2.0
Vincent Tondellier <tonton+hg@team1664.org>
parents: 1
diff changeset
  2055
    this.$element
0df70b8735e3 Update Twitter bootstrap to 3.2.0
Vincent Tondellier <tonton+hg@team1664.org>
parents: 1
diff changeset
  2056
      .removeClass(Affix.RESET)
0df70b8735e3 Update Twitter bootstrap to 3.2.0
Vincent Tondellier <tonton+hg@team1664.org>
parents: 1
diff changeset
  2057
      .addClass(affixType)
0df70b8735e3 Update Twitter bootstrap to 3.2.0
Vincent Tondellier <tonton+hg@team1664.org>
parents: 1
diff changeset
  2058
      .trigger($.Event(affixType.replace('affix', 'affixed')))
0df70b8735e3 Update Twitter bootstrap to 3.2.0
Vincent Tondellier <tonton+hg@team1664.org>
parents: 1
diff changeset
  2059
0df70b8735e3 Update Twitter bootstrap to 3.2.0
Vincent Tondellier <tonton+hg@team1664.org>
parents: 1
diff changeset
  2060
    if (affix == 'bottom') {
0df70b8735e3 Update Twitter bootstrap to 3.2.0
Vincent Tondellier <tonton+hg@team1664.org>
parents: 1
diff changeset
  2061
      this.$element.offset({
0df70b8735e3 Update Twitter bootstrap to 3.2.0
Vincent Tondellier <tonton+hg@team1664.org>
parents: 1
diff changeset
  2062
        top: scrollHeight - this.$element.height() - offsetBottom
0df70b8735e3 Update Twitter bootstrap to 3.2.0
Vincent Tondellier <tonton+hg@team1664.org>
parents: 1
diff changeset
  2063
      })
0df70b8735e3 Update Twitter bootstrap to 3.2.0
Vincent Tondellier <tonton+hg@team1664.org>
parents: 1
diff changeset
  2064
    }
0df70b8735e3 Update Twitter bootstrap to 3.2.0
Vincent Tondellier <tonton+hg@team1664.org>
parents: 1
diff changeset
  2065
  }
0df70b8735e3 Update Twitter bootstrap to 3.2.0
Vincent Tondellier <tonton+hg@team1664.org>
parents: 1
diff changeset
  2066
0df70b8735e3 Update Twitter bootstrap to 3.2.0
Vincent Tondellier <tonton+hg@team1664.org>
parents: 1
diff changeset
  2067
0df70b8735e3 Update Twitter bootstrap to 3.2.0
Vincent Tondellier <tonton+hg@team1664.org>
parents: 1
diff changeset
  2068
  // AFFIX PLUGIN DEFINITION
0df70b8735e3 Update Twitter bootstrap to 3.2.0
Vincent Tondellier <tonton+hg@team1664.org>
parents: 1
diff changeset
  2069
  // =======================
0df70b8735e3 Update Twitter bootstrap to 3.2.0
Vincent Tondellier <tonton+hg@team1664.org>
parents: 1
diff changeset
  2070
0df70b8735e3 Update Twitter bootstrap to 3.2.0
Vincent Tondellier <tonton+hg@team1664.org>
parents: 1
diff changeset
  2071
  function Plugin(option) {
0df70b8735e3 Update Twitter bootstrap to 3.2.0
Vincent Tondellier <tonton+hg@team1664.org>
parents: 1
diff changeset
  2072
    return this.each(function () {
0df70b8735e3 Update Twitter bootstrap to 3.2.0
Vincent Tondellier <tonton+hg@team1664.org>
parents: 1
diff changeset
  2073
      var $this   = $(this)
0df70b8735e3 Update Twitter bootstrap to 3.2.0
Vincent Tondellier <tonton+hg@team1664.org>
parents: 1
diff changeset
  2074
      var data    = $this.data('bs.affix')
0df70b8735e3 Update Twitter bootstrap to 3.2.0
Vincent Tondellier <tonton+hg@team1664.org>
parents: 1
diff changeset
  2075
      var options = typeof option == 'object' && option
0df70b8735e3 Update Twitter bootstrap to 3.2.0
Vincent Tondellier <tonton+hg@team1664.org>
parents: 1
diff changeset
  2076
0df70b8735e3 Update Twitter bootstrap to 3.2.0
Vincent Tondellier <tonton+hg@team1664.org>
parents: 1
diff changeset
  2077
      if (!data) $this.data('bs.affix', (data = new Affix(this, options)))
0df70b8735e3 Update Twitter bootstrap to 3.2.0
Vincent Tondellier <tonton+hg@team1664.org>
parents: 1
diff changeset
  2078
      if (typeof option == 'string') data[option]()
0df70b8735e3 Update Twitter bootstrap to 3.2.0
Vincent Tondellier <tonton+hg@team1664.org>
parents: 1
diff changeset
  2079
    })
0df70b8735e3 Update Twitter bootstrap to 3.2.0
Vincent Tondellier <tonton+hg@team1664.org>
parents: 1
diff changeset
  2080
  }
0df70b8735e3 Update Twitter bootstrap to 3.2.0
Vincent Tondellier <tonton+hg@team1664.org>
parents: 1
diff changeset
  2081
0df70b8735e3 Update Twitter bootstrap to 3.2.0
Vincent Tondellier <tonton+hg@team1664.org>
parents: 1
diff changeset
  2082
  var old = $.fn.affix
0df70b8735e3 Update Twitter bootstrap to 3.2.0
Vincent Tondellier <tonton+hg@team1664.org>
parents: 1
diff changeset
  2083
0df70b8735e3 Update Twitter bootstrap to 3.2.0
Vincent Tondellier <tonton+hg@team1664.org>
parents: 1
diff changeset
  2084
  $.fn.affix             = Plugin
0df70b8735e3 Update Twitter bootstrap to 3.2.0
Vincent Tondellier <tonton+hg@team1664.org>
parents: 1
diff changeset
  2085
  $.fn.affix.Constructor = Affix
0df70b8735e3 Update Twitter bootstrap to 3.2.0
Vincent Tondellier <tonton+hg@team1664.org>
parents: 1
diff changeset
  2086
0df70b8735e3 Update Twitter bootstrap to 3.2.0
Vincent Tondellier <tonton+hg@team1664.org>
parents: 1
diff changeset
  2087
0df70b8735e3 Update Twitter bootstrap to 3.2.0
Vincent Tondellier <tonton+hg@team1664.org>
parents: 1
diff changeset
  2088
  // AFFIX NO CONFLICT
0df70b8735e3 Update Twitter bootstrap to 3.2.0
Vincent Tondellier <tonton+hg@team1664.org>
parents: 1
diff changeset
  2089
  // =================
0df70b8735e3 Update Twitter bootstrap to 3.2.0
Vincent Tondellier <tonton+hg@team1664.org>
parents: 1
diff changeset
  2090
0df70b8735e3 Update Twitter bootstrap to 3.2.0
Vincent Tondellier <tonton+hg@team1664.org>
parents: 1
diff changeset
  2091
  $.fn.affix.noConflict = function () {
0df70b8735e3 Update Twitter bootstrap to 3.2.0
Vincent Tondellier <tonton+hg@team1664.org>
parents: 1
diff changeset
  2092
    $.fn.affix = old
0df70b8735e3 Update Twitter bootstrap to 3.2.0
Vincent Tondellier <tonton+hg@team1664.org>
parents: 1
diff changeset
  2093
    return this
0df70b8735e3 Update Twitter bootstrap to 3.2.0
Vincent Tondellier <tonton+hg@team1664.org>
parents: 1
diff changeset
  2094
  }
0df70b8735e3 Update Twitter bootstrap to 3.2.0
Vincent Tondellier <tonton+hg@team1664.org>
parents: 1
diff changeset
  2095
0df70b8735e3 Update Twitter bootstrap to 3.2.0
Vincent Tondellier <tonton+hg@team1664.org>
parents: 1
diff changeset
  2096
0df70b8735e3 Update Twitter bootstrap to 3.2.0
Vincent Tondellier <tonton+hg@team1664.org>
parents: 1
diff changeset
  2097
  // AFFIX DATA-API
0df70b8735e3 Update Twitter bootstrap to 3.2.0
Vincent Tondellier <tonton+hg@team1664.org>
parents: 1
diff changeset
  2098
  // ==============
0df70b8735e3 Update Twitter bootstrap to 3.2.0
Vincent Tondellier <tonton+hg@team1664.org>
parents: 1
diff changeset
  2099
0df70b8735e3 Update Twitter bootstrap to 3.2.0
Vincent Tondellier <tonton+hg@team1664.org>
parents: 1
diff changeset
  2100
  $(window).on('load', function () {
0df70b8735e3 Update Twitter bootstrap to 3.2.0
Vincent Tondellier <tonton+hg@team1664.org>
parents: 1
diff changeset
  2101
    $('[data-spy="affix"]').each(function () {
0df70b8735e3 Update Twitter bootstrap to 3.2.0
Vincent Tondellier <tonton+hg@team1664.org>
parents: 1
diff changeset
  2102
      var $spy = $(this)
0df70b8735e3 Update Twitter bootstrap to 3.2.0
Vincent Tondellier <tonton+hg@team1664.org>
parents: 1
diff changeset
  2103
      var data = $spy.data()
0df70b8735e3 Update Twitter bootstrap to 3.2.0
Vincent Tondellier <tonton+hg@team1664.org>
parents: 1
diff changeset
  2104
0df70b8735e3 Update Twitter bootstrap to 3.2.0
Vincent Tondellier <tonton+hg@team1664.org>
parents: 1
diff changeset
  2105
      data.offset = data.offset || {}
0df70b8735e3 Update Twitter bootstrap to 3.2.0
Vincent Tondellier <tonton+hg@team1664.org>
parents: 1
diff changeset
  2106
0df70b8735e3 Update Twitter bootstrap to 3.2.0
Vincent Tondellier <tonton+hg@team1664.org>
parents: 1
diff changeset
  2107
      if (data.offsetBottom) data.offset.bottom = data.offsetBottom
0df70b8735e3 Update Twitter bootstrap to 3.2.0
Vincent Tondellier <tonton+hg@team1664.org>
parents: 1
diff changeset
  2108
      if (data.offsetTop)    data.offset.top    = data.offsetTop
0df70b8735e3 Update Twitter bootstrap to 3.2.0
Vincent Tondellier <tonton+hg@team1664.org>
parents: 1
diff changeset
  2109
0df70b8735e3 Update Twitter bootstrap to 3.2.0
Vincent Tondellier <tonton+hg@team1664.org>
parents: 1
diff changeset
  2110
      Plugin.call($spy, data)
0df70b8735e3 Update Twitter bootstrap to 3.2.0
Vincent Tondellier <tonton+hg@team1664.org>
parents: 1
diff changeset
  2111
    })
0df70b8735e3 Update Twitter bootstrap to 3.2.0
Vincent Tondellier <tonton+hg@team1664.org>
parents: 1
diff changeset
  2112
  })
0df70b8735e3 Update Twitter bootstrap to 3.2.0
Vincent Tondellier <tonton+hg@team1664.org>
parents: 1
diff changeset
  2113
0df70b8735e3 Update Twitter bootstrap to 3.2.0
Vincent Tondellier <tonton+hg@team1664.org>
parents: 1
diff changeset
  2114
}(jQuery);