rails-bootstrap 2.3.2.0 → 3.0.0.0

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