public/assets/js/bootstrap.js
author Vincent Tondellier <tonton+hg@team1664.org>
Tue, 01 May 2012 23:34:48 +0200
changeset 0 5b78b8c79d9c
child 1 c3726f733704
permissions -rw-r--r--
Initial commit
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
0
5b78b8c79d9c Initial commit
Vincent Tondellier <tonton+hg@team1664.org>
parents:
diff changeset
     1
/* ===================================================
5b78b8c79d9c Initial commit
Vincent Tondellier <tonton+hg@team1664.org>
parents:
diff changeset
     2
 * bootstrap-transition.js v2.0.3
5b78b8c79d9c Initial commit
Vincent Tondellier <tonton+hg@team1664.org>
parents:
diff changeset
     3
 * http://twitter.github.com/bootstrap/javascript.html#transitions
5b78b8c79d9c Initial commit
Vincent Tondellier <tonton+hg@team1664.org>
parents:
diff changeset
     4
 * ===================================================
5b78b8c79d9c Initial commit
Vincent Tondellier <tonton+hg@team1664.org>
parents:
diff changeset
     5
 * Copyright 2012 Twitter, Inc.
5b78b8c79d9c Initial commit
Vincent Tondellier <tonton+hg@team1664.org>
parents:
diff changeset
     6
 *
5b78b8c79d9c Initial commit
Vincent Tondellier <tonton+hg@team1664.org>
parents:
diff changeset
     7
 * Licensed under the Apache License, Version 2.0 (the "License");
5b78b8c79d9c Initial commit
Vincent Tondellier <tonton+hg@team1664.org>
parents:
diff changeset
     8
 * you may not use this file except in compliance with the License.
5b78b8c79d9c Initial commit
Vincent Tondellier <tonton+hg@team1664.org>
parents:
diff changeset
     9
 * You may obtain a copy of the License at
5b78b8c79d9c Initial commit
Vincent Tondellier <tonton+hg@team1664.org>
parents:
diff changeset
    10
 *
5b78b8c79d9c Initial commit
Vincent Tondellier <tonton+hg@team1664.org>
parents:
diff changeset
    11
 * http://www.apache.org/licenses/LICENSE-2.0
5b78b8c79d9c Initial commit
Vincent Tondellier <tonton+hg@team1664.org>
parents:
diff changeset
    12
 *
5b78b8c79d9c Initial commit
Vincent Tondellier <tonton+hg@team1664.org>
parents:
diff changeset
    13
 * Unless required by applicable law or agreed to in writing, software
5b78b8c79d9c Initial commit
Vincent Tondellier <tonton+hg@team1664.org>
parents:
diff changeset
    14
 * distributed under the License is distributed on an "AS IS" BASIS,
5b78b8c79d9c Initial commit
Vincent Tondellier <tonton+hg@team1664.org>
parents:
diff changeset
    15
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
5b78b8c79d9c Initial commit
Vincent Tondellier <tonton+hg@team1664.org>
parents:
diff changeset
    16
 * See the License for the specific language governing permissions and
5b78b8c79d9c Initial commit
Vincent Tondellier <tonton+hg@team1664.org>
parents:
diff changeset
    17
 * limitations under the License.
5b78b8c79d9c Initial commit
Vincent Tondellier <tonton+hg@team1664.org>
parents:
diff changeset
    18
 * ========================================================== */
5b78b8c79d9c Initial commit
Vincent Tondellier <tonton+hg@team1664.org>
parents:
diff changeset
    19
5b78b8c79d9c Initial commit
Vincent Tondellier <tonton+hg@team1664.org>
parents:
diff changeset
    20
5b78b8c79d9c Initial commit
Vincent Tondellier <tonton+hg@team1664.org>
parents:
diff changeset
    21
!function ($) {
5b78b8c79d9c Initial commit
Vincent Tondellier <tonton+hg@team1664.org>
parents:
diff changeset
    22
5b78b8c79d9c Initial commit
Vincent Tondellier <tonton+hg@team1664.org>
parents:
diff changeset
    23
  $(function () {
5b78b8c79d9c Initial commit
Vincent Tondellier <tonton+hg@team1664.org>
parents:
diff changeset
    24
5b78b8c79d9c Initial commit
Vincent Tondellier <tonton+hg@team1664.org>
parents:
diff changeset
    25
    "use strict"; // jshint ;_;
5b78b8c79d9c Initial commit
Vincent Tondellier <tonton+hg@team1664.org>
parents:
diff changeset
    26
5b78b8c79d9c Initial commit
Vincent Tondellier <tonton+hg@team1664.org>
parents:
diff changeset
    27
5b78b8c79d9c Initial commit
Vincent Tondellier <tonton+hg@team1664.org>
parents:
diff changeset
    28
    /* CSS TRANSITION SUPPORT (http://www.modernizr.com/)
5b78b8c79d9c Initial commit
Vincent Tondellier <tonton+hg@team1664.org>
parents:
diff changeset
    29
     * ======================================================= */
5b78b8c79d9c Initial commit
Vincent Tondellier <tonton+hg@team1664.org>
parents:
diff changeset
    30
5b78b8c79d9c Initial commit
Vincent Tondellier <tonton+hg@team1664.org>
parents:
diff changeset
    31
    $.support.transition = (function () {
5b78b8c79d9c Initial commit
Vincent Tondellier <tonton+hg@team1664.org>
parents:
diff changeset
    32
5b78b8c79d9c Initial commit
Vincent Tondellier <tonton+hg@team1664.org>
parents:
diff changeset
    33
      var transitionEnd = (function () {
5b78b8c79d9c Initial commit
Vincent Tondellier <tonton+hg@team1664.org>
parents:
diff changeset
    34
5b78b8c79d9c Initial commit
Vincent Tondellier <tonton+hg@team1664.org>
parents:
diff changeset
    35
        var el = document.createElement('bootstrap')
5b78b8c79d9c Initial commit
Vincent Tondellier <tonton+hg@team1664.org>
parents:
diff changeset
    36
          , transEndEventNames = {
5b78b8c79d9c Initial commit
Vincent Tondellier <tonton+hg@team1664.org>
parents:
diff changeset
    37
               'WebkitTransition' : 'webkitTransitionEnd'
5b78b8c79d9c Initial commit
Vincent Tondellier <tonton+hg@team1664.org>
parents:
diff changeset
    38
            ,  'MozTransition'    : 'transitionend'
5b78b8c79d9c Initial commit
Vincent Tondellier <tonton+hg@team1664.org>
parents:
diff changeset
    39
            ,  'OTransition'      : 'oTransitionEnd'
5b78b8c79d9c Initial commit
Vincent Tondellier <tonton+hg@team1664.org>
parents:
diff changeset
    40
            ,  'msTransition'     : 'MSTransitionEnd'
5b78b8c79d9c Initial commit
Vincent Tondellier <tonton+hg@team1664.org>
parents:
diff changeset
    41
            ,  'transition'       : 'transitionend'
5b78b8c79d9c Initial commit
Vincent Tondellier <tonton+hg@team1664.org>
parents:
diff changeset
    42
            }
5b78b8c79d9c Initial commit
Vincent Tondellier <tonton+hg@team1664.org>
parents:
diff changeset
    43
          , name
5b78b8c79d9c Initial commit
Vincent Tondellier <tonton+hg@team1664.org>
parents:
diff changeset
    44
5b78b8c79d9c Initial commit
Vincent Tondellier <tonton+hg@team1664.org>
parents:
diff changeset
    45
        for (name in transEndEventNames){
5b78b8c79d9c Initial commit
Vincent Tondellier <tonton+hg@team1664.org>
parents:
diff changeset
    46
          if (el.style[name] !== undefined) {
5b78b8c79d9c Initial commit
Vincent Tondellier <tonton+hg@team1664.org>
parents:
diff changeset
    47
            return transEndEventNames[name]
5b78b8c79d9c Initial commit
Vincent Tondellier <tonton+hg@team1664.org>
parents:
diff changeset
    48
          }
5b78b8c79d9c Initial commit
Vincent Tondellier <tonton+hg@team1664.org>
parents:
diff changeset
    49
        }
5b78b8c79d9c Initial commit
Vincent Tondellier <tonton+hg@team1664.org>
parents:
diff changeset
    50
5b78b8c79d9c Initial commit
Vincent Tondellier <tonton+hg@team1664.org>
parents:
diff changeset
    51
      }())
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
      return transitionEnd && {
5b78b8c79d9c Initial commit
Vincent Tondellier <tonton+hg@team1664.org>
parents:
diff changeset
    54
        end: transitionEnd
5b78b8c79d9c Initial commit
Vincent Tondellier <tonton+hg@team1664.org>
parents:
diff changeset
    55
      }
5b78b8c79d9c Initial commit
Vincent Tondellier <tonton+hg@team1664.org>
parents:
diff changeset
    56
5b78b8c79d9c Initial commit
Vincent Tondellier <tonton+hg@team1664.org>
parents:
diff changeset
    57
    })()
5b78b8c79d9c Initial commit
Vincent Tondellier <tonton+hg@team1664.org>
parents:
diff changeset
    58
5b78b8c79d9c Initial commit
Vincent Tondellier <tonton+hg@team1664.org>
parents:
diff changeset
    59
  })
5b78b8c79d9c Initial commit
Vincent Tondellier <tonton+hg@team1664.org>
parents:
diff changeset
    60
5b78b8c79d9c Initial commit
Vincent Tondellier <tonton+hg@team1664.org>
parents:
diff changeset
    61
}(window.jQuery);/* ==========================================================
5b78b8c79d9c Initial commit
Vincent Tondellier <tonton+hg@team1664.org>
parents:
diff changeset
    62
 * bootstrap-alert.js v2.0.3
5b78b8c79d9c Initial commit
Vincent Tondellier <tonton+hg@team1664.org>
parents:
diff changeset
    63
 * http://twitter.github.com/bootstrap/javascript.html#alerts
5b78b8c79d9c Initial commit
Vincent Tondellier <tonton+hg@team1664.org>
parents:
diff changeset
    64
 * ==========================================================
5b78b8c79d9c Initial commit
Vincent Tondellier <tonton+hg@team1664.org>
parents:
diff changeset
    65
 * Copyright 2012 Twitter, Inc.
5b78b8c79d9c Initial commit
Vincent Tondellier <tonton+hg@team1664.org>
parents:
diff changeset
    66
 *
5b78b8c79d9c Initial commit
Vincent Tondellier <tonton+hg@team1664.org>
parents:
diff changeset
    67
 * Licensed under the Apache License, Version 2.0 (the "License");
5b78b8c79d9c Initial commit
Vincent Tondellier <tonton+hg@team1664.org>
parents:
diff changeset
    68
 * you may not use this file except in compliance with the License.
5b78b8c79d9c Initial commit
Vincent Tondellier <tonton+hg@team1664.org>
parents:
diff changeset
    69
 * You may obtain a copy of the License at
5b78b8c79d9c Initial commit
Vincent Tondellier <tonton+hg@team1664.org>
parents:
diff changeset
    70
 *
5b78b8c79d9c Initial commit
Vincent Tondellier <tonton+hg@team1664.org>
parents:
diff changeset
    71
 * http://www.apache.org/licenses/LICENSE-2.0
5b78b8c79d9c Initial commit
Vincent Tondellier <tonton+hg@team1664.org>
parents:
diff changeset
    72
 *
5b78b8c79d9c Initial commit
Vincent Tondellier <tonton+hg@team1664.org>
parents:
diff changeset
    73
 * Unless required by applicable law or agreed to in writing, software
5b78b8c79d9c Initial commit
Vincent Tondellier <tonton+hg@team1664.org>
parents:
diff changeset
    74
 * distributed under the License is distributed on an "AS IS" BASIS,
5b78b8c79d9c Initial commit
Vincent Tondellier <tonton+hg@team1664.org>
parents:
diff changeset
    75
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
5b78b8c79d9c Initial commit
Vincent Tondellier <tonton+hg@team1664.org>
parents:
diff changeset
    76
 * See the License for the specific language governing permissions and
5b78b8c79d9c Initial commit
Vincent Tondellier <tonton+hg@team1664.org>
parents:
diff changeset
    77
 * limitations under the License.
5b78b8c79d9c Initial commit
Vincent Tondellier <tonton+hg@team1664.org>
parents:
diff changeset
    78
 * ========================================================== */
5b78b8c79d9c Initial commit
Vincent Tondellier <tonton+hg@team1664.org>
parents:
diff changeset
    79
5b78b8c79d9c Initial commit
Vincent Tondellier <tonton+hg@team1664.org>
parents:
diff changeset
    80
5b78b8c79d9c Initial commit
Vincent Tondellier <tonton+hg@team1664.org>
parents:
diff changeset
    81
!function ($) {
5b78b8c79d9c Initial commit
Vincent Tondellier <tonton+hg@team1664.org>
parents:
diff changeset
    82
5b78b8c79d9c Initial commit
Vincent Tondellier <tonton+hg@team1664.org>
parents:
diff changeset
    83
  "use strict"; // jshint ;_;
5b78b8c79d9c Initial commit
Vincent Tondellier <tonton+hg@team1664.org>
parents:
diff changeset
    84
5b78b8c79d9c Initial commit
Vincent Tondellier <tonton+hg@team1664.org>
parents:
diff changeset
    85
5b78b8c79d9c Initial commit
Vincent Tondellier <tonton+hg@team1664.org>
parents:
diff changeset
    86
 /* ALERT CLASS DEFINITION
5b78b8c79d9c Initial commit
Vincent Tondellier <tonton+hg@team1664.org>
parents:
diff changeset
    87
  * ====================== */
5b78b8c79d9c Initial commit
Vincent Tondellier <tonton+hg@team1664.org>
parents:
diff changeset
    88
5b78b8c79d9c Initial commit
Vincent Tondellier <tonton+hg@team1664.org>
parents:
diff changeset
    89
  var dismiss = '[data-dismiss="alert"]'
5b78b8c79d9c Initial commit
Vincent Tondellier <tonton+hg@team1664.org>
parents:
diff changeset
    90
    , Alert = function (el) {
5b78b8c79d9c Initial commit
Vincent Tondellier <tonton+hg@team1664.org>
parents:
diff changeset
    91
        $(el).on('click', dismiss, this.close)
5b78b8c79d9c Initial commit
Vincent Tondellier <tonton+hg@team1664.org>
parents:
diff changeset
    92
      }
5b78b8c79d9c Initial commit
Vincent Tondellier <tonton+hg@team1664.org>
parents:
diff changeset
    93
5b78b8c79d9c Initial commit
Vincent Tondellier <tonton+hg@team1664.org>
parents:
diff changeset
    94
  Alert.prototype.close = function (e) {
5b78b8c79d9c Initial commit
Vincent Tondellier <tonton+hg@team1664.org>
parents:
diff changeset
    95
    var $this = $(this)
5b78b8c79d9c Initial commit
Vincent Tondellier <tonton+hg@team1664.org>
parents:
diff changeset
    96
      , selector = $this.attr('data-target')
5b78b8c79d9c Initial commit
Vincent Tondellier <tonton+hg@team1664.org>
parents:
diff changeset
    97
      , $parent
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
    if (!selector) {
5b78b8c79d9c Initial commit
Vincent Tondellier <tonton+hg@team1664.org>
parents:
diff changeset
   100
      selector = $this.attr('href')
5b78b8c79d9c Initial commit
Vincent Tondellier <tonton+hg@team1664.org>
parents:
diff changeset
   101
      selector = selector && selector.replace(/.*(?=#[^\s]*$)/, '') //strip for ie7
5b78b8c79d9c Initial commit
Vincent Tondellier <tonton+hg@team1664.org>
parents:
diff changeset
   102
    }
5b78b8c79d9c Initial commit
Vincent Tondellier <tonton+hg@team1664.org>
parents:
diff changeset
   103
5b78b8c79d9c Initial commit
Vincent Tondellier <tonton+hg@team1664.org>
parents:
diff changeset
   104
    $parent = $(selector)
5b78b8c79d9c Initial commit
Vincent Tondellier <tonton+hg@team1664.org>
parents:
diff changeset
   105
5b78b8c79d9c Initial commit
Vincent Tondellier <tonton+hg@team1664.org>
parents:
diff changeset
   106
    e && e.preventDefault()
5b78b8c79d9c Initial commit
Vincent Tondellier <tonton+hg@team1664.org>
parents:
diff changeset
   107
5b78b8c79d9c Initial commit
Vincent Tondellier <tonton+hg@team1664.org>
parents:
diff changeset
   108
    $parent.length || ($parent = $this.hasClass('alert') ? $this : $this.parent())
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
    $parent.trigger(e = $.Event('close'))
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
    if (e.isDefaultPrevented()) return
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
    $parent.removeClass('in')
5b78b8c79d9c Initial commit
Vincent Tondellier <tonton+hg@team1664.org>
parents:
diff changeset
   115
5b78b8c79d9c Initial commit
Vincent Tondellier <tonton+hg@team1664.org>
parents:
diff changeset
   116
    function removeElement() {
5b78b8c79d9c Initial commit
Vincent Tondellier <tonton+hg@team1664.org>
parents:
diff changeset
   117
      $parent
5b78b8c79d9c Initial commit
Vincent Tondellier <tonton+hg@team1664.org>
parents:
diff changeset
   118
        .trigger('closed')
5b78b8c79d9c Initial commit
Vincent Tondellier <tonton+hg@team1664.org>
parents:
diff changeset
   119
        .remove()
5b78b8c79d9c Initial commit
Vincent Tondellier <tonton+hg@team1664.org>
parents:
diff changeset
   120
    }
5b78b8c79d9c Initial commit
Vincent Tondellier <tonton+hg@team1664.org>
parents:
diff changeset
   121
5b78b8c79d9c Initial commit
Vincent Tondellier <tonton+hg@team1664.org>
parents:
diff changeset
   122
    $.support.transition && $parent.hasClass('fade') ?
5b78b8c79d9c Initial commit
Vincent Tondellier <tonton+hg@team1664.org>
parents:
diff changeset
   123
      $parent.on($.support.transition.end, removeElement) :
5b78b8c79d9c Initial commit
Vincent Tondellier <tonton+hg@team1664.org>
parents:
diff changeset
   124
      removeElement()
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
5b78b8c79d9c Initial commit
Vincent Tondellier <tonton+hg@team1664.org>
parents:
diff changeset
   127
5b78b8c79d9c Initial commit
Vincent Tondellier <tonton+hg@team1664.org>
parents:
diff changeset
   128
 /* ALERT PLUGIN DEFINITION
5b78b8c79d9c Initial commit
Vincent Tondellier <tonton+hg@team1664.org>
parents:
diff changeset
   129
  * ======================= */
5b78b8c79d9c Initial commit
Vincent Tondellier <tonton+hg@team1664.org>
parents:
diff changeset
   130
5b78b8c79d9c Initial commit
Vincent Tondellier <tonton+hg@team1664.org>
parents:
diff changeset
   131
  $.fn.alert = function (option) {
5b78b8c79d9c Initial commit
Vincent Tondellier <tonton+hg@team1664.org>
parents:
diff changeset
   132
    return this.each(function () {
5b78b8c79d9c Initial commit
Vincent Tondellier <tonton+hg@team1664.org>
parents:
diff changeset
   133
      var $this = $(this)
5b78b8c79d9c Initial commit
Vincent Tondellier <tonton+hg@team1664.org>
parents:
diff changeset
   134
        , data = $this.data('alert')
5b78b8c79d9c Initial commit
Vincent Tondellier <tonton+hg@team1664.org>
parents:
diff changeset
   135
      if (!data) $this.data('alert', (data = new Alert(this)))
5b78b8c79d9c Initial commit
Vincent Tondellier <tonton+hg@team1664.org>
parents:
diff changeset
   136
      if (typeof option == 'string') data[option].call($this)
5b78b8c79d9c Initial commit
Vincent Tondellier <tonton+hg@team1664.org>
parents:
diff changeset
   137
    })
5b78b8c79d9c Initial commit
Vincent Tondellier <tonton+hg@team1664.org>
parents:
diff changeset
   138
  }
5b78b8c79d9c Initial commit
Vincent Tondellier <tonton+hg@team1664.org>
parents:
diff changeset
   139
5b78b8c79d9c Initial commit
Vincent Tondellier <tonton+hg@team1664.org>
parents:
diff changeset
   140
  $.fn.alert.Constructor = Alert
5b78b8c79d9c Initial commit
Vincent Tondellier <tonton+hg@team1664.org>
parents:
diff changeset
   141
5b78b8c79d9c Initial commit
Vincent Tondellier <tonton+hg@team1664.org>
parents:
diff changeset
   142
5b78b8c79d9c Initial commit
Vincent Tondellier <tonton+hg@team1664.org>
parents:
diff changeset
   143
 /* ALERT DATA-API
5b78b8c79d9c Initial commit
Vincent Tondellier <tonton+hg@team1664.org>
parents:
diff changeset
   144
  * ============== */
5b78b8c79d9c Initial commit
Vincent Tondellier <tonton+hg@team1664.org>
parents:
diff changeset
   145
5b78b8c79d9c Initial commit
Vincent Tondellier <tonton+hg@team1664.org>
parents:
diff changeset
   146
  $(function () {
5b78b8c79d9c Initial commit
Vincent Tondellier <tonton+hg@team1664.org>
parents:
diff changeset
   147
    $('body').on('click.alert.data-api', dismiss, Alert.prototype.close)
5b78b8c79d9c Initial commit
Vincent Tondellier <tonton+hg@team1664.org>
parents:
diff changeset
   148
  })
5b78b8c79d9c Initial commit
Vincent Tondellier <tonton+hg@team1664.org>
parents:
diff changeset
   149
5b78b8c79d9c Initial commit
Vincent Tondellier <tonton+hg@team1664.org>
parents:
diff changeset
   150
}(window.jQuery);/* ============================================================
5b78b8c79d9c Initial commit
Vincent Tondellier <tonton+hg@team1664.org>
parents:
diff changeset
   151
 * bootstrap-button.js v2.0.3
5b78b8c79d9c Initial commit
Vincent Tondellier <tonton+hg@team1664.org>
parents:
diff changeset
   152
 * http://twitter.github.com/bootstrap/javascript.html#buttons
5b78b8c79d9c Initial commit
Vincent Tondellier <tonton+hg@team1664.org>
parents:
diff changeset
   153
 * ============================================================
5b78b8c79d9c Initial commit
Vincent Tondellier <tonton+hg@team1664.org>
parents:
diff changeset
   154
 * Copyright 2012 Twitter, Inc.
5b78b8c79d9c Initial commit
Vincent Tondellier <tonton+hg@team1664.org>
parents:
diff changeset
   155
 *
5b78b8c79d9c Initial commit
Vincent Tondellier <tonton+hg@team1664.org>
parents:
diff changeset
   156
 * Licensed under the Apache License, Version 2.0 (the "License");
5b78b8c79d9c Initial commit
Vincent Tondellier <tonton+hg@team1664.org>
parents:
diff changeset
   157
 * you may not use this file except in compliance with the License.
5b78b8c79d9c Initial commit
Vincent Tondellier <tonton+hg@team1664.org>
parents:
diff changeset
   158
 * You may obtain a copy of the License at
5b78b8c79d9c Initial commit
Vincent Tondellier <tonton+hg@team1664.org>
parents:
diff changeset
   159
 *
5b78b8c79d9c Initial commit
Vincent Tondellier <tonton+hg@team1664.org>
parents:
diff changeset
   160
 * http://www.apache.org/licenses/LICENSE-2.0
5b78b8c79d9c Initial commit
Vincent Tondellier <tonton+hg@team1664.org>
parents:
diff changeset
   161
 *
5b78b8c79d9c Initial commit
Vincent Tondellier <tonton+hg@team1664.org>
parents:
diff changeset
   162
 * Unless required by applicable law or agreed to in writing, software
5b78b8c79d9c Initial commit
Vincent Tondellier <tonton+hg@team1664.org>
parents:
diff changeset
   163
 * distributed under the License is distributed on an "AS IS" BASIS,
5b78b8c79d9c Initial commit
Vincent Tondellier <tonton+hg@team1664.org>
parents:
diff changeset
   164
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
5b78b8c79d9c Initial commit
Vincent Tondellier <tonton+hg@team1664.org>
parents:
diff changeset
   165
 * See the License for the specific language governing permissions and
5b78b8c79d9c Initial commit
Vincent Tondellier <tonton+hg@team1664.org>
parents:
diff changeset
   166
 * limitations under the License.
5b78b8c79d9c Initial commit
Vincent Tondellier <tonton+hg@team1664.org>
parents:
diff changeset
   167
 * ============================================================ */
5b78b8c79d9c Initial commit
Vincent Tondellier <tonton+hg@team1664.org>
parents:
diff changeset
   168
5b78b8c79d9c Initial commit
Vincent Tondellier <tonton+hg@team1664.org>
parents:
diff changeset
   169
5b78b8c79d9c Initial commit
Vincent Tondellier <tonton+hg@team1664.org>
parents:
diff changeset
   170
!function ($) {
5b78b8c79d9c Initial commit
Vincent Tondellier <tonton+hg@team1664.org>
parents:
diff changeset
   171
5b78b8c79d9c Initial commit
Vincent Tondellier <tonton+hg@team1664.org>
parents:
diff changeset
   172
  "use strict"; // jshint ;_;
5b78b8c79d9c Initial commit
Vincent Tondellier <tonton+hg@team1664.org>
parents:
diff changeset
   173
5b78b8c79d9c Initial commit
Vincent Tondellier <tonton+hg@team1664.org>
parents:
diff changeset
   174
5b78b8c79d9c Initial commit
Vincent Tondellier <tonton+hg@team1664.org>
parents:
diff changeset
   175
 /* BUTTON PUBLIC CLASS DEFINITION
5b78b8c79d9c Initial commit
Vincent Tondellier <tonton+hg@team1664.org>
parents:
diff changeset
   176
  * ============================== */
5b78b8c79d9c Initial commit
Vincent Tondellier <tonton+hg@team1664.org>
parents:
diff changeset
   177
5b78b8c79d9c Initial commit
Vincent Tondellier <tonton+hg@team1664.org>
parents:
diff changeset
   178
  var Button = function (element, options) {
5b78b8c79d9c Initial commit
Vincent Tondellier <tonton+hg@team1664.org>
parents:
diff changeset
   179
    this.$element = $(element)
5b78b8c79d9c Initial commit
Vincent Tondellier <tonton+hg@team1664.org>
parents:
diff changeset
   180
    this.options = $.extend({}, $.fn.button.defaults, options)
5b78b8c79d9c Initial commit
Vincent Tondellier <tonton+hg@team1664.org>
parents:
diff changeset
   181
  }
5b78b8c79d9c Initial commit
Vincent Tondellier <tonton+hg@team1664.org>
parents:
diff changeset
   182
5b78b8c79d9c Initial commit
Vincent Tondellier <tonton+hg@team1664.org>
parents:
diff changeset
   183
  Button.prototype.setState = function (state) {
5b78b8c79d9c Initial commit
Vincent Tondellier <tonton+hg@team1664.org>
parents:
diff changeset
   184
    var d = 'disabled'
5b78b8c79d9c Initial commit
Vincent Tondellier <tonton+hg@team1664.org>
parents:
diff changeset
   185
      , $el = this.$element
5b78b8c79d9c Initial commit
Vincent Tondellier <tonton+hg@team1664.org>
parents:
diff changeset
   186
      , data = $el.data()
5b78b8c79d9c Initial commit
Vincent Tondellier <tonton+hg@team1664.org>
parents:
diff changeset
   187
      , val = $el.is('input') ? 'val' : 'html'
5b78b8c79d9c Initial commit
Vincent Tondellier <tonton+hg@team1664.org>
parents:
diff changeset
   188
5b78b8c79d9c Initial commit
Vincent Tondellier <tonton+hg@team1664.org>
parents:
diff changeset
   189
    state = state + 'Text'
5b78b8c79d9c Initial commit
Vincent Tondellier <tonton+hg@team1664.org>
parents:
diff changeset
   190
    data.resetText || $el.data('resetText', $el[val]())
5b78b8c79d9c Initial commit
Vincent Tondellier <tonton+hg@team1664.org>
parents:
diff changeset
   191
5b78b8c79d9c Initial commit
Vincent Tondellier <tonton+hg@team1664.org>
parents:
diff changeset
   192
    $el[val](data[state] || this.options[state])
5b78b8c79d9c Initial commit
Vincent Tondellier <tonton+hg@team1664.org>
parents:
diff changeset
   193
5b78b8c79d9c Initial commit
Vincent Tondellier <tonton+hg@team1664.org>
parents:
diff changeset
   194
    // push to event loop to allow forms to submit
5b78b8c79d9c Initial commit
Vincent Tondellier <tonton+hg@team1664.org>
parents:
diff changeset
   195
    setTimeout(function () {
5b78b8c79d9c Initial commit
Vincent Tondellier <tonton+hg@team1664.org>
parents:
diff changeset
   196
      state == 'loadingText' ?
5b78b8c79d9c Initial commit
Vincent Tondellier <tonton+hg@team1664.org>
parents:
diff changeset
   197
        $el.addClass(d).attr(d, d) :
5b78b8c79d9c Initial commit
Vincent Tondellier <tonton+hg@team1664.org>
parents:
diff changeset
   198
        $el.removeClass(d).removeAttr(d)
5b78b8c79d9c Initial commit
Vincent Tondellier <tonton+hg@team1664.org>
parents:
diff changeset
   199
    }, 0)
5b78b8c79d9c Initial commit
Vincent Tondellier <tonton+hg@team1664.org>
parents:
diff changeset
   200
  }
5b78b8c79d9c Initial commit
Vincent Tondellier <tonton+hg@team1664.org>
parents:
diff changeset
   201
5b78b8c79d9c Initial commit
Vincent Tondellier <tonton+hg@team1664.org>
parents:
diff changeset
   202
  Button.prototype.toggle = function () {
5b78b8c79d9c Initial commit
Vincent Tondellier <tonton+hg@team1664.org>
parents:
diff changeset
   203
    var $parent = this.$element.parent('[data-toggle="buttons-radio"]')
5b78b8c79d9c Initial commit
Vincent Tondellier <tonton+hg@team1664.org>
parents:
diff changeset
   204
5b78b8c79d9c Initial commit
Vincent Tondellier <tonton+hg@team1664.org>
parents:
diff changeset
   205
    $parent && $parent
5b78b8c79d9c Initial commit
Vincent Tondellier <tonton+hg@team1664.org>
parents:
diff changeset
   206
      .find('.active')
5b78b8c79d9c Initial commit
Vincent Tondellier <tonton+hg@team1664.org>
parents:
diff changeset
   207
      .removeClass('active')
5b78b8c79d9c Initial commit
Vincent Tondellier <tonton+hg@team1664.org>
parents:
diff changeset
   208
5b78b8c79d9c Initial commit
Vincent Tondellier <tonton+hg@team1664.org>
parents:
diff changeset
   209
    this.$element.toggleClass('active')
5b78b8c79d9c Initial commit
Vincent Tondellier <tonton+hg@team1664.org>
parents:
diff changeset
   210
  }
5b78b8c79d9c Initial commit
Vincent Tondellier <tonton+hg@team1664.org>
parents:
diff changeset
   211
5b78b8c79d9c Initial commit
Vincent Tondellier <tonton+hg@team1664.org>
parents:
diff changeset
   212
5b78b8c79d9c Initial commit
Vincent Tondellier <tonton+hg@team1664.org>
parents:
diff changeset
   213
 /* BUTTON PLUGIN DEFINITION
5b78b8c79d9c Initial commit
Vincent Tondellier <tonton+hg@team1664.org>
parents:
diff changeset
   214
  * ======================== */
5b78b8c79d9c Initial commit
Vincent Tondellier <tonton+hg@team1664.org>
parents:
diff changeset
   215
5b78b8c79d9c Initial commit
Vincent Tondellier <tonton+hg@team1664.org>
parents:
diff changeset
   216
  $.fn.button = function (option) {
5b78b8c79d9c Initial commit
Vincent Tondellier <tonton+hg@team1664.org>
parents:
diff changeset
   217
    return this.each(function () {
5b78b8c79d9c Initial commit
Vincent Tondellier <tonton+hg@team1664.org>
parents:
diff changeset
   218
      var $this = $(this)
5b78b8c79d9c Initial commit
Vincent Tondellier <tonton+hg@team1664.org>
parents:
diff changeset
   219
        , data = $this.data('button')
5b78b8c79d9c Initial commit
Vincent Tondellier <tonton+hg@team1664.org>
parents:
diff changeset
   220
        , options = typeof option == 'object' && option
5b78b8c79d9c Initial commit
Vincent Tondellier <tonton+hg@team1664.org>
parents:
diff changeset
   221
      if (!data) $this.data('button', (data = new Button(this, options)))
5b78b8c79d9c Initial commit
Vincent Tondellier <tonton+hg@team1664.org>
parents:
diff changeset
   222
      if (option == 'toggle') data.toggle()
5b78b8c79d9c Initial commit
Vincent Tondellier <tonton+hg@team1664.org>
parents:
diff changeset
   223
      else if (option) data.setState(option)
5b78b8c79d9c Initial commit
Vincent Tondellier <tonton+hg@team1664.org>
parents:
diff changeset
   224
    })
5b78b8c79d9c Initial commit
Vincent Tondellier <tonton+hg@team1664.org>
parents:
diff changeset
   225
  }
5b78b8c79d9c Initial commit
Vincent Tondellier <tonton+hg@team1664.org>
parents:
diff changeset
   226
5b78b8c79d9c Initial commit
Vincent Tondellier <tonton+hg@team1664.org>
parents:
diff changeset
   227
  $.fn.button.defaults = {
5b78b8c79d9c Initial commit
Vincent Tondellier <tonton+hg@team1664.org>
parents:
diff changeset
   228
    loadingText: 'loading...'
5b78b8c79d9c Initial commit
Vincent Tondellier <tonton+hg@team1664.org>
parents:
diff changeset
   229
  }
5b78b8c79d9c Initial commit
Vincent Tondellier <tonton+hg@team1664.org>
parents:
diff changeset
   230
5b78b8c79d9c Initial commit
Vincent Tondellier <tonton+hg@team1664.org>
parents:
diff changeset
   231
  $.fn.button.Constructor = Button
5b78b8c79d9c Initial commit
Vincent Tondellier <tonton+hg@team1664.org>
parents:
diff changeset
   232
5b78b8c79d9c Initial commit
Vincent Tondellier <tonton+hg@team1664.org>
parents:
diff changeset
   233
5b78b8c79d9c Initial commit
Vincent Tondellier <tonton+hg@team1664.org>
parents:
diff changeset
   234
 /* BUTTON DATA-API
5b78b8c79d9c Initial commit
Vincent Tondellier <tonton+hg@team1664.org>
parents:
diff changeset
   235
  * =============== */
5b78b8c79d9c Initial commit
Vincent Tondellier <tonton+hg@team1664.org>
parents:
diff changeset
   236
5b78b8c79d9c Initial commit
Vincent Tondellier <tonton+hg@team1664.org>
parents:
diff changeset
   237
  $(function () {
5b78b8c79d9c Initial commit
Vincent Tondellier <tonton+hg@team1664.org>
parents:
diff changeset
   238
    $('body').on('click.button.data-api', '[data-toggle^=button]', function ( e ) {
5b78b8c79d9c Initial commit
Vincent Tondellier <tonton+hg@team1664.org>
parents:
diff changeset
   239
      var $btn = $(e.target)
5b78b8c79d9c Initial commit
Vincent Tondellier <tonton+hg@team1664.org>
parents:
diff changeset
   240
      if (!$btn.hasClass('btn')) $btn = $btn.closest('.btn')
5b78b8c79d9c Initial commit
Vincent Tondellier <tonton+hg@team1664.org>
parents:
diff changeset
   241
      $btn.button('toggle')
5b78b8c79d9c Initial commit
Vincent Tondellier <tonton+hg@team1664.org>
parents:
diff changeset
   242
    })
5b78b8c79d9c Initial commit
Vincent Tondellier <tonton+hg@team1664.org>
parents:
diff changeset
   243
  })
5b78b8c79d9c Initial commit
Vincent Tondellier <tonton+hg@team1664.org>
parents:
diff changeset
   244
5b78b8c79d9c Initial commit
Vincent Tondellier <tonton+hg@team1664.org>
parents:
diff changeset
   245
}(window.jQuery);/* ==========================================================
5b78b8c79d9c Initial commit
Vincent Tondellier <tonton+hg@team1664.org>
parents:
diff changeset
   246
 * bootstrap-carousel.js v2.0.3
5b78b8c79d9c Initial commit
Vincent Tondellier <tonton+hg@team1664.org>
parents:
diff changeset
   247
 * http://twitter.github.com/bootstrap/javascript.html#carousel
5b78b8c79d9c Initial commit
Vincent Tondellier <tonton+hg@team1664.org>
parents:
diff changeset
   248
 * ==========================================================
5b78b8c79d9c Initial commit
Vincent Tondellier <tonton+hg@team1664.org>
parents:
diff changeset
   249
 * Copyright 2012 Twitter, Inc.
5b78b8c79d9c Initial commit
Vincent Tondellier <tonton+hg@team1664.org>
parents:
diff changeset
   250
 *
5b78b8c79d9c Initial commit
Vincent Tondellier <tonton+hg@team1664.org>
parents:
diff changeset
   251
 * Licensed under the Apache License, Version 2.0 (the "License");
5b78b8c79d9c Initial commit
Vincent Tondellier <tonton+hg@team1664.org>
parents:
diff changeset
   252
 * you may not use this file except in compliance with the License.
5b78b8c79d9c Initial commit
Vincent Tondellier <tonton+hg@team1664.org>
parents:
diff changeset
   253
 * You may obtain a copy of the License at
5b78b8c79d9c Initial commit
Vincent Tondellier <tonton+hg@team1664.org>
parents:
diff changeset
   254
 *
5b78b8c79d9c Initial commit
Vincent Tondellier <tonton+hg@team1664.org>
parents:
diff changeset
   255
 * http://www.apache.org/licenses/LICENSE-2.0
5b78b8c79d9c Initial commit
Vincent Tondellier <tonton+hg@team1664.org>
parents:
diff changeset
   256
 *
5b78b8c79d9c Initial commit
Vincent Tondellier <tonton+hg@team1664.org>
parents:
diff changeset
   257
 * Unless required by applicable law or agreed to in writing, software
5b78b8c79d9c Initial commit
Vincent Tondellier <tonton+hg@team1664.org>
parents:
diff changeset
   258
 * distributed under the License is distributed on an "AS IS" BASIS,
5b78b8c79d9c Initial commit
Vincent Tondellier <tonton+hg@team1664.org>
parents:
diff changeset
   259
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
5b78b8c79d9c Initial commit
Vincent Tondellier <tonton+hg@team1664.org>
parents:
diff changeset
   260
 * See the License for the specific language governing permissions and
5b78b8c79d9c Initial commit
Vincent Tondellier <tonton+hg@team1664.org>
parents:
diff changeset
   261
 * limitations under the License.
5b78b8c79d9c Initial commit
Vincent Tondellier <tonton+hg@team1664.org>
parents:
diff changeset
   262
 * ========================================================== */
5b78b8c79d9c Initial commit
Vincent Tondellier <tonton+hg@team1664.org>
parents:
diff changeset
   263
5b78b8c79d9c Initial commit
Vincent Tondellier <tonton+hg@team1664.org>
parents:
diff changeset
   264
5b78b8c79d9c Initial commit
Vincent Tondellier <tonton+hg@team1664.org>
parents:
diff changeset
   265
!function ($) {
5b78b8c79d9c Initial commit
Vincent Tondellier <tonton+hg@team1664.org>
parents:
diff changeset
   266
5b78b8c79d9c Initial commit
Vincent Tondellier <tonton+hg@team1664.org>
parents:
diff changeset
   267
  "use strict"; // jshint ;_;
5b78b8c79d9c Initial commit
Vincent Tondellier <tonton+hg@team1664.org>
parents:
diff changeset
   268
5b78b8c79d9c Initial commit
Vincent Tondellier <tonton+hg@team1664.org>
parents:
diff changeset
   269
5b78b8c79d9c Initial commit
Vincent Tondellier <tonton+hg@team1664.org>
parents:
diff changeset
   270
 /* CAROUSEL CLASS DEFINITION
5b78b8c79d9c Initial commit
Vincent Tondellier <tonton+hg@team1664.org>
parents:
diff changeset
   271
  * ========================= */
5b78b8c79d9c Initial commit
Vincent Tondellier <tonton+hg@team1664.org>
parents:
diff changeset
   272
5b78b8c79d9c Initial commit
Vincent Tondellier <tonton+hg@team1664.org>
parents:
diff changeset
   273
  var Carousel = function (element, options) {
5b78b8c79d9c Initial commit
Vincent Tondellier <tonton+hg@team1664.org>
parents:
diff changeset
   274
    this.$element = $(element)
5b78b8c79d9c Initial commit
Vincent Tondellier <tonton+hg@team1664.org>
parents:
diff changeset
   275
    this.options = options
5b78b8c79d9c Initial commit
Vincent Tondellier <tonton+hg@team1664.org>
parents:
diff changeset
   276
    this.options.slide && this.slide(this.options.slide)
5b78b8c79d9c Initial commit
Vincent Tondellier <tonton+hg@team1664.org>
parents:
diff changeset
   277
    this.options.pause == 'hover' && this.$element
5b78b8c79d9c Initial commit
Vincent Tondellier <tonton+hg@team1664.org>
parents:
diff changeset
   278
      .on('mouseenter', $.proxy(this.pause, this))
5b78b8c79d9c Initial commit
Vincent Tondellier <tonton+hg@team1664.org>
parents:
diff changeset
   279
      .on('mouseleave', $.proxy(this.cycle, this))
5b78b8c79d9c Initial commit
Vincent Tondellier <tonton+hg@team1664.org>
parents:
diff changeset
   280
  }
5b78b8c79d9c Initial commit
Vincent Tondellier <tonton+hg@team1664.org>
parents:
diff changeset
   281
5b78b8c79d9c Initial commit
Vincent Tondellier <tonton+hg@team1664.org>
parents:
diff changeset
   282
  Carousel.prototype = {
5b78b8c79d9c Initial commit
Vincent Tondellier <tonton+hg@team1664.org>
parents:
diff changeset
   283
5b78b8c79d9c Initial commit
Vincent Tondellier <tonton+hg@team1664.org>
parents:
diff changeset
   284
    cycle: function (e) {
5b78b8c79d9c Initial commit
Vincent Tondellier <tonton+hg@team1664.org>
parents:
diff changeset
   285
      if (!e) this.paused = false
5b78b8c79d9c Initial commit
Vincent Tondellier <tonton+hg@team1664.org>
parents:
diff changeset
   286
      this.options.interval
5b78b8c79d9c Initial commit
Vincent Tondellier <tonton+hg@team1664.org>
parents:
diff changeset
   287
        && !this.paused
5b78b8c79d9c Initial commit
Vincent Tondellier <tonton+hg@team1664.org>
parents:
diff changeset
   288
        && (this.interval = setInterval($.proxy(this.next, this), this.options.interval))
5b78b8c79d9c Initial commit
Vincent Tondellier <tonton+hg@team1664.org>
parents:
diff changeset
   289
      return this
5b78b8c79d9c Initial commit
Vincent Tondellier <tonton+hg@team1664.org>
parents:
diff changeset
   290
    }
5b78b8c79d9c Initial commit
Vincent Tondellier <tonton+hg@team1664.org>
parents:
diff changeset
   291
5b78b8c79d9c Initial commit
Vincent Tondellier <tonton+hg@team1664.org>
parents:
diff changeset
   292
  , to: function (pos) {
5b78b8c79d9c Initial commit
Vincent Tondellier <tonton+hg@team1664.org>
parents:
diff changeset
   293
      var $active = this.$element.find('.active')
5b78b8c79d9c Initial commit
Vincent Tondellier <tonton+hg@team1664.org>
parents:
diff changeset
   294
        , children = $active.parent().children()
5b78b8c79d9c Initial commit
Vincent Tondellier <tonton+hg@team1664.org>
parents:
diff changeset
   295
        , activePos = children.index($active)
5b78b8c79d9c Initial commit
Vincent Tondellier <tonton+hg@team1664.org>
parents:
diff changeset
   296
        , that = this
5b78b8c79d9c Initial commit
Vincent Tondellier <tonton+hg@team1664.org>
parents:
diff changeset
   297
5b78b8c79d9c Initial commit
Vincent Tondellier <tonton+hg@team1664.org>
parents:
diff changeset
   298
      if (pos > (children.length - 1) || pos < 0) return
5b78b8c79d9c Initial commit
Vincent Tondellier <tonton+hg@team1664.org>
parents:
diff changeset
   299
5b78b8c79d9c Initial commit
Vincent Tondellier <tonton+hg@team1664.org>
parents:
diff changeset
   300
      if (this.sliding) {
5b78b8c79d9c Initial commit
Vincent Tondellier <tonton+hg@team1664.org>
parents:
diff changeset
   301
        return this.$element.one('slid', function () {
5b78b8c79d9c Initial commit
Vincent Tondellier <tonton+hg@team1664.org>
parents:
diff changeset
   302
          that.to(pos)
5b78b8c79d9c Initial commit
Vincent Tondellier <tonton+hg@team1664.org>
parents:
diff changeset
   303
        })
5b78b8c79d9c Initial commit
Vincent Tondellier <tonton+hg@team1664.org>
parents:
diff changeset
   304
      }
5b78b8c79d9c Initial commit
Vincent Tondellier <tonton+hg@team1664.org>
parents:
diff changeset
   305
5b78b8c79d9c Initial commit
Vincent Tondellier <tonton+hg@team1664.org>
parents:
diff changeset
   306
      if (activePos == pos) {
5b78b8c79d9c Initial commit
Vincent Tondellier <tonton+hg@team1664.org>
parents:
diff changeset
   307
        return this.pause().cycle()
5b78b8c79d9c Initial commit
Vincent Tondellier <tonton+hg@team1664.org>
parents:
diff changeset
   308
      }
5b78b8c79d9c Initial commit
Vincent Tondellier <tonton+hg@team1664.org>
parents:
diff changeset
   309
5b78b8c79d9c Initial commit
Vincent Tondellier <tonton+hg@team1664.org>
parents:
diff changeset
   310
      return this.slide(pos > activePos ? 'next' : 'prev', $(children[pos]))
5b78b8c79d9c Initial commit
Vincent Tondellier <tonton+hg@team1664.org>
parents:
diff changeset
   311
    }
5b78b8c79d9c Initial commit
Vincent Tondellier <tonton+hg@team1664.org>
parents:
diff changeset
   312
5b78b8c79d9c Initial commit
Vincent Tondellier <tonton+hg@team1664.org>
parents:
diff changeset
   313
  , pause: function (e) {
5b78b8c79d9c Initial commit
Vincent Tondellier <tonton+hg@team1664.org>
parents:
diff changeset
   314
      if (!e) this.paused = true
5b78b8c79d9c Initial commit
Vincent Tondellier <tonton+hg@team1664.org>
parents:
diff changeset
   315
      clearInterval(this.interval)
5b78b8c79d9c Initial commit
Vincent Tondellier <tonton+hg@team1664.org>
parents:
diff changeset
   316
      this.interval = null
5b78b8c79d9c Initial commit
Vincent Tondellier <tonton+hg@team1664.org>
parents:
diff changeset
   317
      return this
5b78b8c79d9c Initial commit
Vincent Tondellier <tonton+hg@team1664.org>
parents:
diff changeset
   318
    }
5b78b8c79d9c Initial commit
Vincent Tondellier <tonton+hg@team1664.org>
parents:
diff changeset
   319
5b78b8c79d9c Initial commit
Vincent Tondellier <tonton+hg@team1664.org>
parents:
diff changeset
   320
  , next: function () {
5b78b8c79d9c Initial commit
Vincent Tondellier <tonton+hg@team1664.org>
parents:
diff changeset
   321
      if (this.sliding) return
5b78b8c79d9c Initial commit
Vincent Tondellier <tonton+hg@team1664.org>
parents:
diff changeset
   322
      return this.slide('next')
5b78b8c79d9c Initial commit
Vincent Tondellier <tonton+hg@team1664.org>
parents:
diff changeset
   323
    }
5b78b8c79d9c Initial commit
Vincent Tondellier <tonton+hg@team1664.org>
parents:
diff changeset
   324
5b78b8c79d9c Initial commit
Vincent Tondellier <tonton+hg@team1664.org>
parents:
diff changeset
   325
  , prev: function () {
5b78b8c79d9c Initial commit
Vincent Tondellier <tonton+hg@team1664.org>
parents:
diff changeset
   326
      if (this.sliding) return
5b78b8c79d9c Initial commit
Vincent Tondellier <tonton+hg@team1664.org>
parents:
diff changeset
   327
      return this.slide('prev')
5b78b8c79d9c Initial commit
Vincent Tondellier <tonton+hg@team1664.org>
parents:
diff changeset
   328
    }
5b78b8c79d9c Initial commit
Vincent Tondellier <tonton+hg@team1664.org>
parents:
diff changeset
   329
5b78b8c79d9c Initial commit
Vincent Tondellier <tonton+hg@team1664.org>
parents:
diff changeset
   330
  , slide: function (type, next) {
5b78b8c79d9c Initial commit
Vincent Tondellier <tonton+hg@team1664.org>
parents:
diff changeset
   331
      var $active = this.$element.find('.active')
5b78b8c79d9c Initial commit
Vincent Tondellier <tonton+hg@team1664.org>
parents:
diff changeset
   332
        , $next = next || $active[type]()
5b78b8c79d9c Initial commit
Vincent Tondellier <tonton+hg@team1664.org>
parents:
diff changeset
   333
        , isCycling = this.interval
5b78b8c79d9c Initial commit
Vincent Tondellier <tonton+hg@team1664.org>
parents:
diff changeset
   334
        , direction = type == 'next' ? 'left' : 'right'
5b78b8c79d9c Initial commit
Vincent Tondellier <tonton+hg@team1664.org>
parents:
diff changeset
   335
        , fallback  = type == 'next' ? 'first' : 'last'
5b78b8c79d9c Initial commit
Vincent Tondellier <tonton+hg@team1664.org>
parents:
diff changeset
   336
        , that = this
5b78b8c79d9c Initial commit
Vincent Tondellier <tonton+hg@team1664.org>
parents:
diff changeset
   337
        , e = $.Event('slide')
5b78b8c79d9c Initial commit
Vincent Tondellier <tonton+hg@team1664.org>
parents:
diff changeset
   338
5b78b8c79d9c Initial commit
Vincent Tondellier <tonton+hg@team1664.org>
parents:
diff changeset
   339
      this.sliding = true
5b78b8c79d9c Initial commit
Vincent Tondellier <tonton+hg@team1664.org>
parents:
diff changeset
   340
5b78b8c79d9c Initial commit
Vincent Tondellier <tonton+hg@team1664.org>
parents:
diff changeset
   341
      isCycling && this.pause()
5b78b8c79d9c Initial commit
Vincent Tondellier <tonton+hg@team1664.org>
parents:
diff changeset
   342
5b78b8c79d9c Initial commit
Vincent Tondellier <tonton+hg@team1664.org>
parents:
diff changeset
   343
      $next = $next.length ? $next : this.$element.find('.item')[fallback]()
5b78b8c79d9c Initial commit
Vincent Tondellier <tonton+hg@team1664.org>
parents:
diff changeset
   344
5b78b8c79d9c Initial commit
Vincent Tondellier <tonton+hg@team1664.org>
parents:
diff changeset
   345
      if ($next.hasClass('active')) return
5b78b8c79d9c Initial commit
Vincent Tondellier <tonton+hg@team1664.org>
parents:
diff changeset
   346
5b78b8c79d9c Initial commit
Vincent Tondellier <tonton+hg@team1664.org>
parents:
diff changeset
   347
      if ($.support.transition && this.$element.hasClass('slide')) {
5b78b8c79d9c Initial commit
Vincent Tondellier <tonton+hg@team1664.org>
parents:
diff changeset
   348
        this.$element.trigger(e)
5b78b8c79d9c Initial commit
Vincent Tondellier <tonton+hg@team1664.org>
parents:
diff changeset
   349
        if (e.isDefaultPrevented()) return
5b78b8c79d9c Initial commit
Vincent Tondellier <tonton+hg@team1664.org>
parents:
diff changeset
   350
        $next.addClass(type)
5b78b8c79d9c Initial commit
Vincent Tondellier <tonton+hg@team1664.org>
parents:
diff changeset
   351
        $next[0].offsetWidth // force reflow
5b78b8c79d9c Initial commit
Vincent Tondellier <tonton+hg@team1664.org>
parents:
diff changeset
   352
        $active.addClass(direction)
5b78b8c79d9c Initial commit
Vincent Tondellier <tonton+hg@team1664.org>
parents:
diff changeset
   353
        $next.addClass(direction)
5b78b8c79d9c Initial commit
Vincent Tondellier <tonton+hg@team1664.org>
parents:
diff changeset
   354
        this.$element.one($.support.transition.end, function () {
5b78b8c79d9c Initial commit
Vincent Tondellier <tonton+hg@team1664.org>
parents:
diff changeset
   355
          $next.removeClass([type, direction].join(' ')).addClass('active')
5b78b8c79d9c Initial commit
Vincent Tondellier <tonton+hg@team1664.org>
parents:
diff changeset
   356
          $active.removeClass(['active', direction].join(' '))
5b78b8c79d9c Initial commit
Vincent Tondellier <tonton+hg@team1664.org>
parents:
diff changeset
   357
          that.sliding = false
5b78b8c79d9c Initial commit
Vincent Tondellier <tonton+hg@team1664.org>
parents:
diff changeset
   358
          setTimeout(function () { that.$element.trigger('slid') }, 0)
5b78b8c79d9c Initial commit
Vincent Tondellier <tonton+hg@team1664.org>
parents:
diff changeset
   359
        })
5b78b8c79d9c Initial commit
Vincent Tondellier <tonton+hg@team1664.org>
parents:
diff changeset
   360
      } else {
5b78b8c79d9c Initial commit
Vincent Tondellier <tonton+hg@team1664.org>
parents:
diff changeset
   361
        this.$element.trigger(e)
5b78b8c79d9c Initial commit
Vincent Tondellier <tonton+hg@team1664.org>
parents:
diff changeset
   362
        if (e.isDefaultPrevented()) return
5b78b8c79d9c Initial commit
Vincent Tondellier <tonton+hg@team1664.org>
parents:
diff changeset
   363
        $active.removeClass('active')
5b78b8c79d9c Initial commit
Vincent Tondellier <tonton+hg@team1664.org>
parents:
diff changeset
   364
        $next.addClass('active')
5b78b8c79d9c Initial commit
Vincent Tondellier <tonton+hg@team1664.org>
parents:
diff changeset
   365
        this.sliding = false
5b78b8c79d9c Initial commit
Vincent Tondellier <tonton+hg@team1664.org>
parents:
diff changeset
   366
        this.$element.trigger('slid')
5b78b8c79d9c Initial commit
Vincent Tondellier <tonton+hg@team1664.org>
parents:
diff changeset
   367
      }
5b78b8c79d9c Initial commit
Vincent Tondellier <tonton+hg@team1664.org>
parents:
diff changeset
   368
5b78b8c79d9c Initial commit
Vincent Tondellier <tonton+hg@team1664.org>
parents:
diff changeset
   369
      isCycling && this.cycle()
5b78b8c79d9c Initial commit
Vincent Tondellier <tonton+hg@team1664.org>
parents:
diff changeset
   370
5b78b8c79d9c Initial commit
Vincent Tondellier <tonton+hg@team1664.org>
parents:
diff changeset
   371
      return this
5b78b8c79d9c Initial commit
Vincent Tondellier <tonton+hg@team1664.org>
parents:
diff changeset
   372
    }
5b78b8c79d9c Initial commit
Vincent Tondellier <tonton+hg@team1664.org>
parents:
diff changeset
   373
5b78b8c79d9c Initial commit
Vincent Tondellier <tonton+hg@team1664.org>
parents:
diff changeset
   374
  }
5b78b8c79d9c Initial commit
Vincent Tondellier <tonton+hg@team1664.org>
parents:
diff changeset
   375
5b78b8c79d9c Initial commit
Vincent Tondellier <tonton+hg@team1664.org>
parents:
diff changeset
   376
5b78b8c79d9c Initial commit
Vincent Tondellier <tonton+hg@team1664.org>
parents:
diff changeset
   377
 /* CAROUSEL PLUGIN DEFINITION
5b78b8c79d9c Initial commit
Vincent Tondellier <tonton+hg@team1664.org>
parents:
diff changeset
   378
  * ========================== */
5b78b8c79d9c Initial commit
Vincent Tondellier <tonton+hg@team1664.org>
parents:
diff changeset
   379
5b78b8c79d9c Initial commit
Vincent Tondellier <tonton+hg@team1664.org>
parents:
diff changeset
   380
  $.fn.carousel = function (option) {
5b78b8c79d9c Initial commit
Vincent Tondellier <tonton+hg@team1664.org>
parents:
diff changeset
   381
    return this.each(function () {
5b78b8c79d9c Initial commit
Vincent Tondellier <tonton+hg@team1664.org>
parents:
diff changeset
   382
      var $this = $(this)
5b78b8c79d9c Initial commit
Vincent Tondellier <tonton+hg@team1664.org>
parents:
diff changeset
   383
        , data = $this.data('carousel')
5b78b8c79d9c Initial commit
Vincent Tondellier <tonton+hg@team1664.org>
parents:
diff changeset
   384
        , options = $.extend({}, $.fn.carousel.defaults, typeof option == 'object' && option)
5b78b8c79d9c Initial commit
Vincent Tondellier <tonton+hg@team1664.org>
parents:
diff changeset
   385
      if (!data) $this.data('carousel', (data = new Carousel(this, options)))
5b78b8c79d9c Initial commit
Vincent Tondellier <tonton+hg@team1664.org>
parents:
diff changeset
   386
      if (typeof option == 'number') data.to(option)
5b78b8c79d9c Initial commit
Vincent Tondellier <tonton+hg@team1664.org>
parents:
diff changeset
   387
      else if (typeof option == 'string' || (option = options.slide)) data[option]()
5b78b8c79d9c Initial commit
Vincent Tondellier <tonton+hg@team1664.org>
parents:
diff changeset
   388
      else if (options.interval) data.cycle()
5b78b8c79d9c Initial commit
Vincent Tondellier <tonton+hg@team1664.org>
parents:
diff changeset
   389
    })
5b78b8c79d9c Initial commit
Vincent Tondellier <tonton+hg@team1664.org>
parents:
diff changeset
   390
  }
5b78b8c79d9c Initial commit
Vincent Tondellier <tonton+hg@team1664.org>
parents:
diff changeset
   391
5b78b8c79d9c Initial commit
Vincent Tondellier <tonton+hg@team1664.org>
parents:
diff changeset
   392
  $.fn.carousel.defaults = {
5b78b8c79d9c Initial commit
Vincent Tondellier <tonton+hg@team1664.org>
parents:
diff changeset
   393
    interval: 5000
5b78b8c79d9c Initial commit
Vincent Tondellier <tonton+hg@team1664.org>
parents:
diff changeset
   394
  , pause: 'hover'
5b78b8c79d9c Initial commit
Vincent Tondellier <tonton+hg@team1664.org>
parents:
diff changeset
   395
  }
5b78b8c79d9c Initial commit
Vincent Tondellier <tonton+hg@team1664.org>
parents:
diff changeset
   396
5b78b8c79d9c Initial commit
Vincent Tondellier <tonton+hg@team1664.org>
parents:
diff changeset
   397
  $.fn.carousel.Constructor = Carousel
5b78b8c79d9c Initial commit
Vincent Tondellier <tonton+hg@team1664.org>
parents:
diff changeset
   398
5b78b8c79d9c Initial commit
Vincent Tondellier <tonton+hg@team1664.org>
parents:
diff changeset
   399
5b78b8c79d9c Initial commit
Vincent Tondellier <tonton+hg@team1664.org>
parents:
diff changeset
   400
 /* CAROUSEL DATA-API
5b78b8c79d9c Initial commit
Vincent Tondellier <tonton+hg@team1664.org>
parents:
diff changeset
   401
  * ================= */
5b78b8c79d9c Initial commit
Vincent Tondellier <tonton+hg@team1664.org>
parents:
diff changeset
   402
5b78b8c79d9c Initial commit
Vincent Tondellier <tonton+hg@team1664.org>
parents:
diff changeset
   403
  $(function () {
5b78b8c79d9c Initial commit
Vincent Tondellier <tonton+hg@team1664.org>
parents:
diff changeset
   404
    $('body').on('click.carousel.data-api', '[data-slide]', function ( e ) {
5b78b8c79d9c Initial commit
Vincent Tondellier <tonton+hg@team1664.org>
parents:
diff changeset
   405
      var $this = $(this), href
5b78b8c79d9c Initial commit
Vincent Tondellier <tonton+hg@team1664.org>
parents:
diff changeset
   406
        , $target = $($this.attr('data-target') || (href = $this.attr('href')) && href.replace(/.*(?=#[^\s]+$)/, '')) //strip for ie7
5b78b8c79d9c Initial commit
Vincent Tondellier <tonton+hg@team1664.org>
parents:
diff changeset
   407
        , options = !$target.data('modal') && $.extend({}, $target.data(), $this.data())
5b78b8c79d9c Initial commit
Vincent Tondellier <tonton+hg@team1664.org>
parents:
diff changeset
   408
      $target.carousel(options)
5b78b8c79d9c Initial commit
Vincent Tondellier <tonton+hg@team1664.org>
parents:
diff changeset
   409
      e.preventDefault()
5b78b8c79d9c Initial commit
Vincent Tondellier <tonton+hg@team1664.org>
parents:
diff changeset
   410
    })
5b78b8c79d9c Initial commit
Vincent Tondellier <tonton+hg@team1664.org>
parents:
diff changeset
   411
  })
5b78b8c79d9c Initial commit
Vincent Tondellier <tonton+hg@team1664.org>
parents:
diff changeset
   412
5b78b8c79d9c Initial commit
Vincent Tondellier <tonton+hg@team1664.org>
parents:
diff changeset
   413
}(window.jQuery);/* =============================================================
5b78b8c79d9c Initial commit
Vincent Tondellier <tonton+hg@team1664.org>
parents:
diff changeset
   414
 * bootstrap-collapse.js v2.0.3
5b78b8c79d9c Initial commit
Vincent Tondellier <tonton+hg@team1664.org>
parents:
diff changeset
   415
 * http://twitter.github.com/bootstrap/javascript.html#collapse
5b78b8c79d9c Initial commit
Vincent Tondellier <tonton+hg@team1664.org>
parents:
diff changeset
   416
 * =============================================================
5b78b8c79d9c Initial commit
Vincent Tondellier <tonton+hg@team1664.org>
parents:
diff changeset
   417
 * Copyright 2012 Twitter, Inc.
5b78b8c79d9c Initial commit
Vincent Tondellier <tonton+hg@team1664.org>
parents:
diff changeset
   418
 *
5b78b8c79d9c Initial commit
Vincent Tondellier <tonton+hg@team1664.org>
parents:
diff changeset
   419
 * Licensed under the Apache License, Version 2.0 (the "License");
5b78b8c79d9c Initial commit
Vincent Tondellier <tonton+hg@team1664.org>
parents:
diff changeset
   420
 * you may not use this file except in compliance with the License.
5b78b8c79d9c Initial commit
Vincent Tondellier <tonton+hg@team1664.org>
parents:
diff changeset
   421
 * You may obtain a copy of the License at
5b78b8c79d9c Initial commit
Vincent Tondellier <tonton+hg@team1664.org>
parents:
diff changeset
   422
 *
5b78b8c79d9c Initial commit
Vincent Tondellier <tonton+hg@team1664.org>
parents:
diff changeset
   423
 * http://www.apache.org/licenses/LICENSE-2.0
5b78b8c79d9c Initial commit
Vincent Tondellier <tonton+hg@team1664.org>
parents:
diff changeset
   424
 *
5b78b8c79d9c Initial commit
Vincent Tondellier <tonton+hg@team1664.org>
parents:
diff changeset
   425
 * Unless required by applicable law or agreed to in writing, software
5b78b8c79d9c Initial commit
Vincent Tondellier <tonton+hg@team1664.org>
parents:
diff changeset
   426
 * distributed under the License is distributed on an "AS IS" BASIS,
5b78b8c79d9c Initial commit
Vincent Tondellier <tonton+hg@team1664.org>
parents:
diff changeset
   427
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
5b78b8c79d9c Initial commit
Vincent Tondellier <tonton+hg@team1664.org>
parents:
diff changeset
   428
 * See the License for the specific language governing permissions and
5b78b8c79d9c Initial commit
Vincent Tondellier <tonton+hg@team1664.org>
parents:
diff changeset
   429
 * limitations under the License.
5b78b8c79d9c Initial commit
Vincent Tondellier <tonton+hg@team1664.org>
parents:
diff changeset
   430
 * ============================================================ */
5b78b8c79d9c Initial commit
Vincent Tondellier <tonton+hg@team1664.org>
parents:
diff changeset
   431
5b78b8c79d9c Initial commit
Vincent Tondellier <tonton+hg@team1664.org>
parents:
diff changeset
   432
5b78b8c79d9c Initial commit
Vincent Tondellier <tonton+hg@team1664.org>
parents:
diff changeset
   433
!function ($) {
5b78b8c79d9c Initial commit
Vincent Tondellier <tonton+hg@team1664.org>
parents:
diff changeset
   434
5b78b8c79d9c Initial commit
Vincent Tondellier <tonton+hg@team1664.org>
parents:
diff changeset
   435
  "use strict"; // jshint ;_;
5b78b8c79d9c Initial commit
Vincent Tondellier <tonton+hg@team1664.org>
parents:
diff changeset
   436
5b78b8c79d9c Initial commit
Vincent Tondellier <tonton+hg@team1664.org>
parents:
diff changeset
   437
5b78b8c79d9c Initial commit
Vincent Tondellier <tonton+hg@team1664.org>
parents:
diff changeset
   438
 /* COLLAPSE PUBLIC CLASS DEFINITION
5b78b8c79d9c Initial commit
Vincent Tondellier <tonton+hg@team1664.org>
parents:
diff changeset
   439
  * ================================ */
5b78b8c79d9c Initial commit
Vincent Tondellier <tonton+hg@team1664.org>
parents:
diff changeset
   440
5b78b8c79d9c Initial commit
Vincent Tondellier <tonton+hg@team1664.org>
parents:
diff changeset
   441
  var Collapse = function (element, options) {
5b78b8c79d9c Initial commit
Vincent Tondellier <tonton+hg@team1664.org>
parents:
diff changeset
   442
    this.$element = $(element)
5b78b8c79d9c Initial commit
Vincent Tondellier <tonton+hg@team1664.org>
parents:
diff changeset
   443
    this.options = $.extend({}, $.fn.collapse.defaults, options)
5b78b8c79d9c Initial commit
Vincent Tondellier <tonton+hg@team1664.org>
parents:
diff changeset
   444
5b78b8c79d9c Initial commit
Vincent Tondellier <tonton+hg@team1664.org>
parents:
diff changeset
   445
    if (this.options.parent) {
5b78b8c79d9c Initial commit
Vincent Tondellier <tonton+hg@team1664.org>
parents:
diff changeset
   446
      this.$parent = $(this.options.parent)
5b78b8c79d9c Initial commit
Vincent Tondellier <tonton+hg@team1664.org>
parents:
diff changeset
   447
    }
5b78b8c79d9c Initial commit
Vincent Tondellier <tonton+hg@team1664.org>
parents:
diff changeset
   448
5b78b8c79d9c Initial commit
Vincent Tondellier <tonton+hg@team1664.org>
parents:
diff changeset
   449
    this.options.toggle && this.toggle()
5b78b8c79d9c Initial commit
Vincent Tondellier <tonton+hg@team1664.org>
parents:
diff changeset
   450
  }
5b78b8c79d9c Initial commit
Vincent Tondellier <tonton+hg@team1664.org>
parents:
diff changeset
   451
5b78b8c79d9c Initial commit
Vincent Tondellier <tonton+hg@team1664.org>
parents:
diff changeset
   452
  Collapse.prototype = {
5b78b8c79d9c Initial commit
Vincent Tondellier <tonton+hg@team1664.org>
parents:
diff changeset
   453
5b78b8c79d9c Initial commit
Vincent Tondellier <tonton+hg@team1664.org>
parents:
diff changeset
   454
    constructor: Collapse
5b78b8c79d9c Initial commit
Vincent Tondellier <tonton+hg@team1664.org>
parents:
diff changeset
   455
5b78b8c79d9c Initial commit
Vincent Tondellier <tonton+hg@team1664.org>
parents:
diff changeset
   456
  , dimension: function () {
5b78b8c79d9c Initial commit
Vincent Tondellier <tonton+hg@team1664.org>
parents:
diff changeset
   457
      var hasWidth = this.$element.hasClass('width')
5b78b8c79d9c Initial commit
Vincent Tondellier <tonton+hg@team1664.org>
parents:
diff changeset
   458
      return hasWidth ? 'width' : 'height'
5b78b8c79d9c Initial commit
Vincent Tondellier <tonton+hg@team1664.org>
parents:
diff changeset
   459
    }
5b78b8c79d9c Initial commit
Vincent Tondellier <tonton+hg@team1664.org>
parents:
diff changeset
   460
5b78b8c79d9c Initial commit
Vincent Tondellier <tonton+hg@team1664.org>
parents:
diff changeset
   461
  , show: function () {
5b78b8c79d9c Initial commit
Vincent Tondellier <tonton+hg@team1664.org>
parents:
diff changeset
   462
      var dimension
5b78b8c79d9c Initial commit
Vincent Tondellier <tonton+hg@team1664.org>
parents:
diff changeset
   463
        , scroll
5b78b8c79d9c Initial commit
Vincent Tondellier <tonton+hg@team1664.org>
parents:
diff changeset
   464
        , actives
5b78b8c79d9c Initial commit
Vincent Tondellier <tonton+hg@team1664.org>
parents:
diff changeset
   465
        , hasData
5b78b8c79d9c Initial commit
Vincent Tondellier <tonton+hg@team1664.org>
parents:
diff changeset
   466
5b78b8c79d9c Initial commit
Vincent Tondellier <tonton+hg@team1664.org>
parents:
diff changeset
   467
      if (this.transitioning) return
5b78b8c79d9c Initial commit
Vincent Tondellier <tonton+hg@team1664.org>
parents:
diff changeset
   468
5b78b8c79d9c Initial commit
Vincent Tondellier <tonton+hg@team1664.org>
parents:
diff changeset
   469
      dimension = this.dimension()
5b78b8c79d9c Initial commit
Vincent Tondellier <tonton+hg@team1664.org>
parents:
diff changeset
   470
      scroll = $.camelCase(['scroll', dimension].join('-'))
5b78b8c79d9c Initial commit
Vincent Tondellier <tonton+hg@team1664.org>
parents:
diff changeset
   471
      actives = this.$parent && this.$parent.find('> .accordion-group > .in')
5b78b8c79d9c Initial commit
Vincent Tondellier <tonton+hg@team1664.org>
parents:
diff changeset
   472
5b78b8c79d9c Initial commit
Vincent Tondellier <tonton+hg@team1664.org>
parents:
diff changeset
   473
      if (actives && actives.length) {
5b78b8c79d9c Initial commit
Vincent Tondellier <tonton+hg@team1664.org>
parents:
diff changeset
   474
        hasData = actives.data('collapse')
5b78b8c79d9c Initial commit
Vincent Tondellier <tonton+hg@team1664.org>
parents:
diff changeset
   475
        if (hasData && hasData.transitioning) return
5b78b8c79d9c Initial commit
Vincent Tondellier <tonton+hg@team1664.org>
parents:
diff changeset
   476
        actives.collapse('hide')
5b78b8c79d9c Initial commit
Vincent Tondellier <tonton+hg@team1664.org>
parents:
diff changeset
   477
        hasData || actives.data('collapse', null)
5b78b8c79d9c Initial commit
Vincent Tondellier <tonton+hg@team1664.org>
parents:
diff changeset
   478
      }
5b78b8c79d9c Initial commit
Vincent Tondellier <tonton+hg@team1664.org>
parents:
diff changeset
   479
5b78b8c79d9c Initial commit
Vincent Tondellier <tonton+hg@team1664.org>
parents:
diff changeset
   480
      this.$element[dimension](0)
5b78b8c79d9c Initial commit
Vincent Tondellier <tonton+hg@team1664.org>
parents:
diff changeset
   481
      this.transition('addClass', $.Event('show'), 'shown')
5b78b8c79d9c Initial commit
Vincent Tondellier <tonton+hg@team1664.org>
parents:
diff changeset
   482
      this.$element[dimension](this.$element[0][scroll])
5b78b8c79d9c Initial commit
Vincent Tondellier <tonton+hg@team1664.org>
parents:
diff changeset
   483
    }
5b78b8c79d9c Initial commit
Vincent Tondellier <tonton+hg@team1664.org>
parents:
diff changeset
   484
5b78b8c79d9c Initial commit
Vincent Tondellier <tonton+hg@team1664.org>
parents:
diff changeset
   485
  , hide: function () {
5b78b8c79d9c Initial commit
Vincent Tondellier <tonton+hg@team1664.org>
parents:
diff changeset
   486
      var dimension
5b78b8c79d9c Initial commit
Vincent Tondellier <tonton+hg@team1664.org>
parents:
diff changeset
   487
      if (this.transitioning) return
5b78b8c79d9c Initial commit
Vincent Tondellier <tonton+hg@team1664.org>
parents:
diff changeset
   488
      dimension = this.dimension()
5b78b8c79d9c Initial commit
Vincent Tondellier <tonton+hg@team1664.org>
parents:
diff changeset
   489
      this.reset(this.$element[dimension]())
5b78b8c79d9c Initial commit
Vincent Tondellier <tonton+hg@team1664.org>
parents:
diff changeset
   490
      this.transition('removeClass', $.Event('hide'), 'hidden')
5b78b8c79d9c Initial commit
Vincent Tondellier <tonton+hg@team1664.org>
parents:
diff changeset
   491
      this.$element[dimension](0)
5b78b8c79d9c Initial commit
Vincent Tondellier <tonton+hg@team1664.org>
parents:
diff changeset
   492
    }
5b78b8c79d9c Initial commit
Vincent Tondellier <tonton+hg@team1664.org>
parents:
diff changeset
   493
5b78b8c79d9c Initial commit
Vincent Tondellier <tonton+hg@team1664.org>
parents:
diff changeset
   494
  , reset: function (size) {
5b78b8c79d9c Initial commit
Vincent Tondellier <tonton+hg@team1664.org>
parents:
diff changeset
   495
      var dimension = this.dimension()
5b78b8c79d9c Initial commit
Vincent Tondellier <tonton+hg@team1664.org>
parents:
diff changeset
   496
5b78b8c79d9c Initial commit
Vincent Tondellier <tonton+hg@team1664.org>
parents:
diff changeset
   497
      this.$element
5b78b8c79d9c Initial commit
Vincent Tondellier <tonton+hg@team1664.org>
parents:
diff changeset
   498
        .removeClass('collapse')
5b78b8c79d9c Initial commit
Vincent Tondellier <tonton+hg@team1664.org>
parents:
diff changeset
   499
        [dimension](size || 'auto')
5b78b8c79d9c Initial commit
Vincent Tondellier <tonton+hg@team1664.org>
parents:
diff changeset
   500
        [0].offsetWidth
5b78b8c79d9c Initial commit
Vincent Tondellier <tonton+hg@team1664.org>
parents:
diff changeset
   501
5b78b8c79d9c Initial commit
Vincent Tondellier <tonton+hg@team1664.org>
parents:
diff changeset
   502
      this.$element[size !== null ? 'addClass' : 'removeClass']('collapse')
5b78b8c79d9c Initial commit
Vincent Tondellier <tonton+hg@team1664.org>
parents:
diff changeset
   503
5b78b8c79d9c Initial commit
Vincent Tondellier <tonton+hg@team1664.org>
parents:
diff changeset
   504
      return this
5b78b8c79d9c Initial commit
Vincent Tondellier <tonton+hg@team1664.org>
parents:
diff changeset
   505
    }
5b78b8c79d9c Initial commit
Vincent Tondellier <tonton+hg@team1664.org>
parents:
diff changeset
   506
5b78b8c79d9c Initial commit
Vincent Tondellier <tonton+hg@team1664.org>
parents:
diff changeset
   507
  , transition: function (method, startEvent, completeEvent) {
5b78b8c79d9c Initial commit
Vincent Tondellier <tonton+hg@team1664.org>
parents:
diff changeset
   508
      var that = this
5b78b8c79d9c Initial commit
Vincent Tondellier <tonton+hg@team1664.org>
parents:
diff changeset
   509
        , complete = function () {
5b78b8c79d9c Initial commit
Vincent Tondellier <tonton+hg@team1664.org>
parents:
diff changeset
   510
            if (startEvent.type == 'show') that.reset()
5b78b8c79d9c Initial commit
Vincent Tondellier <tonton+hg@team1664.org>
parents:
diff changeset
   511
            that.transitioning = 0
5b78b8c79d9c Initial commit
Vincent Tondellier <tonton+hg@team1664.org>
parents:
diff changeset
   512
            that.$element.trigger(completeEvent)
5b78b8c79d9c Initial commit
Vincent Tondellier <tonton+hg@team1664.org>
parents:
diff changeset
   513
          }
5b78b8c79d9c Initial commit
Vincent Tondellier <tonton+hg@team1664.org>
parents:
diff changeset
   514
5b78b8c79d9c Initial commit
Vincent Tondellier <tonton+hg@team1664.org>
parents:
diff changeset
   515
      this.$element.trigger(startEvent)
5b78b8c79d9c Initial commit
Vincent Tondellier <tonton+hg@team1664.org>
parents:
diff changeset
   516
5b78b8c79d9c Initial commit
Vincent Tondellier <tonton+hg@team1664.org>
parents:
diff changeset
   517
      if (startEvent.isDefaultPrevented()) return
5b78b8c79d9c Initial commit
Vincent Tondellier <tonton+hg@team1664.org>
parents:
diff changeset
   518
5b78b8c79d9c Initial commit
Vincent Tondellier <tonton+hg@team1664.org>
parents:
diff changeset
   519
      this.transitioning = 1
5b78b8c79d9c Initial commit
Vincent Tondellier <tonton+hg@team1664.org>
parents:
diff changeset
   520
5b78b8c79d9c Initial commit
Vincent Tondellier <tonton+hg@team1664.org>
parents:
diff changeset
   521
      this.$element[method]('in')
5b78b8c79d9c Initial commit
Vincent Tondellier <tonton+hg@team1664.org>
parents:
diff changeset
   522
5b78b8c79d9c Initial commit
Vincent Tondellier <tonton+hg@team1664.org>
parents:
diff changeset
   523
      $.support.transition && this.$element.hasClass('collapse') ?
5b78b8c79d9c Initial commit
Vincent Tondellier <tonton+hg@team1664.org>
parents:
diff changeset
   524
        this.$element.one($.support.transition.end, complete) :
5b78b8c79d9c Initial commit
Vincent Tondellier <tonton+hg@team1664.org>
parents:
diff changeset
   525
        complete()
5b78b8c79d9c Initial commit
Vincent Tondellier <tonton+hg@team1664.org>
parents:
diff changeset
   526
    }
5b78b8c79d9c Initial commit
Vincent Tondellier <tonton+hg@team1664.org>
parents:
diff changeset
   527
5b78b8c79d9c Initial commit
Vincent Tondellier <tonton+hg@team1664.org>
parents:
diff changeset
   528
  , toggle: function () {
5b78b8c79d9c Initial commit
Vincent Tondellier <tonton+hg@team1664.org>
parents:
diff changeset
   529
      this[this.$element.hasClass('in') ? 'hide' : 'show']()
5b78b8c79d9c Initial commit
Vincent Tondellier <tonton+hg@team1664.org>
parents:
diff changeset
   530
    }
5b78b8c79d9c Initial commit
Vincent Tondellier <tonton+hg@team1664.org>
parents:
diff changeset
   531
5b78b8c79d9c Initial commit
Vincent Tondellier <tonton+hg@team1664.org>
parents:
diff changeset
   532
  }
5b78b8c79d9c Initial commit
Vincent Tondellier <tonton+hg@team1664.org>
parents:
diff changeset
   533
5b78b8c79d9c Initial commit
Vincent Tondellier <tonton+hg@team1664.org>
parents:
diff changeset
   534
5b78b8c79d9c Initial commit
Vincent Tondellier <tonton+hg@team1664.org>
parents:
diff changeset
   535
 /* COLLAPSIBLE PLUGIN DEFINITION
5b78b8c79d9c Initial commit
Vincent Tondellier <tonton+hg@team1664.org>
parents:
diff changeset
   536
  * ============================== */
5b78b8c79d9c Initial commit
Vincent Tondellier <tonton+hg@team1664.org>
parents:
diff changeset
   537
5b78b8c79d9c Initial commit
Vincent Tondellier <tonton+hg@team1664.org>
parents:
diff changeset
   538
  $.fn.collapse = function (option) {
5b78b8c79d9c Initial commit
Vincent Tondellier <tonton+hg@team1664.org>
parents:
diff changeset
   539
    return this.each(function () {
5b78b8c79d9c Initial commit
Vincent Tondellier <tonton+hg@team1664.org>
parents:
diff changeset
   540
      var $this = $(this)
5b78b8c79d9c Initial commit
Vincent Tondellier <tonton+hg@team1664.org>
parents:
diff changeset
   541
        , data = $this.data('collapse')
5b78b8c79d9c Initial commit
Vincent Tondellier <tonton+hg@team1664.org>
parents:
diff changeset
   542
        , options = typeof option == 'object' && option
5b78b8c79d9c Initial commit
Vincent Tondellier <tonton+hg@team1664.org>
parents:
diff changeset
   543
      if (!data) $this.data('collapse', (data = new Collapse(this, options)))
5b78b8c79d9c Initial commit
Vincent Tondellier <tonton+hg@team1664.org>
parents:
diff changeset
   544
      if (typeof option == 'string') data[option]()
5b78b8c79d9c Initial commit
Vincent Tondellier <tonton+hg@team1664.org>
parents:
diff changeset
   545
    })
5b78b8c79d9c Initial commit
Vincent Tondellier <tonton+hg@team1664.org>
parents:
diff changeset
   546
  }
5b78b8c79d9c Initial commit
Vincent Tondellier <tonton+hg@team1664.org>
parents:
diff changeset
   547
5b78b8c79d9c Initial commit
Vincent Tondellier <tonton+hg@team1664.org>
parents:
diff changeset
   548
  $.fn.collapse.defaults = {
5b78b8c79d9c Initial commit
Vincent Tondellier <tonton+hg@team1664.org>
parents:
diff changeset
   549
    toggle: true
5b78b8c79d9c Initial commit
Vincent Tondellier <tonton+hg@team1664.org>
parents:
diff changeset
   550
  }
5b78b8c79d9c Initial commit
Vincent Tondellier <tonton+hg@team1664.org>
parents:
diff changeset
   551
5b78b8c79d9c Initial commit
Vincent Tondellier <tonton+hg@team1664.org>
parents:
diff changeset
   552
  $.fn.collapse.Constructor = Collapse
5b78b8c79d9c Initial commit
Vincent Tondellier <tonton+hg@team1664.org>
parents:
diff changeset
   553
5b78b8c79d9c Initial commit
Vincent Tondellier <tonton+hg@team1664.org>
parents:
diff changeset
   554
5b78b8c79d9c Initial commit
Vincent Tondellier <tonton+hg@team1664.org>
parents:
diff changeset
   555
 /* COLLAPSIBLE DATA-API
5b78b8c79d9c Initial commit
Vincent Tondellier <tonton+hg@team1664.org>
parents:
diff changeset
   556
  * ==================== */
5b78b8c79d9c Initial commit
Vincent Tondellier <tonton+hg@team1664.org>
parents:
diff changeset
   557
5b78b8c79d9c Initial commit
Vincent Tondellier <tonton+hg@team1664.org>
parents:
diff changeset
   558
  $(function () {
5b78b8c79d9c Initial commit
Vincent Tondellier <tonton+hg@team1664.org>
parents:
diff changeset
   559
    $('body').on('click.collapse.data-api', '[data-toggle=collapse]', function ( e ) {
5b78b8c79d9c Initial commit
Vincent Tondellier <tonton+hg@team1664.org>
parents:
diff changeset
   560
      var $this = $(this), href
5b78b8c79d9c Initial commit
Vincent Tondellier <tonton+hg@team1664.org>
parents:
diff changeset
   561
        , target = $this.attr('data-target')
5b78b8c79d9c Initial commit
Vincent Tondellier <tonton+hg@team1664.org>
parents:
diff changeset
   562
          || e.preventDefault()
5b78b8c79d9c Initial commit
Vincent Tondellier <tonton+hg@team1664.org>
parents:
diff changeset
   563
          || (href = $this.attr('href')) && href.replace(/.*(?=#[^\s]+$)/, '') //strip for ie7
5b78b8c79d9c Initial commit
Vincent Tondellier <tonton+hg@team1664.org>
parents:
diff changeset
   564
        , option = $(target).data('collapse') ? 'toggle' : $this.data()
5b78b8c79d9c Initial commit
Vincent Tondellier <tonton+hg@team1664.org>
parents:
diff changeset
   565
      $(target).collapse(option)
5b78b8c79d9c Initial commit
Vincent Tondellier <tonton+hg@team1664.org>
parents:
diff changeset
   566
    })
5b78b8c79d9c Initial commit
Vincent Tondellier <tonton+hg@team1664.org>
parents:
diff changeset
   567
  })
5b78b8c79d9c Initial commit
Vincent Tondellier <tonton+hg@team1664.org>
parents:
diff changeset
   568
5b78b8c79d9c Initial commit
Vincent Tondellier <tonton+hg@team1664.org>
parents:
diff changeset
   569
}(window.jQuery);/* ============================================================
5b78b8c79d9c Initial commit
Vincent Tondellier <tonton+hg@team1664.org>
parents:
diff changeset
   570
 * bootstrap-dropdown.js v2.0.3
5b78b8c79d9c Initial commit
Vincent Tondellier <tonton+hg@team1664.org>
parents:
diff changeset
   571
 * http://twitter.github.com/bootstrap/javascript.html#dropdowns
5b78b8c79d9c Initial commit
Vincent Tondellier <tonton+hg@team1664.org>
parents:
diff changeset
   572
 * ============================================================
5b78b8c79d9c Initial commit
Vincent Tondellier <tonton+hg@team1664.org>
parents:
diff changeset
   573
 * Copyright 2012 Twitter, Inc.
5b78b8c79d9c Initial commit
Vincent Tondellier <tonton+hg@team1664.org>
parents:
diff changeset
   574
 *
5b78b8c79d9c Initial commit
Vincent Tondellier <tonton+hg@team1664.org>
parents:
diff changeset
   575
 * Licensed under the Apache License, Version 2.0 (the "License");
5b78b8c79d9c Initial commit
Vincent Tondellier <tonton+hg@team1664.org>
parents:
diff changeset
   576
 * you may not use this file except in compliance with the License.
5b78b8c79d9c Initial commit
Vincent Tondellier <tonton+hg@team1664.org>
parents:
diff changeset
   577
 * You may obtain a copy of the License at
5b78b8c79d9c Initial commit
Vincent Tondellier <tonton+hg@team1664.org>
parents:
diff changeset
   578
 *
5b78b8c79d9c Initial commit
Vincent Tondellier <tonton+hg@team1664.org>
parents:
diff changeset
   579
 * http://www.apache.org/licenses/LICENSE-2.0
5b78b8c79d9c Initial commit
Vincent Tondellier <tonton+hg@team1664.org>
parents:
diff changeset
   580
 *
5b78b8c79d9c Initial commit
Vincent Tondellier <tonton+hg@team1664.org>
parents:
diff changeset
   581
 * Unless required by applicable law or agreed to in writing, software
5b78b8c79d9c Initial commit
Vincent Tondellier <tonton+hg@team1664.org>
parents:
diff changeset
   582
 * distributed under the License is distributed on an "AS IS" BASIS,
5b78b8c79d9c Initial commit
Vincent Tondellier <tonton+hg@team1664.org>
parents:
diff changeset
   583
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
5b78b8c79d9c Initial commit
Vincent Tondellier <tonton+hg@team1664.org>
parents:
diff changeset
   584
 * See the License for the specific language governing permissions and
5b78b8c79d9c Initial commit
Vincent Tondellier <tonton+hg@team1664.org>
parents:
diff changeset
   585
 * limitations under the License.
5b78b8c79d9c Initial commit
Vincent Tondellier <tonton+hg@team1664.org>
parents:
diff changeset
   586
 * ============================================================ */
5b78b8c79d9c Initial commit
Vincent Tondellier <tonton+hg@team1664.org>
parents:
diff changeset
   587
5b78b8c79d9c Initial commit
Vincent Tondellier <tonton+hg@team1664.org>
parents:
diff changeset
   588
5b78b8c79d9c Initial commit
Vincent Tondellier <tonton+hg@team1664.org>
parents:
diff changeset
   589
!function ($) {
5b78b8c79d9c Initial commit
Vincent Tondellier <tonton+hg@team1664.org>
parents:
diff changeset
   590
5b78b8c79d9c Initial commit
Vincent Tondellier <tonton+hg@team1664.org>
parents:
diff changeset
   591
  "use strict"; // jshint ;_;
5b78b8c79d9c Initial commit
Vincent Tondellier <tonton+hg@team1664.org>
parents:
diff changeset
   592
5b78b8c79d9c Initial commit
Vincent Tondellier <tonton+hg@team1664.org>
parents:
diff changeset
   593
5b78b8c79d9c Initial commit
Vincent Tondellier <tonton+hg@team1664.org>
parents:
diff changeset
   594
 /* DROPDOWN CLASS DEFINITION
5b78b8c79d9c Initial commit
Vincent Tondellier <tonton+hg@team1664.org>
parents:
diff changeset
   595
  * ========================= */
5b78b8c79d9c Initial commit
Vincent Tondellier <tonton+hg@team1664.org>
parents:
diff changeset
   596
5b78b8c79d9c Initial commit
Vincent Tondellier <tonton+hg@team1664.org>
parents:
diff changeset
   597
  var toggle = '[data-toggle="dropdown"]'
5b78b8c79d9c Initial commit
Vincent Tondellier <tonton+hg@team1664.org>
parents:
diff changeset
   598
    , Dropdown = function (element) {
5b78b8c79d9c Initial commit
Vincent Tondellier <tonton+hg@team1664.org>
parents:
diff changeset
   599
        var $el = $(element).on('click.dropdown.data-api', this.toggle)
5b78b8c79d9c Initial commit
Vincent Tondellier <tonton+hg@team1664.org>
parents:
diff changeset
   600
        $('html').on('click.dropdown.data-api', function () {
5b78b8c79d9c Initial commit
Vincent Tondellier <tonton+hg@team1664.org>
parents:
diff changeset
   601
          $el.parent().removeClass('open')
5b78b8c79d9c Initial commit
Vincent Tondellier <tonton+hg@team1664.org>
parents:
diff changeset
   602
        })
5b78b8c79d9c Initial commit
Vincent Tondellier <tonton+hg@team1664.org>
parents:
diff changeset
   603
      }
5b78b8c79d9c Initial commit
Vincent Tondellier <tonton+hg@team1664.org>
parents:
diff changeset
   604
5b78b8c79d9c Initial commit
Vincent Tondellier <tonton+hg@team1664.org>
parents:
diff changeset
   605
  Dropdown.prototype = {
5b78b8c79d9c Initial commit
Vincent Tondellier <tonton+hg@team1664.org>
parents:
diff changeset
   606
5b78b8c79d9c Initial commit
Vincent Tondellier <tonton+hg@team1664.org>
parents:
diff changeset
   607
    constructor: Dropdown
5b78b8c79d9c Initial commit
Vincent Tondellier <tonton+hg@team1664.org>
parents:
diff changeset
   608
5b78b8c79d9c Initial commit
Vincent Tondellier <tonton+hg@team1664.org>
parents:
diff changeset
   609
  , toggle: function (e) {
5b78b8c79d9c Initial commit
Vincent Tondellier <tonton+hg@team1664.org>
parents:
diff changeset
   610
      var $this = $(this)
5b78b8c79d9c Initial commit
Vincent Tondellier <tonton+hg@team1664.org>
parents:
diff changeset
   611
        , $parent
5b78b8c79d9c Initial commit
Vincent Tondellier <tonton+hg@team1664.org>
parents:
diff changeset
   612
        , selector
5b78b8c79d9c Initial commit
Vincent Tondellier <tonton+hg@team1664.org>
parents:
diff changeset
   613
        , isActive
5b78b8c79d9c Initial commit
Vincent Tondellier <tonton+hg@team1664.org>
parents:
diff changeset
   614
5b78b8c79d9c Initial commit
Vincent Tondellier <tonton+hg@team1664.org>
parents:
diff changeset
   615
      if ($this.is('.disabled, :disabled')) return
5b78b8c79d9c Initial commit
Vincent Tondellier <tonton+hg@team1664.org>
parents:
diff changeset
   616
5b78b8c79d9c Initial commit
Vincent Tondellier <tonton+hg@team1664.org>
parents:
diff changeset
   617
      selector = $this.attr('data-target')
5b78b8c79d9c Initial commit
Vincent Tondellier <tonton+hg@team1664.org>
parents:
diff changeset
   618
5b78b8c79d9c Initial commit
Vincent Tondellier <tonton+hg@team1664.org>
parents:
diff changeset
   619
      if (!selector) {
5b78b8c79d9c Initial commit
Vincent Tondellier <tonton+hg@team1664.org>
parents:
diff changeset
   620
        selector = $this.attr('href')
5b78b8c79d9c Initial commit
Vincent Tondellier <tonton+hg@team1664.org>
parents:
diff changeset
   621
        selector = selector && selector.replace(/.*(?=#[^\s]*$)/, '') //strip for ie7
5b78b8c79d9c Initial commit
Vincent Tondellier <tonton+hg@team1664.org>
parents:
diff changeset
   622
      }
5b78b8c79d9c Initial commit
Vincent Tondellier <tonton+hg@team1664.org>
parents:
diff changeset
   623
5b78b8c79d9c Initial commit
Vincent Tondellier <tonton+hg@team1664.org>
parents:
diff changeset
   624
      $parent = $(selector)
5b78b8c79d9c Initial commit
Vincent Tondellier <tonton+hg@team1664.org>
parents:
diff changeset
   625
      $parent.length || ($parent = $this.parent())
5b78b8c79d9c Initial commit
Vincent Tondellier <tonton+hg@team1664.org>
parents:
diff changeset
   626
5b78b8c79d9c Initial commit
Vincent Tondellier <tonton+hg@team1664.org>
parents:
diff changeset
   627
      isActive = $parent.hasClass('open')
5b78b8c79d9c Initial commit
Vincent Tondellier <tonton+hg@team1664.org>
parents:
diff changeset
   628
5b78b8c79d9c Initial commit
Vincent Tondellier <tonton+hg@team1664.org>
parents:
diff changeset
   629
      clearMenus()
5b78b8c79d9c Initial commit
Vincent Tondellier <tonton+hg@team1664.org>
parents:
diff changeset
   630
5b78b8c79d9c Initial commit
Vincent Tondellier <tonton+hg@team1664.org>
parents:
diff changeset
   631
      if (!isActive) $parent.toggleClass('open')
5b78b8c79d9c Initial commit
Vincent Tondellier <tonton+hg@team1664.org>
parents:
diff changeset
   632
5b78b8c79d9c Initial commit
Vincent Tondellier <tonton+hg@team1664.org>
parents:
diff changeset
   633
      return false
5b78b8c79d9c Initial commit
Vincent Tondellier <tonton+hg@team1664.org>
parents:
diff changeset
   634
    }
5b78b8c79d9c Initial commit
Vincent Tondellier <tonton+hg@team1664.org>
parents:
diff changeset
   635
5b78b8c79d9c Initial commit
Vincent Tondellier <tonton+hg@team1664.org>
parents:
diff changeset
   636
  }
5b78b8c79d9c Initial commit
Vincent Tondellier <tonton+hg@team1664.org>
parents:
diff changeset
   637
5b78b8c79d9c Initial commit
Vincent Tondellier <tonton+hg@team1664.org>
parents:
diff changeset
   638
  function clearMenus() {
5b78b8c79d9c Initial commit
Vincent Tondellier <tonton+hg@team1664.org>
parents:
diff changeset
   639
    $(toggle).parent().removeClass('open')
5b78b8c79d9c Initial commit
Vincent Tondellier <tonton+hg@team1664.org>
parents:
diff changeset
   640
  }
5b78b8c79d9c Initial commit
Vincent Tondellier <tonton+hg@team1664.org>
parents:
diff changeset
   641
5b78b8c79d9c Initial commit
Vincent Tondellier <tonton+hg@team1664.org>
parents:
diff changeset
   642
5b78b8c79d9c Initial commit
Vincent Tondellier <tonton+hg@team1664.org>
parents:
diff changeset
   643
  /* DROPDOWN PLUGIN DEFINITION
5b78b8c79d9c Initial commit
Vincent Tondellier <tonton+hg@team1664.org>
parents:
diff changeset
   644
   * ========================== */
5b78b8c79d9c Initial commit
Vincent Tondellier <tonton+hg@team1664.org>
parents:
diff changeset
   645
5b78b8c79d9c Initial commit
Vincent Tondellier <tonton+hg@team1664.org>
parents:
diff changeset
   646
  $.fn.dropdown = function (option) {
5b78b8c79d9c Initial commit
Vincent Tondellier <tonton+hg@team1664.org>
parents:
diff changeset
   647
    return this.each(function () {
5b78b8c79d9c Initial commit
Vincent Tondellier <tonton+hg@team1664.org>
parents:
diff changeset
   648
      var $this = $(this)
5b78b8c79d9c Initial commit
Vincent Tondellier <tonton+hg@team1664.org>
parents:
diff changeset
   649
        , data = $this.data('dropdown')
5b78b8c79d9c Initial commit
Vincent Tondellier <tonton+hg@team1664.org>
parents:
diff changeset
   650
      if (!data) $this.data('dropdown', (data = new Dropdown(this)))
5b78b8c79d9c Initial commit
Vincent Tondellier <tonton+hg@team1664.org>
parents:
diff changeset
   651
      if (typeof option == 'string') data[option].call($this)
5b78b8c79d9c Initial commit
Vincent Tondellier <tonton+hg@team1664.org>
parents:
diff changeset
   652
    })
5b78b8c79d9c Initial commit
Vincent Tondellier <tonton+hg@team1664.org>
parents:
diff changeset
   653
  }
5b78b8c79d9c Initial commit
Vincent Tondellier <tonton+hg@team1664.org>
parents:
diff changeset
   654
5b78b8c79d9c Initial commit
Vincent Tondellier <tonton+hg@team1664.org>
parents:
diff changeset
   655
  $.fn.dropdown.Constructor = Dropdown
5b78b8c79d9c Initial commit
Vincent Tondellier <tonton+hg@team1664.org>
parents:
diff changeset
   656
5b78b8c79d9c Initial commit
Vincent Tondellier <tonton+hg@team1664.org>
parents:
diff changeset
   657
5b78b8c79d9c Initial commit
Vincent Tondellier <tonton+hg@team1664.org>
parents:
diff changeset
   658
  /* APPLY TO STANDARD DROPDOWN ELEMENTS
5b78b8c79d9c Initial commit
Vincent Tondellier <tonton+hg@team1664.org>
parents:
diff changeset
   659
   * =================================== */
5b78b8c79d9c Initial commit
Vincent Tondellier <tonton+hg@team1664.org>
parents:
diff changeset
   660
5b78b8c79d9c Initial commit
Vincent Tondellier <tonton+hg@team1664.org>
parents:
diff changeset
   661
  $(function () {
5b78b8c79d9c Initial commit
Vincent Tondellier <tonton+hg@team1664.org>
parents:
diff changeset
   662
    $('html').on('click.dropdown.data-api', clearMenus)
5b78b8c79d9c Initial commit
Vincent Tondellier <tonton+hg@team1664.org>
parents:
diff changeset
   663
    $('body')
5b78b8c79d9c Initial commit
Vincent Tondellier <tonton+hg@team1664.org>
parents:
diff changeset
   664
      .on('click.dropdown', '.dropdown form', function (e) { e.stopPropagation() })
5b78b8c79d9c Initial commit
Vincent Tondellier <tonton+hg@team1664.org>
parents:
diff changeset
   665
      .on('click.dropdown.data-api', toggle, Dropdown.prototype.toggle)
5b78b8c79d9c Initial commit
Vincent Tondellier <tonton+hg@team1664.org>
parents:
diff changeset
   666
  })
5b78b8c79d9c Initial commit
Vincent Tondellier <tonton+hg@team1664.org>
parents:
diff changeset
   667
5b78b8c79d9c Initial commit
Vincent Tondellier <tonton+hg@team1664.org>
parents:
diff changeset
   668
}(window.jQuery);/* =========================================================
5b78b8c79d9c Initial commit
Vincent Tondellier <tonton+hg@team1664.org>
parents:
diff changeset
   669
 * bootstrap-modal.js v2.0.3
5b78b8c79d9c Initial commit
Vincent Tondellier <tonton+hg@team1664.org>
parents:
diff changeset
   670
 * http://twitter.github.com/bootstrap/javascript.html#modals
5b78b8c79d9c Initial commit
Vincent Tondellier <tonton+hg@team1664.org>
parents:
diff changeset
   671
 * =========================================================
5b78b8c79d9c Initial commit
Vincent Tondellier <tonton+hg@team1664.org>
parents:
diff changeset
   672
 * Copyright 2012 Twitter, Inc.
5b78b8c79d9c Initial commit
Vincent Tondellier <tonton+hg@team1664.org>
parents:
diff changeset
   673
 *
5b78b8c79d9c Initial commit
Vincent Tondellier <tonton+hg@team1664.org>
parents:
diff changeset
   674
 * Licensed under the Apache License, Version 2.0 (the "License");
5b78b8c79d9c Initial commit
Vincent Tondellier <tonton+hg@team1664.org>
parents:
diff changeset
   675
 * you may not use this file except in compliance with the License.
5b78b8c79d9c Initial commit
Vincent Tondellier <tonton+hg@team1664.org>
parents:
diff changeset
   676
 * You may obtain a copy of the License at
5b78b8c79d9c Initial commit
Vincent Tondellier <tonton+hg@team1664.org>
parents:
diff changeset
   677
 *
5b78b8c79d9c Initial commit
Vincent Tondellier <tonton+hg@team1664.org>
parents:
diff changeset
   678
 * http://www.apache.org/licenses/LICENSE-2.0
5b78b8c79d9c Initial commit
Vincent Tondellier <tonton+hg@team1664.org>
parents:
diff changeset
   679
 *
5b78b8c79d9c Initial commit
Vincent Tondellier <tonton+hg@team1664.org>
parents:
diff changeset
   680
 * Unless required by applicable law or agreed to in writing, software
5b78b8c79d9c Initial commit
Vincent Tondellier <tonton+hg@team1664.org>
parents:
diff changeset
   681
 * distributed under the License is distributed on an "AS IS" BASIS,
5b78b8c79d9c Initial commit
Vincent Tondellier <tonton+hg@team1664.org>
parents:
diff changeset
   682
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
5b78b8c79d9c Initial commit
Vincent Tondellier <tonton+hg@team1664.org>
parents:
diff changeset
   683
 * See the License for the specific language governing permissions and
5b78b8c79d9c Initial commit
Vincent Tondellier <tonton+hg@team1664.org>
parents:
diff changeset
   684
 * limitations under the License.
5b78b8c79d9c Initial commit
Vincent Tondellier <tonton+hg@team1664.org>
parents:
diff changeset
   685
 * ========================================================= */
5b78b8c79d9c Initial commit
Vincent Tondellier <tonton+hg@team1664.org>
parents:
diff changeset
   686
5b78b8c79d9c Initial commit
Vincent Tondellier <tonton+hg@team1664.org>
parents:
diff changeset
   687
5b78b8c79d9c Initial commit
Vincent Tondellier <tonton+hg@team1664.org>
parents:
diff changeset
   688
!function ($) {
5b78b8c79d9c Initial commit
Vincent Tondellier <tonton+hg@team1664.org>
parents:
diff changeset
   689
5b78b8c79d9c Initial commit
Vincent Tondellier <tonton+hg@team1664.org>
parents:
diff changeset
   690
  "use strict"; // jshint ;_;
5b78b8c79d9c Initial commit
Vincent Tondellier <tonton+hg@team1664.org>
parents:
diff changeset
   691
5b78b8c79d9c Initial commit
Vincent Tondellier <tonton+hg@team1664.org>
parents:
diff changeset
   692
5b78b8c79d9c Initial commit
Vincent Tondellier <tonton+hg@team1664.org>
parents:
diff changeset
   693
 /* MODAL CLASS DEFINITION
5b78b8c79d9c Initial commit
Vincent Tondellier <tonton+hg@team1664.org>
parents:
diff changeset
   694
  * ====================== */
5b78b8c79d9c Initial commit
Vincent Tondellier <tonton+hg@team1664.org>
parents:
diff changeset
   695
5b78b8c79d9c Initial commit
Vincent Tondellier <tonton+hg@team1664.org>
parents:
diff changeset
   696
  var Modal = function (content, options) {
5b78b8c79d9c Initial commit
Vincent Tondellier <tonton+hg@team1664.org>
parents:
diff changeset
   697
    this.options = options
5b78b8c79d9c Initial commit
Vincent Tondellier <tonton+hg@team1664.org>
parents:
diff changeset
   698
    this.$element = $(content)
5b78b8c79d9c Initial commit
Vincent Tondellier <tonton+hg@team1664.org>
parents:
diff changeset
   699
      .delegate('[data-dismiss="modal"]', 'click.dismiss.modal', $.proxy(this.hide, this))
5b78b8c79d9c Initial commit
Vincent Tondellier <tonton+hg@team1664.org>
parents:
diff changeset
   700
  }
5b78b8c79d9c Initial commit
Vincent Tondellier <tonton+hg@team1664.org>
parents:
diff changeset
   701
5b78b8c79d9c Initial commit
Vincent Tondellier <tonton+hg@team1664.org>
parents:
diff changeset
   702
  Modal.prototype = {
5b78b8c79d9c Initial commit
Vincent Tondellier <tonton+hg@team1664.org>
parents:
diff changeset
   703
5b78b8c79d9c Initial commit
Vincent Tondellier <tonton+hg@team1664.org>
parents:
diff changeset
   704
      constructor: Modal
5b78b8c79d9c Initial commit
Vincent Tondellier <tonton+hg@team1664.org>
parents:
diff changeset
   705
5b78b8c79d9c Initial commit
Vincent Tondellier <tonton+hg@team1664.org>
parents:
diff changeset
   706
    , toggle: function () {
5b78b8c79d9c Initial commit
Vincent Tondellier <tonton+hg@team1664.org>
parents:
diff changeset
   707
        return this[!this.isShown ? 'show' : 'hide']()
5b78b8c79d9c Initial commit
Vincent Tondellier <tonton+hg@team1664.org>
parents:
diff changeset
   708
      }
5b78b8c79d9c Initial commit
Vincent Tondellier <tonton+hg@team1664.org>
parents:
diff changeset
   709
5b78b8c79d9c Initial commit
Vincent Tondellier <tonton+hg@team1664.org>
parents:
diff changeset
   710
    , show: function () {
5b78b8c79d9c Initial commit
Vincent Tondellier <tonton+hg@team1664.org>
parents:
diff changeset
   711
        var that = this
5b78b8c79d9c Initial commit
Vincent Tondellier <tonton+hg@team1664.org>
parents:
diff changeset
   712
          , e = $.Event('show')
5b78b8c79d9c Initial commit
Vincent Tondellier <tonton+hg@team1664.org>
parents:
diff changeset
   713
5b78b8c79d9c Initial commit
Vincent Tondellier <tonton+hg@team1664.org>
parents:
diff changeset
   714
        this.$element.trigger(e)
5b78b8c79d9c Initial commit
Vincent Tondellier <tonton+hg@team1664.org>
parents:
diff changeset
   715
5b78b8c79d9c Initial commit
Vincent Tondellier <tonton+hg@team1664.org>
parents:
diff changeset
   716
        if (this.isShown || e.isDefaultPrevented()) return
5b78b8c79d9c Initial commit
Vincent Tondellier <tonton+hg@team1664.org>
parents:
diff changeset
   717
5b78b8c79d9c Initial commit
Vincent Tondellier <tonton+hg@team1664.org>
parents:
diff changeset
   718
        $('body').addClass('modal-open')
5b78b8c79d9c Initial commit
Vincent Tondellier <tonton+hg@team1664.org>
parents:
diff changeset
   719
5b78b8c79d9c Initial commit
Vincent Tondellier <tonton+hg@team1664.org>
parents:
diff changeset
   720
        this.isShown = true
5b78b8c79d9c Initial commit
Vincent Tondellier <tonton+hg@team1664.org>
parents:
diff changeset
   721
5b78b8c79d9c Initial commit
Vincent Tondellier <tonton+hg@team1664.org>
parents:
diff changeset
   722
        escape.call(this)
5b78b8c79d9c Initial commit
Vincent Tondellier <tonton+hg@team1664.org>
parents:
diff changeset
   723
        backdrop.call(this, function () {
5b78b8c79d9c Initial commit
Vincent Tondellier <tonton+hg@team1664.org>
parents:
diff changeset
   724
          var transition = $.support.transition && that.$element.hasClass('fade')
5b78b8c79d9c Initial commit
Vincent Tondellier <tonton+hg@team1664.org>
parents:
diff changeset
   725
5b78b8c79d9c Initial commit
Vincent Tondellier <tonton+hg@team1664.org>
parents:
diff changeset
   726
          if (!that.$element.parent().length) {
5b78b8c79d9c Initial commit
Vincent Tondellier <tonton+hg@team1664.org>
parents:
diff changeset
   727
            that.$element.appendTo(document.body) //don't move modals dom position
5b78b8c79d9c Initial commit
Vincent Tondellier <tonton+hg@team1664.org>
parents:
diff changeset
   728
          }
5b78b8c79d9c Initial commit
Vincent Tondellier <tonton+hg@team1664.org>
parents:
diff changeset
   729
5b78b8c79d9c Initial commit
Vincent Tondellier <tonton+hg@team1664.org>
parents:
diff changeset
   730
          that.$element
5b78b8c79d9c Initial commit
Vincent Tondellier <tonton+hg@team1664.org>
parents:
diff changeset
   731
            .show()
5b78b8c79d9c Initial commit
Vincent Tondellier <tonton+hg@team1664.org>
parents:
diff changeset
   732
5b78b8c79d9c Initial commit
Vincent Tondellier <tonton+hg@team1664.org>
parents:
diff changeset
   733
          if (transition) {
5b78b8c79d9c Initial commit
Vincent Tondellier <tonton+hg@team1664.org>
parents:
diff changeset
   734
            that.$element[0].offsetWidth // force reflow
5b78b8c79d9c Initial commit
Vincent Tondellier <tonton+hg@team1664.org>
parents:
diff changeset
   735
          }
5b78b8c79d9c Initial commit
Vincent Tondellier <tonton+hg@team1664.org>
parents:
diff changeset
   736
5b78b8c79d9c Initial commit
Vincent Tondellier <tonton+hg@team1664.org>
parents:
diff changeset
   737
          that.$element.addClass('in')
5b78b8c79d9c Initial commit
Vincent Tondellier <tonton+hg@team1664.org>
parents:
diff changeset
   738
5b78b8c79d9c Initial commit
Vincent Tondellier <tonton+hg@team1664.org>
parents:
diff changeset
   739
          transition ?
5b78b8c79d9c Initial commit
Vincent Tondellier <tonton+hg@team1664.org>
parents:
diff changeset
   740
            that.$element.one($.support.transition.end, function () { that.$element.trigger('shown') }) :
5b78b8c79d9c Initial commit
Vincent Tondellier <tonton+hg@team1664.org>
parents:
diff changeset
   741
            that.$element.trigger('shown')
5b78b8c79d9c Initial commit
Vincent Tondellier <tonton+hg@team1664.org>
parents:
diff changeset
   742
5b78b8c79d9c Initial commit
Vincent Tondellier <tonton+hg@team1664.org>
parents:
diff changeset
   743
        })
5b78b8c79d9c Initial commit
Vincent Tondellier <tonton+hg@team1664.org>
parents:
diff changeset
   744
      }
5b78b8c79d9c Initial commit
Vincent Tondellier <tonton+hg@team1664.org>
parents:
diff changeset
   745
5b78b8c79d9c Initial commit
Vincent Tondellier <tonton+hg@team1664.org>
parents:
diff changeset
   746
    , hide: function (e) {
5b78b8c79d9c Initial commit
Vincent Tondellier <tonton+hg@team1664.org>
parents:
diff changeset
   747
        e && e.preventDefault()
5b78b8c79d9c Initial commit
Vincent Tondellier <tonton+hg@team1664.org>
parents:
diff changeset
   748
5b78b8c79d9c Initial commit
Vincent Tondellier <tonton+hg@team1664.org>
parents:
diff changeset
   749
        var that = this
5b78b8c79d9c Initial commit
Vincent Tondellier <tonton+hg@team1664.org>
parents:
diff changeset
   750
5b78b8c79d9c Initial commit
Vincent Tondellier <tonton+hg@team1664.org>
parents:
diff changeset
   751
        e = $.Event('hide')
5b78b8c79d9c Initial commit
Vincent Tondellier <tonton+hg@team1664.org>
parents:
diff changeset
   752
5b78b8c79d9c Initial commit
Vincent Tondellier <tonton+hg@team1664.org>
parents:
diff changeset
   753
        this.$element.trigger(e)
5b78b8c79d9c Initial commit
Vincent Tondellier <tonton+hg@team1664.org>
parents:
diff changeset
   754
5b78b8c79d9c Initial commit
Vincent Tondellier <tonton+hg@team1664.org>
parents:
diff changeset
   755
        if (!this.isShown || e.isDefaultPrevented()) return
5b78b8c79d9c Initial commit
Vincent Tondellier <tonton+hg@team1664.org>
parents:
diff changeset
   756
5b78b8c79d9c Initial commit
Vincent Tondellier <tonton+hg@team1664.org>
parents:
diff changeset
   757
        this.isShown = false
5b78b8c79d9c Initial commit
Vincent Tondellier <tonton+hg@team1664.org>
parents:
diff changeset
   758
5b78b8c79d9c Initial commit
Vincent Tondellier <tonton+hg@team1664.org>
parents:
diff changeset
   759
        $('body').removeClass('modal-open')
5b78b8c79d9c Initial commit
Vincent Tondellier <tonton+hg@team1664.org>
parents:
diff changeset
   760
5b78b8c79d9c Initial commit
Vincent Tondellier <tonton+hg@team1664.org>
parents:
diff changeset
   761
        escape.call(this)
5b78b8c79d9c Initial commit
Vincent Tondellier <tonton+hg@team1664.org>
parents:
diff changeset
   762
5b78b8c79d9c Initial commit
Vincent Tondellier <tonton+hg@team1664.org>
parents:
diff changeset
   763
        this.$element.removeClass('in')
5b78b8c79d9c Initial commit
Vincent Tondellier <tonton+hg@team1664.org>
parents:
diff changeset
   764
5b78b8c79d9c Initial commit
Vincent Tondellier <tonton+hg@team1664.org>
parents:
diff changeset
   765
        $.support.transition && this.$element.hasClass('fade') ?
5b78b8c79d9c Initial commit
Vincent Tondellier <tonton+hg@team1664.org>
parents:
diff changeset
   766
          hideWithTransition.call(this) :
5b78b8c79d9c Initial commit
Vincent Tondellier <tonton+hg@team1664.org>
parents:
diff changeset
   767
          hideModal.call(this)
5b78b8c79d9c Initial commit
Vincent Tondellier <tonton+hg@team1664.org>
parents:
diff changeset
   768
      }
5b78b8c79d9c Initial commit
Vincent Tondellier <tonton+hg@team1664.org>
parents:
diff changeset
   769
5b78b8c79d9c Initial commit
Vincent Tondellier <tonton+hg@team1664.org>
parents:
diff changeset
   770
  }
5b78b8c79d9c Initial commit
Vincent Tondellier <tonton+hg@team1664.org>
parents:
diff changeset
   771
5b78b8c79d9c Initial commit
Vincent Tondellier <tonton+hg@team1664.org>
parents:
diff changeset
   772
5b78b8c79d9c Initial commit
Vincent Tondellier <tonton+hg@team1664.org>
parents:
diff changeset
   773
 /* MODAL PRIVATE METHODS
5b78b8c79d9c Initial commit
Vincent Tondellier <tonton+hg@team1664.org>
parents:
diff changeset
   774
  * ===================== */
5b78b8c79d9c Initial commit
Vincent Tondellier <tonton+hg@team1664.org>
parents:
diff changeset
   775
5b78b8c79d9c Initial commit
Vincent Tondellier <tonton+hg@team1664.org>
parents:
diff changeset
   776
  function hideWithTransition() {
5b78b8c79d9c Initial commit
Vincent Tondellier <tonton+hg@team1664.org>
parents:
diff changeset
   777
    var that = this
5b78b8c79d9c Initial commit
Vincent Tondellier <tonton+hg@team1664.org>
parents:
diff changeset
   778
      , timeout = setTimeout(function () {
5b78b8c79d9c Initial commit
Vincent Tondellier <tonton+hg@team1664.org>
parents:
diff changeset
   779
          that.$element.off($.support.transition.end)
5b78b8c79d9c Initial commit
Vincent Tondellier <tonton+hg@team1664.org>
parents:
diff changeset
   780
          hideModal.call(that)
5b78b8c79d9c Initial commit
Vincent Tondellier <tonton+hg@team1664.org>
parents:
diff changeset
   781
        }, 500)
5b78b8c79d9c Initial commit
Vincent Tondellier <tonton+hg@team1664.org>
parents:
diff changeset
   782
5b78b8c79d9c Initial commit
Vincent Tondellier <tonton+hg@team1664.org>
parents:
diff changeset
   783
    this.$element.one($.support.transition.end, function () {
5b78b8c79d9c Initial commit
Vincent Tondellier <tonton+hg@team1664.org>
parents:
diff changeset
   784
      clearTimeout(timeout)
5b78b8c79d9c Initial commit
Vincent Tondellier <tonton+hg@team1664.org>
parents:
diff changeset
   785
      hideModal.call(that)
5b78b8c79d9c Initial commit
Vincent Tondellier <tonton+hg@team1664.org>
parents:
diff changeset
   786
    })
5b78b8c79d9c Initial commit
Vincent Tondellier <tonton+hg@team1664.org>
parents:
diff changeset
   787
  }
5b78b8c79d9c Initial commit
Vincent Tondellier <tonton+hg@team1664.org>
parents:
diff changeset
   788
5b78b8c79d9c Initial commit
Vincent Tondellier <tonton+hg@team1664.org>
parents:
diff changeset
   789
  function hideModal(that) {
5b78b8c79d9c Initial commit
Vincent Tondellier <tonton+hg@team1664.org>
parents:
diff changeset
   790
    this.$element
5b78b8c79d9c Initial commit
Vincent Tondellier <tonton+hg@team1664.org>
parents:
diff changeset
   791
      .hide()
5b78b8c79d9c Initial commit
Vincent Tondellier <tonton+hg@team1664.org>
parents:
diff changeset
   792
      .trigger('hidden')
5b78b8c79d9c Initial commit
Vincent Tondellier <tonton+hg@team1664.org>
parents:
diff changeset
   793
5b78b8c79d9c Initial commit
Vincent Tondellier <tonton+hg@team1664.org>
parents:
diff changeset
   794
    backdrop.call(this)
5b78b8c79d9c Initial commit
Vincent Tondellier <tonton+hg@team1664.org>
parents:
diff changeset
   795
  }
5b78b8c79d9c Initial commit
Vincent Tondellier <tonton+hg@team1664.org>
parents:
diff changeset
   796
5b78b8c79d9c Initial commit
Vincent Tondellier <tonton+hg@team1664.org>
parents:
diff changeset
   797
  function backdrop(callback) {
5b78b8c79d9c Initial commit
Vincent Tondellier <tonton+hg@team1664.org>
parents:
diff changeset
   798
    var that = this
5b78b8c79d9c Initial commit
Vincent Tondellier <tonton+hg@team1664.org>
parents:
diff changeset
   799
      , animate = this.$element.hasClass('fade') ? 'fade' : ''
5b78b8c79d9c Initial commit
Vincent Tondellier <tonton+hg@team1664.org>
parents:
diff changeset
   800
5b78b8c79d9c Initial commit
Vincent Tondellier <tonton+hg@team1664.org>
parents:
diff changeset
   801
    if (this.isShown && this.options.backdrop) {
5b78b8c79d9c Initial commit
Vincent Tondellier <tonton+hg@team1664.org>
parents:
diff changeset
   802
      var doAnimate = $.support.transition && animate
5b78b8c79d9c Initial commit
Vincent Tondellier <tonton+hg@team1664.org>
parents:
diff changeset
   803
5b78b8c79d9c Initial commit
Vincent Tondellier <tonton+hg@team1664.org>
parents:
diff changeset
   804
      this.$backdrop = $('<div class="modal-backdrop ' + animate + '" />')
5b78b8c79d9c Initial commit
Vincent Tondellier <tonton+hg@team1664.org>
parents:
diff changeset
   805
        .appendTo(document.body)
5b78b8c79d9c Initial commit
Vincent Tondellier <tonton+hg@team1664.org>
parents:
diff changeset
   806
5b78b8c79d9c Initial commit
Vincent Tondellier <tonton+hg@team1664.org>
parents:
diff changeset
   807
      if (this.options.backdrop != 'static') {
5b78b8c79d9c Initial commit
Vincent Tondellier <tonton+hg@team1664.org>
parents:
diff changeset
   808
        this.$backdrop.click($.proxy(this.hide, this))
5b78b8c79d9c Initial commit
Vincent Tondellier <tonton+hg@team1664.org>
parents:
diff changeset
   809
      }
5b78b8c79d9c Initial commit
Vincent Tondellier <tonton+hg@team1664.org>
parents:
diff changeset
   810
5b78b8c79d9c Initial commit
Vincent Tondellier <tonton+hg@team1664.org>
parents:
diff changeset
   811
      if (doAnimate) this.$backdrop[0].offsetWidth // force reflow
5b78b8c79d9c Initial commit
Vincent Tondellier <tonton+hg@team1664.org>
parents:
diff changeset
   812
5b78b8c79d9c Initial commit
Vincent Tondellier <tonton+hg@team1664.org>
parents:
diff changeset
   813
      this.$backdrop.addClass('in')
5b78b8c79d9c Initial commit
Vincent Tondellier <tonton+hg@team1664.org>
parents:
diff changeset
   814
5b78b8c79d9c Initial commit
Vincent Tondellier <tonton+hg@team1664.org>
parents:
diff changeset
   815
      doAnimate ?
5b78b8c79d9c Initial commit
Vincent Tondellier <tonton+hg@team1664.org>
parents:
diff changeset
   816
        this.$backdrop.one($.support.transition.end, callback) :
5b78b8c79d9c Initial commit
Vincent Tondellier <tonton+hg@team1664.org>
parents:
diff changeset
   817
        callback()
5b78b8c79d9c Initial commit
Vincent Tondellier <tonton+hg@team1664.org>
parents:
diff changeset
   818
5b78b8c79d9c Initial commit
Vincent Tondellier <tonton+hg@team1664.org>
parents:
diff changeset
   819
    } else if (!this.isShown && this.$backdrop) {
5b78b8c79d9c Initial commit
Vincent Tondellier <tonton+hg@team1664.org>
parents:
diff changeset
   820
      this.$backdrop.removeClass('in')
5b78b8c79d9c Initial commit
Vincent Tondellier <tonton+hg@team1664.org>
parents:
diff changeset
   821
5b78b8c79d9c Initial commit
Vincent Tondellier <tonton+hg@team1664.org>
parents:
diff changeset
   822
      $.support.transition && this.$element.hasClass('fade')?
5b78b8c79d9c Initial commit
Vincent Tondellier <tonton+hg@team1664.org>
parents:
diff changeset
   823
        this.$backdrop.one($.support.transition.end, $.proxy(removeBackdrop, this)) :
5b78b8c79d9c Initial commit
Vincent Tondellier <tonton+hg@team1664.org>
parents:
diff changeset
   824
        removeBackdrop.call(this)
5b78b8c79d9c Initial commit
Vincent Tondellier <tonton+hg@team1664.org>
parents:
diff changeset
   825
5b78b8c79d9c Initial commit
Vincent Tondellier <tonton+hg@team1664.org>
parents:
diff changeset
   826
    } else if (callback) {
5b78b8c79d9c Initial commit
Vincent Tondellier <tonton+hg@team1664.org>
parents:
diff changeset
   827
      callback()
5b78b8c79d9c Initial commit
Vincent Tondellier <tonton+hg@team1664.org>
parents:
diff changeset
   828
    }
5b78b8c79d9c Initial commit
Vincent Tondellier <tonton+hg@team1664.org>
parents:
diff changeset
   829
  }
5b78b8c79d9c Initial commit
Vincent Tondellier <tonton+hg@team1664.org>
parents:
diff changeset
   830
5b78b8c79d9c Initial commit
Vincent Tondellier <tonton+hg@team1664.org>
parents:
diff changeset
   831
  function removeBackdrop() {
5b78b8c79d9c Initial commit
Vincent Tondellier <tonton+hg@team1664.org>
parents:
diff changeset
   832
    this.$backdrop.remove()
5b78b8c79d9c Initial commit
Vincent Tondellier <tonton+hg@team1664.org>
parents:
diff changeset
   833
    this.$backdrop = null
5b78b8c79d9c Initial commit
Vincent Tondellier <tonton+hg@team1664.org>
parents:
diff changeset
   834
  }
5b78b8c79d9c Initial commit
Vincent Tondellier <tonton+hg@team1664.org>
parents:
diff changeset
   835
5b78b8c79d9c Initial commit
Vincent Tondellier <tonton+hg@team1664.org>
parents:
diff changeset
   836
  function escape() {
5b78b8c79d9c Initial commit
Vincent Tondellier <tonton+hg@team1664.org>
parents:
diff changeset
   837
    var that = this
5b78b8c79d9c Initial commit
Vincent Tondellier <tonton+hg@team1664.org>
parents:
diff changeset
   838
    if (this.isShown && this.options.keyboard) {
5b78b8c79d9c Initial commit
Vincent Tondellier <tonton+hg@team1664.org>
parents:
diff changeset
   839
      $(document).on('keyup.dismiss.modal', function ( e ) {
5b78b8c79d9c Initial commit
Vincent Tondellier <tonton+hg@team1664.org>
parents:
diff changeset
   840
        e.which == 27 && that.hide()
5b78b8c79d9c Initial commit
Vincent Tondellier <tonton+hg@team1664.org>
parents:
diff changeset
   841
      })
5b78b8c79d9c Initial commit
Vincent Tondellier <tonton+hg@team1664.org>
parents:
diff changeset
   842
    } else if (!this.isShown) {
5b78b8c79d9c Initial commit
Vincent Tondellier <tonton+hg@team1664.org>
parents:
diff changeset
   843
      $(document).off('keyup.dismiss.modal')
5b78b8c79d9c Initial commit
Vincent Tondellier <tonton+hg@team1664.org>
parents:
diff changeset
   844
    }
5b78b8c79d9c Initial commit
Vincent Tondellier <tonton+hg@team1664.org>
parents:
diff changeset
   845
  }
5b78b8c79d9c Initial commit
Vincent Tondellier <tonton+hg@team1664.org>
parents:
diff changeset
   846
5b78b8c79d9c Initial commit
Vincent Tondellier <tonton+hg@team1664.org>
parents:
diff changeset
   847
5b78b8c79d9c Initial commit
Vincent Tondellier <tonton+hg@team1664.org>
parents:
diff changeset
   848
 /* MODAL PLUGIN DEFINITION
5b78b8c79d9c Initial commit
Vincent Tondellier <tonton+hg@team1664.org>
parents:
diff changeset
   849
  * ======================= */
5b78b8c79d9c Initial commit
Vincent Tondellier <tonton+hg@team1664.org>
parents:
diff changeset
   850
5b78b8c79d9c Initial commit
Vincent Tondellier <tonton+hg@team1664.org>
parents:
diff changeset
   851
  $.fn.modal = function (option) {
5b78b8c79d9c Initial commit
Vincent Tondellier <tonton+hg@team1664.org>
parents:
diff changeset
   852
    return this.each(function () {
5b78b8c79d9c Initial commit
Vincent Tondellier <tonton+hg@team1664.org>
parents:
diff changeset
   853
      var $this = $(this)
5b78b8c79d9c Initial commit
Vincent Tondellier <tonton+hg@team1664.org>
parents:
diff changeset
   854
        , data = $this.data('modal')
5b78b8c79d9c Initial commit
Vincent Tondellier <tonton+hg@team1664.org>
parents:
diff changeset
   855
        , options = $.extend({}, $.fn.modal.defaults, $this.data(), typeof option == 'object' && option)
5b78b8c79d9c Initial commit
Vincent Tondellier <tonton+hg@team1664.org>
parents:
diff changeset
   856
      if (!data) $this.data('modal', (data = new Modal(this, options)))
5b78b8c79d9c Initial commit
Vincent Tondellier <tonton+hg@team1664.org>
parents:
diff changeset
   857
      if (typeof option == 'string') data[option]()
5b78b8c79d9c Initial commit
Vincent Tondellier <tonton+hg@team1664.org>
parents:
diff changeset
   858
      else if (options.show) data.show()
5b78b8c79d9c Initial commit
Vincent Tondellier <tonton+hg@team1664.org>
parents:
diff changeset
   859
    })
5b78b8c79d9c Initial commit
Vincent Tondellier <tonton+hg@team1664.org>
parents:
diff changeset
   860
  }
5b78b8c79d9c Initial commit
Vincent Tondellier <tonton+hg@team1664.org>
parents:
diff changeset
   861
5b78b8c79d9c Initial commit
Vincent Tondellier <tonton+hg@team1664.org>
parents:
diff changeset
   862
  $.fn.modal.defaults = {
5b78b8c79d9c Initial commit
Vincent Tondellier <tonton+hg@team1664.org>
parents:
diff changeset
   863
      backdrop: true
5b78b8c79d9c Initial commit
Vincent Tondellier <tonton+hg@team1664.org>
parents:
diff changeset
   864
    , keyboard: true
5b78b8c79d9c Initial commit
Vincent Tondellier <tonton+hg@team1664.org>
parents:
diff changeset
   865
    , show: true
5b78b8c79d9c Initial commit
Vincent Tondellier <tonton+hg@team1664.org>
parents:
diff changeset
   866
  }
5b78b8c79d9c Initial commit
Vincent Tondellier <tonton+hg@team1664.org>
parents:
diff changeset
   867
5b78b8c79d9c Initial commit
Vincent Tondellier <tonton+hg@team1664.org>
parents:
diff changeset
   868
  $.fn.modal.Constructor = Modal
5b78b8c79d9c Initial commit
Vincent Tondellier <tonton+hg@team1664.org>
parents:
diff changeset
   869
5b78b8c79d9c Initial commit
Vincent Tondellier <tonton+hg@team1664.org>
parents:
diff changeset
   870
5b78b8c79d9c Initial commit
Vincent Tondellier <tonton+hg@team1664.org>
parents:
diff changeset
   871
 /* MODAL DATA-API
5b78b8c79d9c Initial commit
Vincent Tondellier <tonton+hg@team1664.org>
parents:
diff changeset
   872
  * ============== */
5b78b8c79d9c Initial commit
Vincent Tondellier <tonton+hg@team1664.org>
parents:
diff changeset
   873
5b78b8c79d9c Initial commit
Vincent Tondellier <tonton+hg@team1664.org>
parents:
diff changeset
   874
  $(function () {
5b78b8c79d9c Initial commit
Vincent Tondellier <tonton+hg@team1664.org>
parents:
diff changeset
   875
    $('body').on('click.modal.data-api', '[data-toggle="modal"]', function ( e ) {
5b78b8c79d9c Initial commit
Vincent Tondellier <tonton+hg@team1664.org>
parents:
diff changeset
   876
      var $this = $(this), href
5b78b8c79d9c Initial commit
Vincent Tondellier <tonton+hg@team1664.org>
parents:
diff changeset
   877
        , $target = $($this.attr('data-target') || (href = $this.attr('href')) && href.replace(/.*(?=#[^\s]+$)/, '')) //strip for ie7
5b78b8c79d9c Initial commit
Vincent Tondellier <tonton+hg@team1664.org>
parents:
diff changeset
   878
        , option = $target.data('modal') ? 'toggle' : $.extend({}, $target.data(), $this.data())
5b78b8c79d9c Initial commit
Vincent Tondellier <tonton+hg@team1664.org>
parents:
diff changeset
   879
5b78b8c79d9c Initial commit
Vincent Tondellier <tonton+hg@team1664.org>
parents:
diff changeset
   880
      e.preventDefault()
5b78b8c79d9c Initial commit
Vincent Tondellier <tonton+hg@team1664.org>
parents:
diff changeset
   881
      $target.modal(option)
5b78b8c79d9c Initial commit
Vincent Tondellier <tonton+hg@team1664.org>
parents:
diff changeset
   882
    })
5b78b8c79d9c Initial commit
Vincent Tondellier <tonton+hg@team1664.org>
parents:
diff changeset
   883
  })
5b78b8c79d9c Initial commit
Vincent Tondellier <tonton+hg@team1664.org>
parents:
diff changeset
   884
5b78b8c79d9c Initial commit
Vincent Tondellier <tonton+hg@team1664.org>
parents:
diff changeset
   885
}(window.jQuery);/* ===========================================================
5b78b8c79d9c Initial commit
Vincent Tondellier <tonton+hg@team1664.org>
parents:
diff changeset
   886
 * bootstrap-tooltip.js v2.0.3
5b78b8c79d9c Initial commit
Vincent Tondellier <tonton+hg@team1664.org>
parents:
diff changeset
   887
 * http://twitter.github.com/bootstrap/javascript.html#tooltips
5b78b8c79d9c Initial commit
Vincent Tondellier <tonton+hg@team1664.org>
parents:
diff changeset
   888
 * Inspired by the original jQuery.tipsy by Jason Frame
5b78b8c79d9c Initial commit
Vincent Tondellier <tonton+hg@team1664.org>
parents:
diff changeset
   889
 * ===========================================================
5b78b8c79d9c Initial commit
Vincent Tondellier <tonton+hg@team1664.org>
parents:
diff changeset
   890
 * Copyright 2012 Twitter, Inc.
5b78b8c79d9c Initial commit
Vincent Tondellier <tonton+hg@team1664.org>
parents:
diff changeset
   891
 *
5b78b8c79d9c Initial commit
Vincent Tondellier <tonton+hg@team1664.org>
parents:
diff changeset
   892
 * Licensed under the Apache License, Version 2.0 (the "License");
5b78b8c79d9c Initial commit
Vincent Tondellier <tonton+hg@team1664.org>
parents:
diff changeset
   893
 * you may not use this file except in compliance with the License.
5b78b8c79d9c Initial commit
Vincent Tondellier <tonton+hg@team1664.org>
parents:
diff changeset
   894
 * You may obtain a copy of the License at
5b78b8c79d9c Initial commit
Vincent Tondellier <tonton+hg@team1664.org>
parents:
diff changeset
   895
 *
5b78b8c79d9c Initial commit
Vincent Tondellier <tonton+hg@team1664.org>
parents:
diff changeset
   896
 * http://www.apache.org/licenses/LICENSE-2.0
5b78b8c79d9c Initial commit
Vincent Tondellier <tonton+hg@team1664.org>
parents:
diff changeset
   897
 *
5b78b8c79d9c Initial commit
Vincent Tondellier <tonton+hg@team1664.org>
parents:
diff changeset
   898
 * Unless required by applicable law or agreed to in writing, software
5b78b8c79d9c Initial commit
Vincent Tondellier <tonton+hg@team1664.org>
parents:
diff changeset
   899
 * distributed under the License is distributed on an "AS IS" BASIS,
5b78b8c79d9c Initial commit
Vincent Tondellier <tonton+hg@team1664.org>
parents:
diff changeset
   900
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
5b78b8c79d9c Initial commit
Vincent Tondellier <tonton+hg@team1664.org>
parents:
diff changeset
   901
 * See the License for the specific language governing permissions and
5b78b8c79d9c Initial commit
Vincent Tondellier <tonton+hg@team1664.org>
parents:
diff changeset
   902
 * limitations under the License.
5b78b8c79d9c Initial commit
Vincent Tondellier <tonton+hg@team1664.org>
parents:
diff changeset
   903
 * ========================================================== */
5b78b8c79d9c Initial commit
Vincent Tondellier <tonton+hg@team1664.org>
parents:
diff changeset
   904
5b78b8c79d9c Initial commit
Vincent Tondellier <tonton+hg@team1664.org>
parents:
diff changeset
   905
5b78b8c79d9c Initial commit
Vincent Tondellier <tonton+hg@team1664.org>
parents:
diff changeset
   906
!function ($) {
5b78b8c79d9c Initial commit
Vincent Tondellier <tonton+hg@team1664.org>
parents:
diff changeset
   907
5b78b8c79d9c Initial commit
Vincent Tondellier <tonton+hg@team1664.org>
parents:
diff changeset
   908
  "use strict"; // jshint ;_;
5b78b8c79d9c Initial commit
Vincent Tondellier <tonton+hg@team1664.org>
parents:
diff changeset
   909
5b78b8c79d9c Initial commit
Vincent Tondellier <tonton+hg@team1664.org>
parents:
diff changeset
   910
5b78b8c79d9c Initial commit
Vincent Tondellier <tonton+hg@team1664.org>
parents:
diff changeset
   911
 /* TOOLTIP PUBLIC CLASS DEFINITION
5b78b8c79d9c Initial commit
Vincent Tondellier <tonton+hg@team1664.org>
parents:
diff changeset
   912
  * =============================== */
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
  var Tooltip = function (element, options) {
5b78b8c79d9c Initial commit
Vincent Tondellier <tonton+hg@team1664.org>
parents:
diff changeset
   915
    this.init('tooltip', element, options)
5b78b8c79d9c Initial commit
Vincent Tondellier <tonton+hg@team1664.org>
parents:
diff changeset
   916
  }
5b78b8c79d9c Initial commit
Vincent Tondellier <tonton+hg@team1664.org>
parents:
diff changeset
   917
5b78b8c79d9c Initial commit
Vincent Tondellier <tonton+hg@team1664.org>
parents:
diff changeset
   918
  Tooltip.prototype = {
5b78b8c79d9c Initial commit
Vincent Tondellier <tonton+hg@team1664.org>
parents:
diff changeset
   919
5b78b8c79d9c Initial commit
Vincent Tondellier <tonton+hg@team1664.org>
parents:
diff changeset
   920
    constructor: Tooltip
5b78b8c79d9c Initial commit
Vincent Tondellier <tonton+hg@team1664.org>
parents:
diff changeset
   921
5b78b8c79d9c Initial commit
Vincent Tondellier <tonton+hg@team1664.org>
parents:
diff changeset
   922
  , init: function (type, element, options) {
5b78b8c79d9c Initial commit
Vincent Tondellier <tonton+hg@team1664.org>
parents:
diff changeset
   923
      var eventIn
5b78b8c79d9c Initial commit
Vincent Tondellier <tonton+hg@team1664.org>
parents:
diff changeset
   924
        , eventOut
5b78b8c79d9c Initial commit
Vincent Tondellier <tonton+hg@team1664.org>
parents:
diff changeset
   925
5b78b8c79d9c Initial commit
Vincent Tondellier <tonton+hg@team1664.org>
parents:
diff changeset
   926
      this.type = type
5b78b8c79d9c Initial commit
Vincent Tondellier <tonton+hg@team1664.org>
parents:
diff changeset
   927
      this.$element = $(element)
5b78b8c79d9c Initial commit
Vincent Tondellier <tonton+hg@team1664.org>
parents:
diff changeset
   928
      this.options = this.getOptions(options)
5b78b8c79d9c Initial commit
Vincent Tondellier <tonton+hg@team1664.org>
parents:
diff changeset
   929
      this.enabled = true
5b78b8c79d9c Initial commit
Vincent Tondellier <tonton+hg@team1664.org>
parents:
diff changeset
   930
5b78b8c79d9c Initial commit
Vincent Tondellier <tonton+hg@team1664.org>
parents:
diff changeset
   931
      if (this.options.trigger != 'manual') {
5b78b8c79d9c Initial commit
Vincent Tondellier <tonton+hg@team1664.org>
parents:
diff changeset
   932
        eventIn  = this.options.trigger == 'hover' ? 'mouseenter' : 'focus'
5b78b8c79d9c Initial commit
Vincent Tondellier <tonton+hg@team1664.org>
parents:
diff changeset
   933
        eventOut = this.options.trigger == 'hover' ? 'mouseleave' : 'blur'
5b78b8c79d9c Initial commit
Vincent Tondellier <tonton+hg@team1664.org>
parents:
diff changeset
   934
        this.$element.on(eventIn, this.options.selector, $.proxy(this.enter, this))
5b78b8c79d9c Initial commit
Vincent Tondellier <tonton+hg@team1664.org>
parents:
diff changeset
   935
        this.$element.on(eventOut, this.options.selector, $.proxy(this.leave, this))
5b78b8c79d9c Initial commit
Vincent Tondellier <tonton+hg@team1664.org>
parents:
diff changeset
   936
      }
5b78b8c79d9c Initial commit
Vincent Tondellier <tonton+hg@team1664.org>
parents:
diff changeset
   937
5b78b8c79d9c Initial commit
Vincent Tondellier <tonton+hg@team1664.org>
parents:
diff changeset
   938
      this.options.selector ?
5b78b8c79d9c Initial commit
Vincent Tondellier <tonton+hg@team1664.org>
parents:
diff changeset
   939
        (this._options = $.extend({}, this.options, { trigger: 'manual', selector: '' })) :
5b78b8c79d9c Initial commit
Vincent Tondellier <tonton+hg@team1664.org>
parents:
diff changeset
   940
        this.fixTitle()
5b78b8c79d9c Initial commit
Vincent Tondellier <tonton+hg@team1664.org>
parents:
diff changeset
   941
    }
5b78b8c79d9c Initial commit
Vincent Tondellier <tonton+hg@team1664.org>
parents:
diff changeset
   942
5b78b8c79d9c Initial commit
Vincent Tondellier <tonton+hg@team1664.org>
parents:
diff changeset
   943
  , getOptions: function (options) {
5b78b8c79d9c Initial commit
Vincent Tondellier <tonton+hg@team1664.org>
parents:
diff changeset
   944
      options = $.extend({}, $.fn[this.type].defaults, options, this.$element.data())
5b78b8c79d9c Initial commit
Vincent Tondellier <tonton+hg@team1664.org>
parents:
diff changeset
   945
5b78b8c79d9c Initial commit
Vincent Tondellier <tonton+hg@team1664.org>
parents:
diff changeset
   946
      if (options.delay && typeof options.delay == 'number') {
5b78b8c79d9c Initial commit
Vincent Tondellier <tonton+hg@team1664.org>
parents:
diff changeset
   947
        options.delay = {
5b78b8c79d9c Initial commit
Vincent Tondellier <tonton+hg@team1664.org>
parents:
diff changeset
   948
          show: options.delay
5b78b8c79d9c Initial commit
Vincent Tondellier <tonton+hg@team1664.org>
parents:
diff changeset
   949
        , hide: options.delay
5b78b8c79d9c Initial commit
Vincent Tondellier <tonton+hg@team1664.org>
parents:
diff changeset
   950
        }
5b78b8c79d9c Initial commit
Vincent Tondellier <tonton+hg@team1664.org>
parents:
diff changeset
   951
      }
5b78b8c79d9c Initial commit
Vincent Tondellier <tonton+hg@team1664.org>
parents:
diff changeset
   952
5b78b8c79d9c Initial commit
Vincent Tondellier <tonton+hg@team1664.org>
parents:
diff changeset
   953
      return options
5b78b8c79d9c Initial commit
Vincent Tondellier <tonton+hg@team1664.org>
parents:
diff changeset
   954
    }
5b78b8c79d9c Initial commit
Vincent Tondellier <tonton+hg@team1664.org>
parents:
diff changeset
   955
5b78b8c79d9c Initial commit
Vincent Tondellier <tonton+hg@team1664.org>
parents:
diff changeset
   956
  , enter: function (e) {
5b78b8c79d9c Initial commit
Vincent Tondellier <tonton+hg@team1664.org>
parents:
diff changeset
   957
      var self = $(e.currentTarget)[this.type](this._options).data(this.type)
5b78b8c79d9c Initial commit
Vincent Tondellier <tonton+hg@team1664.org>
parents:
diff changeset
   958
5b78b8c79d9c Initial commit
Vincent Tondellier <tonton+hg@team1664.org>
parents:
diff changeset
   959
      if (!self.options.delay || !self.options.delay.show) return self.show()
5b78b8c79d9c Initial commit
Vincent Tondellier <tonton+hg@team1664.org>
parents:
diff changeset
   960
5b78b8c79d9c Initial commit
Vincent Tondellier <tonton+hg@team1664.org>
parents:
diff changeset
   961
      clearTimeout(this.timeout)
5b78b8c79d9c Initial commit
Vincent Tondellier <tonton+hg@team1664.org>
parents:
diff changeset
   962
      self.hoverState = 'in'
5b78b8c79d9c Initial commit
Vincent Tondellier <tonton+hg@team1664.org>
parents:
diff changeset
   963
      this.timeout = setTimeout(function() {
5b78b8c79d9c Initial commit
Vincent Tondellier <tonton+hg@team1664.org>
parents:
diff changeset
   964
        if (self.hoverState == 'in') self.show()
5b78b8c79d9c Initial commit
Vincent Tondellier <tonton+hg@team1664.org>
parents:
diff changeset
   965
      }, self.options.delay.show)
5b78b8c79d9c Initial commit
Vincent Tondellier <tonton+hg@team1664.org>
parents:
diff changeset
   966
    }
5b78b8c79d9c Initial commit
Vincent Tondellier <tonton+hg@team1664.org>
parents:
diff changeset
   967
5b78b8c79d9c Initial commit
Vincent Tondellier <tonton+hg@team1664.org>
parents:
diff changeset
   968
  , leave: function (e) {
5b78b8c79d9c Initial commit
Vincent Tondellier <tonton+hg@team1664.org>
parents:
diff changeset
   969
      var self = $(e.currentTarget)[this.type](this._options).data(this.type)
5b78b8c79d9c Initial commit
Vincent Tondellier <tonton+hg@team1664.org>
parents:
diff changeset
   970
5b78b8c79d9c Initial commit
Vincent Tondellier <tonton+hg@team1664.org>
parents:
diff changeset
   971
      if (!self.options.delay || !self.options.delay.hide) return self.hide()
5b78b8c79d9c Initial commit
Vincent Tondellier <tonton+hg@team1664.org>
parents:
diff changeset
   972
5b78b8c79d9c Initial commit
Vincent Tondellier <tonton+hg@team1664.org>
parents:
diff changeset
   973
      clearTimeout(this.timeout)
5b78b8c79d9c Initial commit
Vincent Tondellier <tonton+hg@team1664.org>
parents:
diff changeset
   974
      self.hoverState = 'out'
5b78b8c79d9c Initial commit
Vincent Tondellier <tonton+hg@team1664.org>
parents:
diff changeset
   975
      this.timeout = setTimeout(function() {
5b78b8c79d9c Initial commit
Vincent Tondellier <tonton+hg@team1664.org>
parents:
diff changeset
   976
        if (self.hoverState == 'out') self.hide()
5b78b8c79d9c Initial commit
Vincent Tondellier <tonton+hg@team1664.org>
parents:
diff changeset
   977
      }, self.options.delay.hide)
5b78b8c79d9c Initial commit
Vincent Tondellier <tonton+hg@team1664.org>
parents:
diff changeset
   978
    }
5b78b8c79d9c Initial commit
Vincent Tondellier <tonton+hg@team1664.org>
parents:
diff changeset
   979
5b78b8c79d9c Initial commit
Vincent Tondellier <tonton+hg@team1664.org>
parents:
diff changeset
   980
  , show: function () {
5b78b8c79d9c Initial commit
Vincent Tondellier <tonton+hg@team1664.org>
parents:
diff changeset
   981
      var $tip
5b78b8c79d9c Initial commit
Vincent Tondellier <tonton+hg@team1664.org>
parents:
diff changeset
   982
        , inside
5b78b8c79d9c Initial commit
Vincent Tondellier <tonton+hg@team1664.org>
parents:
diff changeset
   983
        , pos
5b78b8c79d9c Initial commit
Vincent Tondellier <tonton+hg@team1664.org>
parents:
diff changeset
   984
        , actualWidth
5b78b8c79d9c Initial commit
Vincent Tondellier <tonton+hg@team1664.org>
parents:
diff changeset
   985
        , actualHeight
5b78b8c79d9c Initial commit
Vincent Tondellier <tonton+hg@team1664.org>
parents:
diff changeset
   986
        , placement
5b78b8c79d9c Initial commit
Vincent Tondellier <tonton+hg@team1664.org>
parents:
diff changeset
   987
        , tp
5b78b8c79d9c Initial commit
Vincent Tondellier <tonton+hg@team1664.org>
parents:
diff changeset
   988
5b78b8c79d9c Initial commit
Vincent Tondellier <tonton+hg@team1664.org>
parents:
diff changeset
   989
      if (this.hasContent() && this.enabled) {
5b78b8c79d9c Initial commit
Vincent Tondellier <tonton+hg@team1664.org>
parents:
diff changeset
   990
        $tip = this.tip()
5b78b8c79d9c Initial commit
Vincent Tondellier <tonton+hg@team1664.org>
parents:
diff changeset
   991
        this.setContent()
5b78b8c79d9c Initial commit
Vincent Tondellier <tonton+hg@team1664.org>
parents:
diff changeset
   992
5b78b8c79d9c Initial commit
Vincent Tondellier <tonton+hg@team1664.org>
parents:
diff changeset
   993
        if (this.options.animation) {
5b78b8c79d9c Initial commit
Vincent Tondellier <tonton+hg@team1664.org>
parents:
diff changeset
   994
          $tip.addClass('fade')
5b78b8c79d9c Initial commit
Vincent Tondellier <tonton+hg@team1664.org>
parents:
diff changeset
   995
        }
5b78b8c79d9c Initial commit
Vincent Tondellier <tonton+hg@team1664.org>
parents:
diff changeset
   996
5b78b8c79d9c Initial commit
Vincent Tondellier <tonton+hg@team1664.org>
parents:
diff changeset
   997
        placement = typeof this.options.placement == 'function' ?
5b78b8c79d9c Initial commit
Vincent Tondellier <tonton+hg@team1664.org>
parents:
diff changeset
   998
          this.options.placement.call(this, $tip[0], this.$element[0]) :
5b78b8c79d9c Initial commit
Vincent Tondellier <tonton+hg@team1664.org>
parents:
diff changeset
   999
          this.options.placement
5b78b8c79d9c Initial commit
Vincent Tondellier <tonton+hg@team1664.org>
parents:
diff changeset
  1000
5b78b8c79d9c Initial commit
Vincent Tondellier <tonton+hg@team1664.org>
parents:
diff changeset
  1001
        inside = /in/.test(placement)
5b78b8c79d9c Initial commit
Vincent Tondellier <tonton+hg@team1664.org>
parents:
diff changeset
  1002
5b78b8c79d9c Initial commit
Vincent Tondellier <tonton+hg@team1664.org>
parents:
diff changeset
  1003
        $tip
5b78b8c79d9c Initial commit
Vincent Tondellier <tonton+hg@team1664.org>
parents:
diff changeset
  1004
          .remove()
5b78b8c79d9c Initial commit
Vincent Tondellier <tonton+hg@team1664.org>
parents:
diff changeset
  1005
          .css({ top: 0, left: 0, display: 'block' })
5b78b8c79d9c Initial commit
Vincent Tondellier <tonton+hg@team1664.org>
parents:
diff changeset
  1006
          .appendTo(inside ? this.$element : document.body)
5b78b8c79d9c Initial commit
Vincent Tondellier <tonton+hg@team1664.org>
parents:
diff changeset
  1007
5b78b8c79d9c Initial commit
Vincent Tondellier <tonton+hg@team1664.org>
parents:
diff changeset
  1008
        pos = this.getPosition(inside)
5b78b8c79d9c Initial commit
Vincent Tondellier <tonton+hg@team1664.org>
parents:
diff changeset
  1009
5b78b8c79d9c Initial commit
Vincent Tondellier <tonton+hg@team1664.org>
parents:
diff changeset
  1010
        actualWidth = $tip[0].offsetWidth
5b78b8c79d9c Initial commit
Vincent Tondellier <tonton+hg@team1664.org>
parents:
diff changeset
  1011
        actualHeight = $tip[0].offsetHeight
5b78b8c79d9c Initial commit
Vincent Tondellier <tonton+hg@team1664.org>
parents:
diff changeset
  1012
5b78b8c79d9c Initial commit
Vincent Tondellier <tonton+hg@team1664.org>
parents:
diff changeset
  1013
        switch (inside ? placement.split(' ')[1] : placement) {
5b78b8c79d9c Initial commit
Vincent Tondellier <tonton+hg@team1664.org>
parents:
diff changeset
  1014
          case 'bottom':
5b78b8c79d9c Initial commit
Vincent Tondellier <tonton+hg@team1664.org>
parents:
diff changeset
  1015
            tp = {top: pos.top + pos.height, left: pos.left + pos.width / 2 - actualWidth / 2}
5b78b8c79d9c Initial commit
Vincent Tondellier <tonton+hg@team1664.org>
parents:
diff changeset
  1016
            break
5b78b8c79d9c Initial commit
Vincent Tondellier <tonton+hg@team1664.org>
parents:
diff changeset
  1017
          case 'top':
5b78b8c79d9c Initial commit
Vincent Tondellier <tonton+hg@team1664.org>
parents:
diff changeset
  1018
            tp = {top: pos.top - actualHeight, left: pos.left + pos.width / 2 - actualWidth / 2}
5b78b8c79d9c Initial commit
Vincent Tondellier <tonton+hg@team1664.org>
parents:
diff changeset
  1019
            break
5b78b8c79d9c Initial commit
Vincent Tondellier <tonton+hg@team1664.org>
parents:
diff changeset
  1020
          case 'left':
5b78b8c79d9c Initial commit
Vincent Tondellier <tonton+hg@team1664.org>
parents:
diff changeset
  1021
            tp = {top: pos.top + pos.height / 2 - actualHeight / 2, left: pos.left - actualWidth}
5b78b8c79d9c Initial commit
Vincent Tondellier <tonton+hg@team1664.org>
parents:
diff changeset
  1022
            break
5b78b8c79d9c Initial commit
Vincent Tondellier <tonton+hg@team1664.org>
parents:
diff changeset
  1023
          case 'right':
5b78b8c79d9c Initial commit
Vincent Tondellier <tonton+hg@team1664.org>
parents:
diff changeset
  1024
            tp = {top: pos.top + pos.height / 2 - actualHeight / 2, left: pos.left + pos.width}
5b78b8c79d9c Initial commit
Vincent Tondellier <tonton+hg@team1664.org>
parents:
diff changeset
  1025
            break
5b78b8c79d9c Initial commit
Vincent Tondellier <tonton+hg@team1664.org>
parents:
diff changeset
  1026
        }
5b78b8c79d9c Initial commit
Vincent Tondellier <tonton+hg@team1664.org>
parents:
diff changeset
  1027
5b78b8c79d9c Initial commit
Vincent Tondellier <tonton+hg@team1664.org>
parents:
diff changeset
  1028
        $tip
5b78b8c79d9c Initial commit
Vincent Tondellier <tonton+hg@team1664.org>
parents:
diff changeset
  1029
          .css(tp)
5b78b8c79d9c Initial commit
Vincent Tondellier <tonton+hg@team1664.org>
parents:
diff changeset
  1030
          .addClass(placement)
5b78b8c79d9c Initial commit
Vincent Tondellier <tonton+hg@team1664.org>
parents:
diff changeset
  1031
          .addClass('in')
5b78b8c79d9c Initial commit
Vincent Tondellier <tonton+hg@team1664.org>
parents:
diff changeset
  1032
      }
5b78b8c79d9c Initial commit
Vincent Tondellier <tonton+hg@team1664.org>
parents:
diff changeset
  1033
    }
5b78b8c79d9c Initial commit
Vincent Tondellier <tonton+hg@team1664.org>
parents:
diff changeset
  1034
5b78b8c79d9c Initial commit
Vincent Tondellier <tonton+hg@team1664.org>
parents:
diff changeset
  1035
  , isHTML: function(text) {
5b78b8c79d9c Initial commit
Vincent Tondellier <tonton+hg@team1664.org>
parents:
diff changeset
  1036
      // html string detection logic adapted from jQuery
5b78b8c79d9c Initial commit
Vincent Tondellier <tonton+hg@team1664.org>
parents:
diff changeset
  1037
      return typeof text != 'string'
5b78b8c79d9c Initial commit
Vincent Tondellier <tonton+hg@team1664.org>
parents:
diff changeset
  1038
        || ( text.charAt(0) === "<"
5b78b8c79d9c Initial commit
Vincent Tondellier <tonton+hg@team1664.org>
parents:
diff changeset
  1039
          && text.charAt( text.length - 1 ) === ">"
5b78b8c79d9c Initial commit
Vincent Tondellier <tonton+hg@team1664.org>
parents:
diff changeset
  1040
          && text.length >= 3
5b78b8c79d9c Initial commit
Vincent Tondellier <tonton+hg@team1664.org>
parents:
diff changeset
  1041
        ) || /^(?:[^<]*<[\w\W]+>[^>]*$)/.exec(text)
5b78b8c79d9c Initial commit
Vincent Tondellier <tonton+hg@team1664.org>
parents:
diff changeset
  1042
    }
5b78b8c79d9c Initial commit
Vincent Tondellier <tonton+hg@team1664.org>
parents:
diff changeset
  1043
5b78b8c79d9c Initial commit
Vincent Tondellier <tonton+hg@team1664.org>
parents:
diff changeset
  1044
  , setContent: function () {
5b78b8c79d9c Initial commit
Vincent Tondellier <tonton+hg@team1664.org>
parents:
diff changeset
  1045
      var $tip = this.tip()
5b78b8c79d9c Initial commit
Vincent Tondellier <tonton+hg@team1664.org>
parents:
diff changeset
  1046
        , title = this.getTitle()
5b78b8c79d9c Initial commit
Vincent Tondellier <tonton+hg@team1664.org>
parents:
diff changeset
  1047
5b78b8c79d9c Initial commit
Vincent Tondellier <tonton+hg@team1664.org>
parents:
diff changeset
  1048
      $tip.find('.tooltip-inner')[this.isHTML(title) ? 'html' : 'text'](title)
5b78b8c79d9c Initial commit
Vincent Tondellier <tonton+hg@team1664.org>
parents:
diff changeset
  1049
      $tip.removeClass('fade in top bottom left right')
5b78b8c79d9c Initial commit
Vincent Tondellier <tonton+hg@team1664.org>
parents:
diff changeset
  1050
    }
5b78b8c79d9c Initial commit
Vincent Tondellier <tonton+hg@team1664.org>
parents:
diff changeset
  1051
5b78b8c79d9c Initial commit
Vincent Tondellier <tonton+hg@team1664.org>
parents:
diff changeset
  1052
  , hide: function () {
5b78b8c79d9c Initial commit
Vincent Tondellier <tonton+hg@team1664.org>
parents:
diff changeset
  1053
      var that = this
5b78b8c79d9c Initial commit
Vincent Tondellier <tonton+hg@team1664.org>
parents:
diff changeset
  1054
        , $tip = this.tip()
5b78b8c79d9c Initial commit
Vincent Tondellier <tonton+hg@team1664.org>
parents:
diff changeset
  1055
5b78b8c79d9c Initial commit
Vincent Tondellier <tonton+hg@team1664.org>
parents:
diff changeset
  1056
      $tip.removeClass('in')
5b78b8c79d9c Initial commit
Vincent Tondellier <tonton+hg@team1664.org>
parents:
diff changeset
  1057
5b78b8c79d9c Initial commit
Vincent Tondellier <tonton+hg@team1664.org>
parents:
diff changeset
  1058
      function removeWithAnimation() {
5b78b8c79d9c Initial commit
Vincent Tondellier <tonton+hg@team1664.org>
parents:
diff changeset
  1059
        var timeout = setTimeout(function () {
5b78b8c79d9c Initial commit
Vincent Tondellier <tonton+hg@team1664.org>
parents:
diff changeset
  1060
          $tip.off($.support.transition.end).remove()
5b78b8c79d9c Initial commit
Vincent Tondellier <tonton+hg@team1664.org>
parents:
diff changeset
  1061
        }, 500)
5b78b8c79d9c Initial commit
Vincent Tondellier <tonton+hg@team1664.org>
parents:
diff changeset
  1062
5b78b8c79d9c Initial commit
Vincent Tondellier <tonton+hg@team1664.org>
parents:
diff changeset
  1063
        $tip.one($.support.transition.end, function () {
5b78b8c79d9c Initial commit
Vincent Tondellier <tonton+hg@team1664.org>
parents:
diff changeset
  1064
          clearTimeout(timeout)
5b78b8c79d9c Initial commit
Vincent Tondellier <tonton+hg@team1664.org>
parents:
diff changeset
  1065
          $tip.remove()
5b78b8c79d9c Initial commit
Vincent Tondellier <tonton+hg@team1664.org>
parents:
diff changeset
  1066
        })
5b78b8c79d9c Initial commit
Vincent Tondellier <tonton+hg@team1664.org>
parents:
diff changeset
  1067
      }
5b78b8c79d9c Initial commit
Vincent Tondellier <tonton+hg@team1664.org>
parents:
diff changeset
  1068
5b78b8c79d9c Initial commit
Vincent Tondellier <tonton+hg@team1664.org>
parents:
diff changeset
  1069
      $.support.transition && this.$tip.hasClass('fade') ?
5b78b8c79d9c Initial commit
Vincent Tondellier <tonton+hg@team1664.org>
parents:
diff changeset
  1070
        removeWithAnimation() :
5b78b8c79d9c Initial commit
Vincent Tondellier <tonton+hg@team1664.org>
parents:
diff changeset
  1071
        $tip.remove()
5b78b8c79d9c Initial commit
Vincent Tondellier <tonton+hg@team1664.org>
parents:
diff changeset
  1072
    }
5b78b8c79d9c Initial commit
Vincent Tondellier <tonton+hg@team1664.org>
parents:
diff changeset
  1073
5b78b8c79d9c Initial commit
Vincent Tondellier <tonton+hg@team1664.org>
parents:
diff changeset
  1074
  , fixTitle: function () {
5b78b8c79d9c Initial commit
Vincent Tondellier <tonton+hg@team1664.org>
parents:
diff changeset
  1075
      var $e = this.$element
5b78b8c79d9c Initial commit
Vincent Tondellier <tonton+hg@team1664.org>
parents:
diff changeset
  1076
      if ($e.attr('title') || typeof($e.attr('data-original-title')) != 'string') {
5b78b8c79d9c Initial commit
Vincent Tondellier <tonton+hg@team1664.org>
parents:
diff changeset
  1077
        $e.attr('data-original-title', $e.attr('title') || '').removeAttr('title')
5b78b8c79d9c Initial commit
Vincent Tondellier <tonton+hg@team1664.org>
parents:
diff changeset
  1078
      }
5b78b8c79d9c Initial commit
Vincent Tondellier <tonton+hg@team1664.org>
parents:
diff changeset
  1079
    }
5b78b8c79d9c Initial commit
Vincent Tondellier <tonton+hg@team1664.org>
parents:
diff changeset
  1080
5b78b8c79d9c Initial commit
Vincent Tondellier <tonton+hg@team1664.org>
parents:
diff changeset
  1081
  , hasContent: function () {
5b78b8c79d9c Initial commit
Vincent Tondellier <tonton+hg@team1664.org>
parents:
diff changeset
  1082
      return this.getTitle()
5b78b8c79d9c Initial commit
Vincent Tondellier <tonton+hg@team1664.org>
parents:
diff changeset
  1083
    }
5b78b8c79d9c Initial commit
Vincent Tondellier <tonton+hg@team1664.org>
parents:
diff changeset
  1084
5b78b8c79d9c Initial commit
Vincent Tondellier <tonton+hg@team1664.org>
parents:
diff changeset
  1085
  , getPosition: function (inside) {
5b78b8c79d9c Initial commit
Vincent Tondellier <tonton+hg@team1664.org>
parents:
diff changeset
  1086
      return $.extend({}, (inside ? {top: 0, left: 0} : this.$element.offset()), {
5b78b8c79d9c Initial commit
Vincent Tondellier <tonton+hg@team1664.org>
parents:
diff changeset
  1087
        width: this.$element[0].offsetWidth
5b78b8c79d9c Initial commit
Vincent Tondellier <tonton+hg@team1664.org>
parents:
diff changeset
  1088
      , height: this.$element[0].offsetHeight
5b78b8c79d9c Initial commit
Vincent Tondellier <tonton+hg@team1664.org>
parents:
diff changeset
  1089
      })
5b78b8c79d9c Initial commit
Vincent Tondellier <tonton+hg@team1664.org>
parents:
diff changeset
  1090
    }
5b78b8c79d9c Initial commit
Vincent Tondellier <tonton+hg@team1664.org>
parents:
diff changeset
  1091
5b78b8c79d9c Initial commit
Vincent Tondellier <tonton+hg@team1664.org>
parents:
diff changeset
  1092
  , getTitle: function () {
5b78b8c79d9c Initial commit
Vincent Tondellier <tonton+hg@team1664.org>
parents:
diff changeset
  1093
      var title
5b78b8c79d9c Initial commit
Vincent Tondellier <tonton+hg@team1664.org>
parents:
diff changeset
  1094
        , $e = this.$element
5b78b8c79d9c Initial commit
Vincent Tondellier <tonton+hg@team1664.org>
parents:
diff changeset
  1095
        , o = this.options
5b78b8c79d9c Initial commit
Vincent Tondellier <tonton+hg@team1664.org>
parents:
diff changeset
  1096
5b78b8c79d9c Initial commit
Vincent Tondellier <tonton+hg@team1664.org>
parents:
diff changeset
  1097
      title = $e.attr('data-original-title')
5b78b8c79d9c Initial commit
Vincent Tondellier <tonton+hg@team1664.org>
parents:
diff changeset
  1098
        || (typeof o.title == 'function' ? o.title.call($e[0]) :  o.title)
5b78b8c79d9c Initial commit
Vincent Tondellier <tonton+hg@team1664.org>
parents:
diff changeset
  1099
5b78b8c79d9c Initial commit
Vincent Tondellier <tonton+hg@team1664.org>
parents:
diff changeset
  1100
      return title
5b78b8c79d9c Initial commit
Vincent Tondellier <tonton+hg@team1664.org>
parents:
diff changeset
  1101
    }
5b78b8c79d9c Initial commit
Vincent Tondellier <tonton+hg@team1664.org>
parents:
diff changeset
  1102
5b78b8c79d9c Initial commit
Vincent Tondellier <tonton+hg@team1664.org>
parents:
diff changeset
  1103
  , tip: function () {
5b78b8c79d9c Initial commit
Vincent Tondellier <tonton+hg@team1664.org>
parents:
diff changeset
  1104
      return this.$tip = this.$tip || $(this.options.template)
5b78b8c79d9c Initial commit
Vincent Tondellier <tonton+hg@team1664.org>
parents:
diff changeset
  1105
    }
5b78b8c79d9c Initial commit
Vincent Tondellier <tonton+hg@team1664.org>
parents:
diff changeset
  1106
5b78b8c79d9c Initial commit
Vincent Tondellier <tonton+hg@team1664.org>
parents:
diff changeset
  1107
  , validate: function () {
5b78b8c79d9c Initial commit
Vincent Tondellier <tonton+hg@team1664.org>
parents:
diff changeset
  1108
      if (!this.$element[0].parentNode) {
5b78b8c79d9c Initial commit
Vincent Tondellier <tonton+hg@team1664.org>
parents:
diff changeset
  1109
        this.hide()
5b78b8c79d9c Initial commit
Vincent Tondellier <tonton+hg@team1664.org>
parents:
diff changeset
  1110
        this.$element = null
5b78b8c79d9c Initial commit
Vincent Tondellier <tonton+hg@team1664.org>
parents:
diff changeset
  1111
        this.options = null
5b78b8c79d9c Initial commit
Vincent Tondellier <tonton+hg@team1664.org>
parents:
diff changeset
  1112
      }
5b78b8c79d9c Initial commit
Vincent Tondellier <tonton+hg@team1664.org>
parents:
diff changeset
  1113
    }
5b78b8c79d9c Initial commit
Vincent Tondellier <tonton+hg@team1664.org>
parents:
diff changeset
  1114
5b78b8c79d9c Initial commit
Vincent Tondellier <tonton+hg@team1664.org>
parents:
diff changeset
  1115
  , enable: function () {
5b78b8c79d9c Initial commit
Vincent Tondellier <tonton+hg@team1664.org>
parents:
diff changeset
  1116
      this.enabled = true
5b78b8c79d9c Initial commit
Vincent Tondellier <tonton+hg@team1664.org>
parents:
diff changeset
  1117
    }
5b78b8c79d9c Initial commit
Vincent Tondellier <tonton+hg@team1664.org>
parents:
diff changeset
  1118
5b78b8c79d9c Initial commit
Vincent Tondellier <tonton+hg@team1664.org>
parents:
diff changeset
  1119
  , disable: function () {
5b78b8c79d9c Initial commit
Vincent Tondellier <tonton+hg@team1664.org>
parents:
diff changeset
  1120
      this.enabled = false
5b78b8c79d9c Initial commit
Vincent Tondellier <tonton+hg@team1664.org>
parents:
diff changeset
  1121
    }
5b78b8c79d9c Initial commit
Vincent Tondellier <tonton+hg@team1664.org>
parents:
diff changeset
  1122
5b78b8c79d9c Initial commit
Vincent Tondellier <tonton+hg@team1664.org>
parents:
diff changeset
  1123
  , toggleEnabled: function () {
5b78b8c79d9c Initial commit
Vincent Tondellier <tonton+hg@team1664.org>
parents:
diff changeset
  1124
      this.enabled = !this.enabled
5b78b8c79d9c Initial commit
Vincent Tondellier <tonton+hg@team1664.org>
parents:
diff changeset
  1125
    }
5b78b8c79d9c Initial commit
Vincent Tondellier <tonton+hg@team1664.org>
parents:
diff changeset
  1126
5b78b8c79d9c Initial commit
Vincent Tondellier <tonton+hg@team1664.org>
parents:
diff changeset
  1127
  , toggle: function () {
5b78b8c79d9c Initial commit
Vincent Tondellier <tonton+hg@team1664.org>
parents:
diff changeset
  1128
      this[this.tip().hasClass('in') ? 'hide' : 'show']()
5b78b8c79d9c Initial commit
Vincent Tondellier <tonton+hg@team1664.org>
parents:
diff changeset
  1129
    }
5b78b8c79d9c Initial commit
Vincent Tondellier <tonton+hg@team1664.org>
parents:
diff changeset
  1130
5b78b8c79d9c Initial commit
Vincent Tondellier <tonton+hg@team1664.org>
parents:
diff changeset
  1131
  }
5b78b8c79d9c Initial commit
Vincent Tondellier <tonton+hg@team1664.org>
parents:
diff changeset
  1132
5b78b8c79d9c Initial commit
Vincent Tondellier <tonton+hg@team1664.org>
parents:
diff changeset
  1133
5b78b8c79d9c Initial commit
Vincent Tondellier <tonton+hg@team1664.org>
parents:
diff changeset
  1134
 /* TOOLTIP PLUGIN DEFINITION
5b78b8c79d9c Initial commit
Vincent Tondellier <tonton+hg@team1664.org>
parents:
diff changeset
  1135
  * ========================= */
5b78b8c79d9c Initial commit
Vincent Tondellier <tonton+hg@team1664.org>
parents:
diff changeset
  1136
5b78b8c79d9c Initial commit
Vincent Tondellier <tonton+hg@team1664.org>
parents:
diff changeset
  1137
  $.fn.tooltip = function ( option ) {
5b78b8c79d9c Initial commit
Vincent Tondellier <tonton+hg@team1664.org>
parents:
diff changeset
  1138
    return this.each(function () {
5b78b8c79d9c Initial commit
Vincent Tondellier <tonton+hg@team1664.org>
parents:
diff changeset
  1139
      var $this = $(this)
5b78b8c79d9c Initial commit
Vincent Tondellier <tonton+hg@team1664.org>
parents:
diff changeset
  1140
        , data = $this.data('tooltip')
5b78b8c79d9c Initial commit
Vincent Tondellier <tonton+hg@team1664.org>
parents:
diff changeset
  1141
        , options = typeof option == 'object' && option
5b78b8c79d9c Initial commit
Vincent Tondellier <tonton+hg@team1664.org>
parents:
diff changeset
  1142
      if (!data) $this.data('tooltip', (data = new Tooltip(this, options)))
5b78b8c79d9c Initial commit
Vincent Tondellier <tonton+hg@team1664.org>
parents:
diff changeset
  1143
      if (typeof option == 'string') data[option]()
5b78b8c79d9c Initial commit
Vincent Tondellier <tonton+hg@team1664.org>
parents:
diff changeset
  1144
    })
5b78b8c79d9c Initial commit
Vincent Tondellier <tonton+hg@team1664.org>
parents:
diff changeset
  1145
  }
5b78b8c79d9c Initial commit
Vincent Tondellier <tonton+hg@team1664.org>
parents:
diff changeset
  1146
5b78b8c79d9c Initial commit
Vincent Tondellier <tonton+hg@team1664.org>
parents:
diff changeset
  1147
  $.fn.tooltip.Constructor = Tooltip
5b78b8c79d9c Initial commit
Vincent Tondellier <tonton+hg@team1664.org>
parents:
diff changeset
  1148
5b78b8c79d9c Initial commit
Vincent Tondellier <tonton+hg@team1664.org>
parents:
diff changeset
  1149
  $.fn.tooltip.defaults = {
5b78b8c79d9c Initial commit
Vincent Tondellier <tonton+hg@team1664.org>
parents:
diff changeset
  1150
    animation: true
5b78b8c79d9c Initial commit
Vincent Tondellier <tonton+hg@team1664.org>
parents:
diff changeset
  1151
  , placement: 'top'
5b78b8c79d9c Initial commit
Vincent Tondellier <tonton+hg@team1664.org>
parents:
diff changeset
  1152
  , selector: false
5b78b8c79d9c Initial commit
Vincent Tondellier <tonton+hg@team1664.org>
parents:
diff changeset
  1153
  , template: '<div class="tooltip"><div class="tooltip-arrow"></div><div class="tooltip-inner"></div></div>'
5b78b8c79d9c Initial commit
Vincent Tondellier <tonton+hg@team1664.org>
parents:
diff changeset
  1154
  , trigger: 'hover'
5b78b8c79d9c Initial commit
Vincent Tondellier <tonton+hg@team1664.org>
parents:
diff changeset
  1155
  , title: ''
5b78b8c79d9c Initial commit
Vincent Tondellier <tonton+hg@team1664.org>
parents:
diff changeset
  1156
  , delay: 0
5b78b8c79d9c Initial commit
Vincent Tondellier <tonton+hg@team1664.org>
parents:
diff changeset
  1157
  }
5b78b8c79d9c Initial commit
Vincent Tondellier <tonton+hg@team1664.org>
parents:
diff changeset
  1158
5b78b8c79d9c Initial commit
Vincent Tondellier <tonton+hg@team1664.org>
parents:
diff changeset
  1159
}(window.jQuery);/* ===========================================================
5b78b8c79d9c Initial commit
Vincent Tondellier <tonton+hg@team1664.org>
parents:
diff changeset
  1160
 * bootstrap-popover.js v2.0.3
5b78b8c79d9c Initial commit
Vincent Tondellier <tonton+hg@team1664.org>
parents:
diff changeset
  1161
 * http://twitter.github.com/bootstrap/javascript.html#popovers
5b78b8c79d9c Initial commit
Vincent Tondellier <tonton+hg@team1664.org>
parents:
diff changeset
  1162
 * ===========================================================
5b78b8c79d9c Initial commit
Vincent Tondellier <tonton+hg@team1664.org>
parents:
diff changeset
  1163
 * Copyright 2012 Twitter, Inc.
5b78b8c79d9c Initial commit
Vincent Tondellier <tonton+hg@team1664.org>
parents:
diff changeset
  1164
 *
5b78b8c79d9c Initial commit
Vincent Tondellier <tonton+hg@team1664.org>
parents:
diff changeset
  1165
 * Licensed under the Apache License, Version 2.0 (the "License");
5b78b8c79d9c Initial commit
Vincent Tondellier <tonton+hg@team1664.org>
parents:
diff changeset
  1166
 * you may not use this file except in compliance with the License.
5b78b8c79d9c Initial commit
Vincent Tondellier <tonton+hg@team1664.org>
parents:
diff changeset
  1167
 * You may obtain a copy of the License at
5b78b8c79d9c Initial commit
Vincent Tondellier <tonton+hg@team1664.org>
parents:
diff changeset
  1168
 *
5b78b8c79d9c Initial commit
Vincent Tondellier <tonton+hg@team1664.org>
parents:
diff changeset
  1169
 * http://www.apache.org/licenses/LICENSE-2.0
5b78b8c79d9c Initial commit
Vincent Tondellier <tonton+hg@team1664.org>
parents:
diff changeset
  1170
 *
5b78b8c79d9c Initial commit
Vincent Tondellier <tonton+hg@team1664.org>
parents:
diff changeset
  1171
 * Unless required by applicable law or agreed to in writing, software
5b78b8c79d9c Initial commit
Vincent Tondellier <tonton+hg@team1664.org>
parents:
diff changeset
  1172
 * distributed under the License is distributed on an "AS IS" BASIS,
5b78b8c79d9c Initial commit
Vincent Tondellier <tonton+hg@team1664.org>
parents:
diff changeset
  1173
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
5b78b8c79d9c Initial commit
Vincent Tondellier <tonton+hg@team1664.org>
parents:
diff changeset
  1174
 * See the License for the specific language governing permissions and
5b78b8c79d9c Initial commit
Vincent Tondellier <tonton+hg@team1664.org>
parents:
diff changeset
  1175
 * limitations under the License.
5b78b8c79d9c Initial commit
Vincent Tondellier <tonton+hg@team1664.org>
parents:
diff changeset
  1176
 * =========================================================== */
5b78b8c79d9c Initial commit
Vincent Tondellier <tonton+hg@team1664.org>
parents:
diff changeset
  1177
5b78b8c79d9c Initial commit
Vincent Tondellier <tonton+hg@team1664.org>
parents:
diff changeset
  1178
5b78b8c79d9c Initial commit
Vincent Tondellier <tonton+hg@team1664.org>
parents:
diff changeset
  1179
!function ($) {
5b78b8c79d9c Initial commit
Vincent Tondellier <tonton+hg@team1664.org>
parents:
diff changeset
  1180
5b78b8c79d9c Initial commit
Vincent Tondellier <tonton+hg@team1664.org>
parents:
diff changeset
  1181
  "use strict"; // jshint ;_;
5b78b8c79d9c Initial commit
Vincent Tondellier <tonton+hg@team1664.org>
parents:
diff changeset
  1182
5b78b8c79d9c Initial commit
Vincent Tondellier <tonton+hg@team1664.org>
parents:
diff changeset
  1183
5b78b8c79d9c Initial commit
Vincent Tondellier <tonton+hg@team1664.org>
parents:
diff changeset
  1184
 /* POPOVER PUBLIC CLASS DEFINITION
5b78b8c79d9c Initial commit
Vincent Tondellier <tonton+hg@team1664.org>
parents:
diff changeset
  1185
  * =============================== */
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
  var Popover = function ( element, options ) {
5b78b8c79d9c Initial commit
Vincent Tondellier <tonton+hg@team1664.org>
parents:
diff changeset
  1188
    this.init('popover', element, options)
5b78b8c79d9c Initial commit
Vincent Tondellier <tonton+hg@team1664.org>
parents:
diff changeset
  1189
  }
5b78b8c79d9c Initial commit
Vincent Tondellier <tonton+hg@team1664.org>
parents:
diff changeset
  1190
5b78b8c79d9c Initial commit
Vincent Tondellier <tonton+hg@team1664.org>
parents:
diff changeset
  1191
5b78b8c79d9c Initial commit
Vincent Tondellier <tonton+hg@team1664.org>
parents:
diff changeset
  1192
  /* NOTE: POPOVER EXTENDS BOOTSTRAP-TOOLTIP.js
5b78b8c79d9c Initial commit
Vincent Tondellier <tonton+hg@team1664.org>
parents:
diff changeset
  1193
     ========================================== */
5b78b8c79d9c Initial commit
Vincent Tondellier <tonton+hg@team1664.org>
parents:
diff changeset
  1194
5b78b8c79d9c Initial commit
Vincent Tondellier <tonton+hg@team1664.org>
parents:
diff changeset
  1195
  Popover.prototype = $.extend({}, $.fn.tooltip.Constructor.prototype, {
5b78b8c79d9c Initial commit
Vincent Tondellier <tonton+hg@team1664.org>
parents:
diff changeset
  1196
5b78b8c79d9c Initial commit
Vincent Tondellier <tonton+hg@team1664.org>
parents:
diff changeset
  1197
    constructor: Popover
5b78b8c79d9c Initial commit
Vincent Tondellier <tonton+hg@team1664.org>
parents:
diff changeset
  1198
5b78b8c79d9c Initial commit
Vincent Tondellier <tonton+hg@team1664.org>
parents:
diff changeset
  1199
  , setContent: function () {
5b78b8c79d9c Initial commit
Vincent Tondellier <tonton+hg@team1664.org>
parents:
diff changeset
  1200
      var $tip = this.tip()
5b78b8c79d9c Initial commit
Vincent Tondellier <tonton+hg@team1664.org>
parents:
diff changeset
  1201
        , title = this.getTitle()
5b78b8c79d9c Initial commit
Vincent Tondellier <tonton+hg@team1664.org>
parents:
diff changeset
  1202
        , content = this.getContent()
5b78b8c79d9c Initial commit
Vincent Tondellier <tonton+hg@team1664.org>
parents:
diff changeset
  1203
5b78b8c79d9c Initial commit
Vincent Tondellier <tonton+hg@team1664.org>
parents:
diff changeset
  1204
      $tip.find('.popover-title')[this.isHTML(title) ? 'html' : 'text'](title)
5b78b8c79d9c Initial commit
Vincent Tondellier <tonton+hg@team1664.org>
parents:
diff changeset
  1205
      $tip.find('.popover-content > *')[this.isHTML(content) ? 'html' : 'text'](content)
5b78b8c79d9c Initial commit
Vincent Tondellier <tonton+hg@team1664.org>
parents:
diff changeset
  1206
5b78b8c79d9c Initial commit
Vincent Tondellier <tonton+hg@team1664.org>
parents:
diff changeset
  1207
      $tip.removeClass('fade top bottom left right in')
5b78b8c79d9c Initial commit
Vincent Tondellier <tonton+hg@team1664.org>
parents:
diff changeset
  1208
    }
5b78b8c79d9c Initial commit
Vincent Tondellier <tonton+hg@team1664.org>
parents:
diff changeset
  1209
5b78b8c79d9c Initial commit
Vincent Tondellier <tonton+hg@team1664.org>
parents:
diff changeset
  1210
  , hasContent: function () {
5b78b8c79d9c Initial commit
Vincent Tondellier <tonton+hg@team1664.org>
parents:
diff changeset
  1211
      return this.getTitle() || this.getContent()
5b78b8c79d9c Initial commit
Vincent Tondellier <tonton+hg@team1664.org>
parents:
diff changeset
  1212
    }
5b78b8c79d9c Initial commit
Vincent Tondellier <tonton+hg@team1664.org>
parents:
diff changeset
  1213
5b78b8c79d9c Initial commit
Vincent Tondellier <tonton+hg@team1664.org>
parents:
diff changeset
  1214
  , getContent: function () {
5b78b8c79d9c Initial commit
Vincent Tondellier <tonton+hg@team1664.org>
parents:
diff changeset
  1215
      var content
5b78b8c79d9c Initial commit
Vincent Tondellier <tonton+hg@team1664.org>
parents:
diff changeset
  1216
        , $e = this.$element
5b78b8c79d9c Initial commit
Vincent Tondellier <tonton+hg@team1664.org>
parents:
diff changeset
  1217
        , o = this.options
5b78b8c79d9c Initial commit
Vincent Tondellier <tonton+hg@team1664.org>
parents:
diff changeset
  1218
5b78b8c79d9c Initial commit
Vincent Tondellier <tonton+hg@team1664.org>
parents:
diff changeset
  1219
      content = $e.attr('data-content')
5b78b8c79d9c Initial commit
Vincent Tondellier <tonton+hg@team1664.org>
parents:
diff changeset
  1220
        || (typeof o.content == 'function' ? o.content.call($e[0]) :  o.content)
5b78b8c79d9c Initial commit
Vincent Tondellier <tonton+hg@team1664.org>
parents:
diff changeset
  1221
5b78b8c79d9c Initial commit
Vincent Tondellier <tonton+hg@team1664.org>
parents:
diff changeset
  1222
      return content
5b78b8c79d9c Initial commit
Vincent Tondellier <tonton+hg@team1664.org>
parents:
diff changeset
  1223
    }
5b78b8c79d9c Initial commit
Vincent Tondellier <tonton+hg@team1664.org>
parents:
diff changeset
  1224
5b78b8c79d9c Initial commit
Vincent Tondellier <tonton+hg@team1664.org>
parents:
diff changeset
  1225
  , tip: function () {
5b78b8c79d9c Initial commit
Vincent Tondellier <tonton+hg@team1664.org>
parents:
diff changeset
  1226
      if (!this.$tip) {
5b78b8c79d9c Initial commit
Vincent Tondellier <tonton+hg@team1664.org>
parents:
diff changeset
  1227
        this.$tip = $(this.options.template)
5b78b8c79d9c Initial commit
Vincent Tondellier <tonton+hg@team1664.org>
parents:
diff changeset
  1228
      }
5b78b8c79d9c Initial commit
Vincent Tondellier <tonton+hg@team1664.org>
parents:
diff changeset
  1229
      return this.$tip
5b78b8c79d9c Initial commit
Vincent Tondellier <tonton+hg@team1664.org>
parents:
diff changeset
  1230
    }
5b78b8c79d9c Initial commit
Vincent Tondellier <tonton+hg@team1664.org>
parents:
diff changeset
  1231
5b78b8c79d9c Initial commit
Vincent Tondellier <tonton+hg@team1664.org>
parents:
diff changeset
  1232
  })
5b78b8c79d9c Initial commit
Vincent Tondellier <tonton+hg@team1664.org>
parents:
diff changeset
  1233
5b78b8c79d9c Initial commit
Vincent Tondellier <tonton+hg@team1664.org>
parents:
diff changeset
  1234
5b78b8c79d9c Initial commit
Vincent Tondellier <tonton+hg@team1664.org>
parents:
diff changeset
  1235
 /* POPOVER PLUGIN DEFINITION
5b78b8c79d9c Initial commit
Vincent Tondellier <tonton+hg@team1664.org>
parents:
diff changeset
  1236
  * ======================= */
5b78b8c79d9c Initial commit
Vincent Tondellier <tonton+hg@team1664.org>
parents:
diff changeset
  1237
5b78b8c79d9c Initial commit
Vincent Tondellier <tonton+hg@team1664.org>
parents:
diff changeset
  1238
  $.fn.popover = function (option) {
5b78b8c79d9c Initial commit
Vincent Tondellier <tonton+hg@team1664.org>
parents:
diff changeset
  1239
    return this.each(function () {
5b78b8c79d9c Initial commit
Vincent Tondellier <tonton+hg@team1664.org>
parents:
diff changeset
  1240
      var $this = $(this)
5b78b8c79d9c Initial commit
Vincent Tondellier <tonton+hg@team1664.org>
parents:
diff changeset
  1241
        , data = $this.data('popover')
5b78b8c79d9c Initial commit
Vincent Tondellier <tonton+hg@team1664.org>
parents:
diff changeset
  1242
        , options = typeof option == 'object' && option
5b78b8c79d9c Initial commit
Vincent Tondellier <tonton+hg@team1664.org>
parents:
diff changeset
  1243
      if (!data) $this.data('popover', (data = new Popover(this, options)))
5b78b8c79d9c Initial commit
Vincent Tondellier <tonton+hg@team1664.org>
parents:
diff changeset
  1244
      if (typeof option == 'string') data[option]()
5b78b8c79d9c Initial commit
Vincent Tondellier <tonton+hg@team1664.org>
parents:
diff changeset
  1245
    })
5b78b8c79d9c Initial commit
Vincent Tondellier <tonton+hg@team1664.org>
parents:
diff changeset
  1246
  }
5b78b8c79d9c Initial commit
Vincent Tondellier <tonton+hg@team1664.org>
parents:
diff changeset
  1247
5b78b8c79d9c Initial commit
Vincent Tondellier <tonton+hg@team1664.org>
parents:
diff changeset
  1248
  $.fn.popover.Constructor = Popover
5b78b8c79d9c Initial commit
Vincent Tondellier <tonton+hg@team1664.org>
parents:
diff changeset
  1249
5b78b8c79d9c Initial commit
Vincent Tondellier <tonton+hg@team1664.org>
parents:
diff changeset
  1250
  $.fn.popover.defaults = $.extend({} , $.fn.tooltip.defaults, {
5b78b8c79d9c Initial commit
Vincent Tondellier <tonton+hg@team1664.org>
parents:
diff changeset
  1251
    placement: 'right'
5b78b8c79d9c Initial commit
Vincent Tondellier <tonton+hg@team1664.org>
parents:
diff changeset
  1252
  , content: ''
5b78b8c79d9c Initial commit
Vincent Tondellier <tonton+hg@team1664.org>
parents:
diff changeset
  1253
  , template: '<div class="popover"><div class="arrow"></div><div class="popover-inner"><h3 class="popover-title"></h3><div class="popover-content"><p></p></div></div></div>'
5b78b8c79d9c Initial commit
Vincent Tondellier <tonton+hg@team1664.org>
parents:
diff changeset
  1254
  })
5b78b8c79d9c Initial commit
Vincent Tondellier <tonton+hg@team1664.org>
parents:
diff changeset
  1255
5b78b8c79d9c Initial commit
Vincent Tondellier <tonton+hg@team1664.org>
parents:
diff changeset
  1256
}(window.jQuery);/* =============================================================
5b78b8c79d9c Initial commit
Vincent Tondellier <tonton+hg@team1664.org>
parents:
diff changeset
  1257
 * bootstrap-scrollspy.js v2.0.3
5b78b8c79d9c Initial commit
Vincent Tondellier <tonton+hg@team1664.org>
parents:
diff changeset
  1258
 * http://twitter.github.com/bootstrap/javascript.html#scrollspy
5b78b8c79d9c Initial commit
Vincent Tondellier <tonton+hg@team1664.org>
parents:
diff changeset
  1259
 * =============================================================
5b78b8c79d9c Initial commit
Vincent Tondellier <tonton+hg@team1664.org>
parents:
diff changeset
  1260
 * Copyright 2012 Twitter, Inc.
5b78b8c79d9c Initial commit
Vincent Tondellier <tonton+hg@team1664.org>
parents:
diff changeset
  1261
 *
5b78b8c79d9c Initial commit
Vincent Tondellier <tonton+hg@team1664.org>
parents:
diff changeset
  1262
 * Licensed under the Apache License, Version 2.0 (the "License");
5b78b8c79d9c Initial commit
Vincent Tondellier <tonton+hg@team1664.org>
parents:
diff changeset
  1263
 * you may not use this file except in compliance with the License.
5b78b8c79d9c Initial commit
Vincent Tondellier <tonton+hg@team1664.org>
parents:
diff changeset
  1264
 * You may obtain a copy of the License at
5b78b8c79d9c Initial commit
Vincent Tondellier <tonton+hg@team1664.org>
parents:
diff changeset
  1265
 *
5b78b8c79d9c Initial commit
Vincent Tondellier <tonton+hg@team1664.org>
parents:
diff changeset
  1266
 * http://www.apache.org/licenses/LICENSE-2.0
5b78b8c79d9c Initial commit
Vincent Tondellier <tonton+hg@team1664.org>
parents:
diff changeset
  1267
 *
5b78b8c79d9c Initial commit
Vincent Tondellier <tonton+hg@team1664.org>
parents:
diff changeset
  1268
 * Unless required by applicable law or agreed to in writing, software
5b78b8c79d9c Initial commit
Vincent Tondellier <tonton+hg@team1664.org>
parents:
diff changeset
  1269
 * distributed under the License is distributed on an "AS IS" BASIS,
5b78b8c79d9c Initial commit
Vincent Tondellier <tonton+hg@team1664.org>
parents:
diff changeset
  1270
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
5b78b8c79d9c Initial commit
Vincent Tondellier <tonton+hg@team1664.org>
parents:
diff changeset
  1271
 * See the License for the specific language governing permissions and
5b78b8c79d9c Initial commit
Vincent Tondellier <tonton+hg@team1664.org>
parents:
diff changeset
  1272
 * limitations under the License.
5b78b8c79d9c Initial commit
Vincent Tondellier <tonton+hg@team1664.org>
parents:
diff changeset
  1273
 * ============================================================== */
5b78b8c79d9c Initial commit
Vincent Tondellier <tonton+hg@team1664.org>
parents:
diff changeset
  1274
5b78b8c79d9c Initial commit
Vincent Tondellier <tonton+hg@team1664.org>
parents:
diff changeset
  1275
5b78b8c79d9c Initial commit
Vincent Tondellier <tonton+hg@team1664.org>
parents:
diff changeset
  1276
!function ($) {
5b78b8c79d9c Initial commit
Vincent Tondellier <tonton+hg@team1664.org>
parents:
diff changeset
  1277
5b78b8c79d9c Initial commit
Vincent Tondellier <tonton+hg@team1664.org>
parents:
diff changeset
  1278
  "use strict"; // jshint ;_;
5b78b8c79d9c Initial commit
Vincent Tondellier <tonton+hg@team1664.org>
parents:
diff changeset
  1279
5b78b8c79d9c Initial commit
Vincent Tondellier <tonton+hg@team1664.org>
parents:
diff changeset
  1280
5b78b8c79d9c Initial commit
Vincent Tondellier <tonton+hg@team1664.org>
parents:
diff changeset
  1281
  /* SCROLLSPY CLASS DEFINITION
5b78b8c79d9c Initial commit
Vincent Tondellier <tonton+hg@team1664.org>
parents:
diff changeset
  1282
   * ========================== */
5b78b8c79d9c Initial commit
Vincent Tondellier <tonton+hg@team1664.org>
parents:
diff changeset
  1283
5b78b8c79d9c Initial commit
Vincent Tondellier <tonton+hg@team1664.org>
parents:
diff changeset
  1284
  function ScrollSpy( element, options) {
5b78b8c79d9c Initial commit
Vincent Tondellier <tonton+hg@team1664.org>
parents:
diff changeset
  1285
    var process = $.proxy(this.process, this)
5b78b8c79d9c Initial commit
Vincent Tondellier <tonton+hg@team1664.org>
parents:
diff changeset
  1286
      , $element = $(element).is('body') ? $(window) : $(element)
5b78b8c79d9c Initial commit
Vincent Tondellier <tonton+hg@team1664.org>
parents:
diff changeset
  1287
      , href
5b78b8c79d9c Initial commit
Vincent Tondellier <tonton+hg@team1664.org>
parents:
diff changeset
  1288
    this.options = $.extend({}, $.fn.scrollspy.defaults, options)
5b78b8c79d9c Initial commit
Vincent Tondellier <tonton+hg@team1664.org>
parents:
diff changeset
  1289
    this.$scrollElement = $element.on('scroll.scroll.data-api', process)
5b78b8c79d9c Initial commit
Vincent Tondellier <tonton+hg@team1664.org>
parents:
diff changeset
  1290
    this.selector = (this.options.target
5b78b8c79d9c Initial commit
Vincent Tondellier <tonton+hg@team1664.org>
parents:
diff changeset
  1291
      || ((href = $(element).attr('href')) && href.replace(/.*(?=#[^\s]+$)/, '')) //strip for ie7
5b78b8c79d9c Initial commit
Vincent Tondellier <tonton+hg@team1664.org>
parents:
diff changeset
  1292
      || '') + ' .nav li > a'
5b78b8c79d9c Initial commit
Vincent Tondellier <tonton+hg@team1664.org>
parents:
diff changeset
  1293
    this.$body = $('body')
5b78b8c79d9c Initial commit
Vincent Tondellier <tonton+hg@team1664.org>
parents:
diff changeset
  1294
    this.refresh()
5b78b8c79d9c Initial commit
Vincent Tondellier <tonton+hg@team1664.org>
parents:
diff changeset
  1295
    this.process()
5b78b8c79d9c Initial commit
Vincent Tondellier <tonton+hg@team1664.org>
parents:
diff changeset
  1296
  }
5b78b8c79d9c Initial commit
Vincent Tondellier <tonton+hg@team1664.org>
parents:
diff changeset
  1297
5b78b8c79d9c Initial commit
Vincent Tondellier <tonton+hg@team1664.org>
parents:
diff changeset
  1298
  ScrollSpy.prototype = {
5b78b8c79d9c Initial commit
Vincent Tondellier <tonton+hg@team1664.org>
parents:
diff changeset
  1299
5b78b8c79d9c Initial commit
Vincent Tondellier <tonton+hg@team1664.org>
parents:
diff changeset
  1300
      constructor: ScrollSpy
5b78b8c79d9c Initial commit
Vincent Tondellier <tonton+hg@team1664.org>
parents:
diff changeset
  1301
5b78b8c79d9c Initial commit
Vincent Tondellier <tonton+hg@team1664.org>
parents:
diff changeset
  1302
    , refresh: function () {
5b78b8c79d9c Initial commit
Vincent Tondellier <tonton+hg@team1664.org>
parents:
diff changeset
  1303
        var self = this
5b78b8c79d9c Initial commit
Vincent Tondellier <tonton+hg@team1664.org>
parents:
diff changeset
  1304
          , $targets
5b78b8c79d9c Initial commit
Vincent Tondellier <tonton+hg@team1664.org>
parents:
diff changeset
  1305
5b78b8c79d9c Initial commit
Vincent Tondellier <tonton+hg@team1664.org>
parents:
diff changeset
  1306
        this.offsets = $([])
5b78b8c79d9c Initial commit
Vincent Tondellier <tonton+hg@team1664.org>
parents:
diff changeset
  1307
        this.targets = $([])
5b78b8c79d9c Initial commit
Vincent Tondellier <tonton+hg@team1664.org>
parents:
diff changeset
  1308
5b78b8c79d9c Initial commit
Vincent Tondellier <tonton+hg@team1664.org>
parents:
diff changeset
  1309
        $targets = this.$body
5b78b8c79d9c Initial commit
Vincent Tondellier <tonton+hg@team1664.org>
parents:
diff changeset
  1310
          .find(this.selector)
5b78b8c79d9c Initial commit
Vincent Tondellier <tonton+hg@team1664.org>
parents:
diff changeset
  1311
          .map(function () {
5b78b8c79d9c Initial commit
Vincent Tondellier <tonton+hg@team1664.org>
parents:
diff changeset
  1312
            var $el = $(this)
5b78b8c79d9c Initial commit
Vincent Tondellier <tonton+hg@team1664.org>
parents:
diff changeset
  1313
              , href = $el.data('target') || $el.attr('href')
5b78b8c79d9c Initial commit
Vincent Tondellier <tonton+hg@team1664.org>
parents:
diff changeset
  1314
              , $href = /^#\w/.test(href) && $(href)
5b78b8c79d9c Initial commit
Vincent Tondellier <tonton+hg@team1664.org>
parents:
diff changeset
  1315
            return ( $href
5b78b8c79d9c Initial commit
Vincent Tondellier <tonton+hg@team1664.org>
parents:
diff changeset
  1316
              && href.length
5b78b8c79d9c Initial commit
Vincent Tondellier <tonton+hg@team1664.org>
parents:
diff changeset
  1317
              && [[ $href.position().top, href ]] ) || null
5b78b8c79d9c Initial commit
Vincent Tondellier <tonton+hg@team1664.org>
parents:
diff changeset
  1318
          })
5b78b8c79d9c Initial commit
Vincent Tondellier <tonton+hg@team1664.org>
parents:
diff changeset
  1319
          .sort(function (a, b) { return a[0] - b[0] })
5b78b8c79d9c Initial commit
Vincent Tondellier <tonton+hg@team1664.org>
parents:
diff changeset
  1320
          .each(function () {
5b78b8c79d9c Initial commit
Vincent Tondellier <tonton+hg@team1664.org>
parents:
diff changeset
  1321
            self.offsets.push(this[0])
5b78b8c79d9c Initial commit
Vincent Tondellier <tonton+hg@team1664.org>
parents:
diff changeset
  1322
            self.targets.push(this[1])
5b78b8c79d9c Initial commit
Vincent Tondellier <tonton+hg@team1664.org>
parents:
diff changeset
  1323
          })
5b78b8c79d9c Initial commit
Vincent Tondellier <tonton+hg@team1664.org>
parents:
diff changeset
  1324
      }
5b78b8c79d9c Initial commit
Vincent Tondellier <tonton+hg@team1664.org>
parents:
diff changeset
  1325
5b78b8c79d9c Initial commit
Vincent Tondellier <tonton+hg@team1664.org>
parents:
diff changeset
  1326
    , process: function () {
5b78b8c79d9c Initial commit
Vincent Tondellier <tonton+hg@team1664.org>
parents:
diff changeset
  1327
        var scrollTop = this.$scrollElement.scrollTop() + this.options.offset
5b78b8c79d9c Initial commit
Vincent Tondellier <tonton+hg@team1664.org>
parents:
diff changeset
  1328
          , scrollHeight = this.$scrollElement[0].scrollHeight || this.$body[0].scrollHeight
5b78b8c79d9c Initial commit
Vincent Tondellier <tonton+hg@team1664.org>
parents:
diff changeset
  1329
          , maxScroll = scrollHeight - this.$scrollElement.height()
5b78b8c79d9c Initial commit
Vincent Tondellier <tonton+hg@team1664.org>
parents:
diff changeset
  1330
          , offsets = this.offsets
5b78b8c79d9c Initial commit
Vincent Tondellier <tonton+hg@team1664.org>
parents:
diff changeset
  1331
          , targets = this.targets
5b78b8c79d9c Initial commit
Vincent Tondellier <tonton+hg@team1664.org>
parents:
diff changeset
  1332
          , activeTarget = this.activeTarget
5b78b8c79d9c Initial commit
Vincent Tondellier <tonton+hg@team1664.org>
parents:
diff changeset
  1333
          , i
5b78b8c79d9c Initial commit
Vincent Tondellier <tonton+hg@team1664.org>
parents:
diff changeset
  1334
5b78b8c79d9c Initial commit
Vincent Tondellier <tonton+hg@team1664.org>
parents:
diff changeset
  1335
        if (scrollTop >= maxScroll) {
5b78b8c79d9c Initial commit
Vincent Tondellier <tonton+hg@team1664.org>
parents:
diff changeset
  1336
          return activeTarget != (i = targets.last()[0])
5b78b8c79d9c Initial commit
Vincent Tondellier <tonton+hg@team1664.org>
parents:
diff changeset
  1337
            && this.activate ( i )
5b78b8c79d9c Initial commit
Vincent Tondellier <tonton+hg@team1664.org>
parents:
diff changeset
  1338
        }
5b78b8c79d9c Initial commit
Vincent Tondellier <tonton+hg@team1664.org>
parents:
diff changeset
  1339
5b78b8c79d9c Initial commit
Vincent Tondellier <tonton+hg@team1664.org>
parents:
diff changeset
  1340
        for (i = offsets.length; i--;) {
5b78b8c79d9c Initial commit
Vincent Tondellier <tonton+hg@team1664.org>
parents:
diff changeset
  1341
          activeTarget != targets[i]
5b78b8c79d9c Initial commit
Vincent Tondellier <tonton+hg@team1664.org>
parents:
diff changeset
  1342
            && scrollTop >= offsets[i]
5b78b8c79d9c Initial commit
Vincent Tondellier <tonton+hg@team1664.org>
parents:
diff changeset
  1343
            && (!offsets[i + 1] || scrollTop <= offsets[i + 1])
5b78b8c79d9c Initial commit
Vincent Tondellier <tonton+hg@team1664.org>
parents:
diff changeset
  1344
            && this.activate( targets[i] )
5b78b8c79d9c Initial commit
Vincent Tondellier <tonton+hg@team1664.org>
parents:
diff changeset
  1345
        }
5b78b8c79d9c Initial commit
Vincent Tondellier <tonton+hg@team1664.org>
parents:
diff changeset
  1346
      }
5b78b8c79d9c Initial commit
Vincent Tondellier <tonton+hg@team1664.org>
parents:
diff changeset
  1347
5b78b8c79d9c Initial commit
Vincent Tondellier <tonton+hg@team1664.org>
parents:
diff changeset
  1348
    , activate: function (target) {
5b78b8c79d9c Initial commit
Vincent Tondellier <tonton+hg@team1664.org>
parents:
diff changeset
  1349
        var active
5b78b8c79d9c Initial commit
Vincent Tondellier <tonton+hg@team1664.org>
parents:
diff changeset
  1350
          , selector
5b78b8c79d9c Initial commit
Vincent Tondellier <tonton+hg@team1664.org>
parents:
diff changeset
  1351
5b78b8c79d9c Initial commit
Vincent Tondellier <tonton+hg@team1664.org>
parents:
diff changeset
  1352
        this.activeTarget = target
5b78b8c79d9c Initial commit
Vincent Tondellier <tonton+hg@team1664.org>
parents:
diff changeset
  1353
5b78b8c79d9c Initial commit
Vincent Tondellier <tonton+hg@team1664.org>
parents:
diff changeset
  1354
        $(this.selector)
5b78b8c79d9c Initial commit
Vincent Tondellier <tonton+hg@team1664.org>
parents:
diff changeset
  1355
          .parent('.active')
5b78b8c79d9c Initial commit
Vincent Tondellier <tonton+hg@team1664.org>
parents:
diff changeset
  1356
          .removeClass('active')
5b78b8c79d9c Initial commit
Vincent Tondellier <tonton+hg@team1664.org>
parents:
diff changeset
  1357
5b78b8c79d9c Initial commit
Vincent Tondellier <tonton+hg@team1664.org>
parents:
diff changeset
  1358
        selector = this.selector
5b78b8c79d9c Initial commit
Vincent Tondellier <tonton+hg@team1664.org>
parents:
diff changeset
  1359
          + '[data-target="' + target + '"],'
5b78b8c79d9c Initial commit
Vincent Tondellier <tonton+hg@team1664.org>
parents:
diff changeset
  1360
          + this.selector + '[href="' + target + '"]'
5b78b8c79d9c Initial commit
Vincent Tondellier <tonton+hg@team1664.org>
parents:
diff changeset
  1361
5b78b8c79d9c Initial commit
Vincent Tondellier <tonton+hg@team1664.org>
parents:
diff changeset
  1362
        active = $(selector)
5b78b8c79d9c Initial commit
Vincent Tondellier <tonton+hg@team1664.org>
parents:
diff changeset
  1363
          .parent('li')
5b78b8c79d9c Initial commit
Vincent Tondellier <tonton+hg@team1664.org>
parents:
diff changeset
  1364
          .addClass('active')
5b78b8c79d9c Initial commit
Vincent Tondellier <tonton+hg@team1664.org>
parents:
diff changeset
  1365
5b78b8c79d9c Initial commit
Vincent Tondellier <tonton+hg@team1664.org>
parents:
diff changeset
  1366
        if (active.parent('.dropdown-menu'))  {
5b78b8c79d9c Initial commit
Vincent Tondellier <tonton+hg@team1664.org>
parents:
diff changeset
  1367
          active = active.closest('li.dropdown').addClass('active')
5b78b8c79d9c Initial commit
Vincent Tondellier <tonton+hg@team1664.org>
parents:
diff changeset
  1368
        }
5b78b8c79d9c Initial commit
Vincent Tondellier <tonton+hg@team1664.org>
parents:
diff changeset
  1369
5b78b8c79d9c Initial commit
Vincent Tondellier <tonton+hg@team1664.org>
parents:
diff changeset
  1370
        active.trigger('activate')
5b78b8c79d9c Initial commit
Vincent Tondellier <tonton+hg@team1664.org>
parents:
diff changeset
  1371
      }
5b78b8c79d9c Initial commit
Vincent Tondellier <tonton+hg@team1664.org>
parents:
diff changeset
  1372
5b78b8c79d9c Initial commit
Vincent Tondellier <tonton+hg@team1664.org>
parents:
diff changeset
  1373
  }
5b78b8c79d9c Initial commit
Vincent Tondellier <tonton+hg@team1664.org>
parents:
diff changeset
  1374
5b78b8c79d9c Initial commit
Vincent Tondellier <tonton+hg@team1664.org>
parents:
diff changeset
  1375
5b78b8c79d9c Initial commit
Vincent Tondellier <tonton+hg@team1664.org>
parents:
diff changeset
  1376
 /* SCROLLSPY PLUGIN DEFINITION
5b78b8c79d9c Initial commit
Vincent Tondellier <tonton+hg@team1664.org>
parents:
diff changeset
  1377
  * =========================== */
5b78b8c79d9c Initial commit
Vincent Tondellier <tonton+hg@team1664.org>
parents:
diff changeset
  1378
5b78b8c79d9c Initial commit
Vincent Tondellier <tonton+hg@team1664.org>
parents:
diff changeset
  1379
  $.fn.scrollspy = function ( option ) {
5b78b8c79d9c Initial commit
Vincent Tondellier <tonton+hg@team1664.org>
parents:
diff changeset
  1380
    return this.each(function () {
5b78b8c79d9c Initial commit
Vincent Tondellier <tonton+hg@team1664.org>
parents:
diff changeset
  1381
      var $this = $(this)
5b78b8c79d9c Initial commit
Vincent Tondellier <tonton+hg@team1664.org>
parents:
diff changeset
  1382
        , data = $this.data('scrollspy')
5b78b8c79d9c Initial commit
Vincent Tondellier <tonton+hg@team1664.org>
parents:
diff changeset
  1383
        , options = typeof option == 'object' && option
5b78b8c79d9c Initial commit
Vincent Tondellier <tonton+hg@team1664.org>
parents:
diff changeset
  1384
      if (!data) $this.data('scrollspy', (data = new ScrollSpy(this, options)))
5b78b8c79d9c Initial commit
Vincent Tondellier <tonton+hg@team1664.org>
parents:
diff changeset
  1385
      if (typeof option == 'string') data[option]()
5b78b8c79d9c Initial commit
Vincent Tondellier <tonton+hg@team1664.org>
parents:
diff changeset
  1386
    })
5b78b8c79d9c Initial commit
Vincent Tondellier <tonton+hg@team1664.org>
parents:
diff changeset
  1387
  }
5b78b8c79d9c Initial commit
Vincent Tondellier <tonton+hg@team1664.org>
parents:
diff changeset
  1388
5b78b8c79d9c Initial commit
Vincent Tondellier <tonton+hg@team1664.org>
parents:
diff changeset
  1389
  $.fn.scrollspy.Constructor = ScrollSpy
5b78b8c79d9c Initial commit
Vincent Tondellier <tonton+hg@team1664.org>
parents:
diff changeset
  1390
5b78b8c79d9c Initial commit
Vincent Tondellier <tonton+hg@team1664.org>
parents:
diff changeset
  1391
  $.fn.scrollspy.defaults = {
5b78b8c79d9c Initial commit
Vincent Tondellier <tonton+hg@team1664.org>
parents:
diff changeset
  1392
    offset: 10
5b78b8c79d9c Initial commit
Vincent Tondellier <tonton+hg@team1664.org>
parents:
diff changeset
  1393
  }
5b78b8c79d9c Initial commit
Vincent Tondellier <tonton+hg@team1664.org>
parents:
diff changeset
  1394
5b78b8c79d9c Initial commit
Vincent Tondellier <tonton+hg@team1664.org>
parents:
diff changeset
  1395
5b78b8c79d9c Initial commit
Vincent Tondellier <tonton+hg@team1664.org>
parents:
diff changeset
  1396
 /* SCROLLSPY DATA-API
5b78b8c79d9c Initial commit
Vincent Tondellier <tonton+hg@team1664.org>
parents:
diff changeset
  1397
  * ================== */
5b78b8c79d9c Initial commit
Vincent Tondellier <tonton+hg@team1664.org>
parents:
diff changeset
  1398
5b78b8c79d9c Initial commit
Vincent Tondellier <tonton+hg@team1664.org>
parents:
diff changeset
  1399
  $(function () {
5b78b8c79d9c Initial commit
Vincent Tondellier <tonton+hg@team1664.org>
parents:
diff changeset
  1400
    $('[data-spy="scroll"]').each(function () {
5b78b8c79d9c Initial commit
Vincent Tondellier <tonton+hg@team1664.org>
parents:
diff changeset
  1401
      var $spy = $(this)
5b78b8c79d9c Initial commit
Vincent Tondellier <tonton+hg@team1664.org>
parents:
diff changeset
  1402
      $spy.scrollspy($spy.data())
5b78b8c79d9c Initial commit
Vincent Tondellier <tonton+hg@team1664.org>
parents:
diff changeset
  1403
    })
5b78b8c79d9c Initial commit
Vincent Tondellier <tonton+hg@team1664.org>
parents:
diff changeset
  1404
  })
5b78b8c79d9c Initial commit
Vincent Tondellier <tonton+hg@team1664.org>
parents:
diff changeset
  1405
5b78b8c79d9c Initial commit
Vincent Tondellier <tonton+hg@team1664.org>
parents:
diff changeset
  1406
}(window.jQuery);/* ========================================================
5b78b8c79d9c Initial commit
Vincent Tondellier <tonton+hg@team1664.org>
parents:
diff changeset
  1407
 * bootstrap-tab.js v2.0.3
5b78b8c79d9c Initial commit
Vincent Tondellier <tonton+hg@team1664.org>
parents:
diff changeset
  1408
 * http://twitter.github.com/bootstrap/javascript.html#tabs
5b78b8c79d9c Initial commit
Vincent Tondellier <tonton+hg@team1664.org>
parents:
diff changeset
  1409
 * ========================================================
5b78b8c79d9c Initial commit
Vincent Tondellier <tonton+hg@team1664.org>
parents:
diff changeset
  1410
 * Copyright 2012 Twitter, Inc.
5b78b8c79d9c Initial commit
Vincent Tondellier <tonton+hg@team1664.org>
parents:
diff changeset
  1411
 *
5b78b8c79d9c Initial commit
Vincent Tondellier <tonton+hg@team1664.org>
parents:
diff changeset
  1412
 * Licensed under the Apache License, Version 2.0 (the "License");
5b78b8c79d9c Initial commit
Vincent Tondellier <tonton+hg@team1664.org>
parents:
diff changeset
  1413
 * you may not use this file except in compliance with the License.
5b78b8c79d9c Initial commit
Vincent Tondellier <tonton+hg@team1664.org>
parents:
diff changeset
  1414
 * You may obtain a copy of the License at
5b78b8c79d9c Initial commit
Vincent Tondellier <tonton+hg@team1664.org>
parents:
diff changeset
  1415
 *
5b78b8c79d9c Initial commit
Vincent Tondellier <tonton+hg@team1664.org>
parents:
diff changeset
  1416
 * http://www.apache.org/licenses/LICENSE-2.0
5b78b8c79d9c Initial commit
Vincent Tondellier <tonton+hg@team1664.org>
parents:
diff changeset
  1417
 *
5b78b8c79d9c Initial commit
Vincent Tondellier <tonton+hg@team1664.org>
parents:
diff changeset
  1418
 * Unless required by applicable law or agreed to in writing, software
5b78b8c79d9c Initial commit
Vincent Tondellier <tonton+hg@team1664.org>
parents:
diff changeset
  1419
 * distributed under the License is distributed on an "AS IS" BASIS,
5b78b8c79d9c Initial commit
Vincent Tondellier <tonton+hg@team1664.org>
parents:
diff changeset
  1420
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
5b78b8c79d9c Initial commit
Vincent Tondellier <tonton+hg@team1664.org>
parents:
diff changeset
  1421
 * See the License for the specific language governing permissions and
5b78b8c79d9c Initial commit
Vincent Tondellier <tonton+hg@team1664.org>
parents:
diff changeset
  1422
 * limitations under the License.
5b78b8c79d9c Initial commit
Vincent Tondellier <tonton+hg@team1664.org>
parents:
diff changeset
  1423
 * ======================================================== */
5b78b8c79d9c Initial commit
Vincent Tondellier <tonton+hg@team1664.org>
parents:
diff changeset
  1424
5b78b8c79d9c Initial commit
Vincent Tondellier <tonton+hg@team1664.org>
parents:
diff changeset
  1425
5b78b8c79d9c Initial commit
Vincent Tondellier <tonton+hg@team1664.org>
parents:
diff changeset
  1426
!function ($) {
5b78b8c79d9c Initial commit
Vincent Tondellier <tonton+hg@team1664.org>
parents:
diff changeset
  1427
5b78b8c79d9c Initial commit
Vincent Tondellier <tonton+hg@team1664.org>
parents:
diff changeset
  1428
  "use strict"; // jshint ;_;
5b78b8c79d9c Initial commit
Vincent Tondellier <tonton+hg@team1664.org>
parents:
diff changeset
  1429
5b78b8c79d9c Initial commit
Vincent Tondellier <tonton+hg@team1664.org>
parents:
diff changeset
  1430
5b78b8c79d9c Initial commit
Vincent Tondellier <tonton+hg@team1664.org>
parents:
diff changeset
  1431
 /* TAB CLASS DEFINITION
5b78b8c79d9c Initial commit
Vincent Tondellier <tonton+hg@team1664.org>
parents:
diff changeset
  1432
  * ==================== */
5b78b8c79d9c Initial commit
Vincent Tondellier <tonton+hg@team1664.org>
parents:
diff changeset
  1433
5b78b8c79d9c Initial commit
Vincent Tondellier <tonton+hg@team1664.org>
parents:
diff changeset
  1434
  var Tab = function ( element ) {
5b78b8c79d9c Initial commit
Vincent Tondellier <tonton+hg@team1664.org>
parents:
diff changeset
  1435
    this.element = $(element)
5b78b8c79d9c Initial commit
Vincent Tondellier <tonton+hg@team1664.org>
parents:
diff changeset
  1436
  }
5b78b8c79d9c Initial commit
Vincent Tondellier <tonton+hg@team1664.org>
parents:
diff changeset
  1437
5b78b8c79d9c Initial commit
Vincent Tondellier <tonton+hg@team1664.org>
parents:
diff changeset
  1438
  Tab.prototype = {
5b78b8c79d9c Initial commit
Vincent Tondellier <tonton+hg@team1664.org>
parents:
diff changeset
  1439
5b78b8c79d9c Initial commit
Vincent Tondellier <tonton+hg@team1664.org>
parents:
diff changeset
  1440
    constructor: Tab
5b78b8c79d9c Initial commit
Vincent Tondellier <tonton+hg@team1664.org>
parents:
diff changeset
  1441
5b78b8c79d9c Initial commit
Vincent Tondellier <tonton+hg@team1664.org>
parents:
diff changeset
  1442
  , show: function () {
5b78b8c79d9c Initial commit
Vincent Tondellier <tonton+hg@team1664.org>
parents:
diff changeset
  1443
      var $this = this.element
5b78b8c79d9c Initial commit
Vincent Tondellier <tonton+hg@team1664.org>
parents:
diff changeset
  1444
        , $ul = $this.closest('ul:not(.dropdown-menu)')
5b78b8c79d9c Initial commit
Vincent Tondellier <tonton+hg@team1664.org>
parents:
diff changeset
  1445
        , selector = $this.attr('data-target')
5b78b8c79d9c Initial commit
Vincent Tondellier <tonton+hg@team1664.org>
parents:
diff changeset
  1446
        , previous
5b78b8c79d9c Initial commit
Vincent Tondellier <tonton+hg@team1664.org>
parents:
diff changeset
  1447
        , $target
5b78b8c79d9c Initial commit
Vincent Tondellier <tonton+hg@team1664.org>
parents:
diff changeset
  1448
        , e
5b78b8c79d9c Initial commit
Vincent Tondellier <tonton+hg@team1664.org>
parents:
diff changeset
  1449
5b78b8c79d9c Initial commit
Vincent Tondellier <tonton+hg@team1664.org>
parents:
diff changeset
  1450
      if (!selector) {
5b78b8c79d9c Initial commit
Vincent Tondellier <tonton+hg@team1664.org>
parents:
diff changeset
  1451
        selector = $this.attr('href')
5b78b8c79d9c Initial commit
Vincent Tondellier <tonton+hg@team1664.org>
parents:
diff changeset
  1452
        selector = selector && selector.replace(/.*(?=#[^\s]*$)/, '') //strip for ie7
5b78b8c79d9c Initial commit
Vincent Tondellier <tonton+hg@team1664.org>
parents:
diff changeset
  1453
      }
5b78b8c79d9c Initial commit
Vincent Tondellier <tonton+hg@team1664.org>
parents:
diff changeset
  1454
5b78b8c79d9c Initial commit
Vincent Tondellier <tonton+hg@team1664.org>
parents:
diff changeset
  1455
      if ( $this.parent('li').hasClass('active') ) return
5b78b8c79d9c Initial commit
Vincent Tondellier <tonton+hg@team1664.org>
parents:
diff changeset
  1456
5b78b8c79d9c Initial commit
Vincent Tondellier <tonton+hg@team1664.org>
parents:
diff changeset
  1457
      previous = $ul.find('.active a').last()[0]
5b78b8c79d9c Initial commit
Vincent Tondellier <tonton+hg@team1664.org>
parents:
diff changeset
  1458
5b78b8c79d9c Initial commit
Vincent Tondellier <tonton+hg@team1664.org>
parents:
diff changeset
  1459
      e = $.Event('show', {
5b78b8c79d9c Initial commit
Vincent Tondellier <tonton+hg@team1664.org>
parents:
diff changeset
  1460
        relatedTarget: previous
5b78b8c79d9c Initial commit
Vincent Tondellier <tonton+hg@team1664.org>
parents:
diff changeset
  1461
      })
5b78b8c79d9c Initial commit
Vincent Tondellier <tonton+hg@team1664.org>
parents:
diff changeset
  1462
5b78b8c79d9c Initial commit
Vincent Tondellier <tonton+hg@team1664.org>
parents:
diff changeset
  1463
      $this.trigger(e)
5b78b8c79d9c Initial commit
Vincent Tondellier <tonton+hg@team1664.org>
parents:
diff changeset
  1464
5b78b8c79d9c Initial commit
Vincent Tondellier <tonton+hg@team1664.org>
parents:
diff changeset
  1465
      if (e.isDefaultPrevented()) return
5b78b8c79d9c Initial commit
Vincent Tondellier <tonton+hg@team1664.org>
parents:
diff changeset
  1466
5b78b8c79d9c Initial commit
Vincent Tondellier <tonton+hg@team1664.org>
parents:
diff changeset
  1467
      $target = $(selector)
5b78b8c79d9c Initial commit
Vincent Tondellier <tonton+hg@team1664.org>
parents:
diff changeset
  1468
5b78b8c79d9c Initial commit
Vincent Tondellier <tonton+hg@team1664.org>
parents:
diff changeset
  1469
      this.activate($this.parent('li'), $ul)
5b78b8c79d9c Initial commit
Vincent Tondellier <tonton+hg@team1664.org>
parents:
diff changeset
  1470
      this.activate($target, $target.parent(), function () {
5b78b8c79d9c Initial commit
Vincent Tondellier <tonton+hg@team1664.org>
parents:
diff changeset
  1471
        $this.trigger({
5b78b8c79d9c Initial commit
Vincent Tondellier <tonton+hg@team1664.org>
parents:
diff changeset
  1472
          type: 'shown'
5b78b8c79d9c Initial commit
Vincent Tondellier <tonton+hg@team1664.org>
parents:
diff changeset
  1473
        , relatedTarget: previous
5b78b8c79d9c Initial commit
Vincent Tondellier <tonton+hg@team1664.org>
parents:
diff changeset
  1474
        })
5b78b8c79d9c Initial commit
Vincent Tondellier <tonton+hg@team1664.org>
parents:
diff changeset
  1475
      })
5b78b8c79d9c Initial commit
Vincent Tondellier <tonton+hg@team1664.org>
parents:
diff changeset
  1476
    }
5b78b8c79d9c Initial commit
Vincent Tondellier <tonton+hg@team1664.org>
parents:
diff changeset
  1477
5b78b8c79d9c Initial commit
Vincent Tondellier <tonton+hg@team1664.org>
parents:
diff changeset
  1478
  , activate: function ( element, container, callback) {
5b78b8c79d9c Initial commit
Vincent Tondellier <tonton+hg@team1664.org>
parents:
diff changeset
  1479
      var $active = container.find('> .active')
5b78b8c79d9c Initial commit
Vincent Tondellier <tonton+hg@team1664.org>
parents:
diff changeset
  1480
        , transition = callback
5b78b8c79d9c Initial commit
Vincent Tondellier <tonton+hg@team1664.org>
parents:
diff changeset
  1481
            && $.support.transition
5b78b8c79d9c Initial commit
Vincent Tondellier <tonton+hg@team1664.org>
parents:
diff changeset
  1482
            && $active.hasClass('fade')
5b78b8c79d9c Initial commit
Vincent Tondellier <tonton+hg@team1664.org>
parents:
diff changeset
  1483
5b78b8c79d9c Initial commit
Vincent Tondellier <tonton+hg@team1664.org>
parents:
diff changeset
  1484
      function next() {
5b78b8c79d9c Initial commit
Vincent Tondellier <tonton+hg@team1664.org>
parents:
diff changeset
  1485
        $active
5b78b8c79d9c Initial commit
Vincent Tondellier <tonton+hg@team1664.org>
parents:
diff changeset
  1486
          .removeClass('active')
5b78b8c79d9c Initial commit
Vincent Tondellier <tonton+hg@team1664.org>
parents:
diff changeset
  1487
          .find('> .dropdown-menu > .active')
5b78b8c79d9c Initial commit
Vincent Tondellier <tonton+hg@team1664.org>
parents:
diff changeset
  1488
          .removeClass('active')
5b78b8c79d9c Initial commit
Vincent Tondellier <tonton+hg@team1664.org>
parents:
diff changeset
  1489
5b78b8c79d9c Initial commit
Vincent Tondellier <tonton+hg@team1664.org>
parents:
diff changeset
  1490
        element.addClass('active')
5b78b8c79d9c Initial commit
Vincent Tondellier <tonton+hg@team1664.org>
parents:
diff changeset
  1491
5b78b8c79d9c Initial commit
Vincent Tondellier <tonton+hg@team1664.org>
parents:
diff changeset
  1492
        if (transition) {
5b78b8c79d9c Initial commit
Vincent Tondellier <tonton+hg@team1664.org>
parents:
diff changeset
  1493
          element[0].offsetWidth // reflow for transition
5b78b8c79d9c Initial commit
Vincent Tondellier <tonton+hg@team1664.org>
parents:
diff changeset
  1494
          element.addClass('in')
5b78b8c79d9c Initial commit
Vincent Tondellier <tonton+hg@team1664.org>
parents:
diff changeset
  1495
        } else {
5b78b8c79d9c Initial commit
Vincent Tondellier <tonton+hg@team1664.org>
parents:
diff changeset
  1496
          element.removeClass('fade')
5b78b8c79d9c Initial commit
Vincent Tondellier <tonton+hg@team1664.org>
parents:
diff changeset
  1497
        }
5b78b8c79d9c Initial commit
Vincent Tondellier <tonton+hg@team1664.org>
parents:
diff changeset
  1498
5b78b8c79d9c Initial commit
Vincent Tondellier <tonton+hg@team1664.org>
parents:
diff changeset
  1499
        if ( element.parent('.dropdown-menu') ) {
5b78b8c79d9c Initial commit
Vincent Tondellier <tonton+hg@team1664.org>
parents:
diff changeset
  1500
          element.closest('li.dropdown').addClass('active')
5b78b8c79d9c Initial commit
Vincent Tondellier <tonton+hg@team1664.org>
parents:
diff changeset
  1501
        }
5b78b8c79d9c Initial commit
Vincent Tondellier <tonton+hg@team1664.org>
parents:
diff changeset
  1502
5b78b8c79d9c Initial commit
Vincent Tondellier <tonton+hg@team1664.org>
parents:
diff changeset
  1503
        callback && callback()
5b78b8c79d9c Initial commit
Vincent Tondellier <tonton+hg@team1664.org>
parents:
diff changeset
  1504
      }
5b78b8c79d9c Initial commit
Vincent Tondellier <tonton+hg@team1664.org>
parents:
diff changeset
  1505
5b78b8c79d9c Initial commit
Vincent Tondellier <tonton+hg@team1664.org>
parents:
diff changeset
  1506
      transition ?
5b78b8c79d9c Initial commit
Vincent Tondellier <tonton+hg@team1664.org>
parents:
diff changeset
  1507
        $active.one($.support.transition.end, next) :
5b78b8c79d9c Initial commit
Vincent Tondellier <tonton+hg@team1664.org>
parents:
diff changeset
  1508
        next()
5b78b8c79d9c Initial commit
Vincent Tondellier <tonton+hg@team1664.org>
parents:
diff changeset
  1509
5b78b8c79d9c Initial commit
Vincent Tondellier <tonton+hg@team1664.org>
parents:
diff changeset
  1510
      $active.removeClass('in')
5b78b8c79d9c Initial commit
Vincent Tondellier <tonton+hg@team1664.org>
parents:
diff changeset
  1511
    }
5b78b8c79d9c Initial commit
Vincent Tondellier <tonton+hg@team1664.org>
parents:
diff changeset
  1512
  }
5b78b8c79d9c Initial commit
Vincent Tondellier <tonton+hg@team1664.org>
parents:
diff changeset
  1513
5b78b8c79d9c Initial commit
Vincent Tondellier <tonton+hg@team1664.org>
parents:
diff changeset
  1514
5b78b8c79d9c Initial commit
Vincent Tondellier <tonton+hg@team1664.org>
parents:
diff changeset
  1515
 /* TAB PLUGIN DEFINITION
5b78b8c79d9c Initial commit
Vincent Tondellier <tonton+hg@team1664.org>
parents:
diff changeset
  1516
  * ===================== */
5b78b8c79d9c Initial commit
Vincent Tondellier <tonton+hg@team1664.org>
parents:
diff changeset
  1517
5b78b8c79d9c Initial commit
Vincent Tondellier <tonton+hg@team1664.org>
parents:
diff changeset
  1518
  $.fn.tab = function ( option ) {
5b78b8c79d9c Initial commit
Vincent Tondellier <tonton+hg@team1664.org>
parents:
diff changeset
  1519
    return this.each(function () {
5b78b8c79d9c Initial commit
Vincent Tondellier <tonton+hg@team1664.org>
parents:
diff changeset
  1520
      var $this = $(this)
5b78b8c79d9c Initial commit
Vincent Tondellier <tonton+hg@team1664.org>
parents:
diff changeset
  1521
        , data = $this.data('tab')
5b78b8c79d9c Initial commit
Vincent Tondellier <tonton+hg@team1664.org>
parents:
diff changeset
  1522
      if (!data) $this.data('tab', (data = new Tab(this)))
5b78b8c79d9c Initial commit
Vincent Tondellier <tonton+hg@team1664.org>
parents:
diff changeset
  1523
      if (typeof option == 'string') data[option]()
5b78b8c79d9c Initial commit
Vincent Tondellier <tonton+hg@team1664.org>
parents:
diff changeset
  1524
    })
5b78b8c79d9c Initial commit
Vincent Tondellier <tonton+hg@team1664.org>
parents:
diff changeset
  1525
  }
5b78b8c79d9c Initial commit
Vincent Tondellier <tonton+hg@team1664.org>
parents:
diff changeset
  1526
5b78b8c79d9c Initial commit
Vincent Tondellier <tonton+hg@team1664.org>
parents:
diff changeset
  1527
  $.fn.tab.Constructor = Tab
5b78b8c79d9c Initial commit
Vincent Tondellier <tonton+hg@team1664.org>
parents:
diff changeset
  1528
5b78b8c79d9c Initial commit
Vincent Tondellier <tonton+hg@team1664.org>
parents:
diff changeset
  1529
5b78b8c79d9c Initial commit
Vincent Tondellier <tonton+hg@team1664.org>
parents:
diff changeset
  1530
 /* TAB DATA-API
5b78b8c79d9c Initial commit
Vincent Tondellier <tonton+hg@team1664.org>
parents:
diff changeset
  1531
  * ============ */
5b78b8c79d9c Initial commit
Vincent Tondellier <tonton+hg@team1664.org>
parents:
diff changeset
  1532
5b78b8c79d9c Initial commit
Vincent Tondellier <tonton+hg@team1664.org>
parents:
diff changeset
  1533
  $(function () {
5b78b8c79d9c Initial commit
Vincent Tondellier <tonton+hg@team1664.org>
parents:
diff changeset
  1534
    $('body').on('click.tab.data-api', '[data-toggle="tab"], [data-toggle="pill"]', function (e) {
5b78b8c79d9c Initial commit
Vincent Tondellier <tonton+hg@team1664.org>
parents:
diff changeset
  1535
      e.preventDefault()
5b78b8c79d9c Initial commit
Vincent Tondellier <tonton+hg@team1664.org>
parents:
diff changeset
  1536
      $(this).tab('show')
5b78b8c79d9c Initial commit
Vincent Tondellier <tonton+hg@team1664.org>
parents:
diff changeset
  1537
    })
5b78b8c79d9c Initial commit
Vincent Tondellier <tonton+hg@team1664.org>
parents:
diff changeset
  1538
  })
5b78b8c79d9c Initial commit
Vincent Tondellier <tonton+hg@team1664.org>
parents:
diff changeset
  1539
5b78b8c79d9c Initial commit
Vincent Tondellier <tonton+hg@team1664.org>
parents:
diff changeset
  1540
}(window.jQuery);/* =============================================================
5b78b8c79d9c Initial commit
Vincent Tondellier <tonton+hg@team1664.org>
parents:
diff changeset
  1541
 * bootstrap-typeahead.js v2.0.3
5b78b8c79d9c Initial commit
Vincent Tondellier <tonton+hg@team1664.org>
parents:
diff changeset
  1542
 * http://twitter.github.com/bootstrap/javascript.html#typeahead
5b78b8c79d9c Initial commit
Vincent Tondellier <tonton+hg@team1664.org>
parents:
diff changeset
  1543
 * =============================================================
5b78b8c79d9c Initial commit
Vincent Tondellier <tonton+hg@team1664.org>
parents:
diff changeset
  1544
 * Copyright 2012 Twitter, Inc.
5b78b8c79d9c Initial commit
Vincent Tondellier <tonton+hg@team1664.org>
parents:
diff changeset
  1545
 *
5b78b8c79d9c Initial commit
Vincent Tondellier <tonton+hg@team1664.org>
parents:
diff changeset
  1546
 * Licensed under the Apache License, Version 2.0 (the "License");
5b78b8c79d9c Initial commit
Vincent Tondellier <tonton+hg@team1664.org>
parents:
diff changeset
  1547
 * you may not use this file except in compliance with the License.
5b78b8c79d9c Initial commit
Vincent Tondellier <tonton+hg@team1664.org>
parents:
diff changeset
  1548
 * You may obtain a copy of the License at
5b78b8c79d9c Initial commit
Vincent Tondellier <tonton+hg@team1664.org>
parents:
diff changeset
  1549
 *
5b78b8c79d9c Initial commit
Vincent Tondellier <tonton+hg@team1664.org>
parents:
diff changeset
  1550
 * http://www.apache.org/licenses/LICENSE-2.0
5b78b8c79d9c Initial commit
Vincent Tondellier <tonton+hg@team1664.org>
parents:
diff changeset
  1551
 *
5b78b8c79d9c Initial commit
Vincent Tondellier <tonton+hg@team1664.org>
parents:
diff changeset
  1552
 * Unless required by applicable law or agreed to in writing, software
5b78b8c79d9c Initial commit
Vincent Tondellier <tonton+hg@team1664.org>
parents:
diff changeset
  1553
 * distributed under the License is distributed on an "AS IS" BASIS,
5b78b8c79d9c Initial commit
Vincent Tondellier <tonton+hg@team1664.org>
parents:
diff changeset
  1554
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
5b78b8c79d9c Initial commit
Vincent Tondellier <tonton+hg@team1664.org>
parents:
diff changeset
  1555
 * See the License for the specific language governing permissions and
5b78b8c79d9c Initial commit
Vincent Tondellier <tonton+hg@team1664.org>
parents:
diff changeset
  1556
 * limitations under the License.
5b78b8c79d9c Initial commit
Vincent Tondellier <tonton+hg@team1664.org>
parents:
diff changeset
  1557
 * ============================================================ */
5b78b8c79d9c Initial commit
Vincent Tondellier <tonton+hg@team1664.org>
parents:
diff changeset
  1558
5b78b8c79d9c Initial commit
Vincent Tondellier <tonton+hg@team1664.org>
parents:
diff changeset
  1559
5b78b8c79d9c Initial commit
Vincent Tondellier <tonton+hg@team1664.org>
parents:
diff changeset
  1560
!function($){
5b78b8c79d9c Initial commit
Vincent Tondellier <tonton+hg@team1664.org>
parents:
diff changeset
  1561
5b78b8c79d9c Initial commit
Vincent Tondellier <tonton+hg@team1664.org>
parents:
diff changeset
  1562
  "use strict"; // jshint ;_;
5b78b8c79d9c Initial commit
Vincent Tondellier <tonton+hg@team1664.org>
parents:
diff changeset
  1563
5b78b8c79d9c Initial commit
Vincent Tondellier <tonton+hg@team1664.org>
parents:
diff changeset
  1564
5b78b8c79d9c Initial commit
Vincent Tondellier <tonton+hg@team1664.org>
parents:
diff changeset
  1565
 /* TYPEAHEAD PUBLIC CLASS DEFINITION
5b78b8c79d9c Initial commit
Vincent Tondellier <tonton+hg@team1664.org>
parents:
diff changeset
  1566
  * ================================= */
5b78b8c79d9c Initial commit
Vincent Tondellier <tonton+hg@team1664.org>
parents:
diff changeset
  1567
5b78b8c79d9c Initial commit
Vincent Tondellier <tonton+hg@team1664.org>
parents:
diff changeset
  1568
  var Typeahead = function (element, options) {
5b78b8c79d9c Initial commit
Vincent Tondellier <tonton+hg@team1664.org>
parents:
diff changeset
  1569
    this.$element = $(element)
5b78b8c79d9c Initial commit
Vincent Tondellier <tonton+hg@team1664.org>
parents:
diff changeset
  1570
    this.options = $.extend({}, $.fn.typeahead.defaults, options)
5b78b8c79d9c Initial commit
Vincent Tondellier <tonton+hg@team1664.org>
parents:
diff changeset
  1571
    this.matcher = this.options.matcher || this.matcher
5b78b8c79d9c Initial commit
Vincent Tondellier <tonton+hg@team1664.org>
parents:
diff changeset
  1572
    this.sorter = this.options.sorter || this.sorter
5b78b8c79d9c Initial commit
Vincent Tondellier <tonton+hg@team1664.org>
parents:
diff changeset
  1573
    this.highlighter = this.options.highlighter || this.highlighter
5b78b8c79d9c Initial commit
Vincent Tondellier <tonton+hg@team1664.org>
parents:
diff changeset
  1574
    this.updater = this.options.updater || this.updater
5b78b8c79d9c Initial commit
Vincent Tondellier <tonton+hg@team1664.org>
parents:
diff changeset
  1575
    this.$menu = $(this.options.menu).appendTo('body')
5b78b8c79d9c Initial commit
Vincent Tondellier <tonton+hg@team1664.org>
parents:
diff changeset
  1576
    this.source = this.options.source
5b78b8c79d9c Initial commit
Vincent Tondellier <tonton+hg@team1664.org>
parents:
diff changeset
  1577
    this.shown = false
5b78b8c79d9c Initial commit
Vincent Tondellier <tonton+hg@team1664.org>
parents:
diff changeset
  1578
    this.listen()
5b78b8c79d9c Initial commit
Vincent Tondellier <tonton+hg@team1664.org>
parents:
diff changeset
  1579
  }
5b78b8c79d9c Initial commit
Vincent Tondellier <tonton+hg@team1664.org>
parents:
diff changeset
  1580
5b78b8c79d9c Initial commit
Vincent Tondellier <tonton+hg@team1664.org>
parents:
diff changeset
  1581
  Typeahead.prototype = {
5b78b8c79d9c Initial commit
Vincent Tondellier <tonton+hg@team1664.org>
parents:
diff changeset
  1582
5b78b8c79d9c Initial commit
Vincent Tondellier <tonton+hg@team1664.org>
parents:
diff changeset
  1583
    constructor: Typeahead
5b78b8c79d9c Initial commit
Vincent Tondellier <tonton+hg@team1664.org>
parents:
diff changeset
  1584
5b78b8c79d9c Initial commit
Vincent Tondellier <tonton+hg@team1664.org>
parents:
diff changeset
  1585
  , select: function () {
5b78b8c79d9c Initial commit
Vincent Tondellier <tonton+hg@team1664.org>
parents:
diff changeset
  1586
      var val = this.$menu.find('.active').attr('data-value')
5b78b8c79d9c Initial commit
Vincent Tondellier <tonton+hg@team1664.org>
parents:
diff changeset
  1587
      this.$element
5b78b8c79d9c Initial commit
Vincent Tondellier <tonton+hg@team1664.org>
parents:
diff changeset
  1588
        .val(this.updater(val))
5b78b8c79d9c Initial commit
Vincent Tondellier <tonton+hg@team1664.org>
parents:
diff changeset
  1589
        .change()
5b78b8c79d9c Initial commit
Vincent Tondellier <tonton+hg@team1664.org>
parents:
diff changeset
  1590
      return this.hide()
5b78b8c79d9c Initial commit
Vincent Tondellier <tonton+hg@team1664.org>
parents:
diff changeset
  1591
    }
5b78b8c79d9c Initial commit
Vincent Tondellier <tonton+hg@team1664.org>
parents:
diff changeset
  1592
5b78b8c79d9c Initial commit
Vincent Tondellier <tonton+hg@team1664.org>
parents:
diff changeset
  1593
  , updater: function (item) {
5b78b8c79d9c Initial commit
Vincent Tondellier <tonton+hg@team1664.org>
parents:
diff changeset
  1594
      return item
5b78b8c79d9c Initial commit
Vincent Tondellier <tonton+hg@team1664.org>
parents:
diff changeset
  1595
    }
5b78b8c79d9c Initial commit
Vincent Tondellier <tonton+hg@team1664.org>
parents:
diff changeset
  1596
5b78b8c79d9c Initial commit
Vincent Tondellier <tonton+hg@team1664.org>
parents:
diff changeset
  1597
  , show: function () {
5b78b8c79d9c Initial commit
Vincent Tondellier <tonton+hg@team1664.org>
parents:
diff changeset
  1598
      var pos = $.extend({}, this.$element.offset(), {
5b78b8c79d9c Initial commit
Vincent Tondellier <tonton+hg@team1664.org>
parents:
diff changeset
  1599
        height: this.$element[0].offsetHeight
5b78b8c79d9c Initial commit
Vincent Tondellier <tonton+hg@team1664.org>
parents:
diff changeset
  1600
      })
5b78b8c79d9c Initial commit
Vincent Tondellier <tonton+hg@team1664.org>
parents:
diff changeset
  1601
5b78b8c79d9c Initial commit
Vincent Tondellier <tonton+hg@team1664.org>
parents:
diff changeset
  1602
      this.$menu.css({
5b78b8c79d9c Initial commit
Vincent Tondellier <tonton+hg@team1664.org>
parents:
diff changeset
  1603
        top: pos.top + pos.height
5b78b8c79d9c Initial commit
Vincent Tondellier <tonton+hg@team1664.org>
parents:
diff changeset
  1604
      , left: pos.left
5b78b8c79d9c Initial commit
Vincent Tondellier <tonton+hg@team1664.org>
parents:
diff changeset
  1605
      })
5b78b8c79d9c Initial commit
Vincent Tondellier <tonton+hg@team1664.org>
parents:
diff changeset
  1606
5b78b8c79d9c Initial commit
Vincent Tondellier <tonton+hg@team1664.org>
parents:
diff changeset
  1607
      this.$menu.show()
5b78b8c79d9c Initial commit
Vincent Tondellier <tonton+hg@team1664.org>
parents:
diff changeset
  1608
      this.shown = true
5b78b8c79d9c Initial commit
Vincent Tondellier <tonton+hg@team1664.org>
parents:
diff changeset
  1609
      return this
5b78b8c79d9c Initial commit
Vincent Tondellier <tonton+hg@team1664.org>
parents:
diff changeset
  1610
    }
5b78b8c79d9c Initial commit
Vincent Tondellier <tonton+hg@team1664.org>
parents:
diff changeset
  1611
5b78b8c79d9c Initial commit
Vincent Tondellier <tonton+hg@team1664.org>
parents:
diff changeset
  1612
  , hide: function () {
5b78b8c79d9c Initial commit
Vincent Tondellier <tonton+hg@team1664.org>
parents:
diff changeset
  1613
      this.$menu.hide()
5b78b8c79d9c Initial commit
Vincent Tondellier <tonton+hg@team1664.org>
parents:
diff changeset
  1614
      this.shown = false
5b78b8c79d9c Initial commit
Vincent Tondellier <tonton+hg@team1664.org>
parents:
diff changeset
  1615
      return this
5b78b8c79d9c Initial commit
Vincent Tondellier <tonton+hg@team1664.org>
parents:
diff changeset
  1616
    }
5b78b8c79d9c Initial commit
Vincent Tondellier <tonton+hg@team1664.org>
parents:
diff changeset
  1617
5b78b8c79d9c Initial commit
Vincent Tondellier <tonton+hg@team1664.org>
parents:
diff changeset
  1618
  , lookup: function (event) {
5b78b8c79d9c Initial commit
Vincent Tondellier <tonton+hg@team1664.org>
parents:
diff changeset
  1619
      var that = this
5b78b8c79d9c Initial commit
Vincent Tondellier <tonton+hg@team1664.org>
parents:
diff changeset
  1620
        , items
5b78b8c79d9c Initial commit
Vincent Tondellier <tonton+hg@team1664.org>
parents:
diff changeset
  1621
        , q
5b78b8c79d9c Initial commit
Vincent Tondellier <tonton+hg@team1664.org>
parents:
diff changeset
  1622
5b78b8c79d9c Initial commit
Vincent Tondellier <tonton+hg@team1664.org>
parents:
diff changeset
  1623
      this.query = this.$element.val()
5b78b8c79d9c Initial commit
Vincent Tondellier <tonton+hg@team1664.org>
parents:
diff changeset
  1624
5b78b8c79d9c Initial commit
Vincent Tondellier <tonton+hg@team1664.org>
parents:
diff changeset
  1625
      if (!this.query) {
5b78b8c79d9c Initial commit
Vincent Tondellier <tonton+hg@team1664.org>
parents:
diff changeset
  1626
        return this.shown ? this.hide() : this
5b78b8c79d9c Initial commit
Vincent Tondellier <tonton+hg@team1664.org>
parents:
diff changeset
  1627
      }
5b78b8c79d9c Initial commit
Vincent Tondellier <tonton+hg@team1664.org>
parents:
diff changeset
  1628
5b78b8c79d9c Initial commit
Vincent Tondellier <tonton+hg@team1664.org>
parents:
diff changeset
  1629
      items = $.grep(this.source, function (item) {
5b78b8c79d9c Initial commit
Vincent Tondellier <tonton+hg@team1664.org>
parents:
diff changeset
  1630
        return that.matcher(item)
5b78b8c79d9c Initial commit
Vincent Tondellier <tonton+hg@team1664.org>
parents:
diff changeset
  1631
      })
5b78b8c79d9c Initial commit
Vincent Tondellier <tonton+hg@team1664.org>
parents:
diff changeset
  1632
5b78b8c79d9c Initial commit
Vincent Tondellier <tonton+hg@team1664.org>
parents:
diff changeset
  1633
      items = this.sorter(items)
5b78b8c79d9c Initial commit
Vincent Tondellier <tonton+hg@team1664.org>
parents:
diff changeset
  1634
5b78b8c79d9c Initial commit
Vincent Tondellier <tonton+hg@team1664.org>
parents:
diff changeset
  1635
      if (!items.length) {
5b78b8c79d9c Initial commit
Vincent Tondellier <tonton+hg@team1664.org>
parents:
diff changeset
  1636
        return this.shown ? this.hide() : this
5b78b8c79d9c Initial commit
Vincent Tondellier <tonton+hg@team1664.org>
parents:
diff changeset
  1637
      }
5b78b8c79d9c Initial commit
Vincent Tondellier <tonton+hg@team1664.org>
parents:
diff changeset
  1638
5b78b8c79d9c Initial commit
Vincent Tondellier <tonton+hg@team1664.org>
parents:
diff changeset
  1639
      return this.render(items.slice(0, this.options.items)).show()
5b78b8c79d9c Initial commit
Vincent Tondellier <tonton+hg@team1664.org>
parents:
diff changeset
  1640
    }
5b78b8c79d9c Initial commit
Vincent Tondellier <tonton+hg@team1664.org>
parents:
diff changeset
  1641
5b78b8c79d9c Initial commit
Vincent Tondellier <tonton+hg@team1664.org>
parents:
diff changeset
  1642
  , matcher: function (item) {
5b78b8c79d9c Initial commit
Vincent Tondellier <tonton+hg@team1664.org>
parents:
diff changeset
  1643
      return ~item.toLowerCase().indexOf(this.query.toLowerCase())
5b78b8c79d9c Initial commit
Vincent Tondellier <tonton+hg@team1664.org>
parents:
diff changeset
  1644
    }
5b78b8c79d9c Initial commit
Vincent Tondellier <tonton+hg@team1664.org>
parents:
diff changeset
  1645
5b78b8c79d9c Initial commit
Vincent Tondellier <tonton+hg@team1664.org>
parents:
diff changeset
  1646
  , sorter: function (items) {
5b78b8c79d9c Initial commit
Vincent Tondellier <tonton+hg@team1664.org>
parents:
diff changeset
  1647
      var beginswith = []
5b78b8c79d9c Initial commit
Vincent Tondellier <tonton+hg@team1664.org>
parents:
diff changeset
  1648
        , caseSensitive = []
5b78b8c79d9c Initial commit
Vincent Tondellier <tonton+hg@team1664.org>
parents:
diff changeset
  1649
        , caseInsensitive = []
5b78b8c79d9c Initial commit
Vincent Tondellier <tonton+hg@team1664.org>
parents:
diff changeset
  1650
        , item
5b78b8c79d9c Initial commit
Vincent Tondellier <tonton+hg@team1664.org>
parents:
diff changeset
  1651
5b78b8c79d9c Initial commit
Vincent Tondellier <tonton+hg@team1664.org>
parents:
diff changeset
  1652
      while (item = items.shift()) {
5b78b8c79d9c Initial commit
Vincent Tondellier <tonton+hg@team1664.org>
parents:
diff changeset
  1653
        if (!item.toLowerCase().indexOf(this.query.toLowerCase())) beginswith.push(item)
5b78b8c79d9c Initial commit
Vincent Tondellier <tonton+hg@team1664.org>
parents:
diff changeset
  1654
        else if (~item.indexOf(this.query)) caseSensitive.push(item)
5b78b8c79d9c Initial commit
Vincent Tondellier <tonton+hg@team1664.org>
parents:
diff changeset
  1655
        else caseInsensitive.push(item)
5b78b8c79d9c Initial commit
Vincent Tondellier <tonton+hg@team1664.org>
parents:
diff changeset
  1656
      }
5b78b8c79d9c Initial commit
Vincent Tondellier <tonton+hg@team1664.org>
parents:
diff changeset
  1657
5b78b8c79d9c Initial commit
Vincent Tondellier <tonton+hg@team1664.org>
parents:
diff changeset
  1658
      return beginswith.concat(caseSensitive, caseInsensitive)
5b78b8c79d9c Initial commit
Vincent Tondellier <tonton+hg@team1664.org>
parents:
diff changeset
  1659
    }
5b78b8c79d9c Initial commit
Vincent Tondellier <tonton+hg@team1664.org>
parents:
diff changeset
  1660
5b78b8c79d9c Initial commit
Vincent Tondellier <tonton+hg@team1664.org>
parents:
diff changeset
  1661
  , highlighter: function (item) {
5b78b8c79d9c Initial commit
Vincent Tondellier <tonton+hg@team1664.org>
parents:
diff changeset
  1662
      var query = this.query.replace(/[\-\[\]{}()*+?.,\\\^$|#\s]/g, '\\$&')
5b78b8c79d9c Initial commit
Vincent Tondellier <tonton+hg@team1664.org>
parents:
diff changeset
  1663
      return item.replace(new RegExp('(' + query + ')', 'ig'), function ($1, match) {
5b78b8c79d9c Initial commit
Vincent Tondellier <tonton+hg@team1664.org>
parents:
diff changeset
  1664
        return '<strong>' + match + '</strong>'
5b78b8c79d9c Initial commit
Vincent Tondellier <tonton+hg@team1664.org>
parents:
diff changeset
  1665
      })
5b78b8c79d9c Initial commit
Vincent Tondellier <tonton+hg@team1664.org>
parents:
diff changeset
  1666
    }
5b78b8c79d9c Initial commit
Vincent Tondellier <tonton+hg@team1664.org>
parents:
diff changeset
  1667
5b78b8c79d9c Initial commit
Vincent Tondellier <tonton+hg@team1664.org>
parents:
diff changeset
  1668
  , render: function (items) {
5b78b8c79d9c Initial commit
Vincent Tondellier <tonton+hg@team1664.org>
parents:
diff changeset
  1669
      var that = this
5b78b8c79d9c Initial commit
Vincent Tondellier <tonton+hg@team1664.org>
parents:
diff changeset
  1670
5b78b8c79d9c Initial commit
Vincent Tondellier <tonton+hg@team1664.org>
parents:
diff changeset
  1671
      items = $(items).map(function (i, item) {
5b78b8c79d9c Initial commit
Vincent Tondellier <tonton+hg@team1664.org>
parents:
diff changeset
  1672
        i = $(that.options.item).attr('data-value', item)
5b78b8c79d9c Initial commit
Vincent Tondellier <tonton+hg@team1664.org>
parents:
diff changeset
  1673
        i.find('a').html(that.highlighter(item))
5b78b8c79d9c Initial commit
Vincent Tondellier <tonton+hg@team1664.org>
parents:
diff changeset
  1674
        return i[0]
5b78b8c79d9c Initial commit
Vincent Tondellier <tonton+hg@team1664.org>
parents:
diff changeset
  1675
      })
5b78b8c79d9c Initial commit
Vincent Tondellier <tonton+hg@team1664.org>
parents:
diff changeset
  1676
5b78b8c79d9c Initial commit
Vincent Tondellier <tonton+hg@team1664.org>
parents:
diff changeset
  1677
      items.first().addClass('active')
5b78b8c79d9c Initial commit
Vincent Tondellier <tonton+hg@team1664.org>
parents:
diff changeset
  1678
      this.$menu.html(items)
5b78b8c79d9c Initial commit
Vincent Tondellier <tonton+hg@team1664.org>
parents:
diff changeset
  1679
      return this
5b78b8c79d9c Initial commit
Vincent Tondellier <tonton+hg@team1664.org>
parents:
diff changeset
  1680
    }
5b78b8c79d9c Initial commit
Vincent Tondellier <tonton+hg@team1664.org>
parents:
diff changeset
  1681
5b78b8c79d9c Initial commit
Vincent Tondellier <tonton+hg@team1664.org>
parents:
diff changeset
  1682
  , next: function (event) {
5b78b8c79d9c Initial commit
Vincent Tondellier <tonton+hg@team1664.org>
parents:
diff changeset
  1683
      var active = this.$menu.find('.active').removeClass('active')
5b78b8c79d9c Initial commit
Vincent Tondellier <tonton+hg@team1664.org>
parents:
diff changeset
  1684
        , next = active.next()
5b78b8c79d9c Initial commit
Vincent Tondellier <tonton+hg@team1664.org>
parents:
diff changeset
  1685
5b78b8c79d9c Initial commit
Vincent Tondellier <tonton+hg@team1664.org>
parents:
diff changeset
  1686
      if (!next.length) {
5b78b8c79d9c Initial commit
Vincent Tondellier <tonton+hg@team1664.org>
parents:
diff changeset
  1687
        next = $(this.$menu.find('li')[0])
5b78b8c79d9c Initial commit
Vincent Tondellier <tonton+hg@team1664.org>
parents:
diff changeset
  1688
      }
5b78b8c79d9c Initial commit
Vincent Tondellier <tonton+hg@team1664.org>
parents:
diff changeset
  1689
5b78b8c79d9c Initial commit
Vincent Tondellier <tonton+hg@team1664.org>
parents:
diff changeset
  1690
      next.addClass('active')
5b78b8c79d9c Initial commit
Vincent Tondellier <tonton+hg@team1664.org>
parents:
diff changeset
  1691
    }
5b78b8c79d9c Initial commit
Vincent Tondellier <tonton+hg@team1664.org>
parents:
diff changeset
  1692
5b78b8c79d9c Initial commit
Vincent Tondellier <tonton+hg@team1664.org>
parents:
diff changeset
  1693
  , prev: function (event) {
5b78b8c79d9c Initial commit
Vincent Tondellier <tonton+hg@team1664.org>
parents:
diff changeset
  1694
      var active = this.$menu.find('.active').removeClass('active')
5b78b8c79d9c Initial commit
Vincent Tondellier <tonton+hg@team1664.org>
parents:
diff changeset
  1695
        , prev = active.prev()
5b78b8c79d9c Initial commit
Vincent Tondellier <tonton+hg@team1664.org>
parents:
diff changeset
  1696
5b78b8c79d9c Initial commit
Vincent Tondellier <tonton+hg@team1664.org>
parents:
diff changeset
  1697
      if (!prev.length) {
5b78b8c79d9c Initial commit
Vincent Tondellier <tonton+hg@team1664.org>
parents:
diff changeset
  1698
        prev = this.$menu.find('li').last()
5b78b8c79d9c Initial commit
Vincent Tondellier <tonton+hg@team1664.org>
parents:
diff changeset
  1699
      }
5b78b8c79d9c Initial commit
Vincent Tondellier <tonton+hg@team1664.org>
parents:
diff changeset
  1700
5b78b8c79d9c Initial commit
Vincent Tondellier <tonton+hg@team1664.org>
parents:
diff changeset
  1701
      prev.addClass('active')
5b78b8c79d9c Initial commit
Vincent Tondellier <tonton+hg@team1664.org>
parents:
diff changeset
  1702
    }
5b78b8c79d9c Initial commit
Vincent Tondellier <tonton+hg@team1664.org>
parents:
diff changeset
  1703
5b78b8c79d9c Initial commit
Vincent Tondellier <tonton+hg@team1664.org>
parents:
diff changeset
  1704
  , listen: function () {
5b78b8c79d9c Initial commit
Vincent Tondellier <tonton+hg@team1664.org>
parents:
diff changeset
  1705
      this.$element
5b78b8c79d9c Initial commit
Vincent Tondellier <tonton+hg@team1664.org>
parents:
diff changeset
  1706
        .on('blur',     $.proxy(this.blur, this))
5b78b8c79d9c Initial commit
Vincent Tondellier <tonton+hg@team1664.org>
parents:
diff changeset
  1707
        .on('keypress', $.proxy(this.keypress, this))
5b78b8c79d9c Initial commit
Vincent Tondellier <tonton+hg@team1664.org>
parents:
diff changeset
  1708
        .on('keyup',    $.proxy(this.keyup, this))
5b78b8c79d9c Initial commit
Vincent Tondellier <tonton+hg@team1664.org>
parents:
diff changeset
  1709
5b78b8c79d9c Initial commit
Vincent Tondellier <tonton+hg@team1664.org>
parents:
diff changeset
  1710
      if ($.browser.webkit || $.browser.msie) {
5b78b8c79d9c Initial commit
Vincent Tondellier <tonton+hg@team1664.org>
parents:
diff changeset
  1711
        this.$element.on('keydown', $.proxy(this.keypress, this))
5b78b8c79d9c Initial commit
Vincent Tondellier <tonton+hg@team1664.org>
parents:
diff changeset
  1712
      }
5b78b8c79d9c Initial commit
Vincent Tondellier <tonton+hg@team1664.org>
parents:
diff changeset
  1713
5b78b8c79d9c Initial commit
Vincent Tondellier <tonton+hg@team1664.org>
parents:
diff changeset
  1714
      this.$menu
5b78b8c79d9c Initial commit
Vincent Tondellier <tonton+hg@team1664.org>
parents:
diff changeset
  1715
        .on('click', $.proxy(this.click, this))
5b78b8c79d9c Initial commit
Vincent Tondellier <tonton+hg@team1664.org>
parents:
diff changeset
  1716
        .on('mouseenter', 'li', $.proxy(this.mouseenter, this))
5b78b8c79d9c Initial commit
Vincent Tondellier <tonton+hg@team1664.org>
parents:
diff changeset
  1717
    }
5b78b8c79d9c Initial commit
Vincent Tondellier <tonton+hg@team1664.org>
parents:
diff changeset
  1718
5b78b8c79d9c Initial commit
Vincent Tondellier <tonton+hg@team1664.org>
parents:
diff changeset
  1719
  , keyup: function (e) {
5b78b8c79d9c Initial commit
Vincent Tondellier <tonton+hg@team1664.org>
parents:
diff changeset
  1720
      switch(e.keyCode) {
5b78b8c79d9c Initial commit
Vincent Tondellier <tonton+hg@team1664.org>
parents:
diff changeset
  1721
        case 40: // down arrow
5b78b8c79d9c Initial commit
Vincent Tondellier <tonton+hg@team1664.org>
parents:
diff changeset
  1722
        case 38: // up arrow
5b78b8c79d9c Initial commit
Vincent Tondellier <tonton+hg@team1664.org>
parents:
diff changeset
  1723
          break
5b78b8c79d9c Initial commit
Vincent Tondellier <tonton+hg@team1664.org>
parents:
diff changeset
  1724
5b78b8c79d9c Initial commit
Vincent Tondellier <tonton+hg@team1664.org>
parents:
diff changeset
  1725
        case 9: // tab
5b78b8c79d9c Initial commit
Vincent Tondellier <tonton+hg@team1664.org>
parents:
diff changeset
  1726
        case 13: // enter
5b78b8c79d9c Initial commit
Vincent Tondellier <tonton+hg@team1664.org>
parents:
diff changeset
  1727
          if (!this.shown) return
5b78b8c79d9c Initial commit
Vincent Tondellier <tonton+hg@team1664.org>
parents:
diff changeset
  1728
          this.select()
5b78b8c79d9c Initial commit
Vincent Tondellier <tonton+hg@team1664.org>
parents:
diff changeset
  1729
          break
5b78b8c79d9c Initial commit
Vincent Tondellier <tonton+hg@team1664.org>
parents:
diff changeset
  1730
5b78b8c79d9c Initial commit
Vincent Tondellier <tonton+hg@team1664.org>
parents:
diff changeset
  1731
        case 27: // escape
5b78b8c79d9c Initial commit
Vincent Tondellier <tonton+hg@team1664.org>
parents:
diff changeset
  1732
          if (!this.shown) return
5b78b8c79d9c Initial commit
Vincent Tondellier <tonton+hg@team1664.org>
parents:
diff changeset
  1733
          this.hide()
5b78b8c79d9c Initial commit
Vincent Tondellier <tonton+hg@team1664.org>
parents:
diff changeset
  1734
          break
5b78b8c79d9c Initial commit
Vincent Tondellier <tonton+hg@team1664.org>
parents:
diff changeset
  1735
5b78b8c79d9c Initial commit
Vincent Tondellier <tonton+hg@team1664.org>
parents:
diff changeset
  1736
        default:
5b78b8c79d9c Initial commit
Vincent Tondellier <tonton+hg@team1664.org>
parents:
diff changeset
  1737
          this.lookup()
5b78b8c79d9c Initial commit
Vincent Tondellier <tonton+hg@team1664.org>
parents:
diff changeset
  1738
      }
5b78b8c79d9c Initial commit
Vincent Tondellier <tonton+hg@team1664.org>
parents:
diff changeset
  1739
5b78b8c79d9c Initial commit
Vincent Tondellier <tonton+hg@team1664.org>
parents:
diff changeset
  1740
      e.stopPropagation()
5b78b8c79d9c Initial commit
Vincent Tondellier <tonton+hg@team1664.org>
parents:
diff changeset
  1741
      e.preventDefault()
5b78b8c79d9c Initial commit
Vincent Tondellier <tonton+hg@team1664.org>
parents:
diff changeset
  1742
  }
5b78b8c79d9c Initial commit
Vincent Tondellier <tonton+hg@team1664.org>
parents:
diff changeset
  1743
5b78b8c79d9c Initial commit
Vincent Tondellier <tonton+hg@team1664.org>
parents:
diff changeset
  1744
  , keypress: function (e) {
5b78b8c79d9c Initial commit
Vincent Tondellier <tonton+hg@team1664.org>
parents:
diff changeset
  1745
      if (!this.shown) return
5b78b8c79d9c Initial commit
Vincent Tondellier <tonton+hg@team1664.org>
parents:
diff changeset
  1746
5b78b8c79d9c Initial commit
Vincent Tondellier <tonton+hg@team1664.org>
parents:
diff changeset
  1747
      switch(e.keyCode) {
5b78b8c79d9c Initial commit
Vincent Tondellier <tonton+hg@team1664.org>
parents:
diff changeset
  1748
        case 9: // tab
5b78b8c79d9c Initial commit
Vincent Tondellier <tonton+hg@team1664.org>
parents:
diff changeset
  1749
        case 13: // enter
5b78b8c79d9c Initial commit
Vincent Tondellier <tonton+hg@team1664.org>
parents:
diff changeset
  1750
        case 27: // escape
5b78b8c79d9c Initial commit
Vincent Tondellier <tonton+hg@team1664.org>
parents:
diff changeset
  1751
          e.preventDefault()
5b78b8c79d9c Initial commit
Vincent Tondellier <tonton+hg@team1664.org>
parents:
diff changeset
  1752
          break
5b78b8c79d9c Initial commit
Vincent Tondellier <tonton+hg@team1664.org>
parents:
diff changeset
  1753
5b78b8c79d9c Initial commit
Vincent Tondellier <tonton+hg@team1664.org>
parents:
diff changeset
  1754
        case 38: // up arrow
5b78b8c79d9c Initial commit
Vincent Tondellier <tonton+hg@team1664.org>
parents:
diff changeset
  1755
          if (e.type != 'keydown') break
5b78b8c79d9c Initial commit
Vincent Tondellier <tonton+hg@team1664.org>
parents:
diff changeset
  1756
          e.preventDefault()
5b78b8c79d9c Initial commit
Vincent Tondellier <tonton+hg@team1664.org>
parents:
diff changeset
  1757
          this.prev()
5b78b8c79d9c Initial commit
Vincent Tondellier <tonton+hg@team1664.org>
parents:
diff changeset
  1758
          break
5b78b8c79d9c Initial commit
Vincent Tondellier <tonton+hg@team1664.org>
parents:
diff changeset
  1759
5b78b8c79d9c Initial commit
Vincent Tondellier <tonton+hg@team1664.org>
parents:
diff changeset
  1760
        case 40: // down arrow
5b78b8c79d9c Initial commit
Vincent Tondellier <tonton+hg@team1664.org>
parents:
diff changeset
  1761
          if (e.type != 'keydown') break
5b78b8c79d9c Initial commit
Vincent Tondellier <tonton+hg@team1664.org>
parents:
diff changeset
  1762
          e.preventDefault()
5b78b8c79d9c Initial commit
Vincent Tondellier <tonton+hg@team1664.org>
parents:
diff changeset
  1763
          this.next()
5b78b8c79d9c Initial commit
Vincent Tondellier <tonton+hg@team1664.org>
parents:
diff changeset
  1764
          break
5b78b8c79d9c Initial commit
Vincent Tondellier <tonton+hg@team1664.org>
parents:
diff changeset
  1765
      }
5b78b8c79d9c Initial commit
Vincent Tondellier <tonton+hg@team1664.org>
parents:
diff changeset
  1766
5b78b8c79d9c Initial commit
Vincent Tondellier <tonton+hg@team1664.org>
parents:
diff changeset
  1767
      e.stopPropagation()
5b78b8c79d9c Initial commit
Vincent Tondellier <tonton+hg@team1664.org>
parents:
diff changeset
  1768
    }
5b78b8c79d9c Initial commit
Vincent Tondellier <tonton+hg@team1664.org>
parents:
diff changeset
  1769
5b78b8c79d9c Initial commit
Vincent Tondellier <tonton+hg@team1664.org>
parents:
diff changeset
  1770
  , blur: function (e) {
5b78b8c79d9c Initial commit
Vincent Tondellier <tonton+hg@team1664.org>
parents:
diff changeset
  1771
      var that = this
5b78b8c79d9c Initial commit
Vincent Tondellier <tonton+hg@team1664.org>
parents:
diff changeset
  1772
      setTimeout(function () { that.hide() }, 150)
5b78b8c79d9c Initial commit
Vincent Tondellier <tonton+hg@team1664.org>
parents:
diff changeset
  1773
    }
5b78b8c79d9c Initial commit
Vincent Tondellier <tonton+hg@team1664.org>
parents:
diff changeset
  1774
5b78b8c79d9c Initial commit
Vincent Tondellier <tonton+hg@team1664.org>
parents:
diff changeset
  1775
  , click: function (e) {
5b78b8c79d9c Initial commit
Vincent Tondellier <tonton+hg@team1664.org>
parents:
diff changeset
  1776
      e.stopPropagation()
5b78b8c79d9c Initial commit
Vincent Tondellier <tonton+hg@team1664.org>
parents:
diff changeset
  1777
      e.preventDefault()
5b78b8c79d9c Initial commit
Vincent Tondellier <tonton+hg@team1664.org>
parents:
diff changeset
  1778
      this.select()
5b78b8c79d9c Initial commit
Vincent Tondellier <tonton+hg@team1664.org>
parents:
diff changeset
  1779
    }
5b78b8c79d9c Initial commit
Vincent Tondellier <tonton+hg@team1664.org>
parents:
diff changeset
  1780
5b78b8c79d9c Initial commit
Vincent Tondellier <tonton+hg@team1664.org>
parents:
diff changeset
  1781
  , mouseenter: function (e) {
5b78b8c79d9c Initial commit
Vincent Tondellier <tonton+hg@team1664.org>
parents:
diff changeset
  1782
      this.$menu.find('.active').removeClass('active')
5b78b8c79d9c Initial commit
Vincent Tondellier <tonton+hg@team1664.org>
parents:
diff changeset
  1783
      $(e.currentTarget).addClass('active')
5b78b8c79d9c Initial commit
Vincent Tondellier <tonton+hg@team1664.org>
parents:
diff changeset
  1784
    }
5b78b8c79d9c Initial commit
Vincent Tondellier <tonton+hg@team1664.org>
parents:
diff changeset
  1785
5b78b8c79d9c Initial commit
Vincent Tondellier <tonton+hg@team1664.org>
parents:
diff changeset
  1786
  }
5b78b8c79d9c Initial commit
Vincent Tondellier <tonton+hg@team1664.org>
parents:
diff changeset
  1787
5b78b8c79d9c Initial commit
Vincent Tondellier <tonton+hg@team1664.org>
parents:
diff changeset
  1788
5b78b8c79d9c Initial commit
Vincent Tondellier <tonton+hg@team1664.org>
parents:
diff changeset
  1789
  /* TYPEAHEAD PLUGIN DEFINITION
5b78b8c79d9c Initial commit
Vincent Tondellier <tonton+hg@team1664.org>
parents:
diff changeset
  1790
   * =========================== */
5b78b8c79d9c Initial commit
Vincent Tondellier <tonton+hg@team1664.org>
parents:
diff changeset
  1791
5b78b8c79d9c Initial commit
Vincent Tondellier <tonton+hg@team1664.org>
parents:
diff changeset
  1792
  $.fn.typeahead = function (option) {
5b78b8c79d9c Initial commit
Vincent Tondellier <tonton+hg@team1664.org>
parents:
diff changeset
  1793
    return this.each(function () {
5b78b8c79d9c Initial commit
Vincent Tondellier <tonton+hg@team1664.org>
parents:
diff changeset
  1794
      var $this = $(this)
5b78b8c79d9c Initial commit
Vincent Tondellier <tonton+hg@team1664.org>
parents:
diff changeset
  1795
        , data = $this.data('typeahead')
5b78b8c79d9c Initial commit
Vincent Tondellier <tonton+hg@team1664.org>
parents:
diff changeset
  1796
        , options = typeof option == 'object' && option
5b78b8c79d9c Initial commit
Vincent Tondellier <tonton+hg@team1664.org>
parents:
diff changeset
  1797
      if (!data) $this.data('typeahead', (data = new Typeahead(this, options)))
5b78b8c79d9c Initial commit
Vincent Tondellier <tonton+hg@team1664.org>
parents:
diff changeset
  1798
      if (typeof option == 'string') data[option]()
5b78b8c79d9c Initial commit
Vincent Tondellier <tonton+hg@team1664.org>
parents:
diff changeset
  1799
    })
5b78b8c79d9c Initial commit
Vincent Tondellier <tonton+hg@team1664.org>
parents:
diff changeset
  1800
  }
5b78b8c79d9c Initial commit
Vincent Tondellier <tonton+hg@team1664.org>
parents:
diff changeset
  1801
5b78b8c79d9c Initial commit
Vincent Tondellier <tonton+hg@team1664.org>
parents:
diff changeset
  1802
  $.fn.typeahead.defaults = {
5b78b8c79d9c Initial commit
Vincent Tondellier <tonton+hg@team1664.org>
parents:
diff changeset
  1803
    source: []
5b78b8c79d9c Initial commit
Vincent Tondellier <tonton+hg@team1664.org>
parents:
diff changeset
  1804
  , items: 8
5b78b8c79d9c Initial commit
Vincent Tondellier <tonton+hg@team1664.org>
parents:
diff changeset
  1805
  , menu: '<ul class="typeahead dropdown-menu"></ul>'
5b78b8c79d9c Initial commit
Vincent Tondellier <tonton+hg@team1664.org>
parents:
diff changeset
  1806
  , item: '<li><a href="#"></a></li>'
5b78b8c79d9c Initial commit
Vincent Tondellier <tonton+hg@team1664.org>
parents:
diff changeset
  1807
  }
5b78b8c79d9c Initial commit
Vincent Tondellier <tonton+hg@team1664.org>
parents:
diff changeset
  1808
5b78b8c79d9c Initial commit
Vincent Tondellier <tonton+hg@team1664.org>
parents:
diff changeset
  1809
  $.fn.typeahead.Constructor = Typeahead
5b78b8c79d9c Initial commit
Vincent Tondellier <tonton+hg@team1664.org>
parents:
diff changeset
  1810
5b78b8c79d9c Initial commit
Vincent Tondellier <tonton+hg@team1664.org>
parents:
diff changeset
  1811
5b78b8c79d9c Initial commit
Vincent Tondellier <tonton+hg@team1664.org>
parents:
diff changeset
  1812
 /* TYPEAHEAD DATA-API
5b78b8c79d9c Initial commit
Vincent Tondellier <tonton+hg@team1664.org>
parents:
diff changeset
  1813
  * ================== */
5b78b8c79d9c Initial commit
Vincent Tondellier <tonton+hg@team1664.org>
parents:
diff changeset
  1814
5b78b8c79d9c Initial commit
Vincent Tondellier <tonton+hg@team1664.org>
parents:
diff changeset
  1815
  $(function () {
5b78b8c79d9c Initial commit
Vincent Tondellier <tonton+hg@team1664.org>
parents:
diff changeset
  1816
    $('body').on('focus.typeahead.data-api', '[data-provide="typeahead"]', function (e) {
5b78b8c79d9c Initial commit
Vincent Tondellier <tonton+hg@team1664.org>
parents:
diff changeset
  1817
      var $this = $(this)
5b78b8c79d9c Initial commit
Vincent Tondellier <tonton+hg@team1664.org>
parents:
diff changeset
  1818
      if ($this.data('typeahead')) return
5b78b8c79d9c Initial commit
Vincent Tondellier <tonton+hg@team1664.org>
parents:
diff changeset
  1819
      e.preventDefault()
5b78b8c79d9c Initial commit
Vincent Tondellier <tonton+hg@team1664.org>
parents:
diff changeset
  1820
      $this.typeahead($this.data())
5b78b8c79d9c Initial commit
Vincent Tondellier <tonton+hg@team1664.org>
parents:
diff changeset
  1821
    })
5b78b8c79d9c Initial commit
Vincent Tondellier <tonton+hg@team1664.org>
parents:
diff changeset
  1822
  })
5b78b8c79d9c Initial commit
Vincent Tondellier <tonton+hg@team1664.org>
parents:
diff changeset
  1823
5b78b8c79d9c Initial commit
Vincent Tondellier <tonton+hg@team1664.org>
parents:
diff changeset
  1824
}(window.jQuery);