public/assets/js/bootstrap.js
author Vincent Tondellier <tonton+hg@team1664.org>
Wed, 02 May 2012 01:41:29 +0200
changeset 1 c3726f733704
parent 0 5b78b8c79d9c
child 28 0df70b8735e3
permissions -rw-r--r--
Use minimal bootstrap css and js
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
1
c3726f733704 Use minimal bootstrap css and js
Vincent Tondellier <tonton+hg@team1664.org>
parents: 0
diff changeset
    61
}(window.jQuery);
c3726f733704 Use minimal bootstrap css and js
Vincent Tondellier <tonton+hg@team1664.org>
parents: 0
diff changeset
    62
/* ========================================================
c3726f733704 Use minimal bootstrap css and js
Vincent Tondellier <tonton+hg@team1664.org>
parents: 0
diff changeset
    63
 * bootstrap-tab.js v2.0.3
c3726f733704 Use minimal bootstrap css and js
Vincent Tondellier <tonton+hg@team1664.org>
parents: 0
diff changeset
    64
 * http://twitter.github.com/bootstrap/javascript.html#tabs
c3726f733704 Use minimal bootstrap css and js
Vincent Tondellier <tonton+hg@team1664.org>
parents: 0
diff changeset
    65
 * ========================================================
c3726f733704 Use minimal bootstrap css and js
Vincent Tondellier <tonton+hg@team1664.org>
parents: 0
diff changeset
    66
 * Copyright 2012 Twitter, Inc.
c3726f733704 Use minimal bootstrap css and js
Vincent Tondellier <tonton+hg@team1664.org>
parents: 0
diff changeset
    67
 *
c3726f733704 Use minimal bootstrap css and js
Vincent Tondellier <tonton+hg@team1664.org>
parents: 0
diff changeset
    68
 * Licensed under the Apache License, Version 2.0 (the "License");
c3726f733704 Use minimal bootstrap css and js
Vincent Tondellier <tonton+hg@team1664.org>
parents: 0
diff changeset
    69
 * you may not use this file except in compliance with the License.
c3726f733704 Use minimal bootstrap css and js
Vincent Tondellier <tonton+hg@team1664.org>
parents: 0
diff changeset
    70
 * You may obtain a copy of the License at
c3726f733704 Use minimal bootstrap css and js
Vincent Tondellier <tonton+hg@team1664.org>
parents: 0
diff changeset
    71
 *
c3726f733704 Use minimal bootstrap css and js
Vincent Tondellier <tonton+hg@team1664.org>
parents: 0
diff changeset
    72
 * http://www.apache.org/licenses/LICENSE-2.0
c3726f733704 Use minimal bootstrap css and js
Vincent Tondellier <tonton+hg@team1664.org>
parents: 0
diff changeset
    73
 *
c3726f733704 Use minimal bootstrap css and js
Vincent Tondellier <tonton+hg@team1664.org>
parents: 0
diff changeset
    74
 * Unless required by applicable law or agreed to in writing, software
c3726f733704 Use minimal bootstrap css and js
Vincent Tondellier <tonton+hg@team1664.org>
parents: 0
diff changeset
    75
 * distributed under the License is distributed on an "AS IS" BASIS,
c3726f733704 Use minimal bootstrap css and js
Vincent Tondellier <tonton+hg@team1664.org>
parents: 0
diff changeset
    76
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
c3726f733704 Use minimal bootstrap css and js
Vincent Tondellier <tonton+hg@team1664.org>
parents: 0
diff changeset
    77
 * See the License for the specific language governing permissions and
c3726f733704 Use minimal bootstrap css and js
Vincent Tondellier <tonton+hg@team1664.org>
parents: 0
diff changeset
    78
 * limitations under the License.
c3726f733704 Use minimal bootstrap css and js
Vincent Tondellier <tonton+hg@team1664.org>
parents: 0
diff changeset
    79
 * ======================================================== */
c3726f733704 Use minimal bootstrap css and js
Vincent Tondellier <tonton+hg@team1664.org>
parents: 0
diff changeset
    80
c3726f733704 Use minimal bootstrap css and js
Vincent Tondellier <tonton+hg@team1664.org>
parents: 0
diff changeset
    81
c3726f733704 Use minimal bootstrap css and js
Vincent Tondellier <tonton+hg@team1664.org>
parents: 0
diff changeset
    82
!function ($) {
c3726f733704 Use minimal bootstrap css and js
Vincent Tondellier <tonton+hg@team1664.org>
parents: 0
diff changeset
    83
c3726f733704 Use minimal bootstrap css and js
Vincent Tondellier <tonton+hg@team1664.org>
parents: 0
diff changeset
    84
  "use strict"; // jshint ;_;
c3726f733704 Use minimal bootstrap css and js
Vincent Tondellier <tonton+hg@team1664.org>
parents: 0
diff changeset
    85
c3726f733704 Use minimal bootstrap css and js
Vincent Tondellier <tonton+hg@team1664.org>
parents: 0
diff changeset
    86
c3726f733704 Use minimal bootstrap css and js
Vincent Tondellier <tonton+hg@team1664.org>
parents: 0
diff changeset
    87
 /* TAB CLASS DEFINITION
c3726f733704 Use minimal bootstrap css and js
Vincent Tondellier <tonton+hg@team1664.org>
parents: 0
diff changeset
    88
  * ==================== */
c3726f733704 Use minimal bootstrap css and js
Vincent Tondellier <tonton+hg@team1664.org>
parents: 0
diff changeset
    89
c3726f733704 Use minimal bootstrap css and js
Vincent Tondellier <tonton+hg@team1664.org>
parents: 0
diff changeset
    90
  var Tab = function ( element ) {
c3726f733704 Use minimal bootstrap css and js
Vincent Tondellier <tonton+hg@team1664.org>
parents: 0
diff changeset
    91
    this.element = $(element)
c3726f733704 Use minimal bootstrap css and js
Vincent Tondellier <tonton+hg@team1664.org>
parents: 0
diff changeset
    92
  }
c3726f733704 Use minimal bootstrap css and js
Vincent Tondellier <tonton+hg@team1664.org>
parents: 0
diff changeset
    93
c3726f733704 Use minimal bootstrap css and js
Vincent Tondellier <tonton+hg@team1664.org>
parents: 0
diff changeset
    94
  Tab.prototype = {
c3726f733704 Use minimal bootstrap css and js
Vincent Tondellier <tonton+hg@team1664.org>
parents: 0
diff changeset
    95
c3726f733704 Use minimal bootstrap css and js
Vincent Tondellier <tonton+hg@team1664.org>
parents: 0
diff changeset
    96
    constructor: Tab
c3726f733704 Use minimal bootstrap css and js
Vincent Tondellier <tonton+hg@team1664.org>
parents: 0
diff changeset
    97
c3726f733704 Use minimal bootstrap css and js
Vincent Tondellier <tonton+hg@team1664.org>
parents: 0
diff changeset
    98
  , show: function () {
c3726f733704 Use minimal bootstrap css and js
Vincent Tondellier <tonton+hg@team1664.org>
parents: 0
diff changeset
    99
      var $this = this.element
c3726f733704 Use minimal bootstrap css and js
Vincent Tondellier <tonton+hg@team1664.org>
parents: 0
diff changeset
   100
        , $ul = $this.closest('ul:not(.dropdown-menu)')
c3726f733704 Use minimal bootstrap css and js
Vincent Tondellier <tonton+hg@team1664.org>
parents: 0
diff changeset
   101
        , selector = $this.attr('data-target')
c3726f733704 Use minimal bootstrap css and js
Vincent Tondellier <tonton+hg@team1664.org>
parents: 0
diff changeset
   102
        , previous
c3726f733704 Use minimal bootstrap css and js
Vincent Tondellier <tonton+hg@team1664.org>
parents: 0
diff changeset
   103
        , $target
c3726f733704 Use minimal bootstrap css and js
Vincent Tondellier <tonton+hg@team1664.org>
parents: 0
diff changeset
   104
        , e
c3726f733704 Use minimal bootstrap css and js
Vincent Tondellier <tonton+hg@team1664.org>
parents: 0
diff changeset
   105
c3726f733704 Use minimal bootstrap css and js
Vincent Tondellier <tonton+hg@team1664.org>
parents: 0
diff changeset
   106
      if (!selector) {
c3726f733704 Use minimal bootstrap css and js
Vincent Tondellier <tonton+hg@team1664.org>
parents: 0
diff changeset
   107
        selector = $this.attr('href')
c3726f733704 Use minimal bootstrap css and js
Vincent Tondellier <tonton+hg@team1664.org>
parents: 0
diff changeset
   108
        selector = selector && selector.replace(/.*(?=#[^\s]*$)/, '') //strip for ie7
c3726f733704 Use minimal bootstrap css and js
Vincent Tondellier <tonton+hg@team1664.org>
parents: 0
diff changeset
   109
      }
c3726f733704 Use minimal bootstrap css and js
Vincent Tondellier <tonton+hg@team1664.org>
parents: 0
diff changeset
   110
c3726f733704 Use minimal bootstrap css and js
Vincent Tondellier <tonton+hg@team1664.org>
parents: 0
diff changeset
   111
      if ( $this.parent('li').hasClass('active') ) return
c3726f733704 Use minimal bootstrap css and js
Vincent Tondellier <tonton+hg@team1664.org>
parents: 0
diff changeset
   112
c3726f733704 Use minimal bootstrap css and js
Vincent Tondellier <tonton+hg@team1664.org>
parents: 0
diff changeset
   113
      previous = $ul.find('.active a').last()[0]
c3726f733704 Use minimal bootstrap css and js
Vincent Tondellier <tonton+hg@team1664.org>
parents: 0
diff changeset
   114
c3726f733704 Use minimal bootstrap css and js
Vincent Tondellier <tonton+hg@team1664.org>
parents: 0
diff changeset
   115
      e = $.Event('show', {
c3726f733704 Use minimal bootstrap css and js
Vincent Tondellier <tonton+hg@team1664.org>
parents: 0
diff changeset
   116
        relatedTarget: previous
c3726f733704 Use minimal bootstrap css and js
Vincent Tondellier <tonton+hg@team1664.org>
parents: 0
diff changeset
   117
      })
c3726f733704 Use minimal bootstrap css and js
Vincent Tondellier <tonton+hg@team1664.org>
parents: 0
diff changeset
   118
c3726f733704 Use minimal bootstrap css and js
Vincent Tondellier <tonton+hg@team1664.org>
parents: 0
diff changeset
   119
      $this.trigger(e)
c3726f733704 Use minimal bootstrap css and js
Vincent Tondellier <tonton+hg@team1664.org>
parents: 0
diff changeset
   120
c3726f733704 Use minimal bootstrap css and js
Vincent Tondellier <tonton+hg@team1664.org>
parents: 0
diff changeset
   121
      if (e.isDefaultPrevented()) return
c3726f733704 Use minimal bootstrap css and js
Vincent Tondellier <tonton+hg@team1664.org>
parents: 0
diff changeset
   122
c3726f733704 Use minimal bootstrap css and js
Vincent Tondellier <tonton+hg@team1664.org>
parents: 0
diff changeset
   123
      $target = $(selector)
c3726f733704 Use minimal bootstrap css and js
Vincent Tondellier <tonton+hg@team1664.org>
parents: 0
diff changeset
   124
c3726f733704 Use minimal bootstrap css and js
Vincent Tondellier <tonton+hg@team1664.org>
parents: 0
diff changeset
   125
      this.activate($this.parent('li'), $ul)
c3726f733704 Use minimal bootstrap css and js
Vincent Tondellier <tonton+hg@team1664.org>
parents: 0
diff changeset
   126
      this.activate($target, $target.parent(), function () {
c3726f733704 Use minimal bootstrap css and js
Vincent Tondellier <tonton+hg@team1664.org>
parents: 0
diff changeset
   127
        $this.trigger({
c3726f733704 Use minimal bootstrap css and js
Vincent Tondellier <tonton+hg@team1664.org>
parents: 0
diff changeset
   128
          type: 'shown'
c3726f733704 Use minimal bootstrap css and js
Vincent Tondellier <tonton+hg@team1664.org>
parents: 0
diff changeset
   129
        , relatedTarget: previous
c3726f733704 Use minimal bootstrap css and js
Vincent Tondellier <tonton+hg@team1664.org>
parents: 0
diff changeset
   130
        })
c3726f733704 Use minimal bootstrap css and js
Vincent Tondellier <tonton+hg@team1664.org>
parents: 0
diff changeset
   131
      })
c3726f733704 Use minimal bootstrap css and js
Vincent Tondellier <tonton+hg@team1664.org>
parents: 0
diff changeset
   132
    }
c3726f733704 Use minimal bootstrap css and js
Vincent Tondellier <tonton+hg@team1664.org>
parents: 0
diff changeset
   133
c3726f733704 Use minimal bootstrap css and js
Vincent Tondellier <tonton+hg@team1664.org>
parents: 0
diff changeset
   134
  , activate: function ( element, container, callback) {
c3726f733704 Use minimal bootstrap css and js
Vincent Tondellier <tonton+hg@team1664.org>
parents: 0
diff changeset
   135
      var $active = container.find('> .active')
c3726f733704 Use minimal bootstrap css and js
Vincent Tondellier <tonton+hg@team1664.org>
parents: 0
diff changeset
   136
        , transition = callback
c3726f733704 Use minimal bootstrap css and js
Vincent Tondellier <tonton+hg@team1664.org>
parents: 0
diff changeset
   137
            && $.support.transition
c3726f733704 Use minimal bootstrap css and js
Vincent Tondellier <tonton+hg@team1664.org>
parents: 0
diff changeset
   138
            && $active.hasClass('fade')
c3726f733704 Use minimal bootstrap css and js
Vincent Tondellier <tonton+hg@team1664.org>
parents: 0
diff changeset
   139
c3726f733704 Use minimal bootstrap css and js
Vincent Tondellier <tonton+hg@team1664.org>
parents: 0
diff changeset
   140
      function next() {
c3726f733704 Use minimal bootstrap css and js
Vincent Tondellier <tonton+hg@team1664.org>
parents: 0
diff changeset
   141
        $active
c3726f733704 Use minimal bootstrap css and js
Vincent Tondellier <tonton+hg@team1664.org>
parents: 0
diff changeset
   142
          .removeClass('active')
c3726f733704 Use minimal bootstrap css and js
Vincent Tondellier <tonton+hg@team1664.org>
parents: 0
diff changeset
   143
          .find('> .dropdown-menu > .active')
c3726f733704 Use minimal bootstrap css and js
Vincent Tondellier <tonton+hg@team1664.org>
parents: 0
diff changeset
   144
          .removeClass('active')
c3726f733704 Use minimal bootstrap css and js
Vincent Tondellier <tonton+hg@team1664.org>
parents: 0
diff changeset
   145
c3726f733704 Use minimal bootstrap css and js
Vincent Tondellier <tonton+hg@team1664.org>
parents: 0
diff changeset
   146
        element.addClass('active')
c3726f733704 Use minimal bootstrap css and js
Vincent Tondellier <tonton+hg@team1664.org>
parents: 0
diff changeset
   147
c3726f733704 Use minimal bootstrap css and js
Vincent Tondellier <tonton+hg@team1664.org>
parents: 0
diff changeset
   148
        if (transition) {
c3726f733704 Use minimal bootstrap css and js
Vincent Tondellier <tonton+hg@team1664.org>
parents: 0
diff changeset
   149
          element[0].offsetWidth // reflow for transition
c3726f733704 Use minimal bootstrap css and js
Vincent Tondellier <tonton+hg@team1664.org>
parents: 0
diff changeset
   150
          element.addClass('in')
c3726f733704 Use minimal bootstrap css and js
Vincent Tondellier <tonton+hg@team1664.org>
parents: 0
diff changeset
   151
        } else {
c3726f733704 Use minimal bootstrap css and js
Vincent Tondellier <tonton+hg@team1664.org>
parents: 0
diff changeset
   152
          element.removeClass('fade')
c3726f733704 Use minimal bootstrap css and js
Vincent Tondellier <tonton+hg@team1664.org>
parents: 0
diff changeset
   153
        }
c3726f733704 Use minimal bootstrap css and js
Vincent Tondellier <tonton+hg@team1664.org>
parents: 0
diff changeset
   154
c3726f733704 Use minimal bootstrap css and js
Vincent Tondellier <tonton+hg@team1664.org>
parents: 0
diff changeset
   155
        if ( element.parent('.dropdown-menu') ) {
c3726f733704 Use minimal bootstrap css and js
Vincent Tondellier <tonton+hg@team1664.org>
parents: 0
diff changeset
   156
          element.closest('li.dropdown').addClass('active')
c3726f733704 Use minimal bootstrap css and js
Vincent Tondellier <tonton+hg@team1664.org>
parents: 0
diff changeset
   157
        }
c3726f733704 Use minimal bootstrap css and js
Vincent Tondellier <tonton+hg@team1664.org>
parents: 0
diff changeset
   158
c3726f733704 Use minimal bootstrap css and js
Vincent Tondellier <tonton+hg@team1664.org>
parents: 0
diff changeset
   159
        callback && callback()
c3726f733704 Use minimal bootstrap css and js
Vincent Tondellier <tonton+hg@team1664.org>
parents: 0
diff changeset
   160
      }
c3726f733704 Use minimal bootstrap css and js
Vincent Tondellier <tonton+hg@team1664.org>
parents: 0
diff changeset
   161
c3726f733704 Use minimal bootstrap css and js
Vincent Tondellier <tonton+hg@team1664.org>
parents: 0
diff changeset
   162
      transition ?
c3726f733704 Use minimal bootstrap css and js
Vincent Tondellier <tonton+hg@team1664.org>
parents: 0
diff changeset
   163
        $active.one($.support.transition.end, next) :
c3726f733704 Use minimal bootstrap css and js
Vincent Tondellier <tonton+hg@team1664.org>
parents: 0
diff changeset
   164
        next()
c3726f733704 Use minimal bootstrap css and js
Vincent Tondellier <tonton+hg@team1664.org>
parents: 0
diff changeset
   165
c3726f733704 Use minimal bootstrap css and js
Vincent Tondellier <tonton+hg@team1664.org>
parents: 0
diff changeset
   166
      $active.removeClass('in')
c3726f733704 Use minimal bootstrap css and js
Vincent Tondellier <tonton+hg@team1664.org>
parents: 0
diff changeset
   167
    }
c3726f733704 Use minimal bootstrap css and js
Vincent Tondellier <tonton+hg@team1664.org>
parents: 0
diff changeset
   168
  }
c3726f733704 Use minimal bootstrap css and js
Vincent Tondellier <tonton+hg@team1664.org>
parents: 0
diff changeset
   169
c3726f733704 Use minimal bootstrap css and js
Vincent Tondellier <tonton+hg@team1664.org>
parents: 0
diff changeset
   170
c3726f733704 Use minimal bootstrap css and js
Vincent Tondellier <tonton+hg@team1664.org>
parents: 0
diff changeset
   171
 /* TAB PLUGIN DEFINITION
c3726f733704 Use minimal bootstrap css and js
Vincent Tondellier <tonton+hg@team1664.org>
parents: 0
diff changeset
   172
  * ===================== */
c3726f733704 Use minimal bootstrap css and js
Vincent Tondellier <tonton+hg@team1664.org>
parents: 0
diff changeset
   173
c3726f733704 Use minimal bootstrap css and js
Vincent Tondellier <tonton+hg@team1664.org>
parents: 0
diff changeset
   174
  $.fn.tab = function ( option ) {
c3726f733704 Use minimal bootstrap css and js
Vincent Tondellier <tonton+hg@team1664.org>
parents: 0
diff changeset
   175
    return this.each(function () {
c3726f733704 Use minimal bootstrap css and js
Vincent Tondellier <tonton+hg@team1664.org>
parents: 0
diff changeset
   176
      var $this = $(this)
c3726f733704 Use minimal bootstrap css and js
Vincent Tondellier <tonton+hg@team1664.org>
parents: 0
diff changeset
   177
        , data = $this.data('tab')
c3726f733704 Use minimal bootstrap css and js
Vincent Tondellier <tonton+hg@team1664.org>
parents: 0
diff changeset
   178
      if (!data) $this.data('tab', (data = new Tab(this)))
c3726f733704 Use minimal bootstrap css and js
Vincent Tondellier <tonton+hg@team1664.org>
parents: 0
diff changeset
   179
      if (typeof option == 'string') data[option]()
c3726f733704 Use minimal bootstrap css and js
Vincent Tondellier <tonton+hg@team1664.org>
parents: 0
diff changeset
   180
    })
c3726f733704 Use minimal bootstrap css and js
Vincent Tondellier <tonton+hg@team1664.org>
parents: 0
diff changeset
   181
  }
c3726f733704 Use minimal bootstrap css and js
Vincent Tondellier <tonton+hg@team1664.org>
parents: 0
diff changeset
   182
c3726f733704 Use minimal bootstrap css and js
Vincent Tondellier <tonton+hg@team1664.org>
parents: 0
diff changeset
   183
  $.fn.tab.Constructor = Tab
c3726f733704 Use minimal bootstrap css and js
Vincent Tondellier <tonton+hg@team1664.org>
parents: 0
diff changeset
   184
c3726f733704 Use minimal bootstrap css and js
Vincent Tondellier <tonton+hg@team1664.org>
parents: 0
diff changeset
   185
c3726f733704 Use minimal bootstrap css and js
Vincent Tondellier <tonton+hg@team1664.org>
parents: 0
diff changeset
   186
 /* TAB DATA-API
c3726f733704 Use minimal bootstrap css and js
Vincent Tondellier <tonton+hg@team1664.org>
parents: 0
diff changeset
   187
  * ============ */
c3726f733704 Use minimal bootstrap css and js
Vincent Tondellier <tonton+hg@team1664.org>
parents: 0
diff changeset
   188
c3726f733704 Use minimal bootstrap css and js
Vincent Tondellier <tonton+hg@team1664.org>
parents: 0
diff changeset
   189
  $(function () {
c3726f733704 Use minimal bootstrap css and js
Vincent Tondellier <tonton+hg@team1664.org>
parents: 0
diff changeset
   190
    $('body').on('click.tab.data-api', '[data-toggle="tab"], [data-toggle="pill"]', function (e) {
c3726f733704 Use minimal bootstrap css and js
Vincent Tondellier <tonton+hg@team1664.org>
parents: 0
diff changeset
   191
      e.preventDefault()
c3726f733704 Use minimal bootstrap css and js
Vincent Tondellier <tonton+hg@team1664.org>
parents: 0
diff changeset
   192
      $(this).tab('show')
c3726f733704 Use minimal bootstrap css and js
Vincent Tondellier <tonton+hg@team1664.org>
parents: 0
diff changeset
   193
    })
c3726f733704 Use minimal bootstrap css and js
Vincent Tondellier <tonton+hg@team1664.org>
parents: 0
diff changeset
   194
  })
c3726f733704 Use minimal bootstrap css and js
Vincent Tondellier <tonton+hg@team1664.org>
parents: 0
diff changeset
   195
c3726f733704 Use minimal bootstrap css and js
Vincent Tondellier <tonton+hg@team1664.org>
parents: 0
diff changeset
   196
}(window.jQuery);
c3726f733704 Use minimal bootstrap css and js
Vincent Tondellier <tonton+hg@team1664.org>
parents: 0
diff changeset
   197
/* ==========================================================
0
5b78b8c79d9c Initial commit
Vincent Tondellier <tonton+hg@team1664.org>
parents:
diff changeset
   198
 * bootstrap-alert.js v2.0.3
5b78b8c79d9c Initial commit
Vincent Tondellier <tonton+hg@team1664.org>
parents:
diff changeset
   199
 * http://twitter.github.com/bootstrap/javascript.html#alerts
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
 * Copyright 2012 Twitter, Inc.
5b78b8c79d9c Initial commit
Vincent Tondellier <tonton+hg@team1664.org>
parents:
diff changeset
   202
 *
5b78b8c79d9c Initial commit
Vincent Tondellier <tonton+hg@team1664.org>
parents:
diff changeset
   203
 * Licensed under the Apache License, Version 2.0 (the "License");
5b78b8c79d9c Initial commit
Vincent Tondellier <tonton+hg@team1664.org>
parents:
diff changeset
   204
 * you may not use this file except in compliance with the License.
5b78b8c79d9c Initial commit
Vincent Tondellier <tonton+hg@team1664.org>
parents:
diff changeset
   205
 * You may obtain a copy of the License at
5b78b8c79d9c Initial commit
Vincent Tondellier <tonton+hg@team1664.org>
parents:
diff changeset
   206
 *
5b78b8c79d9c Initial commit
Vincent Tondellier <tonton+hg@team1664.org>
parents:
diff changeset
   207
 * http://www.apache.org/licenses/LICENSE-2.0
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
 * Unless required by applicable law or agreed to in writing, software
5b78b8c79d9c Initial commit
Vincent Tondellier <tonton+hg@team1664.org>
parents:
diff changeset
   210
 * distributed under the License is distributed on an "AS IS" BASIS,
5b78b8c79d9c Initial commit
Vincent Tondellier <tonton+hg@team1664.org>
parents:
diff changeset
   211
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
5b78b8c79d9c Initial commit
Vincent Tondellier <tonton+hg@team1664.org>
parents:
diff changeset
   212
 * See the License for the specific language governing permissions and
5b78b8c79d9c Initial commit
Vincent Tondellier <tonton+hg@team1664.org>
parents:
diff changeset
   213
 * limitations under the License.
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
5b78b8c79d9c Initial commit
Vincent Tondellier <tonton+hg@team1664.org>
parents:
diff changeset
   217
!function ($) {
5b78b8c79d9c Initial commit
Vincent Tondellier <tonton+hg@team1664.org>
parents:
diff changeset
   218
5b78b8c79d9c Initial commit
Vincent Tondellier <tonton+hg@team1664.org>
parents:
diff changeset
   219
  "use strict"; // jshint ;_;
5b78b8c79d9c Initial commit
Vincent Tondellier <tonton+hg@team1664.org>
parents:
diff changeset
   220
5b78b8c79d9c Initial commit
Vincent Tondellier <tonton+hg@team1664.org>
parents:
diff changeset
   221
5b78b8c79d9c Initial commit
Vincent Tondellier <tonton+hg@team1664.org>
parents:
diff changeset
   222
 /* ALERT CLASS DEFINITION
5b78b8c79d9c Initial commit
Vincent Tondellier <tonton+hg@team1664.org>
parents:
diff changeset
   223
  * ====================== */
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
  var dismiss = '[data-dismiss="alert"]'
5b78b8c79d9c Initial commit
Vincent Tondellier <tonton+hg@team1664.org>
parents:
diff changeset
   226
    , Alert = function (el) {
5b78b8c79d9c Initial commit
Vincent Tondellier <tonton+hg@team1664.org>
parents:
diff changeset
   227
        $(el).on('click', dismiss, this.close)
5b78b8c79d9c Initial commit
Vincent Tondellier <tonton+hg@team1664.org>
parents:
diff changeset
   228
      }
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
  Alert.prototype.close = function (e) {
5b78b8c79d9c Initial commit
Vincent Tondellier <tonton+hg@team1664.org>
parents:
diff changeset
   231
    var $this = $(this)
5b78b8c79d9c Initial commit
Vincent Tondellier <tonton+hg@team1664.org>
parents:
diff changeset
   232
      , selector = $this.attr('data-target')
5b78b8c79d9c Initial commit
Vincent Tondellier <tonton+hg@team1664.org>
parents:
diff changeset
   233
      , $parent
5b78b8c79d9c Initial commit
Vincent Tondellier <tonton+hg@team1664.org>
parents:
diff changeset
   234
5b78b8c79d9c Initial commit
Vincent Tondellier <tonton+hg@team1664.org>
parents:
diff changeset
   235
    if (!selector) {
5b78b8c79d9c Initial commit
Vincent Tondellier <tonton+hg@team1664.org>
parents:
diff changeset
   236
      selector = $this.attr('href')
5b78b8c79d9c Initial commit
Vincent Tondellier <tonton+hg@team1664.org>
parents:
diff changeset
   237
      selector = selector && selector.replace(/.*(?=#[^\s]*$)/, '') //strip for ie7
5b78b8c79d9c Initial commit
Vincent Tondellier <tonton+hg@team1664.org>
parents:
diff changeset
   238
    }
5b78b8c79d9c Initial commit
Vincent Tondellier <tonton+hg@team1664.org>
parents:
diff changeset
   239
5b78b8c79d9c Initial commit
Vincent Tondellier <tonton+hg@team1664.org>
parents:
diff changeset
   240
    $parent = $(selector)
5b78b8c79d9c Initial commit
Vincent Tondellier <tonton+hg@team1664.org>
parents:
diff changeset
   241
5b78b8c79d9c Initial commit
Vincent Tondellier <tonton+hg@team1664.org>
parents:
diff changeset
   242
    e && e.preventDefault()
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
    $parent.length || ($parent = $this.hasClass('alert') ? $this : $this.parent())
5b78b8c79d9c Initial commit
Vincent Tondellier <tonton+hg@team1664.org>
parents:
diff changeset
   245
5b78b8c79d9c Initial commit
Vincent Tondellier <tonton+hg@team1664.org>
parents:
diff changeset
   246
    $parent.trigger(e = $.Event('close'))
5b78b8c79d9c Initial commit
Vincent Tondellier <tonton+hg@team1664.org>
parents:
diff changeset
   247
5b78b8c79d9c Initial commit
Vincent Tondellier <tonton+hg@team1664.org>
parents:
diff changeset
   248
    if (e.isDefaultPrevented()) return
5b78b8c79d9c Initial commit
Vincent Tondellier <tonton+hg@team1664.org>
parents:
diff changeset
   249
5b78b8c79d9c Initial commit
Vincent Tondellier <tonton+hg@team1664.org>
parents:
diff changeset
   250
    $parent.removeClass('in')
5b78b8c79d9c Initial commit
Vincent Tondellier <tonton+hg@team1664.org>
parents:
diff changeset
   251
5b78b8c79d9c Initial commit
Vincent Tondellier <tonton+hg@team1664.org>
parents:
diff changeset
   252
    function removeElement() {
5b78b8c79d9c Initial commit
Vincent Tondellier <tonton+hg@team1664.org>
parents:
diff changeset
   253
      $parent
5b78b8c79d9c Initial commit
Vincent Tondellier <tonton+hg@team1664.org>
parents:
diff changeset
   254
        .trigger('closed')
5b78b8c79d9c Initial commit
Vincent Tondellier <tonton+hg@team1664.org>
parents:
diff changeset
   255
        .remove()
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
5b78b8c79d9c Initial commit
Vincent Tondellier <tonton+hg@team1664.org>
parents:
diff changeset
   258
    $.support.transition && $parent.hasClass('fade') ?
5b78b8c79d9c Initial commit
Vincent Tondellier <tonton+hg@team1664.org>
parents:
diff changeset
   259
      $parent.on($.support.transition.end, removeElement) :
5b78b8c79d9c Initial commit
Vincent Tondellier <tonton+hg@team1664.org>
parents:
diff changeset
   260
      removeElement()
5b78b8c79d9c Initial commit
Vincent Tondellier <tonton+hg@team1664.org>
parents:
diff changeset
   261
  }
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
 /* ALERT PLUGIN DEFINITION
5b78b8c79d9c Initial commit
Vincent Tondellier <tonton+hg@team1664.org>
parents:
diff changeset
   265
  * ======================= */
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
  $.fn.alert = function (option) {
5b78b8c79d9c Initial commit
Vincent Tondellier <tonton+hg@team1664.org>
parents:
diff changeset
   268
    return this.each(function () {
5b78b8c79d9c Initial commit
Vincent Tondellier <tonton+hg@team1664.org>
parents:
diff changeset
   269
      var $this = $(this)
5b78b8c79d9c Initial commit
Vincent Tondellier <tonton+hg@team1664.org>
parents:
diff changeset
   270
        , data = $this.data('alert')
5b78b8c79d9c Initial commit
Vincent Tondellier <tonton+hg@team1664.org>
parents:
diff changeset
   271
      if (!data) $this.data('alert', (data = new Alert(this)))
5b78b8c79d9c Initial commit
Vincent Tondellier <tonton+hg@team1664.org>
parents:
diff changeset
   272
      if (typeof option == 'string') data[option].call($this)
5b78b8c79d9c Initial commit
Vincent Tondellier <tonton+hg@team1664.org>
parents:
diff changeset
   273
    })
5b78b8c79d9c Initial commit
Vincent Tondellier <tonton+hg@team1664.org>
parents:
diff changeset
   274
  }
5b78b8c79d9c Initial commit
Vincent Tondellier <tonton+hg@team1664.org>
parents:
diff changeset
   275
5b78b8c79d9c Initial commit
Vincent Tondellier <tonton+hg@team1664.org>
parents:
diff changeset
   276
  $.fn.alert.Constructor = Alert
5b78b8c79d9c Initial commit
Vincent Tondellier <tonton+hg@team1664.org>
parents:
diff changeset
   277
5b78b8c79d9c Initial commit
Vincent Tondellier <tonton+hg@team1664.org>
parents:
diff changeset
   278
5b78b8c79d9c Initial commit
Vincent Tondellier <tonton+hg@team1664.org>
parents:
diff changeset
   279
 /* ALERT DATA-API
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
  $(function () {
5b78b8c79d9c Initial commit
Vincent Tondellier <tonton+hg@team1664.org>
parents:
diff changeset
   283
    $('body').on('click.alert.data-api', dismiss, Alert.prototype.close)
5b78b8c79d9c Initial commit
Vincent Tondellier <tonton+hg@team1664.org>
parents:
diff changeset
   284
  })
5b78b8c79d9c Initial commit
Vincent Tondellier <tonton+hg@team1664.org>
parents:
diff changeset
   285
1
c3726f733704 Use minimal bootstrap css and js
Vincent Tondellier <tonton+hg@team1664.org>
parents: 0
diff changeset
   286
}(window.jQuery);
c3726f733704 Use minimal bootstrap css and js
Vincent Tondellier <tonton+hg@team1664.org>
parents: 0
diff changeset
   287
/* =============================================================
0
5b78b8c79d9c Initial commit
Vincent Tondellier <tonton+hg@team1664.org>
parents:
diff changeset
   288
 * bootstrap-collapse.js v2.0.3
5b78b8c79d9c Initial commit
Vincent Tondellier <tonton+hg@team1664.org>
parents:
diff changeset
   289
 * http://twitter.github.com/bootstrap/javascript.html#collapse
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
 * Copyright 2012 Twitter, Inc.
5b78b8c79d9c Initial commit
Vincent Tondellier <tonton+hg@team1664.org>
parents:
diff changeset
   292
 *
5b78b8c79d9c Initial commit
Vincent Tondellier <tonton+hg@team1664.org>
parents:
diff changeset
   293
 * Licensed under the Apache License, Version 2.0 (the "License");
5b78b8c79d9c Initial commit
Vincent Tondellier <tonton+hg@team1664.org>
parents:
diff changeset
   294
 * you may not use this file except in compliance with the License.
5b78b8c79d9c Initial commit
Vincent Tondellier <tonton+hg@team1664.org>
parents:
diff changeset
   295
 * You may obtain a copy of the License at
5b78b8c79d9c Initial commit
Vincent Tondellier <tonton+hg@team1664.org>
parents:
diff changeset
   296
 *
5b78b8c79d9c Initial commit
Vincent Tondellier <tonton+hg@team1664.org>
parents:
diff changeset
   297
 * http://www.apache.org/licenses/LICENSE-2.0
5b78b8c79d9c Initial commit
Vincent Tondellier <tonton+hg@team1664.org>
parents:
diff changeset
   298
 *
5b78b8c79d9c Initial commit
Vincent Tondellier <tonton+hg@team1664.org>
parents:
diff changeset
   299
 * Unless required by applicable law or agreed to in writing, software
5b78b8c79d9c Initial commit
Vincent Tondellier <tonton+hg@team1664.org>
parents:
diff changeset
   300
 * distributed under the License is distributed on an "AS IS" BASIS,
5b78b8c79d9c Initial commit
Vincent Tondellier <tonton+hg@team1664.org>
parents:
diff changeset
   301
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
5b78b8c79d9c Initial commit
Vincent Tondellier <tonton+hg@team1664.org>
parents:
diff changeset
   302
 * See the License for the specific language governing permissions and
5b78b8c79d9c Initial commit
Vincent Tondellier <tonton+hg@team1664.org>
parents:
diff changeset
   303
 * limitations under the License.
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
5b78b8c79d9c Initial commit
Vincent Tondellier <tonton+hg@team1664.org>
parents:
diff changeset
   307
!function ($) {
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
  "use strict"; // jshint ;_;
5b78b8c79d9c Initial commit
Vincent Tondellier <tonton+hg@team1664.org>
parents:
diff changeset
   310
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
 /* COLLAPSE PUBLIC CLASS DEFINITION
5b78b8c79d9c Initial commit
Vincent Tondellier <tonton+hg@team1664.org>
parents:
diff changeset
   313
  * ================================ */
5b78b8c79d9c Initial commit
Vincent Tondellier <tonton+hg@team1664.org>
parents:
diff changeset
   314
5b78b8c79d9c Initial commit
Vincent Tondellier <tonton+hg@team1664.org>
parents:
diff changeset
   315
  var Collapse = function (element, options) {
5b78b8c79d9c Initial commit
Vincent Tondellier <tonton+hg@team1664.org>
parents:
diff changeset
   316
    this.$element = $(element)
5b78b8c79d9c Initial commit
Vincent Tondellier <tonton+hg@team1664.org>
parents:
diff changeset
   317
    this.options = $.extend({}, $.fn.collapse.defaults, options)
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
    if (this.options.parent) {
5b78b8c79d9c Initial commit
Vincent Tondellier <tonton+hg@team1664.org>
parents:
diff changeset
   320
      this.$parent = $(this.options.parent)
5b78b8c79d9c Initial commit
Vincent Tondellier <tonton+hg@team1664.org>
parents:
diff changeset
   321
    }
5b78b8c79d9c Initial commit
Vincent Tondellier <tonton+hg@team1664.org>
parents:
diff changeset
   322
5b78b8c79d9c Initial commit
Vincent Tondellier <tonton+hg@team1664.org>
parents:
diff changeset
   323
    this.options.toggle && this.toggle()
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
5b78b8c79d9c Initial commit
Vincent Tondellier <tonton+hg@team1664.org>
parents:
diff changeset
   326
  Collapse.prototype = {
5b78b8c79d9c Initial commit
Vincent Tondellier <tonton+hg@team1664.org>
parents:
diff changeset
   327
5b78b8c79d9c Initial commit
Vincent Tondellier <tonton+hg@team1664.org>
parents:
diff changeset
   328
    constructor: Collapse
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
  , dimension: function () {
5b78b8c79d9c Initial commit
Vincent Tondellier <tonton+hg@team1664.org>
parents:
diff changeset
   331
      var hasWidth = this.$element.hasClass('width')
5b78b8c79d9c Initial commit
Vincent Tondellier <tonton+hg@team1664.org>
parents:
diff changeset
   332
      return hasWidth ? 'width' : 'height'
5b78b8c79d9c Initial commit
Vincent Tondellier <tonton+hg@team1664.org>
parents:
diff changeset
   333
    }
5b78b8c79d9c Initial commit
Vincent Tondellier <tonton+hg@team1664.org>
parents:
diff changeset
   334
5b78b8c79d9c Initial commit
Vincent Tondellier <tonton+hg@team1664.org>
parents:
diff changeset
   335
  , show: function () {
5b78b8c79d9c Initial commit
Vincent Tondellier <tonton+hg@team1664.org>
parents:
diff changeset
   336
      var dimension
5b78b8c79d9c Initial commit
Vincent Tondellier <tonton+hg@team1664.org>
parents:
diff changeset
   337
        , scroll
5b78b8c79d9c Initial commit
Vincent Tondellier <tonton+hg@team1664.org>
parents:
diff changeset
   338
        , actives
5b78b8c79d9c Initial commit
Vincent Tondellier <tonton+hg@team1664.org>
parents:
diff changeset
   339
        , hasData
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
      if (this.transitioning) return
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
      dimension = this.dimension()
5b78b8c79d9c Initial commit
Vincent Tondellier <tonton+hg@team1664.org>
parents:
diff changeset
   344
      scroll = $.camelCase(['scroll', dimension].join('-'))
5b78b8c79d9c Initial commit
Vincent Tondellier <tonton+hg@team1664.org>
parents:
diff changeset
   345
      actives = this.$parent && this.$parent.find('> .accordion-group > .in')
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 (actives && actives.length) {
5b78b8c79d9c Initial commit
Vincent Tondellier <tonton+hg@team1664.org>
parents:
diff changeset
   348
        hasData = actives.data('collapse')
5b78b8c79d9c Initial commit
Vincent Tondellier <tonton+hg@team1664.org>
parents:
diff changeset
   349
        if (hasData && hasData.transitioning) return
5b78b8c79d9c Initial commit
Vincent Tondellier <tonton+hg@team1664.org>
parents:
diff changeset
   350
        actives.collapse('hide')
5b78b8c79d9c Initial commit
Vincent Tondellier <tonton+hg@team1664.org>
parents:
diff changeset
   351
        hasData || actives.data('collapse', null)
5b78b8c79d9c Initial commit
Vincent Tondellier <tonton+hg@team1664.org>
parents:
diff changeset
   352
      }
5b78b8c79d9c Initial commit
Vincent Tondellier <tonton+hg@team1664.org>
parents:
diff changeset
   353
5b78b8c79d9c Initial commit
Vincent Tondellier <tonton+hg@team1664.org>
parents:
diff changeset
   354
      this.$element[dimension](0)
5b78b8c79d9c Initial commit
Vincent Tondellier <tonton+hg@team1664.org>
parents:
diff changeset
   355
      this.transition('addClass', $.Event('show'), 'shown')
5b78b8c79d9c Initial commit
Vincent Tondellier <tonton+hg@team1664.org>
parents:
diff changeset
   356
      this.$element[dimension](this.$element[0][scroll])
5b78b8c79d9c Initial commit
Vincent Tondellier <tonton+hg@team1664.org>
parents:
diff changeset
   357
    }
5b78b8c79d9c Initial commit
Vincent Tondellier <tonton+hg@team1664.org>
parents:
diff changeset
   358
5b78b8c79d9c Initial commit
Vincent Tondellier <tonton+hg@team1664.org>
parents:
diff changeset
   359
  , hide: function () {
5b78b8c79d9c Initial commit
Vincent Tondellier <tonton+hg@team1664.org>
parents:
diff changeset
   360
      var dimension
5b78b8c79d9c Initial commit
Vincent Tondellier <tonton+hg@team1664.org>
parents:
diff changeset
   361
      if (this.transitioning) return
5b78b8c79d9c Initial commit
Vincent Tondellier <tonton+hg@team1664.org>
parents:
diff changeset
   362
      dimension = this.dimension()
5b78b8c79d9c Initial commit
Vincent Tondellier <tonton+hg@team1664.org>
parents:
diff changeset
   363
      this.reset(this.$element[dimension]())
5b78b8c79d9c Initial commit
Vincent Tondellier <tonton+hg@team1664.org>
parents:
diff changeset
   364
      this.transition('removeClass', $.Event('hide'), 'hidden')
5b78b8c79d9c Initial commit
Vincent Tondellier <tonton+hg@team1664.org>
parents:
diff changeset
   365
      this.$element[dimension](0)
5b78b8c79d9c Initial commit
Vincent Tondellier <tonton+hg@team1664.org>
parents:
diff changeset
   366
    }
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
  , reset: function (size) {
5b78b8c79d9c Initial commit
Vincent Tondellier <tonton+hg@team1664.org>
parents:
diff changeset
   369
      var dimension = this.dimension()
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
      this.$element
5b78b8c79d9c Initial commit
Vincent Tondellier <tonton+hg@team1664.org>
parents:
diff changeset
   372
        .removeClass('collapse')
5b78b8c79d9c Initial commit
Vincent Tondellier <tonton+hg@team1664.org>
parents:
diff changeset
   373
        [dimension](size || 'auto')
5b78b8c79d9c Initial commit
Vincent Tondellier <tonton+hg@team1664.org>
parents:
diff changeset
   374
        [0].offsetWidth
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
      this.$element[size !== null ? 'addClass' : 'removeClass']('collapse')
5b78b8c79d9c Initial commit
Vincent Tondellier <tonton+hg@team1664.org>
parents:
diff changeset
   377
5b78b8c79d9c Initial commit
Vincent Tondellier <tonton+hg@team1664.org>
parents:
diff changeset
   378
      return this
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
5b78b8c79d9c Initial commit
Vincent Tondellier <tonton+hg@team1664.org>
parents:
diff changeset
   381
  , transition: function (method, startEvent, completeEvent) {
5b78b8c79d9c Initial commit
Vincent Tondellier <tonton+hg@team1664.org>
parents:
diff changeset
   382
      var that = this
5b78b8c79d9c Initial commit
Vincent Tondellier <tonton+hg@team1664.org>
parents:
diff changeset
   383
        , complete = function () {
5b78b8c79d9c Initial commit
Vincent Tondellier <tonton+hg@team1664.org>
parents:
diff changeset
   384
            if (startEvent.type == 'show') that.reset()
5b78b8c79d9c Initial commit
Vincent Tondellier <tonton+hg@team1664.org>
parents:
diff changeset
   385
            that.transitioning = 0
5b78b8c79d9c Initial commit
Vincent Tondellier <tonton+hg@team1664.org>
parents:
diff changeset
   386
            that.$element.trigger(completeEvent)
5b78b8c79d9c Initial commit
Vincent Tondellier <tonton+hg@team1664.org>
parents:
diff changeset
   387
          }
5b78b8c79d9c Initial commit
Vincent Tondellier <tonton+hg@team1664.org>
parents:
diff changeset
   388
5b78b8c79d9c Initial commit
Vincent Tondellier <tonton+hg@team1664.org>
parents:
diff changeset
   389
      this.$element.trigger(startEvent)
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
      if (startEvent.isDefaultPrevented()) return
5b78b8c79d9c Initial commit
Vincent Tondellier <tonton+hg@team1664.org>
parents:
diff changeset
   392
5b78b8c79d9c Initial commit
Vincent Tondellier <tonton+hg@team1664.org>
parents:
diff changeset
   393
      this.transitioning = 1
5b78b8c79d9c Initial commit
Vincent Tondellier <tonton+hg@team1664.org>
parents:
diff changeset
   394
5b78b8c79d9c Initial commit
Vincent Tondellier <tonton+hg@team1664.org>
parents:
diff changeset
   395
      this.$element[method]('in')
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
      $.support.transition && this.$element.hasClass('collapse') ?
5b78b8c79d9c Initial commit
Vincent Tondellier <tonton+hg@team1664.org>
parents:
diff changeset
   398
        this.$element.one($.support.transition.end, complete) :
5b78b8c79d9c Initial commit
Vincent Tondellier <tonton+hg@team1664.org>
parents:
diff changeset
   399
        complete()
5b78b8c79d9c Initial commit
Vincent Tondellier <tonton+hg@team1664.org>
parents:
diff changeset
   400
    }
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
  , toggle: function () {
5b78b8c79d9c Initial commit
Vincent Tondellier <tonton+hg@team1664.org>
parents:
diff changeset
   403
      this[this.$element.hasClass('in') ? 'hide' : 'show']()
5b78b8c79d9c Initial commit
Vincent Tondellier <tonton+hg@team1664.org>
parents:
diff changeset
   404
    }
5b78b8c79d9c Initial commit
Vincent Tondellier <tonton+hg@team1664.org>
parents:
diff changeset
   405
5b78b8c79d9c Initial commit
Vincent Tondellier <tonton+hg@team1664.org>
parents:
diff changeset
   406
  }
5b78b8c79d9c Initial commit
Vincent Tondellier <tonton+hg@team1664.org>
parents:
diff changeset
   407
5b78b8c79d9c Initial commit
Vincent Tondellier <tonton+hg@team1664.org>
parents:
diff changeset
   408
5b78b8c79d9c Initial commit
Vincent Tondellier <tonton+hg@team1664.org>
parents:
diff changeset
   409
 /* COLLAPSIBLE PLUGIN DEFINITION
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
  $.fn.collapse = function (option) {
5b78b8c79d9c Initial commit
Vincent Tondellier <tonton+hg@team1664.org>
parents:
diff changeset
   413
    return this.each(function () {
5b78b8c79d9c Initial commit
Vincent Tondellier <tonton+hg@team1664.org>
parents:
diff changeset
   414
      var $this = $(this)
5b78b8c79d9c Initial commit
Vincent Tondellier <tonton+hg@team1664.org>
parents:
diff changeset
   415
        , data = $this.data('collapse')
5b78b8c79d9c Initial commit
Vincent Tondellier <tonton+hg@team1664.org>
parents:
diff changeset
   416
        , options = typeof option == 'object' && option
5b78b8c79d9c Initial commit
Vincent Tondellier <tonton+hg@team1664.org>
parents:
diff changeset
   417
      if (!data) $this.data('collapse', (data = new Collapse(this, options)))
5b78b8c79d9c Initial commit
Vincent Tondellier <tonton+hg@team1664.org>
parents:
diff changeset
   418
      if (typeof option == 'string') data[option]()
5b78b8c79d9c Initial commit
Vincent Tondellier <tonton+hg@team1664.org>
parents:
diff changeset
   419
    })
5b78b8c79d9c Initial commit
Vincent Tondellier <tonton+hg@team1664.org>
parents:
diff changeset
   420
  }
5b78b8c79d9c Initial commit
Vincent Tondellier <tonton+hg@team1664.org>
parents:
diff changeset
   421
5b78b8c79d9c Initial commit
Vincent Tondellier <tonton+hg@team1664.org>
parents:
diff changeset
   422
  $.fn.collapse.defaults = {
5b78b8c79d9c Initial commit
Vincent Tondellier <tonton+hg@team1664.org>
parents:
diff changeset
   423
    toggle: true
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
5b78b8c79d9c Initial commit
Vincent Tondellier <tonton+hg@team1664.org>
parents:
diff changeset
   426
  $.fn.collapse.Constructor = Collapse
5b78b8c79d9c Initial commit
Vincent Tondellier <tonton+hg@team1664.org>
parents:
diff changeset
   427
5b78b8c79d9c Initial commit
Vincent Tondellier <tonton+hg@team1664.org>
parents:
diff changeset
   428
5b78b8c79d9c Initial commit
Vincent Tondellier <tonton+hg@team1664.org>
parents:
diff changeset
   429
 /* COLLAPSIBLE DATA-API
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
  $(function () {
5b78b8c79d9c Initial commit
Vincent Tondellier <tonton+hg@team1664.org>
parents:
diff changeset
   433
    $('body').on('click.collapse.data-api', '[data-toggle=collapse]', function ( e ) {
5b78b8c79d9c Initial commit
Vincent Tondellier <tonton+hg@team1664.org>
parents:
diff changeset
   434
      var $this = $(this), href
5b78b8c79d9c Initial commit
Vincent Tondellier <tonton+hg@team1664.org>
parents:
diff changeset
   435
        , target = $this.attr('data-target')
5b78b8c79d9c Initial commit
Vincent Tondellier <tonton+hg@team1664.org>
parents:
diff changeset
   436
          || e.preventDefault()
5b78b8c79d9c Initial commit
Vincent Tondellier <tonton+hg@team1664.org>
parents:
diff changeset
   437
          || (href = $this.attr('href')) && href.replace(/.*(?=#[^\s]+$)/, '') //strip for ie7
5b78b8c79d9c Initial commit
Vincent Tondellier <tonton+hg@team1664.org>
parents:
diff changeset
   438
        , option = $(target).data('collapse') ? 'toggle' : $this.data()
5b78b8c79d9c Initial commit
Vincent Tondellier <tonton+hg@team1664.org>
parents:
diff changeset
   439
      $(target).collapse(option)
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
  })
5b78b8c79d9c Initial commit
Vincent Tondellier <tonton+hg@team1664.org>
parents:
diff changeset
   442
5b78b8c79d9c Initial commit
Vincent Tondellier <tonton+hg@team1664.org>
parents:
diff changeset
   443
}(window.jQuery);