twitter-bootstrap-rails 1.4.3 → 2.0rc0
Sign up to get free protection for your applications and to get access to all the features.
Potentially problematic release.
This version of twitter-bootstrap-rails might be problematic. Click here for more details.
- data/README.md +85 -52
- data/lib/generators/bootstrap/install/templates/bootstrap.coffee +15 -12
- data/lib/generators/bootstrap/layout/layout_generator.rb +1 -1
- data/lib/generators/bootstrap/layout/templates/layout.html.erb +97 -50
- data/lib/generators/bootstrap/layout/templates/layout.html.slim +40 -0
- data/lib/generators/bootstrap/themed/templates/_form.html.erb +5 -1
- data/lib/generators/bootstrap/themed/templates/edit.html.erb +2 -1
- data/lib/generators/bootstrap/themed/templates/index.html.erb +1 -0
- data/lib/generators/bootstrap/themed/templates/new.html.erb +1 -1
- data/lib/generators/bootstrap/themed/templates/show.html.erb +7 -3
- data/lib/generators/bootstrap/themed/themed_generator.rb +0 -15
- data/lib/twitter-bootstrap-rails.rb +3 -3
- data/lib/twitter/bootstrap/rails/bootstrap.rb +1 -1
- data/lib/twitter/bootstrap/rails/version.rb +1 -1
- data/vendor/assets/images/twitter/bootstrap/glyphicons-halflings-white.png +0 -0
- data/vendor/assets/images/twitter/bootstrap/glyphicons-halflings.png +0 -0
- data/vendor/assets/javascripts/twitter/bootstrap.js +10 -6
- data/vendor/assets/javascripts/twitter/bootstrap/bootstrap-alert.js +91 -0
- data/vendor/assets/javascripts/twitter/bootstrap/bootstrap-button.js +98 -0
- data/vendor/assets/javascripts/twitter/bootstrap/bootstrap-carousel.js +154 -0
- data/vendor/assets/javascripts/twitter/bootstrap/bootstrap-collapse.js +136 -0
- data/vendor/assets/javascripts/twitter/bootstrap/bootstrap-dropdown.js +58 -21
- data/vendor/assets/javascripts/twitter/bootstrap/bootstrap-modal.js +63 -114
- data/vendor/assets/javascripts/twitter/bootstrap/bootstrap-popover.js +38 -33
- data/vendor/assets/javascripts/twitter/bootstrap/bootstrap-scrollspy.js +62 -44
- data/vendor/assets/javascripts/twitter/bootstrap/bootstrap-tab.js +130 -0
- data/vendor/assets/javascripts/twitter/bootstrap/bootstrap-tooltip.js +270 -0
- data/vendor/assets/javascripts/twitter/bootstrap/bootstrap-transition.js +51 -0
- data/vendor/assets/javascripts/twitter/bootstrap/bootstrap-typeahead.js +271 -0
- data/vendor/toolkit/twitter/bootstrap/accordion.less +28 -0
- data/vendor/toolkit/twitter/bootstrap/alerts.less +70 -0
- data/vendor/toolkit/twitter/bootstrap/bootstrap.less +41 -5
- data/vendor/toolkit/twitter/bootstrap/breadcrumbs.less +22 -0
- data/vendor/toolkit/twitter/bootstrap/button-groups.less +147 -0
- data/vendor/toolkit/twitter/bootstrap/buttons.less +165 -0
- data/vendor/toolkit/twitter/bootstrap/carousel.less +121 -0
- data/vendor/toolkit/twitter/bootstrap/close.less +18 -0
- data/vendor/toolkit/twitter/bootstrap/code.less +44 -0
- data/vendor/toolkit/twitter/bootstrap/component-animations.less +18 -0
- data/vendor/toolkit/twitter/bootstrap/dropdowns.less +131 -0
- data/vendor/toolkit/twitter/bootstrap/forms.less +335 -299
- data/vendor/toolkit/twitter/bootstrap/grid.less +8 -0
- data/vendor/toolkit/twitter/bootstrap/hero-unit.less +20 -0
- data/vendor/toolkit/twitter/bootstrap/labels.less +16 -0
- data/vendor/toolkit/twitter/bootstrap/layouts.less +17 -0
- data/vendor/toolkit/twitter/bootstrap/mixins.less +391 -76
- data/vendor/toolkit/twitter/bootstrap/modals.less +72 -0
- data/vendor/toolkit/twitter/bootstrap/navbar.less +292 -0
- data/vendor/toolkit/twitter/bootstrap/navs.less +344 -0
- data/vendor/toolkit/twitter/bootstrap/pager.less +30 -0
- data/vendor/toolkit/twitter/bootstrap/pagination.less +55 -0
- data/vendor/toolkit/twitter/bootstrap/popovers.less +49 -0
- data/vendor/toolkit/twitter/bootstrap/progress-bars.less +95 -0
- data/vendor/toolkit/twitter/bootstrap/reset.less +37 -52
- data/vendor/toolkit/twitter/bootstrap/responsive.less +323 -0
- data/vendor/toolkit/twitter/bootstrap/scaffolding.less +13 -123
- data/vendor/toolkit/twitter/bootstrap/sprites.less +156 -0
- data/vendor/toolkit/twitter/bootstrap/tables.less +75 -160
- data/vendor/toolkit/twitter/bootstrap/thumbnails.less +35 -0
- data/vendor/toolkit/twitter/bootstrap/tooltip.less +35 -0
- data/vendor/toolkit/twitter/bootstrap/type.less +100 -70
- data/vendor/toolkit/twitter/bootstrap/utilities.less +23 -0
- data/vendor/toolkit/twitter/bootstrap/variables.less +94 -55
- data/vendor/toolkit/twitter/bootstrap/wells.less +17 -0
- metadata +58 -49
- data/lib/generators/bootstrap/themed/templates/builders/builder.rb +0 -24
- data/lib/generators/bootstrap/themed/templates/builders/helper.rb +0 -6
- data/vendor/assets/javascripts/twitter/bootstrap/bootstrap-alerts.js +0 -124
- data/vendor/assets/javascripts/twitter/bootstrap/bootstrap-buttons.js +0 -64
- data/vendor/assets/javascripts/twitter/bootstrap/bootstrap-tabs.js +0 -80
- data/vendor/assets/javascripts/twitter/bootstrap/bootstrap-twipsy.js +0 -321
- data/vendor/toolkit/twitter/bootstrap/patterns.less +0 -1063
@@ -1,3 +1,4 @@
|
|
1
|
-
<%%=
|
1
|
+
<%%= form_for @<%= model_name.underscore %>, :url => <%= singular_controller_routing_path %>_path(@<%= resource_name %>), :html => { :class => "edit_<%= model_name.underscore %>", :id => "edit_<%= model_name.underscore %>" } do |f| -%>
|
2
|
+
<input name="_method" type="hidden" value="put" />
|
2
3
|
<%%= render :partial => "form", :locals => {:f => f} %>
|
3
4
|
<%% end -%>
|
@@ -1,3 +1,3 @@
|
|
1
|
-
<%%=
|
1
|
+
<%%= form_for @<%= model_name.underscore %>, :url => <%= controller_routing_path %>_path, :html => { :class => :form } do |f| -%>
|
2
2
|
<%%= render :partial => "form", :locals => {:f => f} %>
|
3
3
|
<%% end -%>
|
@@ -1,5 +1,9 @@
|
|
1
1
|
<% columns.each do |column| %>
|
2
|
-
|
3
|
-
|
2
|
+
<label class="label"><%%= t("activerecord.attributes.<%= singular_controller_routing_path %>.<%= column.name %>", :default => t("activerecord.labels.<%= column.name %>", :default => "<%= column.name.humanize %>")) %>:</label>
|
3
|
+
<p><%%= @<%= resource_name %>.<%= column.name %> %></p>
|
4
4
|
<%- end -%>
|
5
|
-
|
5
|
+
<div class="actions">
|
6
|
+
<%%= link_to "Back", <%= controller_routing_path %>_path, :class => 'btn primary' %>
|
7
|
+
<%%= link_to "Edit", edit_<%= singular_controller_routing_path %>_path(@<%= resource_name %>), :class => 'btn primary' %>
|
8
|
+
<%%= link_to "Delete", <%= singular_controller_routing_path %>_path(@<%= resource_name %>), :method => "delete", :confirm => "#{t("web-app-theme.confirm", :default => "Are you sure?")}", :class => 'btn primary' %>
|
9
|
+
</div>
|
@@ -15,21 +15,6 @@ module Bootstrap
|
|
15
15
|
initialize_views_variables
|
16
16
|
end
|
17
17
|
|
18
|
-
def copy_form_builder
|
19
|
-
copy_file "builders/builder.rb", "app/form_builders/bootstrap_form_builder.rb"
|
20
|
-
end
|
21
|
-
|
22
|
-
def copy_helper
|
23
|
-
if File.exist?('app/helpers/application_helper.rb')
|
24
|
-
insert_into_file "app/helpers/application_helper.rb"," def bootstrap_form_for(object, options = {}, &block)
|
25
|
-
options[:builder] = BootstrapFormBuilder
|
26
|
-
form_for(object, options, &block)
|
27
|
-
end\n", :after => "module ApplicationHelper\n"
|
28
|
-
else
|
29
|
-
copy_file "builders/helper.rb", "app/helpers/application_helper.rb"
|
30
|
-
end
|
31
|
-
end
|
32
|
-
|
33
18
|
def copy_views
|
34
19
|
generate_views
|
35
20
|
gsub_file(File.join('app/views/layouts', "#{layout}.html.erb"), /\<ul\s+class=\"nav\">.*\<\/ul\>/mi) do |match|
|
@@ -1,10 +1,10 @@
|
|
1
1
|
module Twitter
|
2
2
|
module Bootstrap
|
3
|
-
module Rails
|
4
|
-
require 'twitter/bootstrap/rails/engine' if defined?(Rails)
|
3
|
+
module Rails
|
4
|
+
require 'twitter/bootstrap/rails/engine' if defined?(Rails)
|
5
5
|
end
|
6
6
|
end
|
7
7
|
end
|
8
8
|
|
9
9
|
require 'less-rails'
|
10
|
-
require 'twitter/bootstrap/rails/bootstrap'
|
10
|
+
require 'twitter/bootstrap/rails/bootstrap' if defined?(Rails)
|
Binary file
|
@@ -1,8 +1,12 @@
|
|
1
|
-
//= require twitter/bootstrap/bootstrap-
|
2
|
-
//= require twitter/bootstrap/bootstrap-
|
1
|
+
//= require twitter/bootstrap/bootstrap-transition
|
2
|
+
//= require twitter/bootstrap/bootstrap-alert
|
3
3
|
//= require twitter/bootstrap/bootstrap-modal
|
4
|
-
//= require twitter/bootstrap/bootstrap-
|
5
|
-
//= require twitter/bootstrap/bootstrap-popover
|
4
|
+
//= require twitter/bootstrap/bootstrap-dropdown
|
6
5
|
//= require twitter/bootstrap/bootstrap-scrollspy
|
7
|
-
//= require twitter/bootstrap/bootstrap-
|
8
|
-
//= require twitter/bootstrap/bootstrap-
|
6
|
+
//= require twitter/bootstrap/bootstrap-tab
|
7
|
+
//= require twitter/bootstrap/bootstrap-tooltip
|
8
|
+
//= require twitter/bootstrap/bootstrap-popover
|
9
|
+
//= require twitter/bootstrap/bootstrap-button
|
10
|
+
//= require twitter/bootstrap/bootstrap-collapse
|
11
|
+
//= require twitter/bootstrap/bootstrap-carousel
|
12
|
+
//= require twitter/bootstrap/bootstrap-typeahead
|
@@ -0,0 +1,91 @@
|
|
1
|
+
/* ==========================================================
|
2
|
+
* bootstrap-alert.js v2.0.0
|
3
|
+
* http://twitter.github.com/bootstrap/javascript.html#alerts
|
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"
|
24
|
+
|
25
|
+
/* ALERT CLASS DEFINITION
|
26
|
+
* ====================== */
|
27
|
+
|
28
|
+
var dismiss = '[data-dismiss="alert"]'
|
29
|
+
, Alert = function ( el ) {
|
30
|
+
$(el).on('click', dismiss, this.close)
|
31
|
+
}
|
32
|
+
|
33
|
+
Alert.prototype = {
|
34
|
+
|
35
|
+
constructor: Alert
|
36
|
+
|
37
|
+
, close: function ( e ) {
|
38
|
+
var $this = $(this)
|
39
|
+
, selector = $this.attr('data-target')
|
40
|
+
, $parent
|
41
|
+
|
42
|
+
if (!selector) {
|
43
|
+
selector = $this.attr('href')
|
44
|
+
selector = selector && selector.replace(/.*(?=#[^\s]*$)/, '') //strip for ie7
|
45
|
+
}
|
46
|
+
|
47
|
+
$parent = $(selector)
|
48
|
+
$parent.trigger('close')
|
49
|
+
|
50
|
+
e && e.preventDefault()
|
51
|
+
|
52
|
+
$parent.length || ($parent = $this.hasClass('alert') ? $this : $this.parent())
|
53
|
+
|
54
|
+
$parent.removeClass('in')
|
55
|
+
|
56
|
+
function removeElement() {
|
57
|
+
$parent.remove()
|
58
|
+
$parent.trigger('closed')
|
59
|
+
}
|
60
|
+
|
61
|
+
$.support.transition && $parent.hasClass('fade') ?
|
62
|
+
$parent.on($.support.transition.end, removeElement) :
|
63
|
+
removeElement()
|
64
|
+
}
|
65
|
+
|
66
|
+
}
|
67
|
+
|
68
|
+
|
69
|
+
/* ALERT PLUGIN DEFINITION
|
70
|
+
* ======================= */
|
71
|
+
|
72
|
+
$.fn.alert = function ( option ) {
|
73
|
+
return this.each(function () {
|
74
|
+
var $this = $(this)
|
75
|
+
, data = $this.data('alert')
|
76
|
+
if (!data) $this.data('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 DATA-API
|
85
|
+
* ============== */
|
86
|
+
|
87
|
+
$(function () {
|
88
|
+
$('body').on('click.alert.data-api', dismiss, Alert.prototype.close)
|
89
|
+
})
|
90
|
+
|
91
|
+
}( window.jQuery )
|
@@ -0,0 +1,98 @@
|
|
1
|
+
/* ============================================================
|
2
|
+
* bootstrap-button.js v2.0.0
|
3
|
+
* http://twitter.github.com/bootstrap/javascript.html#buttons
|
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
|
+
!function( $ ){
|
21
|
+
|
22
|
+
"use strict"
|
23
|
+
|
24
|
+
/* BUTTON PUBLIC CLASS DEFINITION
|
25
|
+
* ============================== */
|
26
|
+
|
27
|
+
var Button = function ( element, options ) {
|
28
|
+
this.$element = $(element)
|
29
|
+
this.options = $.extend({}, $.fn.button.defaults, options)
|
30
|
+
}
|
31
|
+
|
32
|
+
Button.prototype = {
|
33
|
+
|
34
|
+
constructor: Button
|
35
|
+
|
36
|
+
, setState: function ( state ) {
|
37
|
+
var d = 'disabled'
|
38
|
+
, $el = this.$element
|
39
|
+
, data = $el.data()
|
40
|
+
, val = $el.is('input') ? 'val' : 'html'
|
41
|
+
|
42
|
+
state = state + 'Text'
|
43
|
+
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
|
+
, toggle: function () {
|
56
|
+
var $parent = this.$element.parent('[data-toggle="buttons-radio"]')
|
57
|
+
|
58
|
+
$parent && $parent
|
59
|
+
.find('.active')
|
60
|
+
.removeClass('active')
|
61
|
+
|
62
|
+
this.$element.toggleClass('active')
|
63
|
+
}
|
64
|
+
|
65
|
+
}
|
66
|
+
|
67
|
+
|
68
|
+
/* BUTTON PLUGIN DEFINITION
|
69
|
+
* ======================== */
|
70
|
+
|
71
|
+
$.fn.button = function ( option ) {
|
72
|
+
return this.each(function () {
|
73
|
+
var $this = $(this)
|
74
|
+
, data = $this.data('button')
|
75
|
+
, options = typeof option == 'object' && option
|
76
|
+
if (!data) $this.data('button', (data = new Button(this, options)))
|
77
|
+
if (option == 'toggle') data.toggle()
|
78
|
+
else if (option) data.setState(option)
|
79
|
+
})
|
80
|
+
}
|
81
|
+
|
82
|
+
$.fn.button.defaults = {
|
83
|
+
loadingText: 'loading...'
|
84
|
+
}
|
85
|
+
|
86
|
+
$.fn.button.Constructor = Button
|
87
|
+
|
88
|
+
|
89
|
+
/* BUTTON DATA-API
|
90
|
+
* =============== */
|
91
|
+
|
92
|
+
$(function () {
|
93
|
+
$('body').on('click.button.data-api', '[data-toggle^=button]', function ( e ) {
|
94
|
+
$(e.target).button('toggle')
|
95
|
+
})
|
96
|
+
})
|
97
|
+
|
98
|
+
}( window.jQuery )
|
@@ -0,0 +1,154 @@
|
|
1
|
+
/* ==========================================================
|
2
|
+
* bootstrap-carousel.js v2.0.0
|
3
|
+
* http://twitter.github.com/bootstrap/javascript.html#carousel
|
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"
|
24
|
+
|
25
|
+
/* CAROUSEL CLASS DEFINITION
|
26
|
+
* ========================= */
|
27
|
+
|
28
|
+
var Carousel = function (element, options) {
|
29
|
+
this.$element = $(element)
|
30
|
+
this.options = $.extend({}, $.fn.carousel.defaults, options)
|
31
|
+
this.options.slide && this.slide(this.options.slide)
|
32
|
+
}
|
33
|
+
|
34
|
+
Carousel.prototype = {
|
35
|
+
|
36
|
+
cycle: function () {
|
37
|
+
this.interval = setInterval($.proxy(this.next, this), this.options.interval)
|
38
|
+
return this
|
39
|
+
}
|
40
|
+
|
41
|
+
, to: function (pos) {
|
42
|
+
var $active = this.$element.find('.active')
|
43
|
+
, children = $active.parent().children()
|
44
|
+
, activePos = children.index($active)
|
45
|
+
, that = this
|
46
|
+
|
47
|
+
if (pos > (children.length - 1) || pos < 0) return
|
48
|
+
|
49
|
+
if (this.sliding) {
|
50
|
+
return this.$element.one('slid', function () {
|
51
|
+
that.to(pos)
|
52
|
+
})
|
53
|
+
}
|
54
|
+
|
55
|
+
if (activePos == pos) {
|
56
|
+
return this.pause().cycle()
|
57
|
+
}
|
58
|
+
|
59
|
+
return this.slide(pos > activePos ? 'next' : 'prev', $(children[pos]))
|
60
|
+
}
|
61
|
+
|
62
|
+
, pause: function () {
|
63
|
+
clearInterval(this.interval)
|
64
|
+
return this
|
65
|
+
}
|
66
|
+
|
67
|
+
, next: function () {
|
68
|
+
if (this.sliding) return
|
69
|
+
return this.slide('next')
|
70
|
+
}
|
71
|
+
|
72
|
+
, prev: function () {
|
73
|
+
if (this.sliding) return
|
74
|
+
return this.slide('prev')
|
75
|
+
}
|
76
|
+
|
77
|
+
, slide: function (type, next) {
|
78
|
+
var $active = this.$element.find('.active')
|
79
|
+
, $next = next || $active[type]()
|
80
|
+
, isCycling = this.interval
|
81
|
+
, direction = type == 'next' ? 'left' : 'right'
|
82
|
+
, fallback = type == 'next' ? 'first' : 'last'
|
83
|
+
, that = this
|
84
|
+
|
85
|
+
this.sliding = true
|
86
|
+
|
87
|
+
isCycling && this.pause()
|
88
|
+
|
89
|
+
$next = $next.length ? $next : this.$element.find('.item')[fallback]()
|
90
|
+
|
91
|
+
if (!$.support.transition && this.$element.hasClass('slide')) {
|
92
|
+
this.$element.trigger('slide')
|
93
|
+
$active.removeClass('active')
|
94
|
+
$next.addClass('active')
|
95
|
+
this.sliding = false
|
96
|
+
this.$element.trigger('slid')
|
97
|
+
} else {
|
98
|
+
$next.addClass(type)
|
99
|
+
$next[0].offsetWidth // force reflow
|
100
|
+
$active.addClass(direction)
|
101
|
+
$next.addClass(direction)
|
102
|
+
this.$element.trigger('slide')
|
103
|
+
this.$element.one($.support.transition.end, function () {
|
104
|
+
$next.removeClass([type, direction].join(' ')).addClass('active')
|
105
|
+
$active.removeClass(['active', direction].join(' '))
|
106
|
+
that.sliding = false
|
107
|
+
setTimeout(function () { that.$element.trigger('slid') }, 0)
|
108
|
+
})
|
109
|
+
}
|
110
|
+
|
111
|
+
isCycling && this.cycle()
|
112
|
+
|
113
|
+
return this
|
114
|
+
}
|
115
|
+
|
116
|
+
}
|
117
|
+
|
118
|
+
|
119
|
+
/* CAROUSEL PLUGIN DEFINITION
|
120
|
+
* ========================== */
|
121
|
+
|
122
|
+
$.fn.carousel = function ( option ) {
|
123
|
+
return this.each(function () {
|
124
|
+
var $this = $(this)
|
125
|
+
, data = $this.data('carousel')
|
126
|
+
, options = typeof option == 'object' && option
|
127
|
+
if (!data) $this.data('carousel', (data = new Carousel(this, options)))
|
128
|
+
if (typeof option == 'number') data.to(option)
|
129
|
+
else if (typeof option == 'string' || (option = options.slide)) data[option]()
|
130
|
+
else data.cycle()
|
131
|
+
})
|
132
|
+
}
|
133
|
+
|
134
|
+
$.fn.carousel.defaults = {
|
135
|
+
interval: 5000
|
136
|
+
}
|
137
|
+
|
138
|
+
$.fn.carousel.Constructor = Carousel
|
139
|
+
|
140
|
+
|
141
|
+
/* CAROUSEL DATA-API
|
142
|
+
* ================= */
|
143
|
+
|
144
|
+
$(function () {
|
145
|
+
$('body').on('click.carousel.data-api', '[data-slide]', function ( e ) {
|
146
|
+
var $this = $(this), href
|
147
|
+
, $target = $($this.attr('data-target') || (href = $this.attr('href')) && href.replace(/.*(?=#[^\s]+$)/, '')) //strip for ie7
|
148
|
+
, options = !$target.data('modal') && $.extend({}, $target.data(), $this.data())
|
149
|
+
$target.carousel(options)
|
150
|
+
e.preventDefault()
|
151
|
+
})
|
152
|
+
})
|
153
|
+
|
154
|
+
}( window.jQuery )
|