bootstrap_sass_rails 0.0.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +15 -0
- data/.gitignore +17 -0
- data/.rvmrc +1 -0
- data/Gemfile +4 -0
- data/LICENSE.txt +22 -0
- data/README.md +44 -0
- data/Rakefile +1 -0
- data/app/assets/javascripts/bootstrap.js +12 -0
- data/app/assets/javascripts/bootstrap/affix.js +126 -0
- data/app/assets/javascripts/bootstrap/alert.js +98 -0
- data/app/assets/javascripts/bootstrap/button.js +109 -0
- data/app/assets/javascripts/bootstrap/carousel.js +217 -0
- data/app/assets/javascripts/bootstrap/collapse.js +179 -0
- data/app/assets/javascripts/bootstrap/dropdown.js +154 -0
- data/app/assets/javascripts/bootstrap/modal.js +246 -0
- data/app/assets/javascripts/bootstrap/popover.js +117 -0
- data/app/assets/javascripts/bootstrap/scrollspy.js +158 -0
- data/app/assets/javascripts/bootstrap/tab.js +135 -0
- data/app/assets/javascripts/bootstrap/tooltip.js +386 -0
- data/app/assets/javascripts/bootstrap/transition.js +56 -0
- data/app/assets/stylesheets/bootstrap.css.sass +59 -0
- data/app/assets/stylesheets/bootstrap/_alerts.css.sass +55 -0
- data/app/assets/stylesheets/bootstrap/_badges.css.sass +50 -0
- data/app/assets/stylesheets/bootstrap/_breadcrumbs.css.sass +19 -0
- data/app/assets/stylesheets/bootstrap/_button-groups.css.sass +210 -0
- data/app/assets/stylesheets/bootstrap/_buttons.css.sass +135 -0
- data/app/assets/stylesheets/bootstrap/_carousel.css.sass +165 -0
- data/app/assets/stylesheets/bootstrap/_close.css.sass +28 -0
- data/app/assets/stylesheets/bootstrap/_code.css.sass +49 -0
- data/app/assets/stylesheets/bootstrap/_component-animations.css.sass +25 -0
- data/app/assets/stylesheets/bootstrap/_dropdowns.css.sass +166 -0
- data/app/assets/stylesheets/bootstrap/_forms.css.sass +309 -0
- data/app/assets/stylesheets/bootstrap/_glyphicons.css.sass +827 -0
- data/app/assets/stylesheets/bootstrap/_grid.css.sass +483 -0
- data/app/assets/stylesheets/bootstrap/_input-groups.css.sass +117 -0
- data/app/assets/stylesheets/bootstrap/_jumbotron.css.sass +28 -0
- data/app/assets/stylesheets/bootstrap/_labels.css.sass +46 -0
- data/app/assets/stylesheets/bootstrap/_list-group.css.sass +71 -0
- data/app/assets/stylesheets/bootstrap/_media.css.sass +47 -0
- data/app/assets/stylesheets/bootstrap/_mixins.css.sass +754 -0
- data/app/assets/stylesheets/bootstrap/_modals.css.sass +127 -0
- data/app/assets/stylesheets/bootstrap/_navbar.css.sass +457 -0
- data/app/assets/stylesheets/bootstrap/_navs.css.sass +171 -0
- data/app/assets/stylesheets/bootstrap/_normalize.css.sass +375 -0
- data/app/assets/stylesheets/bootstrap/_pager.css.sass +39 -0
- data/app/assets/stylesheets/bootstrap/_pagination.css.sass +66 -0
- data/app/assets/stylesheets/bootstrap/_panels.css.sass +114 -0
- data/app/assets/stylesheets/bootstrap/_popovers.css.sass +124 -0
- data/app/assets/stylesheets/bootstrap/_print.css.sass +66 -0
- data/app/assets/stylesheets/bootstrap/_progress-bars.css.sass +90 -0
- data/app/assets/stylesheets/bootstrap/_responsive-utilities.css.sass +152 -0
- data/app/assets/stylesheets/bootstrap/_scaffolding.css.sass +108 -0
- data/app/assets/stylesheets/bootstrap/_tables.css.sass +176 -0
- data/app/assets/stylesheets/bootstrap/_theme.css.sass +228 -0
- data/app/assets/stylesheets/bootstrap/_thumbnails.css.sass +26 -0
- data/app/assets/stylesheets/bootstrap/_tooltip.css.sass +91 -0
- data/app/assets/stylesheets/bootstrap/_type.css.sass +251 -0
- data/app/assets/stylesheets/bootstrap/_utilities.css.sass +36 -0
- data/app/assets/stylesheets/bootstrap/_variables.css.sass +614 -0
- data/app/assets/stylesheets/bootstrap/_wells.css.sass +25 -0
- data/bin/convert-sass.sh +3 -0
- data/bootstrap_sass_rails.gemspec +25 -0
- data/lib/bootstrap_sass_rails.rb +13 -0
- data/lib/bootstrap_sass_rails/engine.rb +4 -0
- data/lib/bootstrap_sass_rails/version.rb +3 -0
- metadata +152 -0
checksums.yaml
ADDED
@@ -0,0 +1,15 @@
|
|
1
|
+
---
|
2
|
+
!binary "U0hBMQ==":
|
3
|
+
metadata.gz: !binary |-
|
4
|
+
ZWU3OWFiYTM5NGY5OGE4MDUxM2FkYTM0OTA1Mzk0NmY4MGZmNjNkOA==
|
5
|
+
data.tar.gz: !binary |-
|
6
|
+
OGE5NGRiNTNkNTIxZjQ2NTYwYjE2ODYyODFlMjE0MDg3ZjkxZGM0YQ==
|
7
|
+
!binary "U0hBNTEy":
|
8
|
+
metadata.gz: !binary |-
|
9
|
+
MGU3NjIzZDZhMTg2NzI3MTk4ZDY5YTQ0YTNmYTAxZjAyMDE1YjdkN2ZjN2M2
|
10
|
+
MDY4MjVmZTBkMjExNjYxNDFjYmNmMTE2ZGE3OGRkOWI2Yjk4ZjVhMTk4MDg0
|
11
|
+
NjhjZmJjMTI3YWYyY2VmYTk2ODI2Zjk2ODQwNWM0MjJhMjk5OWY=
|
12
|
+
data.tar.gz: !binary |-
|
13
|
+
MzJkNWRiMmVhYmMzMmViNWU4M2RjODFiZDdkMTZjN2VhOWViMTkyYzJhNjBk
|
14
|
+
Mzc4ZTExNjFmYzc5MjM2YjcxMGU2Y2IxMWE1ODIyMTY2MzBmZTg1NmRmMTA0
|
15
|
+
OGY1NTg3MGUyMDExYTZkMWNiYWJjODVlNjRlZTJmMGY2ZmI4NzI=
|
data/.gitignore
ADDED
data/.rvmrc
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
rvm use 1.9.3
|
data/Gemfile
ADDED
data/LICENSE.txt
ADDED
@@ -0,0 +1,22 @@
|
|
1
|
+
Copyright (c) 2013 John Koht
|
2
|
+
|
3
|
+
MIT License
|
4
|
+
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining
|
6
|
+
a copy of this software and associated documentation files (the
|
7
|
+
"Software"), to deal in the Software without restriction, including
|
8
|
+
without limitation the rights to use, copy, modify, merge, publish,
|
9
|
+
distribute, sublicense, and/or sell copies of the Software, and to
|
10
|
+
permit persons to whom the Software is furnished to do so, subject to
|
11
|
+
the following conditions:
|
12
|
+
|
13
|
+
The above copyright notice and this permission notice shall be
|
14
|
+
included in all copies or substantial portions of the Software.
|
15
|
+
|
16
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
17
|
+
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
18
|
+
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
19
|
+
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
|
20
|
+
LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
|
21
|
+
OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
22
|
+
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
data/README.md
ADDED
@@ -0,0 +1,44 @@
|
|
1
|
+
# BootstrapSassRails
|
2
|
+
|
3
|
+
TODO: Write a gem description
|
4
|
+
|
5
|
+
## Installation
|
6
|
+
|
7
|
+
Add this line to your application's Gemfile:
|
8
|
+
|
9
|
+
gem 'bootstrap_sass_rails'
|
10
|
+
|
11
|
+
And then execute:
|
12
|
+
|
13
|
+
$ bundle
|
14
|
+
|
15
|
+
Or install it yourself as:
|
16
|
+
|
17
|
+
$ gem install bootstrap_sass_rails
|
18
|
+
|
19
|
+
## Usage
|
20
|
+
|
21
|
+
### Stylesheets
|
22
|
+
|
23
|
+
You can add all of bootstrap by adding to your application.scss:
|
24
|
+
|
25
|
+
@import bootstrap
|
26
|
+
|
27
|
+
|
28
|
+
Or you can add individual files:
|
29
|
+
|
30
|
+
...
|
31
|
+
@import bootstrap/mixins
|
32
|
+
@import bootstrap/buttons
|
33
|
+
@import bootstrap/navs
|
34
|
+
@import bootstrap/navbar
|
35
|
+
...
|
36
|
+
|
37
|
+
|
38
|
+
## Contributing
|
39
|
+
|
40
|
+
1. Fork it
|
41
|
+
2. Create your feature branch (`git checkout -b my-new-feature`)
|
42
|
+
3. Commit your changes (`git commit -am 'Add some feature'`)
|
43
|
+
4. Push to the branch (`git push origin my-new-feature`)
|
44
|
+
5. Create new Pull Request
|
data/Rakefile
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
require "bundler/gem_tasks"
|
@@ -0,0 +1,12 @@
|
|
1
|
+
//= require twitter/bootstrap/transition
|
2
|
+
//= require twitter/bootstrap/alert
|
3
|
+
//= require twitter/bootstrap/button
|
4
|
+
//= require twitter/bootstrap/carousel
|
5
|
+
//= require twitter/bootstrap/collapse
|
6
|
+
//= require twitter/bootstrap/dropdown
|
7
|
+
//= require twitter/bootstrap/modal
|
8
|
+
//= require twitter/bootstrap/tooltip
|
9
|
+
//= require twitter/bootstrap/popover
|
10
|
+
//= require twitter/bootstrap/scrollspy
|
11
|
+
//= require twitter/bootstrap/tab
|
12
|
+
//= require twitter/bootstrap/affix
|
@@ -0,0 +1,126 @@
|
|
1
|
+
/* ========================================================================
|
2
|
+
* Bootstrap: affix.js v3.0.0
|
3
|
+
* http://twbs.github.com/bootstrap/javascript.html#affix
|
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 ($) { "use strict";
|
22
|
+
|
23
|
+
// AFFIX CLASS DEFINITION
|
24
|
+
// ======================
|
25
|
+
|
26
|
+
var Affix = function (element, options) {
|
27
|
+
this.options = $.extend({}, Affix.DEFAULTS, options)
|
28
|
+
this.$window = $(window)
|
29
|
+
.on('scroll.bs.affix.data-api', $.proxy(this.checkPosition, this))
|
30
|
+
.on('click.bs.affix.data-api', $.proxy(this.checkPositionWithEventLoop, this))
|
31
|
+
|
32
|
+
this.$element = $(element)
|
33
|
+
this.affixed =
|
34
|
+
this.unpin = null
|
35
|
+
|
36
|
+
this.checkPosition()
|
37
|
+
}
|
38
|
+
|
39
|
+
Affix.RESET = 'affix affix-top affix-bottom'
|
40
|
+
|
41
|
+
Affix.DEFAULTS = {
|
42
|
+
offset: 0
|
43
|
+
}
|
44
|
+
|
45
|
+
Affix.prototype.checkPositionWithEventLoop = function () {
|
46
|
+
setTimeout($.proxy(this.checkPosition, this), 1)
|
47
|
+
}
|
48
|
+
|
49
|
+
Affix.prototype.checkPosition = function () {
|
50
|
+
if (!this.$element.is(':visible')) return
|
51
|
+
|
52
|
+
var scrollHeight = $(document).height()
|
53
|
+
var scrollTop = this.$window.scrollTop()
|
54
|
+
var position = this.$element.offset()
|
55
|
+
var offset = this.options.offset
|
56
|
+
var offsetTop = offset.top
|
57
|
+
var offsetBottom = offset.bottom
|
58
|
+
|
59
|
+
if (typeof offset != 'object') offsetBottom = offsetTop = offset
|
60
|
+
if (typeof offsetTop == 'function') offsetTop = offset.top()
|
61
|
+
if (typeof offsetBottom == 'function') offsetBottom = offset.bottom()
|
62
|
+
|
63
|
+
var affix = this.unpin != null && (scrollTop + this.unpin <= position.top) ? false :
|
64
|
+
offsetBottom != null && (position.top + this.$element.height() >= scrollHeight - offsetBottom) ? 'bottom' :
|
65
|
+
offsetTop != null && (scrollTop <= offsetTop) ? 'top' : false
|
66
|
+
|
67
|
+
if (this.affixed === affix) return
|
68
|
+
if (this.unpin) this.$element.css('top', '')
|
69
|
+
|
70
|
+
this.affixed = affix
|
71
|
+
this.unpin = affix == 'bottom' ? position.top - scrollTop : null
|
72
|
+
|
73
|
+
this.$element.removeClass(Affix.RESET).addClass('affix' + (affix ? '-' + affix : ''))
|
74
|
+
|
75
|
+
if (affix == 'bottom') {
|
76
|
+
this.$element.offset({ top: document.body.offsetHeight - offsetBottom - this.$element.height() })
|
77
|
+
}
|
78
|
+
}
|
79
|
+
|
80
|
+
|
81
|
+
// AFFIX PLUGIN DEFINITION
|
82
|
+
// =======================
|
83
|
+
|
84
|
+
var old = $.fn.affix
|
85
|
+
|
86
|
+
$.fn.affix = function (option) {
|
87
|
+
return this.each(function () {
|
88
|
+
var $this = $(this)
|
89
|
+
var data = $this.data('bs.affix')
|
90
|
+
var options = typeof option == 'object' && option
|
91
|
+
|
92
|
+
if (!data) $this.data('bs.affix', (data = new Affix(this, options)))
|
93
|
+
if (typeof option == 'string') data[option]()
|
94
|
+
})
|
95
|
+
}
|
96
|
+
|
97
|
+
$.fn.affix.Constructor = Affix
|
98
|
+
|
99
|
+
|
100
|
+
// AFFIX NO CONFLICT
|
101
|
+
// =================
|
102
|
+
|
103
|
+
$.fn.affix.noConflict = function () {
|
104
|
+
$.fn.affix = old
|
105
|
+
return this
|
106
|
+
}
|
107
|
+
|
108
|
+
|
109
|
+
// AFFIX DATA-API
|
110
|
+
// ==============
|
111
|
+
|
112
|
+
$(window).on('load', function () {
|
113
|
+
$('[data-spy="affix"]').each(function () {
|
114
|
+
var $spy = $(this)
|
115
|
+
var data = $spy.data()
|
116
|
+
|
117
|
+
data.offset = data.offset || {}
|
118
|
+
|
119
|
+
if (data.offsetBottom) data.offset.bottom = data.offsetBottom
|
120
|
+
if (data.offsetTop) data.offset.top = data.offsetTop
|
121
|
+
|
122
|
+
$spy.affix(data)
|
123
|
+
})
|
124
|
+
})
|
125
|
+
|
126
|
+
}(window.jQuery);
|
@@ -0,0 +1,98 @@
|
|
1
|
+
/* ========================================================================
|
2
|
+
* Bootstrap: alert.js v3.0.0
|
3
|
+
* http://twbs.github.com/bootstrap/javascript.html#alerts
|
4
|
+
* ========================================================================
|
5
|
+
* Copyright 2013 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 ($) { "use strict";
|
22
|
+
|
23
|
+
// ALERT CLASS DEFINITION
|
24
|
+
// ======================
|
25
|
+
|
26
|
+
var dismiss = '[data-dismiss="alert"]'
|
27
|
+
var Alert = function (el) {
|
28
|
+
$(el).on('click', dismiss, this.close)
|
29
|
+
}
|
30
|
+
|
31
|
+
Alert.prototype.close = function (e) {
|
32
|
+
var $this = $(this)
|
33
|
+
var selector = $this.attr('data-target')
|
34
|
+
|
35
|
+
if (!selector) {
|
36
|
+
selector = $this.attr('href')
|
37
|
+
selector = selector && selector.replace(/.*(?=#[^\s]*$)/, '') // strip for ie7
|
38
|
+
}
|
39
|
+
|
40
|
+
var $parent = $(selector)
|
41
|
+
|
42
|
+
if (e) e.preventDefault()
|
43
|
+
|
44
|
+
if (!$parent.length) {
|
45
|
+
$parent = $this.hasClass('alert') ? $this : $this.parent()
|
46
|
+
}
|
47
|
+
|
48
|
+
$parent.trigger(e = $.Event('close.bs.alert'))
|
49
|
+
|
50
|
+
if (e.isDefaultPrevented()) return
|
51
|
+
|
52
|
+
$parent.removeClass('in')
|
53
|
+
|
54
|
+
function removeElement() {
|
55
|
+
$parent.trigger('closed.bs.alert').remove()
|
56
|
+
}
|
57
|
+
|
58
|
+
$.support.transition && $parent.hasClass('fade') ?
|
59
|
+
$parent
|
60
|
+
.one($.support.transition.end, removeElement)
|
61
|
+
.emulateTransitionEnd(150) :
|
62
|
+
removeElement()
|
63
|
+
}
|
64
|
+
|
65
|
+
|
66
|
+
// ALERT PLUGIN DEFINITION
|
67
|
+
// =======================
|
68
|
+
|
69
|
+
var old = $.fn.alert
|
70
|
+
|
71
|
+
$.fn.alert = function (option) {
|
72
|
+
return this.each(function () {
|
73
|
+
var $this = $(this)
|
74
|
+
var data = $this.data('bs.alert')
|
75
|
+
|
76
|
+
if (!data) $this.data('bs.alert', (data = new Alert(this)))
|
77
|
+
if (typeof option == 'string') data[option].call($this)
|
78
|
+
})
|
79
|
+
}
|
80
|
+
|
81
|
+
$.fn.alert.Constructor = Alert
|
82
|
+
|
83
|
+
|
84
|
+
// ALERT NO CONFLICT
|
85
|
+
// =================
|
86
|
+
|
87
|
+
$.fn.alert.noConflict = function () {
|
88
|
+
$.fn.alert = old
|
89
|
+
return this
|
90
|
+
}
|
91
|
+
|
92
|
+
|
93
|
+
// ALERT DATA-API
|
94
|
+
// ==============
|
95
|
+
|
96
|
+
$(document).on('click.bs.alert.data-api', dismiss, Alert.prototype.close)
|
97
|
+
|
98
|
+
}(window.jQuery);
|
@@ -0,0 +1,109 @@
|
|
1
|
+
/* ========================================================================
|
2
|
+
* Bootstrap: button.js v3.0.0
|
3
|
+
* http://twbs.github.com/bootstrap/javascript.html#buttons
|
4
|
+
* ========================================================================
|
5
|
+
* Copyright 2013 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 ($) { "use strict";
|
22
|
+
|
23
|
+
// BUTTON PUBLIC CLASS DEFINITION
|
24
|
+
// ==============================
|
25
|
+
|
26
|
+
var Button = function (element, options) {
|
27
|
+
this.$element = $(element)
|
28
|
+
this.options = $.extend({}, Button.DEFAULTS, options)
|
29
|
+
}
|
30
|
+
|
31
|
+
Button.DEFAULTS = {
|
32
|
+
loadingText: 'loading...'
|
33
|
+
}
|
34
|
+
|
35
|
+
Button.prototype.setState = function (state) {
|
36
|
+
var d = 'disabled'
|
37
|
+
var $el = this.$element
|
38
|
+
var val = $el.is('input') ? 'val' : 'html'
|
39
|
+
var data = $el.data()
|
40
|
+
|
41
|
+
state = state + 'Text'
|
42
|
+
|
43
|
+
if (!data.resetText) $el.data('resetText', $el[val]())
|
44
|
+
|
45
|
+
$el[val](data[state] || this.options[state])
|
46
|
+
|
47
|
+
// push to event loop to allow forms to submit
|
48
|
+
setTimeout(function () {
|
49
|
+
state == 'loadingText' ?
|
50
|
+
$el.addClass(d).attr(d, d) :
|
51
|
+
$el.removeClass(d).removeAttr(d);
|
52
|
+
}, 0)
|
53
|
+
}
|
54
|
+
|
55
|
+
Button.prototype.toggle = function () {
|
56
|
+
var $parent = this.$element.closest('[data-toggle="buttons"]')
|
57
|
+
|
58
|
+
if ($parent.length) {
|
59
|
+
var $input = this.$element.find('input')
|
60
|
+
.prop('checked', !this.$element.hasClass('active'))
|
61
|
+
.trigger('change')
|
62
|
+
if ($input.prop('type') === 'radio') $parent.find('.active').removeClass('active')
|
63
|
+
}
|
64
|
+
|
65
|
+
this.$element.toggleClass('active')
|
66
|
+
}
|
67
|
+
|
68
|
+
|
69
|
+
// BUTTON PLUGIN DEFINITION
|
70
|
+
// ========================
|
71
|
+
|
72
|
+
var old = $.fn.button
|
73
|
+
|
74
|
+
$.fn.button = function (option) {
|
75
|
+
return this.each(function () {
|
76
|
+
var $this = $(this)
|
77
|
+
var data = $this.data('bs.button')
|
78
|
+
var options = typeof option == 'object' && option
|
79
|
+
|
80
|
+
if (!data) $this.data('bs.button', (data = new Button(this, options)))
|
81
|
+
|
82
|
+
if (option == 'toggle') data.toggle()
|
83
|
+
else if (option) data.setState(option)
|
84
|
+
})
|
85
|
+
}
|
86
|
+
|
87
|
+
$.fn.button.Constructor = Button
|
88
|
+
|
89
|
+
|
90
|
+
// BUTTON NO CONFLICT
|
91
|
+
// ==================
|
92
|
+
|
93
|
+
$.fn.button.noConflict = function () {
|
94
|
+
$.fn.button = old
|
95
|
+
return this
|
96
|
+
}
|
97
|
+
|
98
|
+
|
99
|
+
// BUTTON DATA-API
|
100
|
+
// ===============
|
101
|
+
|
102
|
+
$(document).on('click.bs.button.data-api', '[data-toggle^=button]', function (e) {
|
103
|
+
var $btn = $(e.target)
|
104
|
+
if (!$btn.hasClass('btn')) $btn = $btn.closest('.btn')
|
105
|
+
$btn.button('toggle')
|
106
|
+
e.preventDefault()
|
107
|
+
})
|
108
|
+
|
109
|
+
}(window.jQuery);
|