bootstrap-generators 2.0.1 → 2.0.4

Sign up to get free protection for your applications and to get access to all the features.
Files changed (127) hide show
  1. data/README.md +258 -33
  2. data/Rakefile +0 -59
  3. data/lib/bootstrap/generators/engine.rb +6 -1
  4. data/lib/bootstrap/generators/version.rb +1 -1
  5. data/lib/generators/bootstrap/install/install_generator.rb +10 -2
  6. data/lib/generators/bootstrap/install/templates/assets/stylesheets/bootstrap-variables.css.scss +120 -15
  7. data/lib/generators/bootstrap/install/templates/assets/stylesheets/bootstrap-variables.less +206 -0
  8. data/lib/generators/bootstrap/install/templates/assets/stylesheets/fluid.css +2 -0
  9. data/lib/generators/bootstrap/install/templates/assets/stylesheets/fluid.css.less +5 -4
  10. data/lib/generators/bootstrap/install/templates/assets/stylesheets/fluid.css.scss +3 -2
  11. data/lib/generators/bootstrap/install/templates/assets/stylesheets/hero.css +2 -0
  12. data/lib/generators/bootstrap/install/templates/assets/stylesheets/hero.css.less +5 -4
  13. data/lib/generators/bootstrap/install/templates/assets/stylesheets/hero.css.scss +3 -2
  14. data/lib/generators/bootstrap/install/templates/config/initializers/simple_form.rb +3 -0
  15. data/lib/generators/bootstrap/install/templates/form_builders/form_builder/_form.html.erb +3 -3
  16. data/lib/generators/bootstrap/install/templates/form_builders/form_builder/_form.html.haml +2 -2
  17. data/lib/generators/bootstrap/install/templates/form_builders/simple_form/_form.html.erb +1 -1
  18. data/lib/generators/bootstrap/install/templates/form_builders/simple_form/_form.html.haml +1 -1
  19. data/test/fixtures/application.js +3 -0
  20. data/test/lib/generators/bootstrap/install_generator_test.rb +4 -3
  21. data/test/test_helper.rb +8 -1
  22. data/vendor/assets/images/glyphicons-halflings-white.png +0 -0
  23. data/vendor/assets/images/glyphicons-halflings.png +0 -0
  24. data/vendor/assets/javascripts/bootstrap-alert.js +28 -32
  25. data/vendor/assets/javascripts/bootstrap-button.js +29 -33
  26. data/vendor/assets/javascripts/bootstrap-carousel.js +33 -21
  27. data/vendor/assets/javascripts/bootstrap-collapse.js +47 -26
  28. data/vendor/assets/javascripts/bootstrap-dropdown.js +18 -10
  29. data/vendor/assets/javascripts/bootstrap-modal.js +25 -17
  30. data/vendor/assets/javascripts/bootstrap-popover.js +13 -10
  31. data/vendor/assets/javascripts/bootstrap-scrollspy.js +44 -18
  32. data/vendor/assets/javascripts/bootstrap-tab.js +12 -7
  33. data/vendor/assets/javascripts/bootstrap-tooltip.js +40 -35
  34. data/vendor/assets/javascripts/bootstrap-transition.js +30 -20
  35. data/vendor/assets/javascripts/bootstrap-typeahead.js +29 -15
  36. data/vendor/{assets/stylesheets → twitter/bootstrap}/less/accordion.less +5 -0
  37. data/vendor/{assets/stylesheets → twitter/bootstrap}/less/alerts.less +2 -14
  38. data/vendor/{assets/stylesheets → twitter/bootstrap}/less/bootstrap.less +2 -2
  39. data/vendor/{assets/stylesheets → twitter/bootstrap}/less/breadcrumbs.less +2 -0
  40. data/vendor/{assets/stylesheets → twitter/bootstrap}/less/button-groups.less +76 -33
  41. data/vendor/{assets/stylesheets → twitter/bootstrap}/less/buttons.less +32 -24
  42. data/vendor/{assets/stylesheets → twitter/bootstrap}/less/carousel.less +0 -0
  43. data/vendor/{assets/stylesheets → twitter/bootstrap}/less/close.less +12 -1
  44. data/vendor/{assets/stylesheets → twitter/bootstrap}/less/code.less +6 -6
  45. data/vendor/{assets/stylesheets → twitter/bootstrap}/less/component-animations.less +7 -5
  46. data/vendor/{assets/stylesheets → twitter/bootstrap}/less/dropdowns.less +58 -45
  47. data/vendor/{assets/stylesheets → twitter/bootstrap}/less/forms.less +205 -144
  48. data/vendor/twitter/bootstrap/less/grid.less +5 -0
  49. data/vendor/{assets/stylesheets → twitter/bootstrap}/less/hero-unit.less +3 -1
  50. data/vendor/twitter/bootstrap/less/labels-badges.less +55 -0
  51. data/vendor/{assets/stylesheets → twitter/bootstrap}/less/layouts.less +1 -1
  52. data/vendor/{assets/stylesheets → twitter/bootstrap}/less/mixins.less +235 -179
  53. data/vendor/{assets/stylesheets → twitter/bootstrap}/less/modals.less +13 -6
  54. data/vendor/{assets/stylesheets → twitter/bootstrap}/less/navbar.less +131 -72
  55. data/vendor/{assets/stylesheets → twitter/bootstrap}/less/navs.less +53 -43
  56. data/vendor/{assets/stylesheets → twitter/bootstrap}/less/pager.less +6 -0
  57. data/vendor/{assets/stylesheets → twitter/bootstrap}/less/pagination.less +1 -0
  58. data/vendor/{assets/stylesheets → twitter/bootstrap}/less/popovers.less +0 -0
  59. data/vendor/{assets/stylesheets → twitter/bootstrap}/less/progress-bars.less +27 -5
  60. data/vendor/{assets/stylesheets → twitter/bootstrap}/less/reset.less +8 -3
  61. data/vendor/twitter/bootstrap/less/responsive-1200px-min.less +26 -0
  62. data/vendor/twitter/bootstrap/less/responsive-767px-max.less +149 -0
  63. data/vendor/twitter/bootstrap/less/responsive-768px-979px.less +17 -0
  64. data/vendor/twitter/bootstrap/less/responsive-navbar.less +153 -0
  65. data/vendor/twitter/bootstrap/less/responsive-utilities.less +41 -0
  66. data/vendor/twitter/bootstrap/less/responsive.less +48 -0
  67. data/vendor/{assets/stylesheets → twitter/bootstrap}/less/scaffolding.less +4 -4
  68. data/vendor/{assets/stylesheets → twitter/bootstrap}/less/sprites.less +42 -9
  69. data/vendor/{assets/stylesheets → twitter/bootstrap}/less/tables.less +46 -20
  70. data/vendor/{assets/stylesheets → twitter/bootstrap}/less/thumbnails.less +14 -2
  71. data/vendor/{assets/stylesheets → twitter/bootstrap}/less/tooltip.less +0 -0
  72. data/vendor/{assets/stylesheets → twitter/bootstrap}/less/type.less +27 -13
  73. data/vendor/{assets/stylesheets → twitter/bootstrap}/less/utilities.less +0 -0
  74. data/vendor/twitter/bootstrap/less/variables.less +206 -0
  75. data/vendor/{assets/stylesheets → twitter/bootstrap}/less/wells.less +10 -0
  76. data/vendor/{assets/stylesheets/scss/accordion.scss → twitter/bootstrap/sass/_accordion.scss} +5 -0
  77. data/vendor/{assets/stylesheets/scss/alerts.scss → twitter/bootstrap/sass/_alerts.scss} +3 -15
  78. data/vendor/{assets/stylesheets/scss/breadcrumbs.scss → twitter/bootstrap/sass/_breadcrumbs.scss} +2 -0
  79. data/vendor/{assets/stylesheets/scss/button-groups.scss → twitter/bootstrap/sass/_button-groups.scss} +76 -33
  80. data/vendor/{assets/stylesheets/scss/buttons.scss → twitter/bootstrap/sass/_buttons.scss} +33 -25
  81. data/vendor/{assets/stylesheets/scss/carousel.scss → twitter/bootstrap/sass/_carousel.scss} +1 -1
  82. data/vendor/{assets/stylesheets/scss/close.scss → twitter/bootstrap/sass/_close.scss} +12 -1
  83. data/vendor/{assets/stylesheets/scss/code.scss → twitter/bootstrap/sass/_code.scss} +7 -7
  84. data/vendor/{assets/stylesheets/scss/component-animations.scss → twitter/bootstrap/sass/_component-animations.scss} +9 -7
  85. data/vendor/{assets/stylesheets/scss/dropdowns.scss → twitter/bootstrap/sass/_dropdowns.scss} +58 -45
  86. data/vendor/{assets/stylesheets/scss/forms.scss → twitter/bootstrap/sass/_forms.scss} +205 -145
  87. data/vendor/twitter/bootstrap/sass/_grid.scss +5 -0
  88. data/vendor/{assets/stylesheets/scss/hero-unit.scss → twitter/bootstrap/sass/_hero-unit.scss} +3 -1
  89. data/vendor/twitter/bootstrap/sass/_labels-badges.scss +52 -0
  90. data/vendor/{assets/stylesheets/scss/layouts.scss → twitter/bootstrap/sass/_layouts.scss} +2 -2
  91. data/vendor/{assets/stylesheets/scss/mixins.scss → twitter/bootstrap/sass/_mixins.scss} +246 -182
  92. data/vendor/{assets/stylesheets/scss/modals.scss → twitter/bootstrap/sass/_modals.scss} +14 -7
  93. data/vendor/{assets/stylesheets/scss/navbar.scss → twitter/bootstrap/sass/_navbar.scss} +132 -73
  94. data/vendor/{assets/stylesheets/scss/navs.scss → twitter/bootstrap/sass/_navs.scss} +53 -43
  95. data/vendor/{assets/stylesheets/scss/pager.scss → twitter/bootstrap/sass/_pager.scss} +6 -0
  96. data/vendor/{assets/stylesheets/scss/pagination.scss → twitter/bootstrap/sass/_pagination.scss} +1 -0
  97. data/vendor/{assets/stylesheets/scss/popovers.scss → twitter/bootstrap/sass/_popovers.scss} +0 -0
  98. data/vendor/{assets/stylesheets/scss/progress-bars.scss → twitter/bootstrap/sass/_progress-bars.scss} +27 -5
  99. data/vendor/{assets/stylesheets/scss/reset.scss → twitter/bootstrap/sass/_reset.scss} +8 -3
  100. data/vendor/twitter/bootstrap/sass/_responsive-1200px-min.scss +26 -0
  101. data/vendor/twitter/bootstrap/sass/_responsive-767px-max.scss +149 -0
  102. data/vendor/twitter/bootstrap/sass/_responsive-768px-979px.scss +17 -0
  103. data/vendor/twitter/bootstrap/sass/_responsive-navbar.scss +153 -0
  104. data/vendor/twitter/bootstrap/sass/_responsive-utilities.scss +41 -0
  105. data/vendor/{assets/stylesheets/scss/scaffolding.scss → twitter/bootstrap/sass/_scaffolding.scss} +4 -4
  106. data/vendor/{assets/stylesheets/scss/sprites.scss → twitter/bootstrap/sass/_sprites.scss} +40 -7
  107. data/vendor/{assets/stylesheets/scss/tables.scss → twitter/bootstrap/sass/_tables.scss} +37 -32
  108. data/vendor/{assets/stylesheets/scss/thumbnails.scss → twitter/bootstrap/sass/_thumbnails.scss} +14 -2
  109. data/vendor/{assets/stylesheets/scss/tooltip.scss → twitter/bootstrap/sass/_tooltip.scss} +1 -1
  110. data/vendor/{assets/stylesheets/scss/type.scss → twitter/bootstrap/sass/_type.scss} +27 -13
  111. data/vendor/{assets/stylesheets/scss/utilities.scss → twitter/bootstrap/sass/_utilities.scss} +0 -0
  112. data/vendor/twitter/bootstrap/sass/_variables.scss +204 -0
  113. data/vendor/{assets/stylesheets/scss/wells.scss → twitter/bootstrap/sass/_wells.scss} +10 -0
  114. data/vendor/{assets/stylesheets/scss → twitter/bootstrap/sass}/bootstrap.scss +3 -3
  115. data/vendor/twitter/bootstrap/sass/responsive.scss +48 -0
  116. metadata +93 -84
  117. data/lib/generators/bootstrap/install/templates/assets/javascripts/bootstrap-generators.js +0 -1
  118. data/lib/generators/bootstrap/install/templates/assets/stylesheets/bootstrap-variables.css.less +0 -98
  119. data/vendor/assets/stylesheets/bootstrap.css +0 -3363
  120. data/vendor/assets/stylesheets/less/grid.less +0 -8
  121. data/vendor/assets/stylesheets/less/labels.less +0 -32
  122. data/vendor/assets/stylesheets/less/responsive.less +0 -327
  123. data/vendor/assets/stylesheets/less/variables.less +0 -107
  124. data/vendor/assets/stylesheets/scss/grid.scss +0 -8
  125. data/vendor/assets/stylesheets/scss/labels.scss +0 -32
  126. data/vendor/assets/stylesheets/scss/responsive.scss +0 -327
  127. data/vendor/assets/stylesheets/scss/variables.scss +0 -107
@@ -1,5 +1,5 @@
1
1
  /* =============================================================
2
- * bootstrap-collapse.js v2.0.1
2
+ * bootstrap-collapse.js v2.0.4
3
3
  * http://twitter.github.com/bootstrap/javascript.html#collapse
4
4
  * =============================================================
5
5
  * Copyright 2012 Twitter, Inc.
@@ -17,16 +17,21 @@
17
17
  * limitations under the License.
18
18
  * ============================================================ */
19
19
 
20
- !function( $ ){
21
20
 
22
- "use strict"
21
+ !function ($) {
23
22
 
24
- var Collapse = function ( element, options ) {
25
- this.$element = $(element)
23
+ "use strict"; // jshint ;_;
24
+
25
+
26
+ /* COLLAPSE PUBLIC CLASS DEFINITION
27
+ * ================================ */
28
+
29
+ var Collapse = function (element, options) {
30
+ this.$element = $(element)
26
31
  this.options = $.extend({}, $.fn.collapse.defaults, options)
27
32
 
28
- if (this.options["parent"]) {
29
- this.$parent = $(this.options["parent"])
33
+ if (this.options.parent) {
34
+ this.$parent = $(this.options.parent)
30
35
  }
31
36
 
32
37
  this.options.toggle && this.toggle()
@@ -42,31 +47,39 @@
42
47
  }
43
48
 
44
49
  , show: function () {
45
- var dimension = this.dimension()
46
- , scroll = $.camelCase(['scroll', dimension].join('-'))
47
- , actives = this.$parent && this.$parent.find('.in')
50
+ var dimension
51
+ , scroll
52
+ , actives
48
53
  , hasData
49
54
 
55
+ if (this.transitioning) return
56
+
57
+ dimension = this.dimension()
58
+ scroll = $.camelCase(['scroll', dimension].join('-'))
59
+ actives = this.$parent && this.$parent.find('> .accordion-group > .in')
60
+
50
61
  if (actives && actives.length) {
51
62
  hasData = actives.data('collapse')
63
+ if (hasData && hasData.transitioning) return
52
64
  actives.collapse('hide')
53
65
  hasData || actives.data('collapse', null)
54
66
  }
55
67
 
56
68
  this.$element[dimension](0)
57
- this.transition('addClass', 'show', 'shown')
69
+ this.transition('addClass', $.Event('show'), 'shown')
58
70
  this.$element[dimension](this.$element[0][scroll])
59
-
60
71
  }
61
72
 
62
73
  , hide: function () {
63
- var dimension = this.dimension()
74
+ var dimension
75
+ if (this.transitioning) return
76
+ dimension = this.dimension()
64
77
  this.reset(this.$element[dimension]())
65
- this.transition('removeClass', 'hide', 'hidden')
78
+ this.transition('removeClass', $.Event('hide'), 'hidden')
66
79
  this.$element[dimension](0)
67
80
  }
68
81
 
69
- , reset: function ( size ) {
82
+ , reset: function (size) {
70
83
  var dimension = this.dimension()
71
84
 
72
85
  this.$element
@@ -74,35 +87,43 @@
74
87
  [dimension](size || 'auto')
75
88
  [0].offsetWidth
76
89
 
77
- this.$element.addClass('collapse')
90
+ this.$element[size !== null ? 'addClass' : 'removeClass']('collapse')
91
+
92
+ return this
78
93
  }
79
94
 
80
- , transition: function ( method, startEvent, completeEvent ) {
95
+ , transition: function (method, startEvent, completeEvent) {
81
96
  var that = this
82
97
  , complete = function () {
83
- if (startEvent == 'show') that.reset()
98
+ if (startEvent.type == 'show') that.reset()
99
+ that.transitioning = 0
84
100
  that.$element.trigger(completeEvent)
85
101
  }
86
102
 
87
- this.$element
88
- .trigger(startEvent)
89
- [method]('in')
103
+ this.$element.trigger(startEvent)
104
+
105
+ if (startEvent.isDefaultPrevented()) return
106
+
107
+ this.transitioning = 1
108
+
109
+ this.$element[method]('in')
90
110
 
91
111
  $.support.transition && this.$element.hasClass('collapse') ?
92
112
  this.$element.one($.support.transition.end, complete) :
93
113
  complete()
94
- }
114
+ }
95
115
 
96
116
  , toggle: function () {
97
117
  this[this.$element.hasClass('in') ? 'hide' : 'show']()
98
- }
118
+ }
99
119
 
100
120
  }
101
121
 
102
- /* COLLAPSIBLE PLUGIN DEFINITION
122
+
123
+ /* COLLAPSIBLE PLUGIN DEFINITION
103
124
  * ============================== */
104
125
 
105
- $.fn.collapse = function ( option ) {
126
+ $.fn.collapse = function (option) {
106
127
  return this.each(function () {
107
128
  var $this = $(this)
108
129
  , data = $this.data('collapse')
@@ -133,4 +154,4 @@
133
154
  })
134
155
  })
135
156
 
136
- }( window.jQuery );
157
+ }(window.jQuery);
@@ -1,5 +1,5 @@
1
1
  /* ============================================================
2
- * bootstrap-dropdown.js v2.0.1
2
+ * bootstrap-dropdown.js v2.0.4
3
3
  * http://twitter.github.com/bootstrap/javascript.html#dropdowns
4
4
  * ============================================================
5
5
  * Copyright 2012 Twitter, Inc.
@@ -18,15 +18,16 @@
18
18
  * ============================================================ */
19
19
 
20
20
 
21
- !function( $ ){
21
+ !function ($) {
22
+
23
+ "use strict"; // jshint ;_;
22
24
 
23
- "use strict"
24
25
 
25
26
  /* DROPDOWN CLASS DEFINITION
26
27
  * ========================= */
27
28
 
28
29
  var toggle = '[data-toggle="dropdown"]'
29
- , Dropdown = function ( element ) {
30
+ , Dropdown = function (element) {
30
31
  var $el = $(element).on('click.dropdown.data-api', this.toggle)
31
32
  $('html').on('click.dropdown.data-api', function () {
32
33
  $el.parent().removeClass('open')
@@ -37,12 +38,16 @@
37
38
 
38
39
  constructor: Dropdown
39
40
 
40
- , toggle: function ( e ) {
41
+ , toggle: function (e) {
41
42
  var $this = $(this)
42
- , selector = $this.attr('data-target')
43
43
  , $parent
44
+ , selector
44
45
  , isActive
45
46
 
47
+ if ($this.is('.disabled, :disabled')) return
48
+
49
+ selector = $this.attr('data-target')
50
+
46
51
  if (!selector) {
47
52
  selector = $this.attr('href')
48
53
  selector = selector && selector.replace(/.*(?=#[^\s]*$)/, '') //strip for ie7
@@ -54,7 +59,8 @@
54
59
  isActive = $parent.hasClass('open')
55
60
 
56
61
  clearMenus()
57
- !isActive && $parent.toggleClass('open')
62
+
63
+ if (!isActive) $parent.toggleClass('open')
58
64
 
59
65
  return false
60
66
  }
@@ -69,7 +75,7 @@
69
75
  /* DROPDOWN PLUGIN DEFINITION
70
76
  * ========================== */
71
77
 
72
- $.fn.dropdown = function ( option ) {
78
+ $.fn.dropdown = function (option) {
73
79
  return this.each(function () {
74
80
  var $this = $(this)
75
81
  , data = $this.data('dropdown')
@@ -86,7 +92,9 @@
86
92
 
87
93
  $(function () {
88
94
  $('html').on('click.dropdown.data-api', clearMenus)
89
- $('body').on('click.dropdown.data-api', toggle, Dropdown.prototype.toggle)
95
+ $('body')
96
+ .on('click.dropdown', '.dropdown form', function (e) { e.stopPropagation() })
97
+ .on('click.dropdown.data-api', toggle, Dropdown.prototype.toggle)
90
98
  })
91
99
 
92
- }( window.jQuery );
100
+ }(window.jQuery);
@@ -1,5 +1,5 @@
1
1
  /* =========================================================
2
- * bootstrap-modal.js v2.0.1
2
+ * bootstrap-modal.js v2.0.4
3
3
  * http://twitter.github.com/bootstrap/javascript.html#modals
4
4
  * =========================================================
5
5
  * Copyright 2012 Twitter, Inc.
@@ -18,14 +18,15 @@
18
18
  * ========================================================= */
19
19
 
20
20
 
21
- !function( $ ){
21
+ !function ($) {
22
+
23
+ "use strict"; // jshint ;_;
22
24
 
23
- "use strict"
24
25
 
25
26
  /* MODAL CLASS DEFINITION
26
27
  * ====================== */
27
28
 
28
- var Modal = function ( content, options ) {
29
+ var Modal = function (content, options) {
29
30
  this.options = options
30
31
  this.$element = $(content)
31
32
  .delegate('[data-dismiss="modal"]', 'click.dismiss.modal', $.proxy(this.hide, this))
@@ -41,19 +42,23 @@
41
42
 
42
43
  , show: function () {
43
44
  var that = this
45
+ , e = $.Event('show')
46
+
47
+ this.$element.trigger(e)
44
48
 
45
- if (this.isShown) return
49
+ if (this.isShown || e.isDefaultPrevented()) return
46
50
 
47
51
  $('body').addClass('modal-open')
48
52
 
49
53
  this.isShown = true
50
- this.$element.trigger('show')
51
54
 
52
55
  escape.call(this)
53
56
  backdrop.call(this, function () {
54
57
  var transition = $.support.transition && that.$element.hasClass('fade')
55
58
 
56
- !that.$element.parent().length && that.$element.appendTo(document.body) //don't move modals dom position
59
+ if (!that.$element.parent().length) {
60
+ that.$element.appendTo(document.body) //don't move modals dom position
61
+ }
57
62
 
58
63
  that.$element
59
64
  .show()
@@ -71,21 +76,24 @@
71
76
  })
72
77
  }
73
78
 
74
- , hide: function ( e ) {
79
+ , hide: function (e) {
75
80
  e && e.preventDefault()
76
81
 
77
- if (!this.isShown) return
78
-
79
82
  var that = this
83
+
84
+ e = $.Event('hide')
85
+
86
+ this.$element.trigger(e)
87
+
88
+ if (!this.isShown || e.isDefaultPrevented()) return
89
+
80
90
  this.isShown = false
81
91
 
82
92
  $('body').removeClass('modal-open')
83
93
 
84
94
  escape.call(this)
85
95
 
86
- this.$element
87
- .trigger('hide')
88
- .removeClass('in')
96
+ this.$element.removeClass('in')
89
97
 
90
98
  $.support.transition && this.$element.hasClass('fade') ?
91
99
  hideWithTransition.call(this) :
@@ -111,7 +119,7 @@
111
119
  })
112
120
  }
113
121
 
114
- function hideModal( that ) {
122
+ function hideModal(that) {
115
123
  this.$element
116
124
  .hide()
117
125
  .trigger('hidden')
@@ -119,7 +127,7 @@
119
127
  backdrop.call(this)
120
128
  }
121
129
 
122
- function backdrop( callback ) {
130
+ function backdrop(callback) {
123
131
  var that = this
124
132
  , animate = this.$element.hasClass('fade') ? 'fade' : ''
125
133
 
@@ -173,7 +181,7 @@
173
181
  /* MODAL PLUGIN DEFINITION
174
182
  * ======================= */
175
183
 
176
- $.fn.modal = function ( option ) {
184
+ $.fn.modal = function (option) {
177
185
  return this.each(function () {
178
186
  var $this = $(this)
179
187
  , data = $this.data('modal')
@@ -207,4 +215,4 @@
207
215
  })
208
216
  })
209
217
 
210
- }( window.jQuery );
218
+ }(window.jQuery);
@@ -1,5 +1,5 @@
1
1
  /* ===========================================================
2
- * bootstrap-popover.js v2.0.1
2
+ * bootstrap-popover.js v2.0.4
3
3
  * http://twitter.github.com/bootstrap/javascript.html#popovers
4
4
  * ===========================================================
5
5
  * Copyright 2012 Twitter, Inc.
@@ -18,14 +18,19 @@
18
18
  * =========================================================== */
19
19
 
20
20
 
21
- !function( $ ) {
21
+ !function ($) {
22
22
 
23
- "use strict"
23
+ "use strict"; // jshint ;_;
24
+
25
+
26
+ /* POPOVER PUBLIC CLASS DEFINITION
27
+ * =============================== */
24
28
 
25
29
  var Popover = function ( element, options ) {
26
30
  this.init('popover', element, options)
27
31
  }
28
32
 
33
+
29
34
  /* NOTE: POPOVER EXTENDS BOOTSTRAP-TOOLTIP.js
30
35
  ========================================== */
31
36
 
@@ -38,8 +43,8 @@
38
43
  , title = this.getTitle()
39
44
  , content = this.getContent()
40
45
 
41
- $tip.find('.popover-title')[ $.type(title) == 'object' ? 'append' : 'html' ](title)
42
- $tip.find('.popover-content > *')[ $.type(content) == 'object' ? 'append' : 'html' ](content)
46
+ $tip.find('.popover-title')[this.isHTML(title) ? 'html' : 'text'](title)
47
+ $tip.find('.popover-content > *')[this.isHTML(content) ? 'html' : 'text'](content)
43
48
 
44
49
  $tip.removeClass('fade top bottom left right in')
45
50
  }
@@ -56,12 +61,10 @@
56
61
  content = $e.attr('data-content')
57
62
  || (typeof o.content == 'function' ? o.content.call($e[0]) : o.content)
58
63
 
59
- content = content.toString().replace(/(^\s*|\s*$)/, "")
60
-
61
64
  return content
62
65
  }
63
66
 
64
- , tip: function() {
67
+ , tip: function () {
65
68
  if (!this.$tip) {
66
69
  this.$tip = $(this.options.template)
67
70
  }
@@ -74,7 +77,7 @@
74
77
  /* POPOVER PLUGIN DEFINITION
75
78
  * ======================= */
76
79
 
77
- $.fn.popover = function ( option ) {
80
+ $.fn.popover = function (option) {
78
81
  return this.each(function () {
79
82
  var $this = $(this)
80
83
  , data = $this.data('popover')
@@ -92,4 +95,4 @@
92
95
  , 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>'
93
96
  })
94
97
 
95
- }( window.jQuery );
98
+ }(window.jQuery);
@@ -1,5 +1,5 @@
1
1
  /* =============================================================
2
- * bootstrap-scrollspy.js v2.0.1
2
+ * bootstrap-scrollspy.js v2.0.4
3
3
  * http://twitter.github.com/bootstrap/javascript.html#scrollspy
4
4
  * =============================================================
5
5
  * Copyright 2012 Twitter, Inc.
@@ -17,9 +17,11 @@
17
17
  * limitations under the License.
18
18
  * ============================================================== */
19
19
 
20
- !function ( $ ) {
21
20
 
22
- "use strict"
21
+ !function ($) {
22
+
23
+ "use strict"; // jshint ;_;
24
+
23
25
 
24
26
  /* SCROLLSPY CLASS DEFINITION
25
27
  * ========================== */
@@ -33,7 +35,7 @@
33
35
  this.selector = (this.options.target
34
36
  || ((href = $(element).attr('href')) && href.replace(/.*(?=#[^\s]+$)/, '')) //strip for ie7
35
37
  || '') + ' .nav li > a'
36
- this.$body = $('body').on('click.scroll.data-api', this.selector, process)
38
+ this.$body = $('body')
37
39
  this.refresh()
38
40
  this.process()
39
41
  }
@@ -43,25 +45,43 @@
43
45
  constructor: ScrollSpy
44
46
 
45
47
  , refresh: function () {
46
- this.targets = this.$body
48
+ var self = this
49
+ , $targets
50
+
51
+ this.offsets = $([])
52
+ this.targets = $([])
53
+
54
+ $targets = this.$body
47
55
  .find(this.selector)
48
56
  .map(function () {
49
- var href = $(this).attr('href')
50
- return /^#\w/.test(href) && $(href).length ? href : null
57
+ var $el = $(this)
58
+ , href = $el.data('target') || $el.attr('href')
59
+ , $href = /^#\w/.test(href) && $(href)
60
+ return ( $href
61
+ && href.length
62
+ && [[ $href.position().top, href ]] ) || null
63
+ })
64
+ .sort(function (a, b) { return a[0] - b[0] })
65
+ .each(function () {
66
+ self.offsets.push(this[0])
67
+ self.targets.push(this[1])
51
68
  })
52
-
53
- this.offsets = $.map(this.targets, function (id) {
54
- return $(id).position().top
55
- })
56
69
  }
57
70
 
58
71
  , process: function () {
59
72
  var scrollTop = this.$scrollElement.scrollTop() + this.options.offset
73
+ , scrollHeight = this.$scrollElement[0].scrollHeight || this.$body[0].scrollHeight
74
+ , maxScroll = scrollHeight - this.$scrollElement.height()
60
75
  , offsets = this.offsets
61
76
  , targets = this.targets
62
77
  , activeTarget = this.activeTarget
63
78
  , i
64
79
 
80
+ if (scrollTop >= maxScroll) {
81
+ return activeTarget != (i = targets.last()[0])
82
+ && this.activate ( i )
83
+ }
84
+
65
85
  for (i = offsets.length; i--;) {
66
86
  activeTarget != targets[i]
67
87
  && scrollTop >= offsets[i]
@@ -72,21 +92,27 @@
72
92
 
73
93
  , activate: function (target) {
74
94
  var active
95
+ , selector
75
96
 
76
97
  this.activeTarget = target
77
98
 
78
- this.$body
79
- .find(this.selector).parent('.active')
99
+ $(this.selector)
100
+ .parent('.active')
80
101
  .removeClass('active')
81
102
 
82
- active = this.$body
83
- .find(this.selector + '[href="' + target + '"]')
103
+ selector = this.selector
104
+ + '[data-target="' + target + '"],'
105
+ + this.selector + '[href="' + target + '"]'
106
+
107
+ active = $(selector)
84
108
  .parent('li')
85
109
  .addClass('active')
86
110
 
87
- if ( active.parent('.dropdown-menu') ) {
88
- active.closest('li.dropdown').addClass('active')
111
+ if (active.parent('.dropdown-menu')) {
112
+ active = active.closest('li.dropdown').addClass('active')
89
113
  }
114
+
115
+ active.trigger('activate')
90
116
  }
91
117
 
92
118
  }
@@ -122,4 +148,4 @@
122
148
  })
123
149
  })
124
150
 
125
- }( window.jQuery );
151
+ }(window.jQuery);