pure-bootstrap-rails 2.2.2 → 2.3.0

Sign up to get free protection for your applications and to get access to all the features.
@@ -1,5 +1,5 @@
1
1
  module PureBootstrap
2
2
  module Rails
3
- VERSION = "2.2.2"
3
+ VERSION = "2.3.0"
4
4
  end
5
5
  end
@@ -1,5 +1,5 @@
1
1
  /* ===================================================
2
- * bootstrap-transition.js v2.2.2
2
+ * bootstrap-transition.js v2.3.0
3
3
  * http://twitter.github.com/bootstrap/javascript.html#transitions
4
4
  * ===================================================
5
5
  * Copyright 2012 Twitter, Inc.
@@ -58,7 +58,7 @@
58
58
  })
59
59
 
60
60
  }(window.jQuery);/* ==========================================================
61
- * bootstrap-alert.js v2.2.2
61
+ * bootstrap-alert.js v2.3.0
62
62
  * http://twitter.github.com/bootstrap/javascript.html#alerts
63
63
  * ==========================================================
64
64
  * Copyright 2012 Twitter, Inc.
@@ -156,7 +156,7 @@
156
156
  $(document).on('click.alert.data-api', dismiss, Alert.prototype.close)
157
157
 
158
158
  }(window.jQuery);/* ============================================================
159
- * bootstrap-button.js v2.2.2
159
+ * bootstrap-button.js v2.3.0
160
160
  * http://twitter.github.com/bootstrap/javascript.html#buttons
161
161
  * ============================================================
162
162
  * Copyright 2012 Twitter, Inc.
@@ -260,7 +260,7 @@
260
260
  })
261
261
 
262
262
  }(window.jQuery);/* ==========================================================
263
- * bootstrap-carousel.js v2.2.2
263
+ * bootstrap-carousel.js v2.3.0
264
264
  * http://twitter.github.com/bootstrap/javascript.html#carousel
265
265
  * ==========================================================
266
266
  * Copyright 2012 Twitter, Inc.
@@ -289,6 +289,7 @@
289
289
 
290
290
  var Carousel = function (element, options) {
291
291
  this.$element = $(element)
292
+ this.$indicators = this.$element.find('.carousel-indicators')
292
293
  this.options = options
293
294
  this.options.pause == 'hover' && this.$element
294
295
  .on('mouseenter', $.proxy(this.pause, this))
@@ -299,19 +300,24 @@
299
300
 
300
301
  cycle: function (e) {
301
302
  if (!e) this.paused = false
303
+ if (this.interval) clearInterval(this.interval);
302
304
  this.options.interval
303
305
  && !this.paused
304
306
  && (this.interval = setInterval($.proxy(this.next, this), this.options.interval))
305
307
  return this
306
308
  }
307
309
 
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
+ }
315
+
308
316
  , to: function (pos) {
309
- var $active = this.$element.find('.item.active')
310
- , children = $active.parent().children()
311
- , activePos = children.index($active)
317
+ var activeIndex = this.getActiveIndex()
312
318
  , that = this
313
319
 
314
- if (pos > (children.length - 1) || pos < 0) return
320
+ if (pos > (this.$items.length - 1) || pos < 0) return
315
321
 
316
322
  if (this.sliding) {
317
323
  return this.$element.one('slid', function () {
@@ -319,11 +325,11 @@
319
325
  })
320
326
  }
321
327
 
322
- if (activePos == pos) {
328
+ if (activeIndex == pos) {
323
329
  return this.pause().cycle()
324
330
  }
325
331
 
326
- return this.slide(pos > activePos ? 'next' : 'prev', $(children[pos]))
332
+ return this.slide(pos > activeIndex ? 'next' : 'prev', $(this.$items[pos]))
327
333
  }
328
334
 
329
335
  , pause: function (e) {
@@ -364,10 +370,19 @@
364
370
 
365
371
  e = $.Event('slide', {
366
372
  relatedTarget: $next[0]
373
+ , direction: direction
367
374
  })
368
375
 
369
376
  if ($next.hasClass('active')) return
370
377
 
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
+ }
385
+
371
386
  if ($.support.transition && this.$element.hasClass('slide')) {
372
387
  this.$element.trigger(e)
373
388
  if (e.isDefaultPrevented()) return
@@ -412,7 +427,7 @@
412
427
  if (!data) $this.data('carousel', (data = new Carousel(this, options)))
413
428
  if (typeof option == 'number') data.to(option)
414
429
  else if (action) data[action]()
415
- else if (options.interval) data.cycle()
430
+ else if (options.interval) data.pause().cycle()
416
431
  })
417
432
  }
418
433
 
@@ -435,16 +450,23 @@
435
450
  /* CAROUSEL DATA-API
436
451
  * ================= */
437
452
 
438
- $(document).on('click.carousel.data-api', '[data-slide]', function (e) {
453
+ $(document).on('click.carousel.data-api', '[data-slide], [data-slide-to]', function (e) {
439
454
  var $this = $(this), href
440
455
  , $target = $($this.attr('data-target') || (href = $this.attr('href')) && href.replace(/.*(?=#[^\s]+$)/, '')) //strip for ie7
441
456
  , options = $.extend({}, $target.data(), $this.data())
457
+ , slideIndex
458
+
442
459
  $target.carousel(options)
460
+
461
+ if (slideIndex = $this.attr('data-slide-to')) {
462
+ $target.data('carousel').pause().to(slideIndex).cycle()
463
+ }
464
+
443
465
  e.preventDefault()
444
466
  })
445
467
 
446
468
  }(window.jQuery);/* =============================================================
447
- * bootstrap-collapse.js v2.2.2
469
+ * bootstrap-collapse.js v2.3.0
448
470
  * http://twitter.github.com/bootstrap/javascript.html#collapse
449
471
  * =============================================================
450
472
  * Copyright 2012 Twitter, Inc.
@@ -497,7 +519,7 @@
497
519
  , actives
498
520
  , hasData
499
521
 
500
- if (this.transitioning) return
522
+ if (this.transitioning || this.$element.hasClass('in')) return
501
523
 
502
524
  dimension = this.dimension()
503
525
  scroll = $.camelCase(['scroll', dimension].join('-'))
@@ -517,7 +539,7 @@
517
539
 
518
540
  , hide: function () {
519
541
  var dimension
520
- if (this.transitioning) return
542
+ if (this.transitioning || !this.$element.hasClass('in')) return
521
543
  dimension = this.dimension()
522
544
  this.reset(this.$element[dimension]())
523
545
  this.transition('removeClass', $.Event('hide'), 'hidden')
@@ -574,7 +596,7 @@
574
596
  return this.each(function () {
575
597
  var $this = $(this)
576
598
  , data = $this.data('collapse')
577
- , options = typeof option == 'object' && option
599
+ , options = $.extend({}, $.fn.collapse.defaults, $this.data(), typeof option == 'object' && option)
578
600
  if (!data) $this.data('collapse', (data = new Collapse(this, options)))
579
601
  if (typeof option == 'string') data[option]()
580
602
  })
@@ -610,7 +632,7 @@
610
632
  })
611
633
 
612
634
  }(window.jQuery);/* ============================================================
613
- * bootstrap-dropdown.js v2.2.2
635
+ * bootstrap-dropdown.js v2.3.0
614
636
  * http://twitter.github.com/bootstrap/javascript.html#dropdowns
615
637
  * ============================================================
616
638
  * Copyright 2012 Twitter, Inc.
@@ -692,7 +714,10 @@
692
714
 
693
715
  isActive = $parent.hasClass('open')
694
716
 
695
- if (!isActive || (isActive && e.keyCode == 27)) return $this.click()
717
+ if (!isActive || (isActive && e.keyCode == 27)) {
718
+ if (e.which == 27) $parent.find(toggle).focus()
719
+ return $this.click()
720
+ }
696
721
 
697
722
  $items = $('[role=menu] li:not(.divider):visible a', $parent)
698
723
 
@@ -726,8 +751,9 @@
726
751
  selector = selector && /#/.test(selector) && selector.replace(/.*(?=#[^\s]*$)/, '') //strip for ie7
727
752
  }
728
753
 
729
- $parent = $(selector)
730
- $parent.length || ($parent = $this.parent())
754
+ $parent = selector && $(selector)
755
+
756
+ if (!$parent || !$parent.length) $parent = $this.parent()
731
757
 
732
758
  return $parent
733
759
  }
@@ -763,14 +789,15 @@
763
789
  * =================================== */
764
790
 
765
791
  $(document)
766
- .on('click.dropdown.data-api touchstart.dropdown.data-api', clearMenus)
767
- .on('click.dropdown touchstart.dropdown.data-api', '.dropdown form', function (e) { e.stopPropagation() })
768
- .on('touchstart.dropdown.data-api', '.dropdown-menu', function (e) { e.stopPropagation() })
769
- .on('click.dropdown.data-api touchstart.dropdown.data-api' , toggle, Dropdown.prototype.toggle)
770
- .on('keydown.dropdown.data-api touchstart.dropdown.data-api', toggle + ', [role=menu]' , Dropdown.prototype.keydown)
771
-
772
- }(window.jQuery);/* =========================================================
773
- * bootstrap-modal.js v2.2.2
792
+ .on('click.dropdown.data-api', clearMenus)
793
+ .on('click.dropdown.data-api', '.dropdown form', function (e) { e.stopPropagation() })
794
+ .on('.dropdown-menu', function (e) { e.stopPropagation() })
795
+ .on('click.dropdown.data-api' , toggle, Dropdown.prototype.toggle)
796
+ .on('keydown.dropdown.data-api', toggle + ', [role=menu]' , Dropdown.prototype.keydown)
797
+
798
+ }(window.jQuery);
799
+ /* =========================================================
800
+ * bootstrap-modal.js v2.3.0
774
801
  * http://twitter.github.com/bootstrap/javascript.html#modals
775
802
  * =========================================================
776
803
  * Copyright 2012 Twitter, Inc.
@@ -831,8 +858,7 @@
831
858
  that.$element.appendTo(document.body) //don't move modals dom position
832
859
  }
833
860
 
834
- that.$element
835
- .show()
861
+ that.$element.show()
836
862
 
837
863
  if (transition) {
838
864
  that.$element[0].offsetWidth // force reflow
@@ -910,12 +936,13 @@
910
936
  })
911
937
  }
912
938
 
913
- , hideModal: function (that) {
914
- this.$element
915
- .hide()
916
- .trigger('hidden')
917
-
918
- this.backdrop()
939
+ , hideModal: function () {
940
+ var that = this
941
+ this.$element.hide()
942
+ this.backdrop(function () {
943
+ that.removeBackdrop()
944
+ that.$element.trigger('hidden')
945
+ })
919
946
  }
920
947
 
921
948
  , removeBackdrop: function () {
@@ -943,6 +970,8 @@
943
970
 
944
971
  this.$backdrop.addClass('in')
945
972
 
973
+ if (!callback) return
974
+
946
975
  doAnimate ?
947
976
  this.$backdrop.one($.support.transition.end, callback) :
948
977
  callback()
@@ -951,8 +980,8 @@
951
980
  this.$backdrop.removeClass('in')
952
981
 
953
982
  $.support.transition && this.$element.hasClass('fade')?
954
- this.$backdrop.one($.support.transition.end, $.proxy(this.removeBackdrop, this)) :
955
- this.removeBackdrop()
983
+ this.$backdrop.one($.support.transition.end, callback) :
984
+ callback()
956
985
 
957
986
  } else if (callback) {
958
987
  callback()
@@ -1015,7 +1044,7 @@
1015
1044
 
1016
1045
  }(window.jQuery);
1017
1046
  /* ===========================================================
1018
- * bootstrap-tooltip.js v2.2.2
1047
+ * bootstrap-tooltip.js v2.3.0
1019
1048
  * http://twitter.github.com/bootstrap/javascript.html#tooltips
1020
1049
  * Inspired by the original jQuery.tipsy by Jason Frame
1021
1050
  * ===========================================================
@@ -1054,19 +1083,27 @@
1054
1083
  , init: function (type, element, options) {
1055
1084
  var eventIn
1056
1085
  , eventOut
1086
+ , triggers
1087
+ , trigger
1088
+ , i
1057
1089
 
1058
1090
  this.type = type
1059
1091
  this.$element = $(element)
1060
1092
  this.options = this.getOptions(options)
1061
1093
  this.enabled = true
1062
1094
 
1063
- if (this.options.trigger == 'click') {
1064
- this.$element.on('click.' + this.type, this.options.selector, $.proxy(this.toggle, this))
1065
- } else if (this.options.trigger != 'manual') {
1066
- eventIn = this.options.trigger == 'hover' ? 'mouseenter' : 'focus'
1067
- eventOut = this.options.trigger == 'hover' ? 'mouseleave' : 'blur'
1068
- this.$element.on(eventIn + '.' + this.type, this.options.selector, $.proxy(this.enter, this))
1069
- this.$element.on(eventOut + '.' + this.type, this.options.selector, $.proxy(this.leave, this))
1095
+ triggers = this.options.trigger.split(' ')
1096
+
1097
+ for (i = triggers.length; i--;) {
1098
+ trigger = triggers[i]
1099
+ if (trigger == 'click') {
1100
+ this.$element.on('click.' + this.type, this.options.selector, $.proxy(this.toggle, this))
1101
+ } else if (trigger != 'manual') {
1102
+ eventIn = trigger == 'hover' ? 'mouseenter' : 'focus'
1103
+ eventOut = trigger == 'hover' ? 'mouseleave' : 'blur'
1104
+ this.$element.on(eventIn + '.' + this.type, this.options.selector, $.proxy(this.enter, this))
1105
+ this.$element.on(eventOut + '.' + this.type, this.options.selector, $.proxy(this.leave, this))
1106
+ }
1070
1107
  }
1071
1108
 
1072
1109
  this.options.selector ?
@@ -1075,7 +1112,7 @@
1075
1112
  }
1076
1113
 
1077
1114
  , getOptions: function (options) {
1078
- options = $.extend({}, $.fn[this.type].defaults, options, this.$element.data())
1115
+ options = $.extend({}, $.fn[this.type].defaults, this.$element.data(), options)
1079
1116
 
1080
1117
  if (options.delay && typeof options.delay == 'number') {
1081
1118
  options.delay = {
@@ -1113,14 +1150,16 @@
1113
1150
 
1114
1151
  , show: function () {
1115
1152
  var $tip
1116
- , inside
1117
1153
  , pos
1118
1154
  , actualWidth
1119
1155
  , actualHeight
1120
1156
  , placement
1121
1157
  , tp
1158
+ , e = $.Event('show')
1122
1159
 
1123
1160
  if (this.hasContent() && this.enabled) {
1161
+ this.$element.trigger(e)
1162
+ if (e.isDefaultPrevented()) return
1124
1163
  $tip = this.tip()
1125
1164
  this.setContent()
1126
1165
 
@@ -1132,19 +1171,18 @@
1132
1171
  this.options.placement.call(this, $tip[0], this.$element[0]) :
1133
1172
  this.options.placement
1134
1173
 
1135
- inside = /in/.test(placement)
1136
-
1137
1174
  $tip
1138
1175
  .detach()
1139
1176
  .css({ top: 0, left: 0, display: 'block' })
1140
- .insertAfter(this.$element)
1141
1177
 
1142
- pos = this.getPosition(inside)
1178
+ this.options.container ? $tip.appendTo(this.options.container) : $tip.insertAfter(this.$element)
1179
+
1180
+ pos = this.getPosition()
1143
1181
 
1144
1182
  actualWidth = $tip[0].offsetWidth
1145
1183
  actualHeight = $tip[0].offsetHeight
1146
1184
 
1147
- switch (inside ? placement.split(' ')[1] : placement) {
1185
+ switch (placement) {
1148
1186
  case 'bottom':
1149
1187
  tp = {top: pos.top + pos.height, left: pos.left + pos.width / 2 - actualWidth / 2}
1150
1188
  break
@@ -1159,11 +1197,56 @@
1159
1197
  break
1160
1198
  }
1161
1199
 
1162
- $tip
1163
- .offset(tp)
1164
- .addClass(placement)
1165
- .addClass('in')
1200
+ this.applyPlacement(tp, placement)
1201
+ this.$element.trigger('shown')
1202
+ }
1203
+ }
1204
+
1205
+ , applyPlacement: function(offset, placement){
1206
+ var $tip = this.tip()
1207
+ , width = $tip[0].offsetWidth
1208
+ , height = $tip[0].offsetHeight
1209
+ , actualWidth
1210
+ , actualHeight
1211
+ , delta
1212
+ , replace
1213
+
1214
+ $tip
1215
+ .offset(offset)
1216
+ .addClass(placement)
1217
+ .addClass('in')
1218
+
1219
+ actualWidth = $tip[0].offsetWidth
1220
+ actualHeight = $tip[0].offsetHeight
1221
+
1222
+ if (placement == 'top' && actualHeight != height) {
1223
+ offset.top = offset.top + height - actualHeight
1224
+ replace = true
1166
1225
  }
1226
+
1227
+ if (placement == 'bottom' || placement == 'top') {
1228
+ delta = 0
1229
+
1230
+ if (offset.left < 0){
1231
+ delta = offset.left * -2
1232
+ offset.left = 0
1233
+ $tip.offset(offset)
1234
+ actualWidth = $tip[0].offsetWidth
1235
+ actualHeight = $tip[0].offsetHeight
1236
+ }
1237
+
1238
+ this.replaceArrow(delta - width + actualWidth, actualWidth, 'left')
1239
+ } else {
1240
+ this.replaceArrow(actualHeight - height, actualHeight, 'top')
1241
+ }
1242
+
1243
+ if (replace) $tip.offset(offset)
1244
+ }
1245
+
1246
+ , replaceArrow: function(delta, dimension, position){
1247
+ this
1248
+ .arrow()
1249
+ .css(position, delta ? (50 * (1 - delta / dimension) + "%") : '')
1167
1250
  }
1168
1251
 
1169
1252
  , setContent: function () {
@@ -1177,6 +1260,10 @@
1177
1260
  , hide: function () {
1178
1261
  var that = this
1179
1262
  , $tip = this.tip()
1263
+ , e = $.Event('hide')
1264
+
1265
+ this.$element.trigger(e)
1266
+ if (e.isDefaultPrevented()) return
1180
1267
 
1181
1268
  $tip.removeClass('in')
1182
1269
 
@@ -1195,13 +1282,15 @@
1195
1282
  removeWithAnimation() :
1196
1283
  $tip.detach()
1197
1284
 
1285
+ this.$element.trigger('hidden')
1286
+
1198
1287
  return this
1199
1288
  }
1200
1289
 
1201
1290
  , fixTitle: function () {
1202
1291
  var $e = this.$element
1203
1292
  if ($e.attr('title') || typeof($e.attr('data-original-title')) != 'string') {
1204
- $e.attr('data-original-title', $e.attr('title') || '').removeAttr('title')
1293
+ $e.attr('data-original-title', $e.attr('title') || '').attr('title', '')
1205
1294
  }
1206
1295
  }
1207
1296
 
@@ -1209,11 +1298,12 @@
1209
1298
  return this.getTitle()
1210
1299
  }
1211
1300
 
1212
- , getPosition: function (inside) {
1213
- return $.extend({}, (inside ? {top: 0, left: 0} : this.$element.offset()), {
1214
- width: this.$element[0].offsetWidth
1215
- , height: this.$element[0].offsetHeight
1216
- })
1301
+ , getPosition: function () {
1302
+ var el = this.$element[0]
1303
+ return $.extend({}, (typeof el.getBoundingClientRect == 'function') ? el.getBoundingClientRect() : {
1304
+ width: el.offsetWidth
1305
+ , height: el.offsetHeight
1306
+ }, this.$element.offset())
1217
1307
  }
1218
1308
 
1219
1309
  , getTitle: function () {
@@ -1231,6 +1321,10 @@
1231
1321
  return this.$tip = this.$tip || $(this.options.template)
1232
1322
  }
1233
1323
 
1324
+ , arrow: function(){
1325
+ return this.$arrow = this.$arrow || this.tip().find(".tooltip-arrow")
1326
+ }
1327
+
1234
1328
  , validate: function () {
1235
1329
  if (!this.$element[0].parentNode) {
1236
1330
  this.hide()
@@ -1252,8 +1346,8 @@
1252
1346
  }
1253
1347
 
1254
1348
  , toggle: function (e) {
1255
- var self = $(e.currentTarget)[this.type](this._options).data(this.type)
1256
- self[self.tip().hasClass('in') ? 'hide' : 'show']()
1349
+ var self = e ? $(e.currentTarget)[this.type](this._options).data(this.type) : this
1350
+ self.tip().hasClass('in') ? self.hide() : self.show()
1257
1351
  }
1258
1352
 
1259
1353
  , destroy: function () {
@@ -1285,10 +1379,11 @@
1285
1379
  , placement: 'top'
1286
1380
  , selector: false
1287
1381
  , template: '<div class="tooltip"><div class="tooltip-arrow"></div><div class="tooltip-inner"></div></div>'
1288
- , trigger: 'hover'
1382
+ , trigger: 'hover focus'
1289
1383
  , title: ''
1290
1384
  , delay: 0
1291
1385
  , html: false
1386
+ , container: false
1292
1387
  }
1293
1388
 
1294
1389
 
@@ -1300,8 +1395,9 @@
1300
1395
  return this
1301
1396
  }
1302
1397
 
1303
- }(window.jQuery);/* ===========================================================
1304
- * bootstrap-popover.js v2.2.2
1398
+ }(window.jQuery);
1399
+ /* ===========================================================
1400
+ * bootstrap-popover.js v2.3.0
1305
1401
  * http://twitter.github.com/bootstrap/javascript.html#popovers
1306
1402
  * ===========================================================
1307
1403
  * Copyright 2012 Twitter, Inc.
@@ -1360,8 +1456,8 @@
1360
1456
  , $e = this.$element
1361
1457
  , o = this.options
1362
1458
 
1363
- content = $e.attr('data-content')
1364
- || (typeof o.content == 'function' ? o.content.call($e[0]) : o.content)
1459
+ content = (typeof o.content == 'function' ? o.content.call($e[0]) : o.content)
1460
+ || $e.attr('data-content')
1365
1461
 
1366
1462
  return content
1367
1463
  }
@@ -1401,7 +1497,7 @@
1401
1497
  placement: 'right'
1402
1498
  , trigger: 'click'
1403
1499
  , content: ''
1404
- , template: '<div class="popover"><div class="arrow"></div><div class="popover-inner"><h3 class="popover-title"></h3><div class="popover-content"></div></div></div>'
1500
+ , template: '<div class="popover"><div class="arrow"></div><h3 class="popover-title"></h3><div class="popover-content"></div></div>'
1405
1501
  })
1406
1502
 
1407
1503
 
@@ -1413,8 +1509,9 @@
1413
1509
  return this
1414
1510
  }
1415
1511
 
1416
- }(window.jQuery);/* =============================================================
1417
- * bootstrap-scrollspy.js v2.2.2
1512
+ }(window.jQuery);
1513
+ /* =============================================================
1514
+ * bootstrap-scrollspy.js v2.3.0
1418
1515
  * http://twitter.github.com/bootstrap/javascript.html#scrollspy
1419
1516
  * =============================================================
1420
1517
  * Copyright 2012 Twitter, Inc.
@@ -1474,7 +1571,7 @@
1474
1571
  , $href = /^#\w/.test(href) && $(href)
1475
1572
  return ( $href
1476
1573
  && $href.length
1477
- && [[ $href.position().top + self.$scrollElement.scrollTop(), href ]] ) || null
1574
+ && [[ $href.position().top + (!$.isWindow(self.$scrollElement.get(0)) && self.$scrollElement.scrollTop()), href ]] ) || null
1478
1575
  })
1479
1576
  .sort(function (a, b) { return a[0] - b[0] })
1480
1577
  .each(function () {
@@ -1575,7 +1672,7 @@
1575
1672
  })
1576
1673
 
1577
1674
  }(window.jQuery);/* ========================================================
1578
- * bootstrap-tab.js v2.2.2
1675
+ * bootstrap-tab.js v2.3.0
1579
1676
  * http://twitter.github.com/bootstrap/javascript.html#tabs
1580
1677
  * ========================================================
1581
1678
  * Copyright 2012 Twitter, Inc.
@@ -1718,7 +1815,7 @@
1718
1815
  })
1719
1816
 
1720
1817
  }(window.jQuery);/* =============================================================
1721
- * bootstrap-typeahead.js v2.2.2
1818
+ * bootstrap-typeahead.js v2.3.0
1722
1819
  * http://twitter.github.com/bootstrap/javascript.html#typeahead
1723
1820
  * =============================================================
1724
1821
  * Copyright 2012 Twitter, Inc.
@@ -1891,6 +1988,7 @@
1891
1988
 
1892
1989
  , listen: function () {
1893
1990
  this.$element
1991
+ .on('focus', $.proxy(this.focus, this))
1894
1992
  .on('blur', $.proxy(this.blur, this))
1895
1993
  .on('keypress', $.proxy(this.keypress, this))
1896
1994
  .on('keyup', $.proxy(this.keyup, this))
@@ -1902,6 +2000,7 @@
1902
2000
  this.$menu
1903
2001
  .on('click', $.proxy(this.click, this))
1904
2002
  .on('mouseenter', 'li', $.proxy(this.mouseenter, this))
2003
+ .on('mouseleave', 'li', $.proxy(this.mouseleave, this))
1905
2004
  }
1906
2005
 
1907
2006
  , eventSupported: function(eventName) {
@@ -1975,22 +2074,33 @@
1975
2074
  e.preventDefault()
1976
2075
  }
1977
2076
 
2077
+ , focus: function (e) {
2078
+ this.focused = true
2079
+ }
2080
+
1978
2081
  , blur: function (e) {
1979
- var that = this
1980
- setTimeout(function () { that.hide() }, 150)
2082
+ this.focused = false
2083
+ if (!this.mousedover && this.shown) this.hide()
1981
2084
  }
1982
2085
 
1983
2086
  , click: function (e) {
1984
2087
  e.stopPropagation()
1985
2088
  e.preventDefault()
1986
2089
  this.select()
2090
+ this.$element.focus()
1987
2091
  }
1988
2092
 
1989
2093
  , mouseenter: function (e) {
2094
+ this.mousedover = true
1990
2095
  this.$menu.find('.active').removeClass('active')
1991
2096
  $(e.currentTarget).addClass('active')
1992
2097
  }
1993
2098
 
2099
+ , mouseleave: function (e) {
2100
+ this.mousedover = false
2101
+ if (!this.focused && this.shown) this.hide()
2102
+ }
2103
+
1994
2104
  }
1995
2105
 
1996
2106
 
@@ -2035,13 +2145,12 @@
2035
2145
  $(document).on('focus.typeahead.data-api', '[data-provide="typeahead"]', function (e) {
2036
2146
  var $this = $(this)
2037
2147
  if ($this.data('typeahead')) return
2038
- e.preventDefault()
2039
2148
  $this.typeahead($this.data())
2040
2149
  })
2041
2150
 
2042
2151
  }(window.jQuery);
2043
2152
  /* ==========================================================
2044
- * bootstrap-affix.js v2.2.2
2153
+ * bootstrap-affix.js v2.3.0
2045
2154
  * http://twitter.github.com/bootstrap/javascript.html#affix
2046
2155
  * ==========================================================
2047
2156
  * Copyright 2012 Twitter, Inc.