less-rails-bootstrap 1.4.3 → 2.0.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (59) hide show
  1. data/CHANGELOG.md +5 -0
  2. data/lib/less/rails/bootstrap/version.rb +1 -1
  3. data/test/cases/usage_css_spec.rb +2 -9
  4. data/test/cases/usage_js_spec.rb +5 -7
  5. data/vendor/assets/javascripts/twitter/bootstrap.js +12 -8
  6. data/vendor/assets/javascripts/twitter/bootstrap/alert.js +91 -0
  7. data/vendor/assets/javascripts/twitter/bootstrap/button.js +98 -0
  8. data/vendor/assets/javascripts/twitter/bootstrap/carousel.js +154 -0
  9. data/vendor/assets/javascripts/twitter/bootstrap/collapse.js +136 -0
  10. data/vendor/assets/javascripts/twitter/bootstrap/dropdown.js +58 -21
  11. data/vendor/assets/javascripts/twitter/bootstrap/modal.js +63 -114
  12. data/vendor/assets/javascripts/twitter/bootstrap/popover.js +39 -30
  13. data/vendor/assets/javascripts/twitter/bootstrap/scrollspy.js +62 -44
  14. data/vendor/assets/javascripts/twitter/bootstrap/tab.js +130 -0
  15. data/vendor/assets/javascripts/twitter/bootstrap/tooltip.js +270 -0
  16. data/vendor/assets/javascripts/twitter/bootstrap/transition.js +51 -0
  17. data/vendor/assets/javascripts/twitter/bootstrap/typeahead.js +271 -0
  18. data/vendor/frameworks/twitter/bootstrap/accordion.less +28 -0
  19. data/vendor/frameworks/twitter/bootstrap/alerts.less +70 -0
  20. data/vendor/frameworks/twitter/bootstrap/bootstrap.less +41 -5
  21. data/vendor/frameworks/twitter/bootstrap/breadcrumbs.less +22 -0
  22. data/vendor/frameworks/twitter/bootstrap/button-groups.less +147 -0
  23. data/vendor/frameworks/twitter/bootstrap/buttons.less +165 -0
  24. data/vendor/frameworks/twitter/bootstrap/carousel.less +121 -0
  25. data/vendor/frameworks/twitter/bootstrap/close.less +18 -0
  26. data/vendor/frameworks/twitter/bootstrap/code.less +44 -0
  27. data/vendor/frameworks/twitter/bootstrap/component-animations.less +18 -0
  28. data/vendor/frameworks/twitter/bootstrap/dropdowns.less +131 -0
  29. data/vendor/frameworks/twitter/bootstrap/forms.less +336 -300
  30. data/vendor/frameworks/twitter/bootstrap/grid.less +8 -0
  31. data/vendor/frameworks/twitter/bootstrap/hero-unit.less +20 -0
  32. data/vendor/frameworks/twitter/bootstrap/labels.less +16 -0
  33. data/vendor/frameworks/twitter/bootstrap/layouts.less +17 -0
  34. data/vendor/frameworks/twitter/bootstrap/mixins.less +391 -76
  35. data/vendor/frameworks/twitter/bootstrap/modals.less +72 -0
  36. data/vendor/frameworks/twitter/bootstrap/navbar.less +292 -0
  37. data/vendor/frameworks/twitter/bootstrap/navs.less +343 -0
  38. data/vendor/frameworks/twitter/bootstrap/pager.less +30 -0
  39. data/vendor/frameworks/twitter/bootstrap/pagination.less +55 -0
  40. data/vendor/frameworks/twitter/bootstrap/patterns.less +5 -1052
  41. data/vendor/frameworks/twitter/bootstrap/popovers.less +49 -0
  42. data/vendor/frameworks/twitter/bootstrap/print.less +18 -0
  43. data/vendor/frameworks/twitter/bootstrap/progress-bars.less +95 -0
  44. data/vendor/frameworks/twitter/bootstrap/reset.less +37 -52
  45. data/vendor/frameworks/twitter/bootstrap/responsive.less +323 -0
  46. data/vendor/frameworks/twitter/bootstrap/scaffolding.less +13 -121
  47. data/vendor/frameworks/twitter/bootstrap/sprites.less +156 -0
  48. data/vendor/frameworks/twitter/bootstrap/tables.less +75 -160
  49. data/vendor/frameworks/twitter/bootstrap/thumbnails.less +35 -0
  50. data/vendor/frameworks/twitter/bootstrap/tooltip.less +35 -0
  51. data/vendor/frameworks/twitter/bootstrap/type.less +100 -70
  52. data/vendor/frameworks/twitter/bootstrap/utilities.less +23 -0
  53. data/vendor/frameworks/twitter/bootstrap/variables.less +94 -55
  54. data/vendor/frameworks/twitter/bootstrap/wells.less +17 -0
  55. metadata +44 -11
  56. data/vendor/assets/javascripts/twitter/bootstrap/alerts.js +0 -113
  57. data/vendor/assets/javascripts/twitter/bootstrap/buttons.js +0 -62
  58. data/vendor/assets/javascripts/twitter/bootstrap/tabs.js +0 -80
  59. data/vendor/assets/javascripts/twitter/bootstrap/twipsy.js +0 -310
@@ -0,0 +1,17 @@
1
+ // WELLS
2
+ // -----
3
+
4
+ .well {
5
+ min-height: 20px;
6
+ padding: 19px;
7
+ margin-bottom: 20px;
8
+ background-color: #f5f5f5;
9
+ border: 1px solid #eee;
10
+ border: 1px solid rgba(0,0,0,.05);
11
+ .border-radius(4px);
12
+ .box-shadow(inset 0 1px 1px rgba(0,0,0,.05));
13
+ blockquote {
14
+ border-color: #ddd;
15
+ border-color: rgba(0,0,0,.15);
16
+ }
17
+ }
metadata CHANGED
@@ -1,13 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: less-rails-bootstrap
3
3
  version: !ruby/object:Gem::Version
4
- hash: 1
4
+ hash: 15
5
5
  prerelease:
6
6
  segments:
7
- - 1
8
- - 4
9
- - 3
10
- version: 1.4.3
7
+ - 2
8
+ - 0
9
+ - 0
10
+ version: 2.0.0
11
11
  platform: ruby
12
12
  authors:
13
13
  - Ken Collins
@@ -15,7 +15,7 @@ autorequire:
15
15
  bindir: bin
16
16
  cert_chain: []
17
17
 
18
- date: 2012-01-23 00:00:00 Z
18
+ date: 2012-02-01 00:00:00 Z
19
19
  dependencies:
20
20
  - !ruby/object:Gem::Dependency
21
21
  name: less-rails
@@ -109,25 +109,57 @@ files:
109
109
  - test/dummy_app/init.rb
110
110
  - test/spec_helper.rb
111
111
  - vendor/assets/javascripts/twitter/bootstrap.js
112
- - vendor/assets/javascripts/twitter/bootstrap/alerts.js
113
- - vendor/assets/javascripts/twitter/bootstrap/buttons.js
112
+ - vendor/assets/javascripts/twitter/bootstrap/alert.js
113
+ - vendor/assets/javascripts/twitter/bootstrap/button.js
114
+ - vendor/assets/javascripts/twitter/bootstrap/carousel.js
115
+ - vendor/assets/javascripts/twitter/bootstrap/collapse.js
114
116
  - vendor/assets/javascripts/twitter/bootstrap/dropdown.js
115
117
  - vendor/assets/javascripts/twitter/bootstrap/modal.js
116
118
  - vendor/assets/javascripts/twitter/bootstrap/popover.js
117
119
  - vendor/assets/javascripts/twitter/bootstrap/scrollspy.js
118
- - vendor/assets/javascripts/twitter/bootstrap/tabs.js
119
- - vendor/assets/javascripts/twitter/bootstrap/twipsy.js
120
+ - vendor/assets/javascripts/twitter/bootstrap/tab.js
121
+ - vendor/assets/javascripts/twitter/bootstrap/tooltip.js
122
+ - vendor/assets/javascripts/twitter/bootstrap/transition.js
123
+ - vendor/assets/javascripts/twitter/bootstrap/typeahead.js
120
124
  - vendor/assets/stylesheets/twitter/bootstrap.css.less
121
125
  - vendor/frameworks/twitter/bootstrap.less
126
+ - vendor/frameworks/twitter/bootstrap/accordion.less
127
+ - vendor/frameworks/twitter/bootstrap/alerts.less
122
128
  - vendor/frameworks/twitter/bootstrap/bootstrap.less
129
+ - vendor/frameworks/twitter/bootstrap/breadcrumbs.less
130
+ - vendor/frameworks/twitter/bootstrap/button-groups.less
131
+ - vendor/frameworks/twitter/bootstrap/buttons.less
132
+ - vendor/frameworks/twitter/bootstrap/carousel.less
133
+ - vendor/frameworks/twitter/bootstrap/close.less
134
+ - vendor/frameworks/twitter/bootstrap/code.less
135
+ - vendor/frameworks/twitter/bootstrap/component-animations.less
136
+ - vendor/frameworks/twitter/bootstrap/dropdowns.less
123
137
  - vendor/frameworks/twitter/bootstrap/forms.less
138
+ - vendor/frameworks/twitter/bootstrap/grid.less
139
+ - vendor/frameworks/twitter/bootstrap/hero-unit.less
140
+ - vendor/frameworks/twitter/bootstrap/labels.less
141
+ - vendor/frameworks/twitter/bootstrap/layouts.less
124
142
  - vendor/frameworks/twitter/bootstrap/mixins.less
143
+ - vendor/frameworks/twitter/bootstrap/modals.less
144
+ - vendor/frameworks/twitter/bootstrap/navbar.less
145
+ - vendor/frameworks/twitter/bootstrap/navs.less
146
+ - vendor/frameworks/twitter/bootstrap/pager.less
147
+ - vendor/frameworks/twitter/bootstrap/pagination.less
125
148
  - vendor/frameworks/twitter/bootstrap/patterns.less
149
+ - vendor/frameworks/twitter/bootstrap/popovers.less
150
+ - vendor/frameworks/twitter/bootstrap/print.less
151
+ - vendor/frameworks/twitter/bootstrap/progress-bars.less
126
152
  - vendor/frameworks/twitter/bootstrap/reset.less
153
+ - vendor/frameworks/twitter/bootstrap/responsive.less
127
154
  - vendor/frameworks/twitter/bootstrap/scaffolding.less
155
+ - vendor/frameworks/twitter/bootstrap/sprites.less
128
156
  - vendor/frameworks/twitter/bootstrap/tables.less
157
+ - vendor/frameworks/twitter/bootstrap/thumbnails.less
158
+ - vendor/frameworks/twitter/bootstrap/tooltip.less
129
159
  - vendor/frameworks/twitter/bootstrap/type.less
160
+ - vendor/frameworks/twitter/bootstrap/utilities.less
130
161
  - vendor/frameworks/twitter/bootstrap/variables.less
162
+ - vendor/frameworks/twitter/bootstrap/wells.less
131
163
  homepage: http://github.com/metaskills/less-rails-bootstrap
132
164
  licenses: []
133
165
 
@@ -157,7 +189,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
157
189
  requirements: []
158
190
 
159
191
  rubyforge_project:
160
- rubygems_version: 1.8.15
192
+ rubygems_version: 1.8.12
161
193
  signing_key:
162
194
  specification_version: 3
163
195
  summary: CSS toolkit from Twitter For Rails 3.1 Asset Pipeline
@@ -172,3 +204,4 @@ test_files:
172
204
  - test/dummy_app/app/assets/stylesheets/individual.css.less
173
205
  - test/dummy_app/init.rb
174
206
  - test/spec_helper.rb
207
+ has_rdoc:
@@ -1,113 +0,0 @@
1
- /* ==========================================================
2
- * bootstrap-alerts.js v1.4.0
3
- * http://twitter.github.com/bootstrap/javascript.html#alerts
4
- * ==========================================================
5
- * Copyright 2011 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"
24
-
25
- /* CSS TRANSITION SUPPORT (https://gist.github.com/373874)
26
- * ======================================================= */
27
-
28
- var transitionEnd
29
-
30
- $(document).ready(function () {
31
-
32
- $.support.transition = (function () {
33
- var thisBody = document.body || document.documentElement
34
- , thisStyle = thisBody.style
35
- , support = thisStyle.transition !== undefined || thisStyle.WebkitTransition !== undefined || thisStyle.MozTransition !== undefined || thisStyle.MsTransition !== undefined || thisStyle.OTransition !== undefined
36
- return support
37
- })()
38
-
39
- // set CSS transition event type
40
- if ( $.support.transition ) {
41
- transitionEnd = "TransitionEnd"
42
- if ( $.browser.webkit ) {
43
- transitionEnd = "webkitTransitionEnd"
44
- } else if ( $.browser.mozilla ) {
45
- transitionEnd = "transitionend"
46
- } else if ( $.browser.opera ) {
47
- transitionEnd = "oTransitionEnd"
48
- }
49
- }
50
-
51
- })
52
-
53
- /* ALERT CLASS DEFINITION
54
- * ====================== */
55
-
56
- var Alert = function ( content, options ) {
57
- this.settings = $.extend({}, $.fn.alert.defaults, options)
58
- this.$element = $(content)
59
- .delegate(this.settings.selector, 'click', this.close)
60
- }
61
-
62
- Alert.prototype = {
63
-
64
- close: function (e) {
65
- var $element = $(this).parent('.alert-message')
66
-
67
- e && e.preventDefault()
68
- $element.removeClass('in')
69
-
70
- function removeElement () {
71
- $element.remove()
72
- }
73
-
74
- $.support.transition && $element.hasClass('fade') ?
75
- $element.bind(transitionEnd, removeElement) :
76
- removeElement()
77
- }
78
-
79
- }
80
-
81
-
82
- /* ALERT PLUGIN DEFINITION
83
- * ======================= */
84
-
85
- $.fn.alert = function ( options ) {
86
-
87
- if ( options === true ) {
88
- return this.data('alert')
89
- }
90
-
91
- return this.each(function () {
92
- var $this = $(this)
93
-
94
- if ( typeof options == 'string' ) {
95
- return $this.data('alert')[options]()
96
- }
97
-
98
- $(this).data('alert', new Alert( this, options ))
99
-
100
- })
101
- }
102
-
103
- $.fn.alert.defaults = {
104
- selector: '.close'
105
- }
106
-
107
- $(document).ready(function () {
108
- new Alert($('body'), {
109
- selector: '.alert-message[data-alert] .close'
110
- })
111
- })
112
-
113
- }( window.jQuery || window.ender );
@@ -1,62 +0,0 @@
1
- /* ============================================================
2
- * bootstrap-buttons.js v1.4.0
3
- * http://twitter.github.com/bootstrap/javascript.html#buttons
4
- * ============================================================
5
- * Copyright 2011 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
- !function( $ ){
21
-
22
- "use strict"
23
-
24
- function setState(el, state) {
25
- var d = 'disabled'
26
- , $el = $(el)
27
- , data = $el.data()
28
-
29
- state = state + 'Text'
30
- data.resetText || $el.data('resetText', $el.html())
31
-
32
- $el.html( data[state] || $.fn.button.defaults[state] )
33
-
34
- state == 'loadingText' ?
35
- $el.addClass(d).attr(d, d) :
36
- $el.removeClass(d).removeAttr(d)
37
- }
38
-
39
- function toggle(el) {
40
- $(el).toggleClass('active')
41
- }
42
-
43
- $.fn.button = function(options) {
44
- return this.each(function () {
45
- if (options == 'toggle') {
46
- return toggle(this)
47
- }
48
- options && setState(this, options)
49
- })
50
- }
51
-
52
- $.fn.button.defaults = {
53
- loadingText: 'loading...'
54
- }
55
-
56
- $(function () {
57
- $('body').delegate('.btn[data-toggle]', 'click', function () {
58
- $(this).button('toggle')
59
- })
60
- })
61
-
62
- }( window.jQuery || window.ender );
@@ -1,80 +0,0 @@
1
- /* ========================================================
2
- * bootstrap-tabs.js v1.4.0
3
- * http://twitter.github.com/bootstrap/javascript.html#tabs
4
- * ========================================================
5
- * Copyright 2011 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"
24
-
25
- function activate ( element, container ) {
26
- container
27
- .find('> .active')
28
- .removeClass('active')
29
- .find('> .dropdown-menu > .active')
30
- .removeClass('active')
31
-
32
- element.addClass('active')
33
-
34
- if ( element.parent('.dropdown-menu') ) {
35
- element.closest('li.dropdown').addClass('active')
36
- }
37
- }
38
-
39
- function tab( e ) {
40
- var $this = $(this)
41
- , $ul = $this.closest('ul:not(.dropdown-menu)')
42
- , href = $this.attr('href')
43
- , previous
44
- , $href
45
-
46
- if ( /^#\w+/.test(href) ) {
47
- e.preventDefault()
48
-
49
- if ( $this.parent('li').hasClass('active') ) {
50
- return
51
- }
52
-
53
- previous = $ul.find('.active a').last()[0]
54
- $href = $(href)
55
-
56
- activate($this.parent('li'), $ul)
57
- activate($href, $href.parent())
58
-
59
- $this.trigger({
60
- type: 'change'
61
- , relatedTarget: previous
62
- })
63
- }
64
- }
65
-
66
-
67
- /* TABS/PILLS PLUGIN DEFINITION
68
- * ============================ */
69
-
70
- $.fn.tabs = $.fn.pills = function ( selector ) {
71
- return this.each(function () {
72
- $(this).delegate(selector || '.tabs li > a, .pills > li > a', 'click', tab)
73
- })
74
- }
75
-
76
- $(document).ready(function () {
77
- $('body').tabs('ul[data-tabs] li > a, ul[data-pills] > li > a')
78
- })
79
-
80
- }( window.jQuery || window.ender );
@@ -1,310 +0,0 @@
1
- /* ==========================================================
2
- * bootstrap-twipsy.js v1.4.0
3
- * http://twitter.github.com/bootstrap/javascript.html#twipsy
4
- * Adapted from the original jQuery.tipsy by Jason Frame
5
- * ==========================================================
6
- * Copyright 2011 Twitter, Inc.
7
- *
8
- * Licensed under the Apache License, Version 2.0 (the "License");
9
- * you may not use this file except in compliance with the License.
10
- * You may obtain a copy of the License at
11
- *
12
- * http://www.apache.org/licenses/LICENSE-2.0
13
- *
14
- * Unless required by applicable law or agreed to in writing, software
15
- * distributed under the License is distributed on an "AS IS" BASIS,
16
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
17
- * See the License for the specific language governing permissions and
18
- * limitations under the License.
19
- * ========================================================== */
20
-
21
-
22
- !function( $ ) {
23
-
24
- "use strict"
25
-
26
- /* CSS TRANSITION SUPPORT (https://gist.github.com/373874)
27
- * ======================================================= */
28
-
29
- var transitionEnd
30
-
31
- $(document).ready(function () {
32
-
33
- $.support.transition = (function () {
34
- var thisBody = document.body || document.documentElement
35
- , thisStyle = thisBody.style
36
- , support = thisStyle.transition !== undefined || thisStyle.WebkitTransition !== undefined || thisStyle.MozTransition !== undefined || thisStyle.MsTransition !== undefined || thisStyle.OTransition !== undefined
37
- return support
38
- })()
39
-
40
- // set CSS transition event type
41
- if ( $.support.transition ) {
42
- transitionEnd = "TransitionEnd"
43
- if ( $.browser.webkit ) {
44
- transitionEnd = "webkitTransitionEnd"
45
- } else if ( $.browser.mozilla ) {
46
- transitionEnd = "transitionend"
47
- } else if ( $.browser.opera ) {
48
- transitionEnd = "oTransitionEnd"
49
- }
50
- }
51
-
52
- })
53
-
54
-
55
- /* TWIPSY PUBLIC CLASS DEFINITION
56
- * ============================== */
57
-
58
- var Twipsy = function ( element, options ) {
59
- this.$element = $(element)
60
- this.options = options
61
- this.enabled = true
62
- this.fixTitle()
63
- }
64
-
65
- Twipsy.prototype = {
66
-
67
- show: function() {
68
- var pos
69
- , actualWidth
70
- , actualHeight
71
- , placement
72
- , $tip
73
- , tp
74
-
75
- if (this.hasContent() && this.enabled) {
76
- $tip = this.tip()
77
- this.setContent()
78
-
79
- if (this.options.animate) {
80
- $tip.addClass('fade')
81
- }
82
-
83
- $tip
84
- .remove()
85
- .css({ top: 0, left: 0, display: 'block' })
86
- .prependTo(document.body)
87
-
88
- pos = $.extend({}, this.$element.offset(), {
89
- width: this.$element[0].offsetWidth
90
- , height: this.$element[0].offsetHeight
91
- })
92
-
93
- actualWidth = $tip[0].offsetWidth
94
- actualHeight = $tip[0].offsetHeight
95
-
96
- placement = maybeCall(this.options.placement, this, [ $tip[0], this.$element[0] ])
97
-
98
- switch (placement) {
99
- case 'below':
100
- tp = {top: pos.top + pos.height + this.options.offset, left: pos.left + pos.width / 2 - actualWidth / 2}
101
- break
102
- case 'above':
103
- tp = {top: pos.top - actualHeight - this.options.offset, left: pos.left + pos.width / 2 - actualWidth / 2}
104
- break
105
- case 'left':
106
- tp = {top: pos.top + pos.height / 2 - actualHeight / 2, left: pos.left - actualWidth - this.options.offset}
107
- break
108
- case 'right':
109
- tp = {top: pos.top + pos.height / 2 - actualHeight / 2, left: pos.left + pos.width + this.options.offset}
110
- break
111
- }
112
-
113
- $tip
114
- .css(tp)
115
- .addClass(placement)
116
- .addClass('in')
117
- }
118
- }
119
-
120
- , setContent: function () {
121
- var $tip = this.tip()
122
- $tip.find('.twipsy-inner')[this.options.html ? 'html' : 'text'](this.getTitle())
123
- $tip[0].className = 'twipsy'
124
- }
125
-
126
- , hide: function() {
127
- var that = this
128
- , $tip = this.tip()
129
-
130
- $tip.removeClass('in')
131
-
132
- function removeElement () {
133
- $tip.remove()
134
- }
135
-
136
- $.support.transition && this.$tip.hasClass('fade') ?
137
- $tip.bind(transitionEnd, removeElement) :
138
- removeElement()
139
- }
140
-
141
- , fixTitle: function() {
142
- var $e = this.$element
143
- if ($e.attr('title') || typeof($e.attr('data-original-title')) != 'string') {
144
- $e.attr('data-original-title', $e.attr('title') || '').removeAttr('title')
145
- }
146
- }
147
-
148
- , hasContent: function () {
149
- return this.getTitle()
150
- }
151
-
152
- , getTitle: function() {
153
- var title
154
- , $e = this.$element
155
- , o = this.options
156
-
157
- this.fixTitle()
158
-
159
- if (typeof o.title == 'string') {
160
- title = $e.attr(o.title == 'title' ? 'data-original-title' : o.title)
161
- } else if (typeof o.title == 'function') {
162
- title = o.title.call($e[0])
163
- }
164
-
165
- title = ('' + title).replace(/(^\s*|\s*$)/, "")
166
-
167
- return title || o.fallback
168
- }
169
-
170
- , tip: function() {
171
- if (!this.$tip) {
172
- this.$tip = $('<div class="twipsy" />').html(this.options.template)
173
- }
174
- return this.$tip
175
- }
176
-
177
- , validate: function() {
178
- if (!this.$element[0].parentNode) {
179
- this.hide()
180
- this.$element = null
181
- this.options = null
182
- }
183
- }
184
-
185
- , enable: function() {
186
- this.enabled = true
187
- }
188
-
189
- , disable: function() {
190
- this.enabled = false
191
- }
192
-
193
- , toggleEnabled: function() {
194
- this.enabled = !this.enabled
195
- }
196
-
197
- }
198
-
199
-
200
- /* TWIPSY PRIVATE METHODS
201
- * ====================== */
202
-
203
- function maybeCall ( thing, ctx, args ) {
204
- return typeof thing == 'function' ? thing.apply(ctx, args) : thing
205
- }
206
-
207
- /* TWIPSY PLUGIN DEFINITION
208
- * ======================== */
209
-
210
- $.fn.twipsy = function (options) {
211
- $.fn.twipsy.initWith.call(this, options, Twipsy, 'twipsy')
212
- return this
213
- }
214
-
215
- $.fn.twipsy.initWith = function (options, Constructor, name) {
216
- var twipsy
217
- , binder
218
- , eventIn
219
- , eventOut
220
-
221
- if (options === true) {
222
- return this.data(name)
223
- } else if (typeof options == 'string') {
224
- twipsy = this.data(name)
225
- if (twipsy) {
226
- twipsy[options]()
227
- }
228
- return this
229
- }
230
-
231
- options = $.extend({}, $.fn[name].defaults, options)
232
-
233
- function get(ele) {
234
- var twipsy = $.data(ele, name)
235
-
236
- if (!twipsy) {
237
- twipsy = new Constructor(ele, $.fn.twipsy.elementOptions(ele, options))
238
- $.data(ele, name, twipsy)
239
- }
240
-
241
- return twipsy
242
- }
243
-
244
- function enter() {
245
- var twipsy = get(this)
246
- twipsy.hoverState = 'in'
247
-
248
- if (options.delayIn == 0) {
249
- twipsy.show()
250
- } else {
251
- twipsy.fixTitle()
252
- setTimeout(function() {
253
- if (twipsy.hoverState == 'in') {
254
- twipsy.show()
255
- }
256
- }, options.delayIn)
257
- }
258
- }
259
-
260
- function leave() {
261
- var twipsy = get(this)
262
- twipsy.hoverState = 'out'
263
- if (options.delayOut == 0) {
264
- twipsy.hide()
265
- } else {
266
- setTimeout(function() {
267
- if (twipsy.hoverState == 'out') {
268
- twipsy.hide()
269
- }
270
- }, options.delayOut)
271
- }
272
- }
273
-
274
- if (!options.live) {
275
- this.each(function() {
276
- get(this)
277
- })
278
- }
279
-
280
- if (options.trigger != 'manual') {
281
- binder = options.live ? 'live' : 'bind'
282
- eventIn = options.trigger == 'hover' ? 'mouseenter' : 'focus'
283
- eventOut = options.trigger == 'hover' ? 'mouseleave' : 'blur'
284
- this[binder](eventIn, enter)[binder](eventOut, leave)
285
- }
286
-
287
- return this
288
- }
289
-
290
- $.fn.twipsy.Twipsy = Twipsy
291
-
292
- $.fn.twipsy.defaults = {
293
- animate: true
294
- , delayIn: 0
295
- , delayOut: 0
296
- , fallback: ''
297
- , placement: 'above'
298
- , html: false
299
- , live: false
300
- , offset: 0
301
- , title: 'title'
302
- , trigger: 'hover'
303
- , template: '<div class="twipsy-arrow"></div><div class="twipsy-inner"></div>'
304
- }
305
-
306
- $.fn.twipsy.elementOptions = function(ele, options) {
307
- return $.extend({}, options, $(ele).data())
308
- }
309
-
310
- }( window.jQuery || window.ender );