bootstrap-sass 1.4.4 → 2.0.0

Sign up to get free protection for your applications and to get access to all the features.

Potentially problematic release.


This version of bootstrap-sass might be problematic. Click here for more details.

Files changed (71) hide show
  1. data/README.md +52 -19
  2. data/lib/bootstrap-sass.rb +24 -6
  3. data/lib/bootstrap-sass/compass_extensions.rb +10 -0
  4. data/lib/bootstrap-sass/config/sass_extentions.rb +14 -0
  5. data/lib/bootstrap-sass/engine.rb +9 -0
  6. data/templates/project/manifest.rb +18 -0
  7. data/templates/project/styles.scss +5 -0
  8. data/vendor/assets/images/glyphicons-halflings-white.png +0 -0
  9. data/vendor/assets/images/glyphicons-halflings.png +0 -0
  10. data/vendor/assets/javascripts/bootstrap-alert.js +91 -0
  11. data/vendor/assets/javascripts/bootstrap-button.js +98 -0
  12. data/vendor/assets/javascripts/bootstrap-carousel.js +154 -0
  13. data/vendor/assets/javascripts/bootstrap-collapse.js +136 -0
  14. data/vendor/assets/javascripts/bootstrap-dropdown.js +58 -21
  15. data/vendor/assets/javascripts/bootstrap-modal.js +63 -114
  16. data/vendor/assets/javascripts/bootstrap-popover.js +38 -33
  17. data/vendor/assets/javascripts/bootstrap-scrollspy.js +62 -44
  18. data/vendor/assets/javascripts/bootstrap-tab.js +130 -0
  19. data/vendor/assets/javascripts/bootstrap-tooltip.js +270 -0
  20. data/vendor/assets/javascripts/bootstrap-transition.js +51 -0
  21. data/vendor/assets/javascripts/bootstrap-typeahead.js +271 -0
  22. data/vendor/assets/javascripts/bootstrap.js +9 -6
  23. data/vendor/assets/stylesheets/_bootstrap-responsive.scss +314 -0
  24. data/vendor/assets/stylesheets/_bootstrap.scss +63 -0
  25. data/vendor/assets/stylesheets/bootstrap/_accordion.scss +28 -0
  26. data/vendor/assets/stylesheets/bootstrap/_alerts.scss +62 -0
  27. data/vendor/assets/stylesheets/bootstrap/_breadcrumbs.scss +22 -0
  28. data/vendor/assets/stylesheets/bootstrap/_button-groups.scss +136 -0
  29. data/vendor/assets/stylesheets/bootstrap/_buttons.scss +149 -0
  30. data/vendor/assets/stylesheets/bootstrap/_carousel.scss +116 -0
  31. data/vendor/assets/stylesheets/bootstrap/_close.scss +18 -0
  32. data/vendor/assets/stylesheets/bootstrap/_code.scss +43 -0
  33. data/vendor/assets/stylesheets/bootstrap/_component-animations.scss +18 -0
  34. data/vendor/assets/stylesheets/bootstrap/_dropdowns.scss +127 -0
  35. data/vendor/assets/stylesheets/bootstrap/_forms.scss +458 -0
  36. data/vendor/assets/stylesheets/bootstrap/_grid.scss +8 -0
  37. data/vendor/assets/stylesheets/bootstrap/_hero-unit.scss +20 -0
  38. data/vendor/assets/stylesheets/bootstrap/_labels.scss +16 -0
  39. data/vendor/assets/stylesheets/bootstrap/_layouts.scss +17 -0
  40. data/vendor/assets/stylesheets/bootstrap/_mixins.scss +479 -0
  41. data/vendor/assets/stylesheets/bootstrap/_modals.scss +72 -0
  42. data/vendor/assets/stylesheets/bootstrap/_navbar.scss +282 -0
  43. data/vendor/assets/stylesheets/bootstrap/_navs.scss +320 -0
  44. data/vendor/assets/stylesheets/bootstrap/_pager.scss +30 -0
  45. data/vendor/assets/stylesheets/bootstrap/_pagination.scss +53 -0
  46. data/vendor/assets/stylesheets/bootstrap/_popovers.scss +49 -0
  47. data/vendor/assets/stylesheets/bootstrap/_progress-bars.scss +95 -0
  48. data/vendor/assets/stylesheets/bootstrap/_reset.scss +105 -0
  49. data/vendor/assets/stylesheets/bootstrap/_scaffolding.scss +29 -0
  50. data/vendor/assets/stylesheets/bootstrap/_sprites.scss +156 -0
  51. data/vendor/assets/stylesheets/bootstrap/_tables.scss +117 -0
  52. data/vendor/assets/stylesheets/bootstrap/_thumbnails.scss +35 -0
  53. data/vendor/assets/stylesheets/bootstrap/_tooltip.scss +35 -0
  54. data/vendor/assets/stylesheets/bootstrap/_type.scss +209 -0
  55. data/vendor/assets/stylesheets/bootstrap/_utilities.scss +23 -0
  56. data/vendor/assets/stylesheets/bootstrap/_variables.scss +99 -0
  57. data/vendor/assets/stylesheets/bootstrap/_wells.scss +17 -0
  58. metadata +68 -20
  59. data/vendor/assets/javascripts/bootstrap-alerts.js +0 -124
  60. data/vendor/assets/javascripts/bootstrap-buttons.js +0 -64
  61. data/vendor/assets/javascripts/bootstrap-tabs.js +0 -80
  62. data/vendor/assets/javascripts/bootstrap-twipsy.js +0 -321
  63. data/vendor/assets/stylesheets/bootstrap.css.scss +0 -25
  64. data/vendor/assets/stylesheets/bootstrap/forms.css.scss +0 -427
  65. data/vendor/assets/stylesheets/bootstrap/mixins.css.scss +0 -216
  66. data/vendor/assets/stylesheets/bootstrap/patterns.css.scss +0 -994
  67. data/vendor/assets/stylesheets/bootstrap/reset.css.scss +0 -142
  68. data/vendor/assets/stylesheets/bootstrap/scaffolding.css.scss +0 -129
  69. data/vendor/assets/stylesheets/bootstrap/tables.css.scss +0 -212
  70. data/vendor/assets/stylesheets/bootstrap/type.css.scss +0 -186
  71. data/vendor/assets/stylesheets/bootstrap/variables.css.scss +0 -51
@@ -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
+ @include border-radius(4px);
12
+ @include 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,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: bootstrap-sass
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.4.4
4
+ version: 2.0.0
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -9,47 +9,95 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2012-01-17 00:00:00.000000000 Z
12
+ date: 2012-02-06 00:00:00.000000000 Z
13
13
  dependencies:
14
+ - !ruby/object:Gem::Dependency
15
+ name: compass
16
+ requirement: &70321730749300 !ruby/object:Gem::Requirement
17
+ none: false
18
+ requirements:
19
+ - - ! '>='
20
+ - !ruby/object:Gem::Version
21
+ version: '0'
22
+ type: :development
23
+ prerelease: false
24
+ version_requirements: *70321730749300
14
25
  - !ruby/object:Gem::Dependency
15
26
  name: sass-rails
16
- requirement: &70140394982440 !ruby/object:Gem::Requirement
27
+ requirement: &70321730748560 !ruby/object:Gem::Requirement
17
28
  none: false
18
29
  requirements:
19
30
  - - ~>
20
31
  - !ruby/object:Gem::Version
21
32
  version: '3.1'
22
- type: :runtime
33
+ type: :development
23
34
  prerelease: false
24
- version_requirements: *70140394982440
35
+ version_requirements: *70321730748560
25
36
  description:
26
37
  email: tom@conceptcoding.co.uk
27
38
  executables: []
28
39
  extensions: []
29
40
  extra_rdoc_files: []
30
41
  files:
31
- - vendor/assets/stylesheets/bootstrap/forms.css.scss
32
- - vendor/assets/stylesheets/bootstrap/mixins.css.scss
33
- - vendor/assets/stylesheets/bootstrap/patterns.css.scss
34
- - vendor/assets/stylesheets/bootstrap/reset.css.scss
35
- - vendor/assets/stylesheets/bootstrap/scaffolding.css.scss
36
- - vendor/assets/stylesheets/bootstrap/tables.css.scss
37
- - vendor/assets/stylesheets/bootstrap/type.css.scss
38
- - vendor/assets/stylesheets/bootstrap/variables.css.scss
39
- - vendor/assets/stylesheets/bootstrap.css.scss
40
- - vendor/assets/javascripts/bootstrap-alerts.js
41
- - vendor/assets/javascripts/bootstrap-buttons.js
42
+ - vendor/assets/stylesheets/_bootstrap-responsive.scss
43
+ - vendor/assets/stylesheets/_bootstrap.scss
44
+ - vendor/assets/stylesheets/bootstrap/_accordion.scss
45
+ - vendor/assets/stylesheets/bootstrap/_alerts.scss
46
+ - vendor/assets/stylesheets/bootstrap/_breadcrumbs.scss
47
+ - vendor/assets/stylesheets/bootstrap/_button-groups.scss
48
+ - vendor/assets/stylesheets/bootstrap/_buttons.scss
49
+ - vendor/assets/stylesheets/bootstrap/_carousel.scss
50
+ - vendor/assets/stylesheets/bootstrap/_close.scss
51
+ - vendor/assets/stylesheets/bootstrap/_code.scss
52
+ - vendor/assets/stylesheets/bootstrap/_component-animations.scss
53
+ - vendor/assets/stylesheets/bootstrap/_dropdowns.scss
54
+ - vendor/assets/stylesheets/bootstrap/_forms.scss
55
+ - vendor/assets/stylesheets/bootstrap/_grid.scss
56
+ - vendor/assets/stylesheets/bootstrap/_hero-unit.scss
57
+ - vendor/assets/stylesheets/bootstrap/_labels.scss
58
+ - vendor/assets/stylesheets/bootstrap/_layouts.scss
59
+ - vendor/assets/stylesheets/bootstrap/_mixins.scss
60
+ - vendor/assets/stylesheets/bootstrap/_modals.scss
61
+ - vendor/assets/stylesheets/bootstrap/_navbar.scss
62
+ - vendor/assets/stylesheets/bootstrap/_navs.scss
63
+ - vendor/assets/stylesheets/bootstrap/_pager.scss
64
+ - vendor/assets/stylesheets/bootstrap/_pagination.scss
65
+ - vendor/assets/stylesheets/bootstrap/_popovers.scss
66
+ - vendor/assets/stylesheets/bootstrap/_progress-bars.scss
67
+ - vendor/assets/stylesheets/bootstrap/_reset.scss
68
+ - vendor/assets/stylesheets/bootstrap/_scaffolding.scss
69
+ - vendor/assets/stylesheets/bootstrap/_sprites.scss
70
+ - vendor/assets/stylesheets/bootstrap/_tables.scss
71
+ - vendor/assets/stylesheets/bootstrap/_thumbnails.scss
72
+ - vendor/assets/stylesheets/bootstrap/_tooltip.scss
73
+ - vendor/assets/stylesheets/bootstrap/_type.scss
74
+ - vendor/assets/stylesheets/bootstrap/_utilities.scss
75
+ - vendor/assets/stylesheets/bootstrap/_variables.scss
76
+ - vendor/assets/stylesheets/bootstrap/_wells.scss
77
+ - vendor/assets/javascripts/bootstrap-alert.js
78
+ - vendor/assets/javascripts/bootstrap-button.js
79
+ - vendor/assets/javascripts/bootstrap-carousel.js
80
+ - vendor/assets/javascripts/bootstrap-collapse.js
42
81
  - vendor/assets/javascripts/bootstrap-dropdown.js
43
82
  - vendor/assets/javascripts/bootstrap-modal.js
44
83
  - vendor/assets/javascripts/bootstrap-popover.js
45
84
  - vendor/assets/javascripts/bootstrap-scrollspy.js
46
- - vendor/assets/javascripts/bootstrap-tabs.js
47
- - vendor/assets/javascripts/bootstrap-twipsy.js
85
+ - vendor/assets/javascripts/bootstrap-tab.js
86
+ - vendor/assets/javascripts/bootstrap-tooltip.js
87
+ - vendor/assets/javascripts/bootstrap-transition.js
88
+ - vendor/assets/javascripts/bootstrap-typeahead.js
48
89
  - vendor/assets/javascripts/bootstrap.js
90
+ - vendor/assets/images/glyphicons-halflings-white.png
91
+ - vendor/assets/images/glyphicons-halflings.png
92
+ - lib/bootstrap-sass/compass_extensions.rb
93
+ - lib/bootstrap-sass/config/sass-ie_hex_str.rb
94
+ - lib/bootstrap-sass/config/sass_extentions.rb
95
+ - lib/bootstrap-sass/engine.rb
96
+ - lib/bootstrap-sass.rb
97
+ - templates/project/manifest.rb
98
+ - templates/project/styles.scss
49
99
  - README.md
50
100
  - LICENSE
51
- - lib/bootstrap-sass.rb
52
- - lib/bootstrap-sass/config/sass-ie_hex_str.rb
53
101
  homepage: http://github.com/thomas-mcdonald/bootstrap-sass
54
102
  licenses: []
55
103
  post_install_message:
@@ -1,124 +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
- if (options == 'close') return this.close.call(content)
58
- this.settings = $.extend({}, $.fn.alert.defaults, options)
59
- this.$element = $(content)
60
- .delegate(this.settings.selector, 'click', this.close)
61
- }
62
-
63
- Alert.prototype = {
64
-
65
- close: function (e) {
66
- var $element = $(this)
67
- , className = 'alert-message'
68
-
69
- $element = $element.hasClass(className) ? $element : $element.parent()
70
-
71
- e && e.preventDefault()
72
- $element.removeClass('in')
73
-
74
- function removeElement () {
75
- $element.remove()
76
- }
77
-
78
- $.support.transition && $element.hasClass('fade') ?
79
- $element.bind(transitionEnd, removeElement) :
80
- removeElement()
81
- }
82
-
83
- }
84
-
85
-
86
- /* ALERT PLUGIN DEFINITION
87
- * ======================= */
88
-
89
- $.fn.alert = function ( options ) {
90
-
91
- if ( options === true ) {
92
- return this.data('alert')
93
- }
94
-
95
- return this.each(function () {
96
- var $this = $(this)
97
- , data
98
-
99
- if ( typeof options == 'string' ) {
100
-
101
- data = $this.data('alert')
102
-
103
- if (typeof data == 'object') {
104
- return data[options].call( $this )
105
- }
106
-
107
- }
108
-
109
- $(this).data('alert', new Alert( this, options ))
110
-
111
- })
112
- }
113
-
114
- $.fn.alert.defaults = {
115
- selector: '.close'
116
- }
117
-
118
- $(document).ready(function () {
119
- new Alert($('body'), {
120
- selector: '.alert-message[data-alert] .close'
121
- })
122
- })
123
-
124
- }( window.jQuery || window.ender );
@@ -1,64 +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
- setTimeout(function () {
35
- state == 'loadingText' ?
36
- $el.addClass(d).attr(d, d) :
37
- $el.removeClass(d).removeAttr(d)
38
- }, 0)
39
- }
40
-
41
- function toggle(el) {
42
- $(el).toggleClass('active')
43
- }
44
-
45
- $.fn.button = function(options) {
46
- return this.each(function () {
47
- if (options == 'toggle') {
48
- return toggle(this)
49
- }
50
- options && setState(this, options)
51
- })
52
- }
53
-
54
- $.fn.button.defaults = {
55
- loadingText: 'loading...'
56
- }
57
-
58
- $(function () {
59
- $('body').delegate('.btn[data-toggle]', 'click', function () {
60
- $(this).button('toggle')
61
- })
62
- })
63
-
64
- }( 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,321 +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
- return this.$tip = this.$tip || $('<div class="twipsy" />').html(this.options.template)
172
- }
173
-
174
- , validate: function() {
175
- if (!this.$element[0].parentNode) {
176
- this.hide()
177
- this.$element = null
178
- this.options = null
179
- }
180
- }
181
-
182
- , enable: function() {
183
- this.enabled = true
184
- }
185
-
186
- , disable: function() {
187
- this.enabled = false
188
- }
189
-
190
- , toggleEnabled: function() {
191
- this.enabled = !this.enabled
192
- }
193
-
194
- , toggle: function () {
195
- this[this.tip().hasClass('in') ? 'hide' : 'show']()
196
- }
197
-
198
- }
199
-
200
-
201
- /* TWIPSY PRIVATE METHODS
202
- * ====================== */
203
-
204
- function maybeCall ( thing, ctx, args ) {
205
- return typeof thing == 'function' ? thing.apply(ctx, args) : thing
206
- }
207
-
208
- /* TWIPSY PLUGIN DEFINITION
209
- * ======================== */
210
-
211
- $.fn.twipsy = function (options) {
212
- $.fn.twipsy.initWith.call(this, options, Twipsy, 'twipsy')
213
- return this
214
- }
215
-
216
- $.fn.twipsy.initWith = function (options, Constructor, name) {
217
- var twipsy
218
- , binder
219
- , eventIn
220
- , eventOut
221
-
222
- if (options === true) {
223
- return this.data(name)
224
- } else if (typeof options == 'string') {
225
- twipsy = this.data(name)
226
- if (twipsy) {
227
- twipsy[options]()
228
- }
229
- return this
230
- }
231
-
232
- options = $.extend({}, $.fn[name].defaults, options)
233
-
234
- function get(ele) {
235
- var twipsy = $.data(ele, name)
236
-
237
- if (!twipsy) {
238
- twipsy = new Constructor(ele, $.fn.twipsy.elementOptions(ele, options))
239
- $.data(ele, name, twipsy)
240
- }
241
-
242
- return twipsy
243
- }
244
-
245
- function enter() {
246
- var twipsy = get(this)
247
- twipsy.hoverState = 'in'
248
-
249
- if (options.delayIn == 0) {
250
- twipsy.show()
251
- } else {
252
- twipsy.fixTitle()
253
- setTimeout(function() {
254
- if (twipsy.hoverState == 'in') {
255
- twipsy.show()
256
- }
257
- }, options.delayIn)
258
- }
259
- }
260
-
261
- function leave() {
262
- var twipsy = get(this)
263
- twipsy.hoverState = 'out'
264
- if (options.delayOut == 0) {
265
- twipsy.hide()
266
- } else {
267
- setTimeout(function() {
268
- if (twipsy.hoverState == 'out') {
269
- twipsy.hide()
270
- }
271
- }, options.delayOut)
272
- }
273
- }
274
-
275
- if (!options.live) {
276
- this.each(function() {
277
- get(this)
278
- })
279
- }
280
-
281
- if (options.trigger != 'manual') {
282
- binder = options.live ? 'live' : 'bind'
283
- eventIn = options.trigger == 'hover' ? 'mouseenter' : 'focus'
284
- eventOut = options.trigger == 'hover' ? 'mouseleave' : 'blur'
285
- this[binder](eventIn, enter)[binder](eventOut, leave)
286
- }
287
-
288
- return this
289
- }
290
-
291
- $.fn.twipsy.Twipsy = Twipsy
292
-
293
- $.fn.twipsy.defaults = {
294
- animate: true
295
- , delayIn: 0
296
- , delayOut: 0
297
- , fallback: ''
298
- , placement: 'above'
299
- , html: false
300
- , live: false
301
- , offset: 0
302
- , title: 'title'
303
- , trigger: 'hover'
304
- , template: '<div class="twipsy-arrow"></div><div class="twipsy-inner"></div>'
305
- }
306
-
307
- $.fn.twipsy.rejectAttrOptions = [ 'title' ]
308
-
309
- $.fn.twipsy.elementOptions = function(ele, options) {
310
- var data = $(ele).data()
311
- , rejects = $.fn.twipsy.rejectAttrOptions
312
- , i = rejects.length
313
-
314
- while (i--) {
315
- delete data[rejects[i]]
316
- }
317
-
318
- return $.extend({}, options, data)
319
- }
320
-
321
- }( window.jQuery || window.ender );