bootstrap_builder 0.2.6 → 0.3.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
data/README.md CHANGED
@@ -2,7 +2,7 @@
2
2
 
3
3
  A Rails form builder that generates [Twitter Bootstrap](http://twitter.github.com/bootstrap) markup and helps keep your code clean.
4
4
 
5
- * Includes Twiter Bootstrap 2.0.2 CSS and Javascript files
5
+ * Includes Twiter Bootstrap 2.0.4 CSS and Javascript files
6
6
  * Uses existing Rails helpers
7
7
  * Auto-generates labels
8
8
  * Generates horizontal, vertical and inline forms
data/VERSION CHANGED
@@ -1 +1 @@
1
- 0.2.6
1
+ 0.3.0
@@ -1,5 +1,5 @@
1
1
  /* ===================================================
2
- * bootstrap-transition.js v2.0.2
2
+ * bootstrap-transition.js v2.0.4
3
3
  * http://twitter.github.com/bootstrap/javascript.html#transitions
4
4
  * ===================================================
5
5
  * Copyright 2012 Twitter, Inc.
@@ -17,39 +17,49 @@
17
17
  * limitations under the License.
18
18
  * ========================================================== */
19
19
 
20
- !function( $ ) {
20
+
21
+ !function ($) {
21
22
 
22
23
  $(function () {
23
24
 
24
- "use strict"
25
+ "use strict"; // jshint ;_;
26
+
25
27
 
26
- /* CSS TRANSITION SUPPORT (https://gist.github.com/373874)
28
+ /* CSS TRANSITION SUPPORT (http://www.modernizr.com/)
27
29
  * ======================================================= */
28
30
 
29
31
  $.support.transition = (function () {
30
- var thisBody = document.body || document.documentElement
31
- , thisStyle = thisBody.style
32
- , support = thisStyle.transition !== undefined || thisStyle.WebkitTransition !== undefined || thisStyle.MozTransition !== undefined || thisStyle.MsTransition !== undefined || thisStyle.OTransition !== undefined
33
-
34
- return support && {
35
- end: (function () {
36
- var transitionEnd = "TransitionEnd"
37
- if ( $.browser.webkit ) {
38
- transitionEnd = "webkitTransitionEnd"
39
- } else if ( $.browser.mozilla ) {
40
- transitionEnd = "transitionend"
41
- } else if ( $.browser.opera ) {
42
- transitionEnd = "oTransitionEnd"
32
+
33
+ var transitionEnd = (function () {
34
+
35
+ var el = document.createElement('bootstrap')
36
+ , transEndEventNames = {
37
+ 'WebkitTransition' : 'webkitTransitionEnd'
38
+ , 'MozTransition' : 'transitionend'
39
+ , 'OTransition' : 'oTransitionEnd'
40
+ , 'msTransition' : 'MSTransitionEnd'
41
+ , 'transition' : 'transitionend'
42
+ }
43
+ , name
44
+
45
+ for (name in transEndEventNames){
46
+ if (el.style[name] !== undefined) {
47
+ return transEndEventNames[name]
43
48
  }
44
- return transitionEnd
45
- }())
49
+ }
50
+
51
+ }())
52
+
53
+ return transitionEnd && {
54
+ end: transitionEnd
46
55
  }
56
+
47
57
  })()
48
58
 
49
59
  })
50
60
 
51
- }( window.jQuery );/* ==========================================================
52
- * bootstrap-alert.js v2.0.2
61
+ }(window.jQuery);/* ==========================================================
62
+ * bootstrap-alert.js v2.0.4
53
63
  * http://twitter.github.com/bootstrap/javascript.html#alerts
54
64
  * ==========================================================
55
65
  * Copyright 2012 Twitter, Inc.
@@ -68,61 +78,57 @@
68
78
  * ========================================================== */
69
79
 
70
80
 
71
- !function( $ ){
81
+ !function ($) {
82
+
83
+ "use strict"; // jshint ;_;
72
84
 
73
- "use strict"
74
85
 
75
86
  /* ALERT CLASS DEFINITION
76
87
  * ====================== */
77
88
 
78
89
  var dismiss = '[data-dismiss="alert"]'
79
- , Alert = function ( el ) {
90
+ , Alert = function (el) {
80
91
  $(el).on('click', dismiss, this.close)
81
92
  }
82
93
 
83
- Alert.prototype = {
94
+ Alert.prototype.close = function (e) {
95
+ var $this = $(this)
96
+ , selector = $this.attr('data-target')
97
+ , $parent
84
98
 
85
- constructor: Alert
99
+ if (!selector) {
100
+ selector = $this.attr('href')
101
+ selector = selector && selector.replace(/.*(?=#[^\s]*$)/, '') //strip for ie7
102
+ }
86
103
 
87
- , close: function ( e ) {
88
- var $this = $(this)
89
- , selector = $this.attr('data-target')
90
- , $parent
104
+ $parent = $(selector)
91
105
 
92
- if (!selector) {
93
- selector = $this.attr('href')
94
- selector = selector && selector.replace(/.*(?=#[^\s]*$)/, '') //strip for ie7
95
- }
106
+ e && e.preventDefault()
96
107
 
97
- $parent = $(selector)
98
- $parent.trigger('close')
99
-
100
- e && e.preventDefault()
108
+ $parent.length || ($parent = $this.hasClass('alert') ? $this : $this.parent())
101
109
 
102
- $parent.length || ($parent = $this.hasClass('alert') ? $this : $this.parent())
110
+ $parent.trigger(e = $.Event('close'))
103
111
 
104
- $parent
105
- .trigger('close')
106
- .removeClass('in')
112
+ if (e.isDefaultPrevented()) return
107
113
 
108
- function removeElement() {
109
- $parent
110
- .trigger('closed')
111
- .remove()
112
- }
114
+ $parent.removeClass('in')
113
115
 
114
- $.support.transition && $parent.hasClass('fade') ?
115
- $parent.on($.support.transition.end, removeElement) :
116
- removeElement()
116
+ function removeElement() {
117
+ $parent
118
+ .trigger('closed')
119
+ .remove()
117
120
  }
118
121
 
122
+ $.support.transition && $parent.hasClass('fade') ?
123
+ $parent.on($.support.transition.end, removeElement) :
124
+ removeElement()
119
125
  }
120
126
 
121
127
 
122
128
  /* ALERT PLUGIN DEFINITION
123
129
  * ======================= */
124
130
 
125
- $.fn.alert = function ( option ) {
131
+ $.fn.alert = function (option) {
126
132
  return this.each(function () {
127
133
  var $this = $(this)
128
134
  , data = $this.data('alert')
@@ -141,8 +147,8 @@
141
147
  $('body').on('click.alert.data-api', dismiss, Alert.prototype.close)
142
148
  })
143
149
 
144
- }( window.jQuery );/* ============================================================
145
- * bootstrap-button.js v2.0.2
150
+ }(window.jQuery);/* ============================================================
151
+ * bootstrap-button.js v2.0.4
146
152
  * http://twitter.github.com/bootstrap/javascript.html#buttons
147
153
  * ============================================================
148
154
  * Copyright 2012 Twitter, Inc.
@@ -160,58 +166,54 @@
160
166
  * limitations under the License.
161
167
  * ============================================================ */
162
168
 
163
- !function( $ ){
164
169
 
165
- "use strict"
170
+ !function ($) {
171
+
172
+ "use strict"; // jshint ;_;
173
+
166
174
 
167
175
  /* BUTTON PUBLIC CLASS DEFINITION
168
176
  * ============================== */
169
177
 
170
- var Button = function ( element, options ) {
178
+ var Button = function (element, options) {
171
179
  this.$element = $(element)
172
180
  this.options = $.extend({}, $.fn.button.defaults, options)
173
181
  }
174
182
 
175
- Button.prototype = {
183
+ Button.prototype.setState = function (state) {
184
+ var d = 'disabled'
185
+ , $el = this.$element
186
+ , data = $el.data()
187
+ , val = $el.is('input') ? 'val' : 'html'
176
188
 
177
- constructor: Button
189
+ state = state + 'Text'
190
+ data.resetText || $el.data('resetText', $el[val]())
178
191
 
179
- , setState: function ( state ) {
180
- var d = 'disabled'
181
- , $el = this.$element
182
- , data = $el.data()
183
- , val = $el.is('input') ? 'val' : 'html'
192
+ $el[val](data[state] || this.options[state])
184
193
 
185
- state = state + 'Text'
186
- data.resetText || $el.data('resetText', $el[val]())
187
-
188
- $el[val](data[state] || this.options[state])
194
+ // push to event loop to allow forms to submit
195
+ setTimeout(function () {
196
+ state == 'loadingText' ?
197
+ $el.addClass(d).attr(d, d) :
198
+ $el.removeClass(d).removeAttr(d)
199
+ }, 0)
200
+ }
189
201
 
190
- // push to event loop to allow forms to submit
191
- setTimeout(function () {
192
- state == 'loadingText' ?
193
- $el.addClass(d).attr(d, d) :
194
- $el.removeClass(d).removeAttr(d)
195
- }, 0)
196
- }
202
+ Button.prototype.toggle = function () {
203
+ var $parent = this.$element.parent('[data-toggle="buttons-radio"]')
197
204
 
198
- , toggle: function () {
199
- var $parent = this.$element.parent('[data-toggle="buttons-radio"]')
200
-
201
- $parent && $parent
202
- .find('.active')
203
- .removeClass('active')
204
-
205
- this.$element.toggleClass('active')
206
- }
205
+ $parent && $parent
206
+ .find('.active')
207
+ .removeClass('active')
207
208
 
209
+ this.$element.toggleClass('active')
208
210
  }
209
211
 
210
212
 
211
213
  /* BUTTON PLUGIN DEFINITION
212
214
  * ======================== */
213
215
 
214
- $.fn.button = function ( option ) {
216
+ $.fn.button = function (option) {
215
217
  return this.each(function () {
216
218
  var $this = $(this)
217
219
  , data = $this.data('button')
@@ -240,8 +242,8 @@
240
242
  })
241
243
  })
242
244
 
243
- }( window.jQuery );/* ==========================================================
244
- * bootstrap-carousel.js v2.0.2
245
+ }(window.jQuery);/* ==========================================================
246
+ * bootstrap-carousel.js v2.0.4
245
247
  * http://twitter.github.com/bootstrap/javascript.html#carousel
246
248
  * ==========================================================
247
249
  * Copyright 2012 Twitter, Inc.
@@ -260,16 +262,17 @@
260
262
  * ========================================================== */
261
263
 
262
264
 
263
- !function( $ ){
265
+ !function ($) {
266
+
267
+ "use strict"; // jshint ;_;
264
268
 
265
- "use strict"
266
269
 
267
270
  /* CAROUSEL CLASS DEFINITION
268
271
  * ========================= */
269
272
 
270
273
  var Carousel = function (element, options) {
271
274
  this.$element = $(element)
272
- this.options = $.extend({}, $.fn.carousel.defaults, options)
275
+ this.options = options
273
276
  this.options.slide && this.slide(this.options.slide)
274
277
  this.options.pause == 'hover' && this.$element
275
278
  .on('mouseenter', $.proxy(this.pause, this))
@@ -278,8 +281,11 @@
278
281
 
279
282
  Carousel.prototype = {
280
283
 
281
- cycle: function () {
282
- this.interval = setInterval($.proxy(this.next, this), this.options.interval)
284
+ cycle: function (e) {
285
+ if (!e) this.paused = false
286
+ this.options.interval
287
+ && !this.paused
288
+ && (this.interval = setInterval($.proxy(this.next, this), this.options.interval))
283
289
  return this
284
290
  }
285
291
 
@@ -304,7 +310,8 @@
304
310
  return this.slide(pos > activePos ? 'next' : 'prev', $(children[pos]))
305
311
  }
306
312
 
307
- , pause: function () {
313
+ , pause: function (e) {
314
+ if (!e) this.paused = true
308
315
  clearInterval(this.interval)
309
316
  this.interval = null
310
317
  return this
@@ -327,6 +334,7 @@
327
334
  , direction = type == 'next' ? 'left' : 'right'
328
335
  , fallback = type == 'next' ? 'first' : 'last'
329
336
  , that = this
337
+ , e = $.Event('slide')
330
338
 
331
339
  this.sliding = true
332
340
 
@@ -336,24 +344,26 @@
336
344
 
337
345
  if ($next.hasClass('active')) return
338
346
 
339
- if (!$.support.transition && this.$element.hasClass('slide')) {
340
- this.$element.trigger('slide')
341
- $active.removeClass('active')
342
- $next.addClass('active')
343
- this.sliding = false
344
- this.$element.trigger('slid')
345
- } else {
347
+ if ($.support.transition && this.$element.hasClass('slide')) {
348
+ this.$element.trigger(e)
349
+ if (e.isDefaultPrevented()) return
346
350
  $next.addClass(type)
347
351
  $next[0].offsetWidth // force reflow
348
352
  $active.addClass(direction)
349
353
  $next.addClass(direction)
350
- this.$element.trigger('slide')
351
354
  this.$element.one($.support.transition.end, function () {
352
355
  $next.removeClass([type, direction].join(' ')).addClass('active')
353
356
  $active.removeClass(['active', direction].join(' '))
354
357
  that.sliding = false
355
358
  setTimeout(function () { that.$element.trigger('slid') }, 0)
356
359
  })
360
+ } else {
361
+ this.$element.trigger(e)
362
+ if (e.isDefaultPrevented()) return
363
+ $active.removeClass('active')
364
+ $next.addClass('active')
365
+ this.sliding = false
366
+ this.$element.trigger('slid')
357
367
  }
358
368
 
359
369
  isCycling && this.cycle()
@@ -367,15 +377,15 @@
367
377
  /* CAROUSEL PLUGIN DEFINITION
368
378
  * ========================== */
369
379
 
370
- $.fn.carousel = function ( option ) {
380
+ $.fn.carousel = function (option) {
371
381
  return this.each(function () {
372
382
  var $this = $(this)
373
383
  , data = $this.data('carousel')
374
- , options = typeof option == 'object' && option
384
+ , options = $.extend({}, $.fn.carousel.defaults, typeof option == 'object' && option)
375
385
  if (!data) $this.data('carousel', (data = new Carousel(this, options)))
376
386
  if (typeof option == 'number') data.to(option)
377
387
  else if (typeof option == 'string' || (option = options.slide)) data[option]()
378
- else data.cycle()
388
+ else if (options.interval) data.cycle()
379
389
  })
380
390
  }
381
391
 
@@ -400,8 +410,8 @@
400
410
  })
401
411
  })
402
412
 
403
- }( window.jQuery );/* =============================================================
404
- * bootstrap-collapse.js v2.0.2
413
+ }(window.jQuery);/* =============================================================
414
+ * bootstrap-collapse.js v2.0.4
405
415
  * http://twitter.github.com/bootstrap/javascript.html#collapse
406
416
  * =============================================================
407
417
  * Copyright 2012 Twitter, Inc.
@@ -419,16 +429,21 @@
419
429
  * limitations under the License.
420
430
  * ============================================================ */
421
431
 
422
- !function( $ ){
423
432
 
424
- "use strict"
433
+ !function ($) {
434
+
435
+ "use strict"; // jshint ;_;
425
436
 
426
- var Collapse = function ( element, options ) {
427
- this.$element = $(element)
437
+
438
+ /* COLLAPSE PUBLIC CLASS DEFINITION
439
+ * ================================ */
440
+
441
+ var Collapse = function (element, options) {
442
+ this.$element = $(element)
428
443
  this.options = $.extend({}, $.fn.collapse.defaults, options)
429
444
 
430
- if (this.options["parent"]) {
431
- this.$parent = $(this.options["parent"])
445
+ if (this.options.parent) {
446
+ this.$parent = $(this.options.parent)
432
447
  }
433
448
 
434
449
  this.options.toggle && this.toggle()
@@ -444,31 +459,39 @@
444
459
  }
445
460
 
446
461
  , show: function () {
447
- var dimension = this.dimension()
448
- , scroll = $.camelCase(['scroll', dimension].join('-'))
449
- , actives = this.$parent && this.$parent.find('.in')
462
+ var dimension
463
+ , scroll
464
+ , actives
450
465
  , hasData
451
466
 
467
+ if (this.transitioning) return
468
+
469
+ dimension = this.dimension()
470
+ scroll = $.camelCase(['scroll', dimension].join('-'))
471
+ actives = this.$parent && this.$parent.find('> .accordion-group > .in')
472
+
452
473
  if (actives && actives.length) {
453
474
  hasData = actives.data('collapse')
475
+ if (hasData && hasData.transitioning) return
454
476
  actives.collapse('hide')
455
477
  hasData || actives.data('collapse', null)
456
478
  }
457
479
 
458
480
  this.$element[dimension](0)
459
- this.transition('addClass', 'show', 'shown')
481
+ this.transition('addClass', $.Event('show'), 'shown')
460
482
  this.$element[dimension](this.$element[0][scroll])
461
-
462
483
  }
463
484
 
464
485
  , hide: function () {
465
- var dimension = this.dimension()
486
+ var dimension
487
+ if (this.transitioning) return
488
+ dimension = this.dimension()
466
489
  this.reset(this.$element[dimension]())
467
- this.transition('removeClass', 'hide', 'hidden')
490
+ this.transition('removeClass', $.Event('hide'), 'hidden')
468
491
  this.$element[dimension](0)
469
492
  }
470
493
 
471
- , reset: function ( size ) {
494
+ , reset: function (size) {
472
495
  var dimension = this.dimension()
473
496
 
474
497
  this.$element
@@ -476,37 +499,43 @@
476
499
  [dimension](size || 'auto')
477
500
  [0].offsetWidth
478
501
 
479
- this.$element[size ? 'addClass' : 'removeClass']('collapse')
502
+ this.$element[size !== null ? 'addClass' : 'removeClass']('collapse')
480
503
 
481
504
  return this
482
505
  }
483
506
 
484
- , transition: function ( method, startEvent, completeEvent ) {
507
+ , transition: function (method, startEvent, completeEvent) {
485
508
  var that = this
486
509
  , complete = function () {
487
- if (startEvent == 'show') that.reset()
510
+ if (startEvent.type == 'show') that.reset()
511
+ that.transitioning = 0
488
512
  that.$element.trigger(completeEvent)
489
513
  }
490
514
 
491
- this.$element
492
- .trigger(startEvent)
493
- [method]('in')
515
+ this.$element.trigger(startEvent)
516
+
517
+ if (startEvent.isDefaultPrevented()) return
518
+
519
+ this.transitioning = 1
520
+
521
+ this.$element[method]('in')
494
522
 
495
523
  $.support.transition && this.$element.hasClass('collapse') ?
496
524
  this.$element.one($.support.transition.end, complete) :
497
525
  complete()
498
- }
526
+ }
499
527
 
500
528
  , toggle: function () {
501
529
  this[this.$element.hasClass('in') ? 'hide' : 'show']()
502
- }
530
+ }
503
531
 
504
532
  }
505
533
 
506
- /* COLLAPSIBLE PLUGIN DEFINITION
534
+
535
+ /* COLLAPSIBLE PLUGIN DEFINITION
507
536
  * ============================== */
508
537
 
509
- $.fn.collapse = function ( option ) {
538
+ $.fn.collapse = function (option) {
510
539
  return this.each(function () {
511
540
  var $this = $(this)
512
541
  , data = $this.data('collapse')
@@ -537,8 +566,8 @@
537
566
  })
538
567
  })
539
568
 
540
- }( window.jQuery );/* ============================================================
541
- * bootstrap-dropdown.js v2.0.2
569
+ }(window.jQuery);/* ============================================================
570
+ * bootstrap-dropdown.js v2.0.4
542
571
  * http://twitter.github.com/bootstrap/javascript.html#dropdowns
543
572
  * ============================================================
544
573
  * Copyright 2012 Twitter, Inc.
@@ -557,15 +586,16 @@
557
586
  * ============================================================ */
558
587
 
559
588
 
560
- !function( $ ){
589
+ !function ($) {
590
+
591
+ "use strict"; // jshint ;_;
561
592
 
562
- "use strict"
563
593
 
564
594
  /* DROPDOWN CLASS DEFINITION
565
595
  * ========================= */
566
596
 
567
597
  var toggle = '[data-toggle="dropdown"]'
568
- , Dropdown = function ( element ) {
598
+ , Dropdown = function (element) {
569
599
  var $el = $(element).on('click.dropdown.data-api', this.toggle)
570
600
  $('html').on('click.dropdown.data-api', function () {
571
601
  $el.parent().removeClass('open')
@@ -576,12 +606,16 @@
576
606
 
577
607
  constructor: Dropdown
578
608
 
579
- , toggle: function ( e ) {
609
+ , toggle: function (e) {
580
610
  var $this = $(this)
581
- , selector = $this.attr('data-target')
582
611
  , $parent
612
+ , selector
583
613
  , isActive
584
614
 
615
+ if ($this.is('.disabled, :disabled')) return
616
+
617
+ selector = $this.attr('data-target')
618
+
585
619
  if (!selector) {
586
620
  selector = $this.attr('href')
587
621
  selector = selector && selector.replace(/.*(?=#[^\s]*$)/, '') //strip for ie7
@@ -593,7 +627,8 @@
593
627
  isActive = $parent.hasClass('open')
594
628
 
595
629
  clearMenus()
596
- !isActive && $parent.toggleClass('open')
630
+
631
+ if (!isActive) $parent.toggleClass('open')
597
632
 
598
633
  return false
599
634
  }
@@ -608,7 +643,7 @@
608
643
  /* DROPDOWN PLUGIN DEFINITION
609
644
  * ========================== */
610
645
 
611
- $.fn.dropdown = function ( option ) {
646
+ $.fn.dropdown = function (option) {
612
647
  return this.each(function () {
613
648
  var $this = $(this)
614
649
  , data = $this.data('dropdown')
@@ -625,11 +660,13 @@
625
660
 
626
661
  $(function () {
627
662
  $('html').on('click.dropdown.data-api', clearMenus)
628
- $('body').on('click.dropdown.data-api', toggle, Dropdown.prototype.toggle)
663
+ $('body')
664
+ .on('click.dropdown', '.dropdown form', function (e) { e.stopPropagation() })
665
+ .on('click.dropdown.data-api', toggle, Dropdown.prototype.toggle)
629
666
  })
630
667
 
631
- }( window.jQuery );/* =========================================================
632
- * bootstrap-modal.js v2.0.2
668
+ }(window.jQuery);/* =========================================================
669
+ * bootstrap-modal.js v2.0.4
633
670
  * http://twitter.github.com/bootstrap/javascript.html#modals
634
671
  * =========================================================
635
672
  * Copyright 2012 Twitter, Inc.
@@ -648,14 +685,15 @@
648
685
  * ========================================================= */
649
686
 
650
687
 
651
- !function( $ ){
688
+ !function ($) {
689
+
690
+ "use strict"; // jshint ;_;
652
691
 
653
- "use strict"
654
692
 
655
693
  /* MODAL CLASS DEFINITION
656
694
  * ====================== */
657
695
 
658
- var Modal = function ( content, options ) {
696
+ var Modal = function (content, options) {
659
697
  this.options = options
660
698
  this.$element = $(content)
661
699
  .delegate('[data-dismiss="modal"]', 'click.dismiss.modal', $.proxy(this.hide, this))
@@ -671,19 +709,23 @@
671
709
 
672
710
  , show: function () {
673
711
  var that = this
712
+ , e = $.Event('show')
674
713
 
675
- if (this.isShown) return
714
+ this.$element.trigger(e)
715
+
716
+ if (this.isShown || e.isDefaultPrevented()) return
676
717
 
677
718
  $('body').addClass('modal-open')
678
719
 
679
720
  this.isShown = true
680
- this.$element.trigger('show')
681
721
 
682
722
  escape.call(this)
683
723
  backdrop.call(this, function () {
684
724
  var transition = $.support.transition && that.$element.hasClass('fade')
685
725
 
686
- !that.$element.parent().length && that.$element.appendTo(document.body) //don't move modals dom position
726
+ if (!that.$element.parent().length) {
727
+ that.$element.appendTo(document.body) //don't move modals dom position
728
+ }
687
729
 
688
730
  that.$element
689
731
  .show()
@@ -701,21 +743,24 @@
701
743
  })
702
744
  }
703
745
 
704
- , hide: function ( e ) {
746
+ , hide: function (e) {
705
747
  e && e.preventDefault()
706
748
 
707
- if (!this.isShown) return
708
-
709
749
  var that = this
750
+
751
+ e = $.Event('hide')
752
+
753
+ this.$element.trigger(e)
754
+
755
+ if (!this.isShown || e.isDefaultPrevented()) return
756
+
710
757
  this.isShown = false
711
758
 
712
759
  $('body').removeClass('modal-open')
713
760
 
714
761
  escape.call(this)
715
762
 
716
- this.$element
717
- .trigger('hide')
718
- .removeClass('in')
763
+ this.$element.removeClass('in')
719
764
 
720
765
  $.support.transition && this.$element.hasClass('fade') ?
721
766
  hideWithTransition.call(this) :
@@ -741,7 +786,7 @@
741
786
  })
742
787
  }
743
788
 
744
- function hideModal( that ) {
789
+ function hideModal(that) {
745
790
  this.$element
746
791
  .hide()
747
792
  .trigger('hidden')
@@ -749,7 +794,7 @@
749
794
  backdrop.call(this)
750
795
  }
751
796
 
752
- function backdrop( callback ) {
797
+ function backdrop(callback) {
753
798
  var that = this
754
799
  , animate = this.$element.hasClass('fade') ? 'fade' : ''
755
800
 
@@ -803,7 +848,7 @@
803
848
  /* MODAL PLUGIN DEFINITION
804
849
  * ======================= */
805
850
 
806
- $.fn.modal = function ( option ) {
851
+ $.fn.modal = function (option) {
807
852
  return this.each(function () {
808
853
  var $this = $(this)
809
854
  , data = $this.data('modal')
@@ -837,8 +882,8 @@
837
882
  })
838
883
  })
839
884
 
840
- }( window.jQuery );/* ===========================================================
841
- * bootstrap-tooltip.js v2.0.2
885
+ }(window.jQuery);/* ===========================================================
886
+ * bootstrap-tooltip.js v2.0.4
842
887
  * http://twitter.github.com/bootstrap/javascript.html#tooltips
843
888
  * Inspired by the original jQuery.tipsy by Jason Frame
844
889
  * ===========================================================
@@ -857,14 +902,16 @@
857
902
  * limitations under the License.
858
903
  * ========================================================== */
859
904
 
860
- !function( $ ) {
861
905
 
862
- "use strict"
906
+ !function ($) {
907
+
908
+ "use strict"; // jshint ;_;
909
+
863
910
 
864
911
  /* TOOLTIP PUBLIC CLASS DEFINITION
865
912
  * =============================== */
866
913
 
867
- var Tooltip = function ( element, options ) {
914
+ var Tooltip = function (element, options) {
868
915
  this.init('tooltip', element, options)
869
916
  }
870
917
 
@@ -872,7 +919,7 @@
872
919
 
873
920
  constructor: Tooltip
874
921
 
875
- , init: function ( type, element, options ) {
922
+ , init: function (type, element, options) {
876
923
  var eventIn
877
924
  , eventOut
878
925
 
@@ -893,7 +940,7 @@
893
940
  this.fixTitle()
894
941
  }
895
942
 
896
- , getOptions: function ( options ) {
943
+ , getOptions: function (options) {
897
944
  options = $.extend({}, $.fn[this.type].defaults, options, this.$element.data())
898
945
 
899
946
  if (options.delay && typeof options.delay == 'number') {
@@ -906,34 +953,28 @@
906
953
  return options
907
954
  }
908
955
 
909
- , enter: function ( e ) {
956
+ , enter: function (e) {
910
957
  var self = $(e.currentTarget)[this.type](this._options).data(this.type)
911
958
 
912
- if (!self.options.delay || !self.options.delay.show) {
913
- self.show()
914
- } else {
915
- self.hoverState = 'in'
916
- setTimeout(function() {
917
- if (self.hoverState == 'in') {
918
- self.show()
919
- }
920
- }, self.options.delay.show)
921
- }
959
+ if (!self.options.delay || !self.options.delay.show) return self.show()
960
+
961
+ clearTimeout(this.timeout)
962
+ self.hoverState = 'in'
963
+ this.timeout = setTimeout(function() {
964
+ if (self.hoverState == 'in') self.show()
965
+ }, self.options.delay.show)
922
966
  }
923
967
 
924
- , leave: function ( e ) {
968
+ , leave: function (e) {
925
969
  var self = $(e.currentTarget)[this.type](this._options).data(this.type)
926
970
 
927
- if (!self.options.delay || !self.options.delay.hide) {
928
- self.hide()
929
- } else {
930
- self.hoverState = 'out'
931
- setTimeout(function() {
932
- if (self.hoverState == 'out') {
933
- self.hide()
934
- }
935
- }, self.options.delay.hide)
936
- }
971
+ if (this.timeout) clearTimeout(this.timeout)
972
+ if (!self.options.delay || !self.options.delay.hide) return self.hide()
973
+
974
+ self.hoverState = 'out'
975
+ this.timeout = setTimeout(function() {
976
+ if (self.hoverState == 'out') self.hide()
977
+ }, self.options.delay.hide)
937
978
  }
938
979
 
939
980
  , show: function () {
@@ -991,9 +1032,20 @@
991
1032
  }
992
1033
  }
993
1034
 
1035
+ , isHTML: function(text) {
1036
+ // html string detection logic adapted from jQuery
1037
+ return typeof text != 'string'
1038
+ || ( text.charAt(0) === "<"
1039
+ && text.charAt( text.length - 1 ) === ">"
1040
+ && text.length >= 3
1041
+ ) || /^(?:[^<]*<[\w\W]+>[^>]*$)/.exec(text)
1042
+ }
1043
+
994
1044
  , setContent: function () {
995
1045
  var $tip = this.tip()
996
- $tip.find('.tooltip-inner').html(this.getTitle())
1046
+ , title = this.getTitle()
1047
+
1048
+ $tip.find('.tooltip-inner')[this.isHTML(title) ? 'html' : 'text'](title)
997
1049
  $tip.removeClass('fade in top bottom left right')
998
1050
  }
999
1051
 
@@ -1045,8 +1097,6 @@
1045
1097
  title = $e.attr('data-original-title')
1046
1098
  || (typeof o.title == 'function' ? o.title.call($e[0]) : o.title)
1047
1099
 
1048
- title = (title || '').toString().replace(/(^\s*|\s*$)/, "")
1049
-
1050
1100
  return title
1051
1101
  }
1052
1102
 
@@ -1098,16 +1148,17 @@
1098
1148
 
1099
1149
  $.fn.tooltip.defaults = {
1100
1150
  animation: true
1101
- , delay: 0
1102
- , selector: false
1103
1151
  , placement: 'top'
1152
+ , selector: false
1153
+ , template: '<div class="tooltip"><div class="tooltip-arrow"></div><div class="tooltip-inner"></div></div>'
1104
1154
  , trigger: 'hover'
1105
1155
  , title: ''
1106
- , template: '<div class="tooltip"><div class="tooltip-arrow"></div><div class="tooltip-inner"></div></div>'
1156
+ , delay: 0
1107
1157
  }
1108
1158
 
1109
- }( window.jQuery );/* ===========================================================
1110
- * bootstrap-popover.js v2.0.2
1159
+ }(window.jQuery);
1160
+ /* ===========================================================
1161
+ * bootstrap-popover.js v2.0.4
1111
1162
  * http://twitter.github.com/bootstrap/javascript.html#popovers
1112
1163
  * ===========================================================
1113
1164
  * Copyright 2012 Twitter, Inc.
@@ -1126,14 +1177,19 @@
1126
1177
  * =========================================================== */
1127
1178
 
1128
1179
 
1129
- !function( $ ) {
1180
+ !function ($) {
1130
1181
 
1131
- "use strict"
1182
+ "use strict"; // jshint ;_;
1183
+
1184
+
1185
+ /* POPOVER PUBLIC CLASS DEFINITION
1186
+ * =============================== */
1132
1187
 
1133
1188
  var Popover = function ( element, options ) {
1134
1189
  this.init('popover', element, options)
1135
1190
  }
1136
1191
 
1192
+
1137
1193
  /* NOTE: POPOVER EXTENDS BOOTSTRAP-TOOLTIP.js
1138
1194
  ========================================== */
1139
1195
 
@@ -1146,8 +1202,8 @@
1146
1202
  , title = this.getTitle()
1147
1203
  , content = this.getContent()
1148
1204
 
1149
- $tip.find('.popover-title')[ $.type(title) == 'object' ? 'append' : 'html' ](title)
1150
- $tip.find('.popover-content > *')[ $.type(content) == 'object' ? 'append' : 'html' ](content)
1205
+ $tip.find('.popover-title')[this.isHTML(title) ? 'html' : 'text'](title)
1206
+ $tip.find('.popover-content > *')[this.isHTML(content) ? 'html' : 'text'](content)
1151
1207
 
1152
1208
  $tip.removeClass('fade top bottom left right in')
1153
1209
  }
@@ -1164,12 +1220,10 @@
1164
1220
  content = $e.attr('data-content')
1165
1221
  || (typeof o.content == 'function' ? o.content.call($e[0]) : o.content)
1166
1222
 
1167
- content = content.toString().replace(/(^\s*|\s*$)/, "")
1168
-
1169
1223
  return content
1170
1224
  }
1171
1225
 
1172
- , tip: function() {
1226
+ , tip: function () {
1173
1227
  if (!this.$tip) {
1174
1228
  this.$tip = $(this.options.template)
1175
1229
  }
@@ -1182,7 +1236,7 @@
1182
1236
  /* POPOVER PLUGIN DEFINITION
1183
1237
  * ======================= */
1184
1238
 
1185
- $.fn.popover = function ( option ) {
1239
+ $.fn.popover = function (option) {
1186
1240
  return this.each(function () {
1187
1241
  var $this = $(this)
1188
1242
  , data = $this.data('popover')
@@ -1200,8 +1254,8 @@
1200
1254
  , template: '<div class="popover"><div class="arrow"></div><div class="popover-inner"><h3 class="popover-title"></h3><div class="popover-content"><p></p></div></div></div>'
1201
1255
  })
1202
1256
 
1203
- }( window.jQuery );/* =============================================================
1204
- * bootstrap-scrollspy.js v2.0.2
1257
+ }(window.jQuery);/* =============================================================
1258
+ * bootstrap-scrollspy.js v2.0.4
1205
1259
  * http://twitter.github.com/bootstrap/javascript.html#scrollspy
1206
1260
  * =============================================================
1207
1261
  * Copyright 2012 Twitter, Inc.
@@ -1219,9 +1273,11 @@
1219
1273
  * limitations under the License.
1220
1274
  * ============================================================== */
1221
1275
 
1222
- !function ( $ ) {
1223
1276
 
1224
- "use strict"
1277
+ !function ($) {
1278
+
1279
+ "use strict"; // jshint ;_;
1280
+
1225
1281
 
1226
1282
  /* SCROLLSPY CLASS DEFINITION
1227
1283
  * ========================== */
@@ -1235,7 +1291,7 @@
1235
1291
  this.selector = (this.options.target
1236
1292
  || ((href = $(element).attr('href')) && href.replace(/.*(?=#[^\s]+$)/, '')) //strip for ie7
1237
1293
  || '') + ' .nav li > a'
1238
- this.$body = $('body').on('click.scroll.data-api', this.selector, process)
1294
+ this.$body = $('body')
1239
1295
  this.refresh()
1240
1296
  this.process()
1241
1297
  }
@@ -1245,25 +1301,43 @@
1245
1301
  constructor: ScrollSpy
1246
1302
 
1247
1303
  , refresh: function () {
1248
- this.targets = this.$body
1304
+ var self = this
1305
+ , $targets
1306
+
1307
+ this.offsets = $([])
1308
+ this.targets = $([])
1309
+
1310
+ $targets = this.$body
1249
1311
  .find(this.selector)
1250
1312
  .map(function () {
1251
- var href = $(this).attr('href')
1252
- return /^#\w/.test(href) && $(href).length ? href : null
1313
+ var $el = $(this)
1314
+ , href = $el.data('target') || $el.attr('href')
1315
+ , $href = /^#\w/.test(href) && $(href)
1316
+ return ( $href
1317
+ && href.length
1318
+ && [[ $href.position().top, href ]] ) || null
1319
+ })
1320
+ .sort(function (a, b) { return a[0] - b[0] })
1321
+ .each(function () {
1322
+ self.offsets.push(this[0])
1323
+ self.targets.push(this[1])
1253
1324
  })
1254
-
1255
- this.offsets = $.map(this.targets, function (id) {
1256
- return $(id).position().top
1257
- })
1258
1325
  }
1259
1326
 
1260
1327
  , process: function () {
1261
1328
  var scrollTop = this.$scrollElement.scrollTop() + this.options.offset
1329
+ , scrollHeight = this.$scrollElement[0].scrollHeight || this.$body[0].scrollHeight
1330
+ , maxScroll = scrollHeight - this.$scrollElement.height()
1262
1331
  , offsets = this.offsets
1263
1332
  , targets = this.targets
1264
1333
  , activeTarget = this.activeTarget
1265
1334
  , i
1266
1335
 
1336
+ if (scrollTop >= maxScroll) {
1337
+ return activeTarget != (i = targets.last()[0])
1338
+ && this.activate ( i )
1339
+ }
1340
+
1267
1341
  for (i = offsets.length; i--;) {
1268
1342
  activeTarget != targets[i]
1269
1343
  && scrollTop >= offsets[i]
@@ -1274,21 +1348,27 @@
1274
1348
 
1275
1349
  , activate: function (target) {
1276
1350
  var active
1351
+ , selector
1277
1352
 
1278
1353
  this.activeTarget = target
1279
1354
 
1280
- this.$body
1281
- .find(this.selector).parent('.active')
1355
+ $(this.selector)
1356
+ .parent('.active')
1282
1357
  .removeClass('active')
1283
1358
 
1284
- active = this.$body
1285
- .find(this.selector + '[href="' + target + '"]')
1359
+ selector = this.selector
1360
+ + '[data-target="' + target + '"],'
1361
+ + this.selector + '[href="' + target + '"]'
1362
+
1363
+ active = $(selector)
1286
1364
  .parent('li')
1287
1365
  .addClass('active')
1288
1366
 
1289
- if ( active.parent('.dropdown-menu') ) {
1290
- active.closest('li.dropdown').addClass('active')
1367
+ if (active.parent('.dropdown-menu')) {
1368
+ active = active.closest('li.dropdown').addClass('active')
1291
1369
  }
1370
+
1371
+ active.trigger('activate')
1292
1372
  }
1293
1373
 
1294
1374
  }
@@ -1324,8 +1404,8 @@
1324
1404
  })
1325
1405
  })
1326
1406
 
1327
- }( window.jQuery );/* ========================================================
1328
- * bootstrap-tab.js v2.0.2
1407
+ }(window.jQuery);/* ========================================================
1408
+ * bootstrap-tab.js v2.0.4
1329
1409
  * http://twitter.github.com/bootstrap/javascript.html#tabs
1330
1410
  * ========================================================
1331
1411
  * Copyright 2012 Twitter, Inc.
@@ -1344,9 +1424,10 @@
1344
1424
  * ======================================================== */
1345
1425
 
1346
1426
 
1347
- !function( $ ){
1427
+ !function ($) {
1428
+
1429
+ "use strict"; // jshint ;_;
1348
1430
 
1349
- "use strict"
1350
1431
 
1351
1432
  /* TAB CLASS DEFINITION
1352
1433
  * ==================== */
@@ -1365,6 +1446,7 @@
1365
1446
  , selector = $this.attr('data-target')
1366
1447
  , previous
1367
1448
  , $target
1449
+ , e
1368
1450
 
1369
1451
  if (!selector) {
1370
1452
  selector = $this.attr('href')
@@ -1375,11 +1457,14 @@
1375
1457
 
1376
1458
  previous = $ul.find('.active a').last()[0]
1377
1459
 
1378
- $this.trigger({
1379
- type: 'show'
1380
- , relatedTarget: previous
1460
+ e = $.Event('show', {
1461
+ relatedTarget: previous
1381
1462
  })
1382
1463
 
1464
+ $this.trigger(e)
1465
+
1466
+ if (e.isDefaultPrevented()) return
1467
+
1383
1468
  $target = $(selector)
1384
1469
 
1385
1470
  this.activate($this.parent('li'), $ul)
@@ -1453,8 +1538,8 @@
1453
1538
  })
1454
1539
  })
1455
1540
 
1456
- }( window.jQuery );/* =============================================================
1457
- * bootstrap-typeahead.js v2.0.2
1541
+ }(window.jQuery);/* =============================================================
1542
+ * bootstrap-typeahead.js v2.0.4
1458
1543
  * http://twitter.github.com/bootstrap/javascript.html#typeahead
1459
1544
  * =============================================================
1460
1545
  * Copyright 2012 Twitter, Inc.
@@ -1472,16 +1557,22 @@
1472
1557
  * limitations under the License.
1473
1558
  * ============================================================ */
1474
1559
 
1475
- !function( $ ){
1476
1560
 
1477
- "use strict"
1561
+ !function($){
1562
+
1563
+ "use strict"; // jshint ;_;
1564
+
1565
+
1566
+ /* TYPEAHEAD PUBLIC CLASS DEFINITION
1567
+ * ================================= */
1478
1568
 
1479
- var Typeahead = function ( element, options ) {
1569
+ var Typeahead = function (element, options) {
1480
1570
  this.$element = $(element)
1481
1571
  this.options = $.extend({}, $.fn.typeahead.defaults, options)
1482
1572
  this.matcher = this.options.matcher || this.matcher
1483
1573
  this.sorter = this.options.sorter || this.sorter
1484
1574
  this.highlighter = this.options.highlighter || this.highlighter
1575
+ this.updater = this.options.updater || this.updater
1485
1576
  this.$menu = $(this.options.menu).appendTo('body')
1486
1577
  this.source = this.options.source
1487
1578
  this.shown = false
@@ -1494,11 +1585,16 @@
1494
1585
 
1495
1586
  , select: function () {
1496
1587
  var val = this.$menu.find('.active').attr('data-value')
1497
- this.$element.val(val)
1498
- this.$element.change();
1588
+ this.$element
1589
+ .val(this.updater(val))
1590
+ .change()
1499
1591
  return this.hide()
1500
1592
  }
1501
1593
 
1594
+ , updater: function (item) {
1595
+ return item
1596
+ }
1597
+
1502
1598
  , show: function () {
1503
1599
  var pos = $.extend({}, this.$element.offset(), {
1504
1600
  height: this.$element[0].offsetHeight
@@ -1532,7 +1628,7 @@
1532
1628
  }
1533
1629
 
1534
1630
  items = $.grep(this.source, function (item) {
1535
- if (that.matcher(item)) return item
1631
+ return that.matcher(item)
1536
1632
  })
1537
1633
 
1538
1634
  items = this.sorter(items)
@@ -1564,7 +1660,8 @@
1564
1660
  }
1565
1661
 
1566
1662
  , highlighter: function (item) {
1567
- return item.replace(new RegExp('(' + this.query + ')', 'ig'), function ($1, match) {
1663
+ var query = this.query.replace(/[\-\[\]{}()*+?.,\\\^$|#\s]/g, '\\$&')
1664
+ return item.replace(new RegExp('(' + query + ')', 'ig'), function ($1, match) {
1568
1665
  return '<strong>' + match + '</strong>'
1569
1666
  })
1570
1667
  }
@@ -1656,11 +1753,13 @@
1656
1753
  break
1657
1754
 
1658
1755
  case 38: // up arrow
1756
+ if (e.type != 'keydown') break
1659
1757
  e.preventDefault()
1660
1758
  this.prev()
1661
1759
  break
1662
1760
 
1663
1761
  case 40: // down arrow
1762
+ if (e.type != 'keydown') break
1664
1763
  e.preventDefault()
1665
1764
  this.next()
1666
1765
  break
@@ -1691,7 +1790,7 @@
1691
1790
  /* TYPEAHEAD PLUGIN DEFINITION
1692
1791
  * =========================== */
1693
1792
 
1694
- $.fn.typeahead = function ( option ) {
1793
+ $.fn.typeahead = function (option) {
1695
1794
  return this.each(function () {
1696
1795
  var $this = $(this)
1697
1796
  , data = $this.data('typeahead')
@@ -1723,4 +1822,4 @@
1723
1822
  })
1724
1823
  })
1725
1824
 
1726
- }( window.jQuery );
1825
+ }(window.jQuery);