annotate static/bootstrap/js/bootstrap.js @ 58:746e53efc188

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