underoos 1.0.0 → 1.1.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (140) hide show
  1. data/Gemfile +5 -0
  2. data/Gemfile.lock +21 -7
  3. data/README.md +85 -10
  4. data/Rakefile +36 -1
  5. data/app/assets/javascripts/docs.js +6 -0
  6. data/app/assets/javascripts/styleguide.coffee +162 -0
  7. data/app/assets/javascripts/underoos.js +0 -1
  8. data/app/assets/stylesheets/base/_base.sass +14 -0
  9. data/app/assets/stylesheets/base/_buttons.sass +68 -0
  10. data/app/assets/stylesheets/base/_forms.sass +313 -24
  11. data/app/assets/stylesheets/base/_helpers.sass +27 -13
  12. data/app/assets/stylesheets/base/_normalize.sass +17 -9
  13. data/app/assets/stylesheets/base/_scaffold.sass +85 -0
  14. data/app/assets/stylesheets/base/_tables.sass +77 -0
  15. data/app/assets/stylesheets/base/_transitions.sass +10 -2
  16. data/app/assets/stylesheets/base/_typography.sass +183 -21
  17. data/app/assets/stylesheets/components/_accordions.sass +38 -0
  18. data/app/assets/stylesheets/components/_breadcrumbs.sass +19 -5
  19. data/app/assets/stylesheets/components/_button-groups.sass +43 -0
  20. data/app/assets/stylesheets/components/_carets.sass +13 -2
  21. data/app/assets/stylesheets/components/_carousels.sass +32 -0
  22. data/app/assets/stylesheets/components/_close.sass +15 -2
  23. data/app/assets/stylesheets/components/_components.sass +28 -0
  24. data/app/assets/stylesheets/components/_decals.sass +14 -0
  25. data/app/assets/stylesheets/components/_dropdowns.sass +88 -4
  26. data/app/assets/stylesheets/components/_media.sass +36 -0
  27. data/app/assets/stylesheets/components/_modals.sass +29 -0
  28. data/app/assets/stylesheets/components/_nav-lists.sass +20 -0
  29. data/app/assets/stylesheets/components/_navbars.sass +64 -3
  30. data/app/assets/stylesheets/components/_notifications.sass +112 -16
  31. data/app/assets/stylesheets/components/_paddles.sass +26 -0
  32. data/app/assets/stylesheets/components/_pagination.sass +23 -3
  33. data/app/assets/stylesheets/components/_pills.sass +80 -0
  34. data/app/assets/stylesheets/components/_popovers.sass +28 -0
  35. data/app/assets/stylesheets/components/_progress-bars.sass +33 -1
  36. data/app/assets/stylesheets/components/_tabs.sass +79 -0
  37. data/app/assets/stylesheets/components/_tooltips.sass +26 -0
  38. data/app/assets/stylesheets/components/_wells.sass +9 -0
  39. data/app/assets/stylesheets/layouts/_containers.sass +12 -0
  40. data/app/assets/stylesheets/layouts/_layouts.sass +5 -0
  41. data/app/assets/stylesheets/layouts/_print.sass +5 -1
  42. data/app/assets/stylesheets/layouts/_queries.sass +18 -15
  43. data/app/assets/stylesheets/layouts/_upgrades.sass +51 -40
  44. data/app/assets/stylesheets/mixins/_arrows.sass +13 -1
  45. data/app/assets/stylesheets/mixins/_clearfixins.sass +18 -4
  46. data/app/assets/stylesheets/mixins/_coloring.sass +10 -1
  47. data/app/assets/stylesheets/mixins/_columns.sass +16 -3
  48. data/app/assets/stylesheets/mixins/_conversions.sass +18 -6
  49. data/app/assets/stylesheets/mixins/_font-size.sass +16 -1
  50. data/app/assets/stylesheets/mixins/_image-tools.sass +12 -1
  51. data/app/assets/stylesheets/mixins/_inline-block.sass +21 -0
  52. data/app/assets/stylesheets/mixins/_ir.sass +14 -1
  53. data/app/assets/stylesheets/mixins/_mixins.sass +6 -0
  54. data/app/assets/stylesheets/mixins/_responsive.sass +16 -0
  55. data/app/assets/stylesheets/mixins/_sticky-footer.sass +52 -0
  56. data/app/assets/stylesheets/mixins/_tab-focus.sass +8 -1
  57. data/app/assets/stylesheets/mixins/_timing-equations.sass +34 -1
  58. data/app/assets/stylesheets/mixins/_visibility.sass +18 -5
  59. data/app/assets/stylesheets/polyfills/_box-shadow.sass +10 -0
  60. data/app/assets/stylesheets/polyfills/_box-sizing.sass +10 -1
  61. data/app/assets/stylesheets/polyfills/_functions.sass +14 -1
  62. data/app/assets/stylesheets/polyfills/_opacity.sass +10 -1
  63. data/app/assets/stylesheets/polyfills/_polyfills.sass +9 -2
  64. data/app/assets/stylesheets/polyfills/_transition.sass +10 -0
  65. data/app/assets/stylesheets/polyfills/_user-select.sass +10 -0
  66. data/app/assets/stylesheets/settings/_config.sass +26 -0
  67. data/app/assets/stylesheets/settings/_settings.sass +7 -0
  68. data/app/assets/stylesheets/settings/_theme.sass +189 -0
  69. data/app/assets/stylesheets/{styleguide.sass → underoos-docs.sass} +20 -116
  70. data/app/assets/stylesheets/underoos.sass +5 -16
  71. data/config.ru +1 -3
  72. data/features/generator.feature +13 -4
  73. data/lib/generators/underoos/assets_generator.rb +4 -2
  74. data/lib/underoos/version.rb +1 -1
  75. data/public/images.html +157 -0
  76. data/public/index.html +149 -0
  77. data/public/sherpa.css +306 -0
  78. data/public/styles.html +5374 -0
  79. data/script/javascripts +0 -1
  80. data/sherpa/config.yml +96 -0
  81. data/sherpa/layouts/images.mustache +17 -0
  82. data/sherpa/layouts/layout.mustache +77 -0
  83. data/sherpa/layouts/overview.mustache +19 -0
  84. data/sherpa/layouts/raw.mustache +25 -0
  85. data/sherpa/layouts/section.mustache +67 -0
  86. data/underoos.gemspec +0 -2
  87. data/vendor/assets/javascripts/bootstrap-alert.js +28 -32
  88. data/vendor/assets/javascripts/bootstrap-button.js +29 -33
  89. data/vendor/assets/javascripts/bootstrap-collapse.js +45 -26
  90. data/vendor/assets/javascripts/bootstrap-dropdown.js +18 -10
  91. data/vendor/assets/javascripts/bootstrap-modal.js +25 -17
  92. data/vendor/assets/javascripts/bootstrap-popover.js +13 -10
  93. data/vendor/assets/javascripts/bootstrap-tab.js +12 -7
  94. data/vendor/assets/javascripts/bootstrap-tooltip.js +40 -35
  95. data/vendor/assets/javascripts/bootstrap-transition.js +30 -20
  96. data/vendor/assets/javascripts/bootstrap-typeahead.js +24 -10
  97. data/vendor/assets/javascripts/sherpa.coffee +78 -0
  98. metadata +34 -75
  99. data/app/assets/javascripts/styleguide.js +0 -132
  100. data/app/assets/stylesheets/base/_elements.sass +0 -61
  101. data/app/assets/stylesheets/polyfills/_inline-block.sass +0 -8
  102. data/app/assets/stylesheets/themes/_default.sass +0 -119
  103. data/app/controllers/underoos/styleguides_controller.rb +0 -79
  104. data/app/views/shared/_upgrades.html.haml +0 -12
  105. data/app/views/underoos/styleguides/_assets.haml +0 -42
  106. data/app/views/underoos/styleguides/_components.haml +0 -42
  107. data/app/views/underoos/styleguides/_elements.haml +0 -242
  108. data/app/views/underoos/styleguides/_forms.haml +0 -305
  109. data/app/views/underoos/styleguides/_layouts.haml +0 -76
  110. data/app/views/underoos/styleguides/_palettes.haml +0 -18
  111. data/app/views/underoos/styleguides/_resources.haml +0 -27
  112. data/app/views/underoos/styleguides/_tables.haml +0 -124
  113. data/app/views/underoos/styleguides/_typography.haml +0 -284
  114. data/app/views/underoos/styleguides/_utilities.haml +0 -270
  115. data/app/views/underoos/styleguides/components/_accordions.haml +0 -83
  116. data/app/views/underoos/styleguides/components/_breadcrumbs.haml +0 -42
  117. data/app/views/underoos/styleguides/components/_button-groups.haml +0 -162
  118. data/app/views/underoos/styleguides/components/_carets.haml +0 -28
  119. data/app/views/underoos/styleguides/components/_close.haml +0 -20
  120. data/app/views/underoos/styleguides/components/_decals.haml +0 -40
  121. data/app/views/underoos/styleguides/components/_dropdowns.haml +0 -189
  122. data/app/views/underoos/styleguides/components/_media.haml +0 -78
  123. data/app/views/underoos/styleguides/components/_modals.haml +0 -42
  124. data/app/views/underoos/styleguides/components/_nav-lists.haml +0 -52
  125. data/app/views/underoos/styleguides/components/_navbars.haml +0 -144
  126. data/app/views/underoos/styleguides/components/_navs-showcase.haml +0 -27
  127. data/app/views/underoos/styleguides/components/_notifications.haml +0 -169
  128. data/app/views/underoos/styleguides/components/_paddles.haml +0 -68
  129. data/app/views/underoos/styleguides/components/_pagination.haml +0 -64
  130. data/app/views/underoos/styleguides/components/_popovers.haml +0 -33
  131. data/app/views/underoos/styleguides/components/_progress-bars.haml +0 -72
  132. data/app/views/underoos/styleguides/components/_tabs-pills.haml +0 -241
  133. data/app/views/underoos/styleguides/components/_tooltips.haml +0 -37
  134. data/app/views/underoos/styleguides/components/_wells.haml +0 -29
  135. data/app/views/underoos/styleguides/index.html.haml +0 -259
  136. data/app/views/underoos/styleguides/partials/_form-template.haml +0 -171
  137. data/app/views/underoos/styleguides/partials/_table-data.haml +0 -33
  138. data/app/views/underoos/styleguides/partials/_transitions.haml +0 -136
  139. data/config/routes.rb +0 -3
  140. data/vendor/assets/javascripts/bootstrap-scrollspy.js +0 -125
@@ -1,5 +1,5 @@
1
1
  /* =============================================================
2
- * bootstrap-collapse.js v2.0.2
2
+ * bootstrap-collapse.js v2.0.3
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,37 +87,43 @@
74
87
  [dimension](size || 'auto')
75
88
  [0].offsetWidth
76
89
 
77
- this.$element[size ? 'addClass' : 'removeClass']('collapse')
90
+ this.$element[size !== null ? 'addClass' : 'removeClass']('collapse')
78
91
 
79
92
  return this
80
93
  }
81
94
 
82
- , transition: function ( method, startEvent, completeEvent ) {
95
+ , transition: function (method, startEvent, completeEvent) {
83
96
  var that = this
84
97
  , complete = function () {
85
- if (startEvent == 'show') that.reset()
98
+ if (startEvent.type == 'show') that.reset()
99
+ that.transitioning = 0
86
100
  that.$element.trigger(completeEvent)
87
101
  }
88
102
 
89
- this.$element
90
- .trigger(startEvent)
91
- [method]('in')
103
+ this.$element.trigger(startEvent)
104
+
105
+ if (startEvent.isDefaultPrevented()) return
106
+
107
+ this.transitioning = 1
108
+
109
+ this.$element[method]('in')
92
110
 
93
111
  $.support.transition && this.$element.hasClass('collapse') ?
94
112
  this.$element.one($.support.transition.end, complete) :
95
113
  complete()
96
- }
114
+ }
97
115
 
98
116
  , toggle: function () {
99
117
  this[this.$element.hasClass('in') ? 'hide' : 'show']()
100
- }
118
+ }
101
119
 
102
120
  }
103
121
 
104
- /* COLLAPSIBLE PLUGIN DEFINITION
122
+
123
+ /* COLLAPSIBLE PLUGIN DEFINITION
105
124
  * ============================== */
106
125
 
107
- $.fn.collapse = function ( option ) {
126
+ $.fn.collapse = function (option) {
108
127
  return this.each(function () {
109
128
  var $this = $(this)
110
129
  , data = $this.data('collapse')
@@ -135,4 +154,4 @@
135
154
  })
136
155
  })
137
156
 
138
- }( window.jQuery );
157
+ }(window.jQuery);
@@ -1,5 +1,5 @@
1
1
  /* ============================================================
2
- * bootstrap-dropdown.js v2.0.2
2
+ * bootstrap-dropdown.js v2.0.3
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.2
2
+ * bootstrap-modal.js v2.0.3
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.2
2
+ * bootstrap-popover.js v2.0.3
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-tab.js v2.0.2
2
+ * bootstrap-tab.js v2.0.3
3
3
  * http://twitter.github.com/bootstrap/javascript.html#tabs
4
4
  * ========================================================
5
5
  * Copyright 2012 Twitter, Inc.
@@ -18,9 +18,10 @@
18
18
  * ======================================================== */
19
19
 
20
20
 
21
- !function( $ ){
21
+ !function ($) {
22
+
23
+ "use strict"; // jshint ;_;
22
24
 
23
- "use strict"
24
25
 
25
26
  /* TAB CLASS DEFINITION
26
27
  * ==================== */
@@ -39,6 +40,7 @@
39
40
  , selector = $this.attr('data-target')
40
41
  , previous
41
42
  , $target
43
+ , e
42
44
 
43
45
  if (!selector) {
44
46
  selector = $this.attr('href')
@@ -49,11 +51,14 @@
49
51
 
50
52
  previous = $ul.find('.active a').last()[0]
51
53
 
52
- $this.trigger({
53
- type: 'show'
54
- , relatedTarget: previous
54
+ e = $.Event('show', {
55
+ relatedTarget: previous
55
56
  })
56
57
 
58
+ $this.trigger(e)
59
+
60
+ if (e.isDefaultPrevented()) return
61
+
57
62
  $target = $(selector)
58
63
 
59
64
  this.activate($this.parent('li'), $ul)
@@ -127,4 +132,4 @@
127
132
  })
128
133
  })
129
134
 
130
- }( window.jQuery );
135
+ }(window.jQuery);
@@ -1,5 +1,5 @@
1
1
  /* ===========================================================
2
- * bootstrap-tooltip.js v2.0.2
2
+ * bootstrap-tooltip.js v2.0.3
3
3
  * http://twitter.github.com/bootstrap/javascript.html#tooltips
4
4
  * Inspired by the original jQuery.tipsy by Jason Frame
5
5
  * ===========================================================
@@ -18,14 +18,16 @@
18
18
  * limitations under the License.
19
19
  * ========================================================== */
20
20
 
21
- !function( $ ) {
22
21
 
23
- "use strict"
22
+ !function ($) {
23
+
24
+ "use strict"; // jshint ;_;
25
+
24
26
 
25
27
  /* TOOLTIP PUBLIC CLASS DEFINITION
26
28
  * =============================== */
27
29
 
28
- var Tooltip = function ( element, options ) {
30
+ var Tooltip = function (element, options) {
29
31
  this.init('tooltip', element, options)
30
32
  }
31
33
 
@@ -33,7 +35,7 @@
33
35
 
34
36
  constructor: Tooltip
35
37
 
36
- , init: function ( type, element, options ) {
38
+ , init: function (type, element, options) {
37
39
  var eventIn
38
40
  , eventOut
39
41
 
@@ -54,7 +56,7 @@
54
56
  this.fixTitle()
55
57
  }
56
58
 
57
- , getOptions: function ( options ) {
59
+ , getOptions: function (options) {
58
60
  options = $.extend({}, $.fn[this.type].defaults, options, this.$element.data())
59
61
 
60
62
  if (options.delay && typeof options.delay == 'number') {
@@ -67,34 +69,28 @@
67
69
  return options
68
70
  }
69
71
 
70
- , enter: function ( e ) {
72
+ , enter: function (e) {
71
73
  var self = $(e.currentTarget)[this.type](this._options).data(this.type)
72
74
 
73
- if (!self.options.delay || !self.options.delay.show) {
74
- self.show()
75
- } else {
76
- self.hoverState = 'in'
77
- setTimeout(function() {
78
- if (self.hoverState == 'in') {
79
- self.show()
80
- }
81
- }, self.options.delay.show)
82
- }
75
+ if (!self.options.delay || !self.options.delay.show) return self.show()
76
+
77
+ clearTimeout(this.timeout)
78
+ self.hoverState = 'in'
79
+ this.timeout = setTimeout(function() {
80
+ if (self.hoverState == 'in') self.show()
81
+ }, self.options.delay.show)
83
82
  }
84
83
 
85
- , leave: function ( e ) {
84
+ , leave: function (e) {
86
85
  var self = $(e.currentTarget)[this.type](this._options).data(this.type)
87
86
 
88
- if (!self.options.delay || !self.options.delay.hide) {
89
- self.hide()
90
- } else {
91
- self.hoverState = 'out'
92
- setTimeout(function() {
93
- if (self.hoverState == 'out') {
94
- self.hide()
95
- }
96
- }, self.options.delay.hide)
97
- }
87
+ if (!self.options.delay || !self.options.delay.hide) return self.hide()
88
+
89
+ clearTimeout(this.timeout)
90
+ self.hoverState = 'out'
91
+ this.timeout = setTimeout(function() {
92
+ if (self.hoverState == 'out') self.hide()
93
+ }, self.options.delay.hide)
98
94
  }
99
95
 
100
96
  , show: function () {
@@ -152,9 +148,20 @@
152
148
  }
153
149
  }
154
150
 
151
+ , isHTML: function(text) {
152
+ // html string detection logic adapted from jQuery
153
+ return typeof text != 'string'
154
+ || ( text.charAt(0) === "<"
155
+ && text.charAt( text.length - 1 ) === ">"
156
+ && text.length >= 3
157
+ ) || /^(?:[^<]*<[\w\W]+>[^>]*$)/.exec(text)
158
+ }
159
+
155
160
  , setContent: function () {
156
161
  var $tip = this.tip()
157
- $tip.find('.tooltip-inner').html(this.getTitle())
162
+ , title = this.getTitle()
163
+
164
+ $tip.find('.tooltip-inner')[this.isHTML(title) ? 'html' : 'text'](title)
158
165
  $tip.removeClass('fade in top bottom left right')
159
166
  }
160
167
 
@@ -206,8 +213,6 @@
206
213
  title = $e.attr('data-original-title')
207
214
  || (typeof o.title == 'function' ? o.title.call($e[0]) : o.title)
208
215
 
209
- title = (title || '').toString().replace(/(^\s*|\s*$)/, "")
210
-
211
216
  return title
212
217
  }
213
218
 
@@ -259,12 +264,12 @@
259
264
 
260
265
  $.fn.tooltip.defaults = {
261
266
  animation: true
262
- , delay: 0
263
- , selector: false
264
267
  , placement: 'top'
268
+ , selector: false
269
+ , template: '<div class="tooltip"><div class="tooltip-arrow"></div><div class="tooltip-inner"></div></div>'
265
270
  , trigger: 'hover'
266
271
  , title: ''
267
- , template: '<div class="tooltip"><div class="tooltip-arrow"></div><div class="tooltip-inner"></div></div>'
272
+ , delay: 0
268
273
  }
269
274
 
270
- }( window.jQuery );
275
+ }(window.jQuery);