less-rails-bootstrap 2.3.3 → 3.0.0.rc1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (72) hide show
  1. data/.gitignore +1 -0
  2. data/CHANGELOG.md +4 -0
  3. data/README.md +7 -11
  4. data/lib/less/rails/bootstrap/version.rb +1 -1
  5. data/scripts/update_bootstrap.sh +37 -8
  6. data/test/cases/usage_css_spec.rb +15 -12
  7. data/test/cases/usage_js_spec.rb +4 -4
  8. data/test/dummy_app/app/assets/stylesheets/fonts.css.less +2 -0
  9. data/test/dummy_app/app/assets/stylesheets/framework.css.less +4 -2
  10. data/test/dummy_app/app/assets/stylesheets/individual.css.less +2 -2
  11. data/test/spec_helper.rb +1 -2
  12. data/vendor/assets/javascripts/twitter/bootstrap.js +0 -1
  13. data/vendor/assets/javascripts/twitter/bootstrap/affix.js +58 -49
  14. data/vendor/assets/javascripts/twitter/bootstrap/alert.js +36 -37
  15. data/vendor/assets/javascripts/twitter/bootstrap/button.js +41 -39
  16. data/vendor/assets/javascripts/twitter/bootstrap/carousel.js +131 -125
  17. data/vendor/assets/javascripts/twitter/bootstrap/collapse.js +108 -96
  18. data/vendor/assets/javascripts/twitter/bootstrap/dropdown.js +72 -87
  19. data/vendor/assets/javascripts/twitter/bootstrap/modal.js +149 -155
  20. data/vendor/assets/javascripts/twitter/bootstrap/popover.js +60 -59
  21. data/vendor/assets/javascripts/twitter/bootstrap/scrollspy.js +103 -107
  22. data/vendor/assets/javascripts/twitter/bootstrap/tab.js +73 -82
  23. data/vendor/assets/javascripts/twitter/bootstrap/tooltip.js +258 -255
  24. data/vendor/assets/javascripts/twitter/bootstrap/transition.js +34 -38
  25. data/vendor/frameworks/twitter/bootstrap/accordion.less +9 -12
  26. data/vendor/frameworks/twitter/bootstrap/alerts.less +43 -53
  27. data/vendor/frameworks/twitter/bootstrap/bootstrap.less +21 -21
  28. data/vendor/frameworks/twitter/bootstrap/breadcrumbs.less +7 -8
  29. data/vendor/frameworks/twitter/bootstrap/button-groups.less +93 -151
  30. data/vendor/frameworks/twitter/bootstrap/buttons.less +93 -164
  31. data/vendor/frameworks/twitter/bootstrap/carousel.less +110 -63
  32. data/vendor/frameworks/twitter/bootstrap/close.less +18 -17
  33. data/vendor/frameworks/twitter/bootstrap/code.less +14 -20
  34. data/vendor/frameworks/twitter/bootstrap/component-animations.less +10 -3
  35. data/vendor/frameworks/twitter/bootstrap/dropdowns.less +66 -143
  36. data/vendor/frameworks/twitter/bootstrap/forms.less +281 -548
  37. data/vendor/frameworks/twitter/bootstrap/grid.less +194 -11
  38. data/vendor/frameworks/twitter/bootstrap/media.less +8 -7
  39. data/vendor/frameworks/twitter/bootstrap/mixins.less +290 -446
  40. data/vendor/frameworks/twitter/bootstrap/modals.less +92 -51
  41. data/vendor/frameworks/twitter/bootstrap/navbar.less +285 -402
  42. data/vendor/frameworks/twitter/bootstrap/navs.less +176 -348
  43. data/vendor/frameworks/twitter/bootstrap/pager.less +45 -33
  44. data/vendor/frameworks/twitter/bootstrap/pagination.less +89 -104
  45. data/vendor/frameworks/twitter/bootstrap/popovers.less +53 -51
  46. data/vendor/frameworks/twitter/bootstrap/progress-bars.less +28 -45
  47. data/vendor/frameworks/twitter/bootstrap/responsive-utilities.less +92 -32
  48. data/vendor/frameworks/twitter/bootstrap/scaffolding.less +60 -18
  49. data/vendor/frameworks/twitter/bootstrap/tables.less +131 -164
  50. data/vendor/frameworks/twitter/bootstrap/thumbnails.less +20 -31
  51. data/vendor/frameworks/twitter/bootstrap/tooltip.less +45 -20
  52. data/vendor/frameworks/twitter/bootstrap/type.less +84 -99
  53. data/vendor/frameworks/twitter/bootstrap/utilities.less +17 -5
  54. data/vendor/frameworks/twitter/bootstrap/variables.less +446 -179
  55. data/vendor/frameworks/twitter/bootstrap/wells.less +5 -5
  56. metadata +41 -44
  57. data/vendor/assets/images/twitter/bootstrap/glyphicons-halflings-white.png +0 -0
  58. data/vendor/assets/images/twitter/bootstrap/glyphicons-halflings.png +0 -0
  59. data/vendor/assets/javascripts/twitter/bootstrap/typeahead.js +0 -335
  60. data/vendor/assets/stylesheets/twitter/bootstrap-responsive.css.less +0 -1
  61. data/vendor/assets/stylesheets/twitter/bootstrap.css.less +0 -1
  62. data/vendor/frameworks/twitter/bootstrap.less +0 -1
  63. data/vendor/frameworks/twitter/bootstrap/hero-unit.less +0 -25
  64. data/vendor/frameworks/twitter/bootstrap/labels-badges.less +0 -84
  65. data/vendor/frameworks/twitter/bootstrap/layouts.less +0 -16
  66. data/vendor/frameworks/twitter/bootstrap/reset.less +0 -216
  67. data/vendor/frameworks/twitter/bootstrap/responsive-1200px-min.less +0 -28
  68. data/vendor/frameworks/twitter/bootstrap/responsive-767px-max.less +0 -193
  69. data/vendor/frameworks/twitter/bootstrap/responsive-768px-979px.less +0 -19
  70. data/vendor/frameworks/twitter/bootstrap/responsive-navbar.less +0 -189
  71. data/vendor/frameworks/twitter/bootstrap/responsive.less +0 -48
  72. data/vendor/frameworks/twitter/bootstrap/sprites.less +0 -197
@@ -8,9 +8,9 @@
8
8
  min-height: 20px;
9
9
  padding: 19px;
10
10
  margin-bottom: 20px;
11
- background-color: @wellBackground;
12
- border: 1px solid darken(@wellBackground, 7%);
13
- .border-radius(@baseBorderRadius);
11
+ background-color: @well-bg;
12
+ border: 1px solid darken(@well-bg, 7%);
13
+ border-radius: @border-radius-base;
14
14
  .box-shadow(inset 0 1px 1px rgba(0,0,0,.05));
15
15
  blockquote {
16
16
  border-color: #ddd;
@@ -21,9 +21,9 @@
21
21
  // Sizes
22
22
  .well-large {
23
23
  padding: 24px;
24
- .border-radius(@borderRadiusLarge);
24
+ border-radius: @border-radius-large;
25
25
  }
26
26
  .well-small {
27
27
  padding: 9px;
28
- .border-radius(@borderRadiusSmall);
28
+ border-radius: @border-radius-small;
29
29
  }
metadata CHANGED
@@ -1,80 +1,80 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: less-rails-bootstrap
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.3.3
5
- prerelease:
4
+ prerelease: 6
5
+ version: 3.0.0.rc1
6
6
  platform: ruby
7
7
  authors:
8
8
  - Ken Collins
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2013-06-06 00:00:00.000000000 Z
12
+ date: 2013-08-03 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: less-rails
16
+ type: :runtime
16
17
  requirement: !ruby/object:Gem::Requirement
17
- none: false
18
18
  requirements:
19
19
  - - ~>
20
20
  - !ruby/object:Gem::Version
21
21
  version: 2.3.1
22
- type: :runtime
23
- prerelease: false
24
- version_requirements: !ruby/object:Gem::Requirement
25
22
  none: false
23
+ version_requirements: !ruby/object:Gem::Requirement
26
24
  requirements:
27
25
  - - ~>
28
26
  - !ruby/object:Gem::Version
29
27
  version: 2.3.1
28
+ none: false
29
+ prerelease: false
30
30
  - !ruby/object:Gem::Dependency
31
31
  name: minitest
32
+ type: :development
32
33
  requirement: !ruby/object:Gem::Requirement
33
- none: false
34
34
  requirements:
35
35
  - - ! '>='
36
36
  - !ruby/object:Gem::Version
37
37
  version: '0'
38
- type: :development
39
- prerelease: false
40
- version_requirements: !ruby/object:Gem::Requirement
41
38
  none: false
39
+ version_requirements: !ruby/object:Gem::Requirement
42
40
  requirements:
43
41
  - - ! '>='
44
42
  - !ruby/object:Gem::Version
45
43
  version: '0'
44
+ none: false
45
+ prerelease: false
46
46
  - !ruby/object:Gem::Dependency
47
47
  name: guard-minitest
48
+ type: :development
48
49
  requirement: !ruby/object:Gem::Requirement
49
- none: false
50
50
  requirements:
51
51
  - - ! '>='
52
52
  - !ruby/object:Gem::Version
53
53
  version: '0'
54
- type: :development
55
- prerelease: false
56
- version_requirements: !ruby/object:Gem::Requirement
57
54
  none: false
55
+ version_requirements: !ruby/object:Gem::Requirement
58
56
  requirements:
59
57
  - - ! '>='
60
58
  - !ruby/object:Gem::Version
61
59
  version: '0'
60
+ none: false
61
+ prerelease: false
62
62
  - !ruby/object:Gem::Dependency
63
63
  name: rails
64
+ type: :development
64
65
  requirement: !ruby/object:Gem::Requirement
65
- none: false
66
66
  requirements:
67
67
  - - ~>
68
68
  - !ruby/object:Gem::Version
69
69
  version: '3.1'
70
- type: :development
71
- prerelease: false
72
- version_requirements: !ruby/object:Gem::Requirement
73
70
  none: false
71
+ version_requirements: !ruby/object:Gem::Requirement
74
72
  requirements:
75
73
  - - ~>
76
74
  - !ruby/object:Gem::Version
77
75
  version: '3.1'
76
+ none: false
77
+ prerelease: false
78
78
  description: CSS toolkit from Twitter For Rails 3.1 Asset Pipeline. Best one of all!
79
79
  email:
80
80
  - ken@metaskills.net
@@ -101,12 +101,16 @@ files:
101
101
  - test/dummy_app/app/assets/javascripts/application.js
102
102
  - test/dummy_app/app/assets/javascripts/individual.js
103
103
  - test/dummy_app/app/assets/stylesheets/application.css
104
+ - test/dummy_app/app/assets/stylesheets/fonts.css.less
104
105
  - test/dummy_app/app/assets/stylesheets/framework.css.less
105
106
  - test/dummy_app/app/assets/stylesheets/individual.css.less
106
107
  - test/dummy_app/init.rb
107
108
  - test/spec_helper.rb
108
- - vendor/assets/images/twitter/bootstrap/glyphicons-halflings-white.png
109
- - vendor/assets/images/twitter/bootstrap/glyphicons-halflings.png
109
+ - vendor/assets/fonts/twitter/bootstrap/glyphiconshalflings-regular.eot
110
+ - vendor/assets/fonts/twitter/bootstrap/glyphiconshalflings-regular.otf
111
+ - vendor/assets/fonts/twitter/bootstrap/glyphiconshalflings-regular.svg
112
+ - vendor/assets/fonts/twitter/bootstrap/glyphiconshalflings-regular.ttf
113
+ - vendor/assets/fonts/twitter/bootstrap/glyphiconshalflings-regular.woff
110
114
  - vendor/assets/javascripts/twitter/bootstrap.js
111
115
  - vendor/assets/javascripts/twitter/bootstrap/affix.js
112
116
  - vendor/assets/javascripts/twitter/bootstrap/alert.js
@@ -120,12 +124,10 @@ files:
120
124
  - vendor/assets/javascripts/twitter/bootstrap/tab.js
121
125
  - vendor/assets/javascripts/twitter/bootstrap/tooltip.js
122
126
  - vendor/assets/javascripts/twitter/bootstrap/transition.js
123
- - vendor/assets/javascripts/twitter/bootstrap/typeahead.js
124
- - vendor/assets/stylesheets/twitter/bootstrap-responsive.css.less
125
- - vendor/assets/stylesheets/twitter/bootstrap.css.less
126
- - vendor/frameworks/twitter/bootstrap.less
127
+ - vendor/assets/stylesheets/twitter/bootstrap.less
127
128
  - vendor/frameworks/twitter/bootstrap/accordion.less
128
129
  - vendor/frameworks/twitter/bootstrap/alerts.less
130
+ - vendor/frameworks/twitter/bootstrap/badges.less
129
131
  - vendor/frameworks/twitter/bootstrap/bootstrap.less
130
132
  - vendor/frameworks/twitter/bootstrap/breadcrumbs.less
131
133
  - vendor/frameworks/twitter/bootstrap/button-groups.less
@@ -136,28 +138,25 @@ files:
136
138
  - vendor/frameworks/twitter/bootstrap/component-animations.less
137
139
  - vendor/frameworks/twitter/bootstrap/dropdowns.less
138
140
  - vendor/frameworks/twitter/bootstrap/forms.less
141
+ - vendor/frameworks/twitter/bootstrap/glyphicons.less
139
142
  - vendor/frameworks/twitter/bootstrap/grid.less
140
- - vendor/frameworks/twitter/bootstrap/hero-unit.less
141
- - vendor/frameworks/twitter/bootstrap/labels-badges.less
142
- - vendor/frameworks/twitter/bootstrap/layouts.less
143
+ - vendor/frameworks/twitter/bootstrap/jumbotron.less
144
+ - vendor/frameworks/twitter/bootstrap/labels.less
145
+ - vendor/frameworks/twitter/bootstrap/list-group.less
143
146
  - vendor/frameworks/twitter/bootstrap/media.less
144
147
  - vendor/frameworks/twitter/bootstrap/mixins.less
145
148
  - vendor/frameworks/twitter/bootstrap/modals.less
146
149
  - vendor/frameworks/twitter/bootstrap/navbar.less
147
150
  - vendor/frameworks/twitter/bootstrap/navs.less
151
+ - vendor/frameworks/twitter/bootstrap/normalize.less
148
152
  - vendor/frameworks/twitter/bootstrap/pager.less
149
153
  - vendor/frameworks/twitter/bootstrap/pagination.less
154
+ - vendor/frameworks/twitter/bootstrap/panels.less
150
155
  - vendor/frameworks/twitter/bootstrap/popovers.less
156
+ - vendor/frameworks/twitter/bootstrap/print.less
151
157
  - vendor/frameworks/twitter/bootstrap/progress-bars.less
152
- - vendor/frameworks/twitter/bootstrap/reset.less
153
- - vendor/frameworks/twitter/bootstrap/responsive-1200px-min.less
154
- - vendor/frameworks/twitter/bootstrap/responsive-767px-max.less
155
- - vendor/frameworks/twitter/bootstrap/responsive-768px-979px.less
156
- - vendor/frameworks/twitter/bootstrap/responsive-navbar.less
157
158
  - vendor/frameworks/twitter/bootstrap/responsive-utilities.less
158
- - vendor/frameworks/twitter/bootstrap/responsive.less
159
159
  - vendor/frameworks/twitter/bootstrap/scaffolding.less
160
- - vendor/frameworks/twitter/bootstrap/sprites.less
161
160
  - vendor/frameworks/twitter/bootstrap/tables.less
162
161
  - vendor/frameworks/twitter/bootstrap/thumbnails.less
163
162
  - vendor/frameworks/twitter/bootstrap/tooltip.less
@@ -172,23 +171,20 @@ rdoc_options: []
172
171
  require_paths:
173
172
  - lib
174
173
  required_ruby_version: !ruby/object:Gem::Requirement
175
- none: false
176
174
  requirements:
177
175
  - - ! '>='
178
176
  - !ruby/object:Gem::Version
179
- version: '0'
180
177
  segments:
181
178
  - 0
182
- hash: -785556492811934017
183
- required_rubygems_version: !ruby/object:Gem::Requirement
179
+ hash: 2182416616650389701
180
+ version: '0'
184
181
  none: false
182
+ required_rubygems_version: !ruby/object:Gem::Requirement
185
183
  requirements:
186
- - - ! '>='
184
+ - - ! '>'
187
185
  - !ruby/object:Gem::Version
188
- version: '0'
189
- segments:
190
- - 0
191
- hash: -785556492811934017
186
+ version: 1.3.1
187
+ none: false
192
188
  requirements: []
193
189
  rubyforge_project:
194
190
  rubygems_version: 1.8.25
@@ -202,6 +198,7 @@ test_files:
202
198
  - test/dummy_app/app/assets/javascripts/application.js
203
199
  - test/dummy_app/app/assets/javascripts/individual.js
204
200
  - test/dummy_app/app/assets/stylesheets/application.css
201
+ - test/dummy_app/app/assets/stylesheets/fonts.css.less
205
202
  - test/dummy_app/app/assets/stylesheets/framework.css.less
206
203
  - test/dummy_app/app/assets/stylesheets/individual.css.less
207
204
  - test/dummy_app/init.rb
@@ -1,335 +0,0 @@
1
- /* =============================================================
2
- * bootstrap-typeahead.js v2.3.2
3
- * http://twitter.github.com/bootstrap/javascript.html#typeahead
4
- * =============================================================
5
- * Copyright 2012 Twitter, Inc.
6
- *
7
- * Licensed under the Apache License, Version 2.0 (the "License");
8
- * you may not use this file except in compliance with the License.
9
- * You may obtain a copy of the License at
10
- *
11
- * http://www.apache.org/licenses/LICENSE-2.0
12
- *
13
- * Unless required by applicable law or agreed to in writing, software
14
- * distributed under the License is distributed on an "AS IS" BASIS,
15
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
16
- * See the License for the specific language governing permissions and
17
- * limitations under the License.
18
- * ============================================================ */
19
-
20
-
21
- !function($){
22
-
23
- "use strict"; // jshint ;_;
24
-
25
-
26
- /* TYPEAHEAD PUBLIC CLASS DEFINITION
27
- * ================================= */
28
-
29
- var Typeahead = function (element, options) {
30
- this.$element = $(element)
31
- this.options = $.extend({}, $.fn.typeahead.defaults, options)
32
- this.matcher = this.options.matcher || this.matcher
33
- this.sorter = this.options.sorter || this.sorter
34
- this.highlighter = this.options.highlighter || this.highlighter
35
- this.updater = this.options.updater || this.updater
36
- this.source = this.options.source
37
- this.$menu = $(this.options.menu)
38
- this.shown = false
39
- this.listen()
40
- }
41
-
42
- Typeahead.prototype = {
43
-
44
- constructor: Typeahead
45
-
46
- , select: function () {
47
- var val = this.$menu.find('.active').attr('data-value')
48
- this.$element
49
- .val(this.updater(val))
50
- .change()
51
- return this.hide()
52
- }
53
-
54
- , updater: function (item) {
55
- return item
56
- }
57
-
58
- , show: function () {
59
- var pos = $.extend({}, this.$element.position(), {
60
- height: this.$element[0].offsetHeight
61
- })
62
-
63
- this.$menu
64
- .insertAfter(this.$element)
65
- .css({
66
- top: pos.top + pos.height
67
- , left: pos.left
68
- })
69
- .show()
70
-
71
- this.shown = true
72
- return this
73
- }
74
-
75
- , hide: function () {
76
- this.$menu.hide()
77
- this.shown = false
78
- return this
79
- }
80
-
81
- , lookup: function (event) {
82
- var items
83
-
84
- this.query = this.$element.val()
85
-
86
- if (!this.query || this.query.length < this.options.minLength) {
87
- return this.shown ? this.hide() : this
88
- }
89
-
90
- items = $.isFunction(this.source) ? this.source(this.query, $.proxy(this.process, this)) : this.source
91
-
92
- return items ? this.process(items) : this
93
- }
94
-
95
- , process: function (items) {
96
- var that = this
97
-
98
- items = $.grep(items, function (item) {
99
- return that.matcher(item)
100
- })
101
-
102
- items = this.sorter(items)
103
-
104
- if (!items.length) {
105
- return this.shown ? this.hide() : this
106
- }
107
-
108
- return this.render(items.slice(0, this.options.items)).show()
109
- }
110
-
111
- , matcher: function (item) {
112
- return ~item.toLowerCase().indexOf(this.query.toLowerCase())
113
- }
114
-
115
- , sorter: function (items) {
116
- var beginswith = []
117
- , caseSensitive = []
118
- , caseInsensitive = []
119
- , item
120
-
121
- while (item = items.shift()) {
122
- if (!item.toLowerCase().indexOf(this.query.toLowerCase())) beginswith.push(item)
123
- else if (~item.indexOf(this.query)) caseSensitive.push(item)
124
- else caseInsensitive.push(item)
125
- }
126
-
127
- return beginswith.concat(caseSensitive, caseInsensitive)
128
- }
129
-
130
- , highlighter: function (item) {
131
- var query = this.query.replace(/[\-\[\]{}()*+?.,\\\^$|#\s]/g, '\\$&')
132
- return item.replace(new RegExp('(' + query + ')', 'ig'), function ($1, match) {
133
- return '<strong>' + match + '</strong>'
134
- })
135
- }
136
-
137
- , render: function (items) {
138
- var that = this
139
-
140
- items = $(items).map(function (i, item) {
141
- i = $(that.options.item).attr('data-value', item)
142
- i.find('a').html(that.highlighter(item))
143
- return i[0]
144
- })
145
-
146
- items.first().addClass('active')
147
- this.$menu.html(items)
148
- return this
149
- }
150
-
151
- , next: function (event) {
152
- var active = this.$menu.find('.active').removeClass('active')
153
- , next = active.next()
154
-
155
- if (!next.length) {
156
- next = $(this.$menu.find('li')[0])
157
- }
158
-
159
- next.addClass('active')
160
- }
161
-
162
- , prev: function (event) {
163
- var active = this.$menu.find('.active').removeClass('active')
164
- , prev = active.prev()
165
-
166
- if (!prev.length) {
167
- prev = this.$menu.find('li').last()
168
- }
169
-
170
- prev.addClass('active')
171
- }
172
-
173
- , listen: function () {
174
- this.$element
175
- .on('focus', $.proxy(this.focus, this))
176
- .on('blur', $.proxy(this.blur, this))
177
- .on('keypress', $.proxy(this.keypress, this))
178
- .on('keyup', $.proxy(this.keyup, this))
179
-
180
- if (this.eventSupported('keydown')) {
181
- this.$element.on('keydown', $.proxy(this.keydown, this))
182
- }
183
-
184
- this.$menu
185
- .on('click', $.proxy(this.click, this))
186
- .on('mouseenter', 'li', $.proxy(this.mouseenter, this))
187
- .on('mouseleave', 'li', $.proxy(this.mouseleave, this))
188
- }
189
-
190
- , eventSupported: function(eventName) {
191
- var isSupported = eventName in this.$element
192
- if (!isSupported) {
193
- this.$element.setAttribute(eventName, 'return;')
194
- isSupported = typeof this.$element[eventName] === 'function'
195
- }
196
- return isSupported
197
- }
198
-
199
- , move: function (e) {
200
- if (!this.shown) return
201
-
202
- switch(e.keyCode) {
203
- case 9: // tab
204
- case 13: // enter
205
- case 27: // escape
206
- e.preventDefault()
207
- break
208
-
209
- case 38: // up arrow
210
- e.preventDefault()
211
- this.prev()
212
- break
213
-
214
- case 40: // down arrow
215
- e.preventDefault()
216
- this.next()
217
- break
218
- }
219
-
220
- e.stopPropagation()
221
- }
222
-
223
- , keydown: function (e) {
224
- this.suppressKeyPressRepeat = ~$.inArray(e.keyCode, [40,38,9,13,27])
225
- this.move(e)
226
- }
227
-
228
- , keypress: function (e) {
229
- if (this.suppressKeyPressRepeat) return
230
- this.move(e)
231
- }
232
-
233
- , keyup: function (e) {
234
- switch(e.keyCode) {
235
- case 40: // down arrow
236
- case 38: // up arrow
237
- case 16: // shift
238
- case 17: // ctrl
239
- case 18: // alt
240
- break
241
-
242
- case 9: // tab
243
- case 13: // enter
244
- if (!this.shown) return
245
- this.select()
246
- break
247
-
248
- case 27: // escape
249
- if (!this.shown) return
250
- this.hide()
251
- break
252
-
253
- default:
254
- this.lookup()
255
- }
256
-
257
- e.stopPropagation()
258
- e.preventDefault()
259
- }
260
-
261
- , focus: function (e) {
262
- this.focused = true
263
- }
264
-
265
- , blur: function (e) {
266
- this.focused = false
267
- if (!this.mousedover && this.shown) this.hide()
268
- }
269
-
270
- , click: function (e) {
271
- e.stopPropagation()
272
- e.preventDefault()
273
- this.select()
274
- this.$element.focus()
275
- }
276
-
277
- , mouseenter: function (e) {
278
- this.mousedover = true
279
- this.$menu.find('.active').removeClass('active')
280
- $(e.currentTarget).addClass('active')
281
- }
282
-
283
- , mouseleave: function (e) {
284
- this.mousedover = false
285
- if (!this.focused && this.shown) this.hide()
286
- }
287
-
288
- }
289
-
290
-
291
- /* TYPEAHEAD PLUGIN DEFINITION
292
- * =========================== */
293
-
294
- var old = $.fn.typeahead
295
-
296
- $.fn.typeahead = function (option) {
297
- return this.each(function () {
298
- var $this = $(this)
299
- , data = $this.data('typeahead')
300
- , options = typeof option == 'object' && option
301
- if (!data) $this.data('typeahead', (data = new Typeahead(this, options)))
302
- if (typeof option == 'string') data[option]()
303
- })
304
- }
305
-
306
- $.fn.typeahead.defaults = {
307
- source: []
308
- , items: 8
309
- , menu: '<ul class="typeahead dropdown-menu"></ul>'
310
- , item: '<li><a href="#"></a></li>'
311
- , minLength: 1
312
- }
313
-
314
- $.fn.typeahead.Constructor = Typeahead
315
-
316
-
317
- /* TYPEAHEAD NO CONFLICT
318
- * =================== */
319
-
320
- $.fn.typeahead.noConflict = function () {
321
- $.fn.typeahead = old
322
- return this
323
- }
324
-
325
-
326
- /* TYPEAHEAD DATA-API
327
- * ================== */
328
-
329
- $(document).on('focus.typeahead.data-api', '[data-provide="typeahead"]', function (e) {
330
- var $this = $(this)
331
- if ($this.data('typeahead')) return
332
- $this.typeahead($this.data())
333
- })
334
-
335
- }(window.jQuery);