bootstrap-jasny 0.1.12
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/LICENSE.txt +20 -0
- data/README.rdoc +27 -0
- data/lib/bootstrap-jasny.rb +51 -0
- data/lib/bootstrap-jasny/compass_functions.rb +24 -0
- data/lib/bootstrap-jasny/engine.rb +7 -0
- data/lib/bootstrap-jasny/less_functions.rb +14 -0
- data/vendor/assets/fonts/bootstrap/iconic/iconic_fill.eot +0 -0
- data/vendor/assets/fonts/bootstrap/iconic/iconic_fill.otf +0 -0
- data/vendor/assets/fonts/bootstrap/iconic/iconic_fill.svg +475 -0
- data/vendor/assets/fonts/bootstrap/iconic/iconic_fill.ttf +0 -0
- data/vendor/assets/fonts/bootstrap/iconic/iconic_fill.woff +0 -0
- data/vendor/assets/fonts/bootstrap/iconic/iconic_stroke.eot +0 -0
- data/vendor/assets/fonts/bootstrap/iconic/iconic_stroke.otf +0 -0
- data/vendor/assets/fonts/bootstrap/iconic/iconic_stroke.svg +492 -0
- data/vendor/assets/fonts/bootstrap/iconic/iconic_stroke.ttf +0 -0
- data/vendor/assets/fonts/bootstrap/iconic/iconic_stroke.woff +0 -0
- data/vendor/assets/images/bootstrap/glyphicons-halflings-white.png +0 -0
- data/vendor/assets/images/bootstrap/glyphicons-halflings.png +0 -0
- data/vendor/assets/javascripts/bootstrap-affix.js +117 -0
- data/vendor/assets/javascripts/bootstrap-alert.js +99 -0
- data/vendor/assets/javascripts/bootstrap-button.js +105 -0
- data/vendor/assets/javascripts/bootstrap-carousel.js +207 -0
- data/vendor/assets/javascripts/bootstrap-collapse.js +167 -0
- data/vendor/assets/javascripts/bootstrap-dropdown.js +165 -0
- data/vendor/assets/javascripts/bootstrap-fileupload.js +169 -0
- data/vendor/assets/javascripts/bootstrap-inputmask.js +355 -0
- data/vendor/assets/javascripts/bootstrap-modal.js +247 -0
- data/vendor/assets/javascripts/bootstrap-popover.js +114 -0
- data/vendor/assets/javascripts/bootstrap-rowlink.js +71 -0
- data/vendor/assets/javascripts/bootstrap-scrollspy.js +162 -0
- data/vendor/assets/javascripts/bootstrap-tab.js +144 -0
- data/vendor/assets/javascripts/bootstrap-tooltip.js +361 -0
- data/vendor/assets/javascripts/bootstrap-transition.js +60 -0
- data/vendor/assets/javascripts/bootstrap-typeahead.js +524 -0
- data/vendor/assets/javascripts/bootstrap.js +21 -0
- data/vendor/assets/stylesheets/bootstrap-responsive.less +1 -0
- data/vendor/assets/stylesheets/bootstrap.less +2 -0
- data/vendor/assets/stylesheets/bootstrap/accordion.less +34 -0
- data/vendor/assets/stylesheets/bootstrap/action-areas.less +14 -0
- data/vendor/assets/stylesheets/bootstrap/action-links.less +57 -0
- data/vendor/assets/stylesheets/bootstrap/alerts.less +79 -0
- data/vendor/assets/stylesheets/bootstrap/bootstrap.less +63 -0
- data/vendor/assets/stylesheets/bootstrap/breadcrumbs.less +24 -0
- data/vendor/assets/stylesheets/bootstrap/button-groups.less +229 -0
- data/vendor/assets/stylesheets/bootstrap/buttons.less +228 -0
- data/vendor/assets/stylesheets/bootstrap/carousel.less +158 -0
- data/vendor/assets/stylesheets/bootstrap/close.less +32 -0
- data/vendor/assets/stylesheets/bootstrap/code.less +61 -0
- data/vendor/assets/stylesheets/bootstrap/component-animations.less +22 -0
- data/vendor/assets/stylesheets/bootstrap/dropdowns.less +237 -0
- data/vendor/assets/stylesheets/bootstrap/fileupload.less +105 -0
- data/vendor/assets/stylesheets/bootstrap/forms-uneditable.less +159 -0
- data/vendor/assets/stylesheets/bootstrap/forms.less +690 -0
- data/vendor/assets/stylesheets/bootstrap/grid.less +21 -0
- data/vendor/assets/stylesheets/bootstrap/hero-unit.less +25 -0
- data/vendor/assets/stylesheets/bootstrap/iconic.less +209 -0
- data/vendor/assets/stylesheets/bootstrap/jasny-bootstrap.less +31 -0
- data/vendor/assets/stylesheets/bootstrap/jasny-forms.less +99 -0
- data/vendor/assets/stylesheets/bootstrap/jasny-forms.responsive-1200px-min.less +16 -0
- data/vendor/assets/stylesheets/bootstrap/jasny-forms.responsive-767px-max.less +17 -0
- data/vendor/assets/stylesheets/bootstrap/jasny-forms.responsive-768px-979px.less +36 -0
- data/vendor/assets/stylesheets/bootstrap/jasny-navs-tabbable.less +148 -0
- data/vendor/assets/stylesheets/bootstrap/jasny-responsive.less +27 -0
- data/vendor/assets/stylesheets/bootstrap/labels-badges.less +84 -0
- data/vendor/assets/stylesheets/bootstrap/layouts-semifluid.less +11 -0
- data/vendor/assets/stylesheets/bootstrap/layouts-semifluid.responsive-1200px-min.less +7 -0
- data/vendor/assets/stylesheets/bootstrap/layouts.less +16 -0
- data/vendor/assets/stylesheets/bootstrap/media.less +55 -0
- data/vendor/assets/stylesheets/bootstrap/mixins.less +702 -0
- data/vendor/assets/stylesheets/bootstrap/modals.less +95 -0
- data/vendor/assets/stylesheets/bootstrap/navbar.less +497 -0
- data/vendor/assets/stylesheets/bootstrap/navs.less +409 -0
- data/vendor/assets/stylesheets/bootstrap/page-alert.less +23 -0
- data/vendor/assets/stylesheets/bootstrap/page-alert.responsive-1200px-min.less +11 -0
- data/vendor/assets/stylesheets/bootstrap/page-alert.responsive-767px-max.less +20 -0
- data/vendor/assets/stylesheets/bootstrap/pager.less +43 -0
- data/vendor/assets/stylesheets/bootstrap/pagination.less +123 -0
- data/vendor/assets/stylesheets/bootstrap/popovers.less +133 -0
- data/vendor/assets/stylesheets/bootstrap/progress-bars.less +122 -0
- data/vendor/assets/stylesheets/bootstrap/reset.less +216 -0
- data/vendor/assets/stylesheets/bootstrap/responsive-1200px-min.less +28 -0
- data/vendor/assets/stylesheets/bootstrap/responsive-767px-max.less +193 -0
- data/vendor/assets/stylesheets/bootstrap/responsive-768px-979px.less +19 -0
- data/vendor/assets/stylesheets/bootstrap/responsive-navbar.less +189 -0
- data/vendor/assets/stylesheets/bootstrap/responsive-row-desktop.less +23 -0
- data/vendor/assets/stylesheets/bootstrap/responsive-tables.less +30 -0
- data/vendor/assets/stylesheets/bootstrap/responsive-utilities.less +59 -0
- data/vendor/assets/stylesheets/bootstrap/responsive.less +48 -0
- data/vendor/assets/stylesheets/bootstrap/rowlink.less +20 -0
- data/vendor/assets/stylesheets/bootstrap/scaffolding.less +53 -0
- data/vendor/assets/stylesheets/bootstrap/sprites.less +197 -0
- data/vendor/assets/stylesheets/bootstrap/tables.less +244 -0
- data/vendor/assets/stylesheets/bootstrap/thumbnails.less +53 -0
- data/vendor/assets/stylesheets/bootstrap/tooltip.less +70 -0
- data/vendor/assets/stylesheets/bootstrap/type.less +247 -0
- data/vendor/assets/stylesheets/bootstrap/utilities.less +30 -0
- data/vendor/assets/stylesheets/bootstrap/variables.less +302 -0
- data/vendor/assets/stylesheets/bootstrap/wells.less +29 -0
- metadata +241 -0
@@ -0,0 +1,114 @@
|
|
1
|
+
/* ===========================================================
|
2
|
+
* bootstrap-popover.js v2.3.1
|
3
|
+
* http://twitter.github.com/bootstrap/javascript.html#popovers
|
4
|
+
* ===========================================================
|
5
|
+
* Copyright 2012 Twitter, Inc.
|
6
|
+
*
|
7
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
8
|
+
* you may not use this file except in compliance with the License.
|
9
|
+
* You may obtain a copy of the License at
|
10
|
+
*
|
11
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
12
|
+
*
|
13
|
+
* Unless required by applicable law or agreed to in writing, software
|
14
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
15
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
16
|
+
* See the License for the specific language governing permissions and
|
17
|
+
* limitations under the License.
|
18
|
+
* =========================================================== */
|
19
|
+
|
20
|
+
|
21
|
+
!function ($) {
|
22
|
+
|
23
|
+
"use strict"; // jshint ;_;
|
24
|
+
|
25
|
+
|
26
|
+
/* POPOVER PUBLIC CLASS DEFINITION
|
27
|
+
* =============================== */
|
28
|
+
|
29
|
+
var Popover = function (element, options) {
|
30
|
+
this.init('popover', element, options)
|
31
|
+
}
|
32
|
+
|
33
|
+
|
34
|
+
/* NOTE: POPOVER EXTENDS BOOTSTRAP-TOOLTIP.js
|
35
|
+
========================================== */
|
36
|
+
|
37
|
+
Popover.prototype = $.extend({}, $.fn.tooltip.Constructor.prototype, {
|
38
|
+
|
39
|
+
constructor: Popover
|
40
|
+
|
41
|
+
, setContent: function () {
|
42
|
+
var $tip = this.tip()
|
43
|
+
, title = this.getTitle()
|
44
|
+
, content = this.getContent()
|
45
|
+
|
46
|
+
$tip.find('.popover-title')[this.options.html ? 'html' : 'text'](title)
|
47
|
+
$tip.find('.popover-content')[this.options.html ? 'html' : 'text'](content)
|
48
|
+
|
49
|
+
$tip.removeClass('fade top bottom left right in')
|
50
|
+
}
|
51
|
+
|
52
|
+
, hasContent: function () {
|
53
|
+
return this.getTitle() || this.getContent()
|
54
|
+
}
|
55
|
+
|
56
|
+
, getContent: function () {
|
57
|
+
var content
|
58
|
+
, $e = this.$element
|
59
|
+
, o = this.options
|
60
|
+
|
61
|
+
content = (typeof o.content == 'function' ? o.content.call($e[0]) : o.content)
|
62
|
+
|| $e.attr('data-content')
|
63
|
+
|
64
|
+
return content
|
65
|
+
}
|
66
|
+
|
67
|
+
, tip: function () {
|
68
|
+
if (!this.$tip) {
|
69
|
+
this.$tip = $(this.options.template)
|
70
|
+
}
|
71
|
+
return this.$tip
|
72
|
+
}
|
73
|
+
|
74
|
+
, destroy: function () {
|
75
|
+
this.hide().$element.off('.' + this.type).removeData(this.type)
|
76
|
+
}
|
77
|
+
|
78
|
+
})
|
79
|
+
|
80
|
+
|
81
|
+
/* POPOVER PLUGIN DEFINITION
|
82
|
+
* ======================= */
|
83
|
+
|
84
|
+
var old = $.fn.popover
|
85
|
+
|
86
|
+
$.fn.popover = function (option) {
|
87
|
+
return this.each(function () {
|
88
|
+
var $this = $(this)
|
89
|
+
, data = $this.data('popover')
|
90
|
+
, options = typeof option == 'object' && option
|
91
|
+
if (!data) $this.data('popover', (data = new Popover(this, options)))
|
92
|
+
if (typeof option == 'string') data[option]()
|
93
|
+
})
|
94
|
+
}
|
95
|
+
|
96
|
+
$.fn.popover.Constructor = Popover
|
97
|
+
|
98
|
+
$.fn.popover.defaults = $.extend({} , $.fn.tooltip.defaults, {
|
99
|
+
placement: 'right'
|
100
|
+
, trigger: 'click'
|
101
|
+
, content: ''
|
102
|
+
, template: '<div class="popover"><div class="arrow"></div><h3 class="popover-title"></h3><div class="popover-content"></div></div>'
|
103
|
+
})
|
104
|
+
|
105
|
+
|
106
|
+
/* POPOVER NO CONFLICT
|
107
|
+
* =================== */
|
108
|
+
|
109
|
+
$.fn.popover.noConflict = function () {
|
110
|
+
$.fn.popover = old
|
111
|
+
return this
|
112
|
+
}
|
113
|
+
|
114
|
+
}(window.jQuery);
|
@@ -0,0 +1,71 @@
|
|
1
|
+
/* ============================================================
|
2
|
+
* bootstrap-rowlink.js j1
|
3
|
+
* http://jasny.github.com/bootstrap/javascript.html#rowlink
|
4
|
+
* ============================================================
|
5
|
+
* Copyright 2012 Jasny BV, Netherlands.
|
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"; // jshint ;_;
|
23
|
+
|
24
|
+
var Rowlink = function (element, options) {
|
25
|
+
options = $.extend({}, $.fn.rowlink.defaults, options)
|
26
|
+
var tr = element.nodeName.toLowerCase() == 'tr' ? $(element) : $(element).find('tr:has(td)')
|
27
|
+
|
28
|
+
tr.each(function() {
|
29
|
+
var link = $(this).find(options.target).first()
|
30
|
+
if (!link.length) return
|
31
|
+
|
32
|
+
var href = link.attr('href')
|
33
|
+
|
34
|
+
$(this).find('td').not('.nolink').click(function() {
|
35
|
+
window.location = href;
|
36
|
+
})
|
37
|
+
|
38
|
+
$(this).addClass('rowlink')
|
39
|
+
link.replaceWith(link.html())
|
40
|
+
})
|
41
|
+
}
|
42
|
+
|
43
|
+
|
44
|
+
/* ROWLINK PLUGIN DEFINITION
|
45
|
+
* =========================== */
|
46
|
+
|
47
|
+
$.fn.rowlink = function (options) {
|
48
|
+
return this.each(function () {
|
49
|
+
var $this = $(this)
|
50
|
+
, data = $this.data('rowlink')
|
51
|
+
if (!data) $this.data('rowlink', (data = new Rowlink(this, options)))
|
52
|
+
})
|
53
|
+
}
|
54
|
+
|
55
|
+
$.fn.rowlink.defaults = {
|
56
|
+
target: "a"
|
57
|
+
}
|
58
|
+
|
59
|
+
$.fn.rowlink.Constructor = Rowlink
|
60
|
+
|
61
|
+
|
62
|
+
/* ROWLINK DATA-API
|
63
|
+
* ================== */
|
64
|
+
|
65
|
+
$(function () {
|
66
|
+
$('[data-provide="rowlink"],[data-provides="rowlink"]').each(function () {
|
67
|
+
$(this).rowlink($(this).data())
|
68
|
+
})
|
69
|
+
})
|
70
|
+
|
71
|
+
}(window.jQuery);
|
@@ -0,0 +1,162 @@
|
|
1
|
+
/* =============================================================
|
2
|
+
* bootstrap-scrollspy.js v2.3.1
|
3
|
+
* http://twitter.github.com/bootstrap/javascript.html#scrollspy
|
4
|
+
* =============================================================
|
5
|
+
* Copyright 2012 Twitter, Inc.
|
6
|
+
*
|
7
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
8
|
+
* you may not use this file except in compliance with the License.
|
9
|
+
* You may obtain a copy of the License at
|
10
|
+
*
|
11
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
12
|
+
*
|
13
|
+
* Unless required by applicable law or agreed to in writing, software
|
14
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
15
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
16
|
+
* See the License for the specific language governing permissions and
|
17
|
+
* limitations under the License.
|
18
|
+
* ============================================================== */
|
19
|
+
|
20
|
+
|
21
|
+
!function ($) {
|
22
|
+
|
23
|
+
"use strict"; // jshint ;_;
|
24
|
+
|
25
|
+
|
26
|
+
/* SCROLLSPY CLASS DEFINITION
|
27
|
+
* ========================== */
|
28
|
+
|
29
|
+
function ScrollSpy(element, options) {
|
30
|
+
var process = $.proxy(this.process, this)
|
31
|
+
, $element = $(element).is('body') ? $(window) : $(element)
|
32
|
+
, href
|
33
|
+
this.options = $.extend({}, $.fn.scrollspy.defaults, options)
|
34
|
+
this.$scrollElement = $element.on('scroll.scroll-spy.data-api', process)
|
35
|
+
this.selector = (this.options.target
|
36
|
+
|| ((href = $(element).attr('href')) && href.replace(/.*(?=#[^\s]+$)/, '')) //strip for ie7
|
37
|
+
|| '') + ' .nav li > a'
|
38
|
+
this.$body = $('body')
|
39
|
+
this.refresh()
|
40
|
+
this.process()
|
41
|
+
}
|
42
|
+
|
43
|
+
ScrollSpy.prototype = {
|
44
|
+
|
45
|
+
constructor: ScrollSpy
|
46
|
+
|
47
|
+
, refresh: function () {
|
48
|
+
var self = this
|
49
|
+
, $targets
|
50
|
+
|
51
|
+
this.offsets = $([])
|
52
|
+
this.targets = $([])
|
53
|
+
|
54
|
+
$targets = this.$body
|
55
|
+
.find(this.selector)
|
56
|
+
.map(function () {
|
57
|
+
var $el = $(this)
|
58
|
+
, href = $el.data('target') || $el.attr('href')
|
59
|
+
, $href = /^#\w/.test(href) && $(href)
|
60
|
+
return ( $href
|
61
|
+
&& $href.length
|
62
|
+
&& [[ $href.position().top + (!$.isWindow(self.$scrollElement.get(0)) && self.$scrollElement.scrollTop()), href ]] ) || null
|
63
|
+
})
|
64
|
+
.sort(function (a, b) { return a[0] - b[0] })
|
65
|
+
.each(function () {
|
66
|
+
self.offsets.push(this[0])
|
67
|
+
self.targets.push(this[1])
|
68
|
+
})
|
69
|
+
}
|
70
|
+
|
71
|
+
, process: function () {
|
72
|
+
var scrollTop = this.$scrollElement.scrollTop() + this.options.offset
|
73
|
+
, scrollHeight = this.$scrollElement[0].scrollHeight || this.$body[0].scrollHeight
|
74
|
+
, maxScroll = scrollHeight - this.$scrollElement.height()
|
75
|
+
, offsets = this.offsets
|
76
|
+
, targets = this.targets
|
77
|
+
, activeTarget = this.activeTarget
|
78
|
+
, i
|
79
|
+
|
80
|
+
if (scrollTop >= maxScroll) {
|
81
|
+
return activeTarget != (i = targets.last()[0])
|
82
|
+
&& this.activate ( i )
|
83
|
+
}
|
84
|
+
|
85
|
+
for (i = offsets.length; i--;) {
|
86
|
+
activeTarget != targets[i]
|
87
|
+
&& scrollTop >= offsets[i]
|
88
|
+
&& (!offsets[i + 1] || scrollTop <= offsets[i + 1])
|
89
|
+
&& this.activate( targets[i] )
|
90
|
+
}
|
91
|
+
}
|
92
|
+
|
93
|
+
, activate: function (target) {
|
94
|
+
var active
|
95
|
+
, selector
|
96
|
+
|
97
|
+
this.activeTarget = target
|
98
|
+
|
99
|
+
$(this.selector)
|
100
|
+
.parent('.active')
|
101
|
+
.removeClass('active')
|
102
|
+
|
103
|
+
selector = this.selector
|
104
|
+
+ '[data-target="' + target + '"],'
|
105
|
+
+ this.selector + '[href="' + target + '"]'
|
106
|
+
|
107
|
+
active = $(selector)
|
108
|
+
.parent('li')
|
109
|
+
.addClass('active')
|
110
|
+
|
111
|
+
if (active.parent('.dropdown-menu').length) {
|
112
|
+
active = active.closest('li.dropdown').addClass('active')
|
113
|
+
}
|
114
|
+
|
115
|
+
active.trigger('activate')
|
116
|
+
}
|
117
|
+
|
118
|
+
}
|
119
|
+
|
120
|
+
|
121
|
+
/* SCROLLSPY PLUGIN DEFINITION
|
122
|
+
* =========================== */
|
123
|
+
|
124
|
+
var old = $.fn.scrollspy
|
125
|
+
|
126
|
+
$.fn.scrollspy = function (option) {
|
127
|
+
return this.each(function () {
|
128
|
+
var $this = $(this)
|
129
|
+
, data = $this.data('scrollspy')
|
130
|
+
, options = typeof option == 'object' && option
|
131
|
+
if (!data) $this.data('scrollspy', (data = new ScrollSpy(this, options)))
|
132
|
+
if (typeof option == 'string') data[option]()
|
133
|
+
})
|
134
|
+
}
|
135
|
+
|
136
|
+
$.fn.scrollspy.Constructor = ScrollSpy
|
137
|
+
|
138
|
+
$.fn.scrollspy.defaults = {
|
139
|
+
offset: 10
|
140
|
+
}
|
141
|
+
|
142
|
+
|
143
|
+
/* SCROLLSPY NO CONFLICT
|
144
|
+
* ===================== */
|
145
|
+
|
146
|
+
$.fn.scrollspy.noConflict = function () {
|
147
|
+
$.fn.scrollspy = old
|
148
|
+
return this
|
149
|
+
}
|
150
|
+
|
151
|
+
|
152
|
+
/* SCROLLSPY DATA-API
|
153
|
+
* ================== */
|
154
|
+
|
155
|
+
$(window).on('load', function () {
|
156
|
+
$('[data-spy="scroll"]').each(function () {
|
157
|
+
var $spy = $(this)
|
158
|
+
$spy.scrollspy($spy.data())
|
159
|
+
})
|
160
|
+
})
|
161
|
+
|
162
|
+
}(window.jQuery);
|
@@ -0,0 +1,144 @@
|
|
1
|
+
/* ========================================================
|
2
|
+
* bootstrap-tab.js v2.3.1
|
3
|
+
* http://twitter.github.com/bootstrap/javascript.html#tabs
|
4
|
+
* ========================================================
|
5
|
+
* Copyright 2012 Twitter, Inc.
|
6
|
+
*
|
7
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
8
|
+
* you may not use this file except in compliance with the License.
|
9
|
+
* You may obtain a copy of the License at
|
10
|
+
*
|
11
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
12
|
+
*
|
13
|
+
* Unless required by applicable law or agreed to in writing, software
|
14
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
15
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
16
|
+
* See the License for the specific language governing permissions and
|
17
|
+
* limitations under the License.
|
18
|
+
* ======================================================== */
|
19
|
+
|
20
|
+
|
21
|
+
!function ($) {
|
22
|
+
|
23
|
+
"use strict"; // jshint ;_;
|
24
|
+
|
25
|
+
|
26
|
+
/* TAB CLASS DEFINITION
|
27
|
+
* ==================== */
|
28
|
+
|
29
|
+
var Tab = function (element) {
|
30
|
+
this.element = $(element)
|
31
|
+
}
|
32
|
+
|
33
|
+
Tab.prototype = {
|
34
|
+
|
35
|
+
constructor: Tab
|
36
|
+
|
37
|
+
, show: function () {
|
38
|
+
var $this = this.element
|
39
|
+
, $ul = $this.closest('ul:not(.dropdown-menu)')
|
40
|
+
, selector = $this.attr('data-target')
|
41
|
+
, previous
|
42
|
+
, $target
|
43
|
+
, e
|
44
|
+
|
45
|
+
if (!selector) {
|
46
|
+
selector = $this.attr('href')
|
47
|
+
selector = selector && selector.replace(/.*(?=#[^\s]*$)/, '') //strip for ie7
|
48
|
+
}
|
49
|
+
|
50
|
+
if ( $this.parent('li').hasClass('active') ) return
|
51
|
+
|
52
|
+
previous = $ul.find('.active:last a')[0]
|
53
|
+
|
54
|
+
e = $.Event('show', {
|
55
|
+
relatedTarget: previous
|
56
|
+
})
|
57
|
+
|
58
|
+
$this.trigger(e)
|
59
|
+
|
60
|
+
if (e.isDefaultPrevented()) return
|
61
|
+
|
62
|
+
$target = $(selector)
|
63
|
+
|
64
|
+
this.activate($this.parent('li'), $ul)
|
65
|
+
this.activate($target, $target.parent(), function () {
|
66
|
+
$this.trigger({
|
67
|
+
type: 'shown'
|
68
|
+
, relatedTarget: previous
|
69
|
+
})
|
70
|
+
})
|
71
|
+
}
|
72
|
+
|
73
|
+
, activate: function ( element, container, callback) {
|
74
|
+
var $active = container.find('> .active')
|
75
|
+
, transition = callback
|
76
|
+
&& $.support.transition
|
77
|
+
&& $active.hasClass('fade')
|
78
|
+
|
79
|
+
function next() {
|
80
|
+
$active
|
81
|
+
.removeClass('active')
|
82
|
+
.find('> .dropdown-menu > .active')
|
83
|
+
.removeClass('active')
|
84
|
+
|
85
|
+
element.addClass('active')
|
86
|
+
|
87
|
+
if (transition) {
|
88
|
+
element[0].offsetWidth // reflow for transition
|
89
|
+
element.addClass('in')
|
90
|
+
} else {
|
91
|
+
element.removeClass('fade')
|
92
|
+
}
|
93
|
+
|
94
|
+
if ( element.parent('.dropdown-menu') ) {
|
95
|
+
element.closest('li.dropdown').addClass('active')
|
96
|
+
}
|
97
|
+
|
98
|
+
callback && callback()
|
99
|
+
}
|
100
|
+
|
101
|
+
transition ?
|
102
|
+
$active.one($.support.transition.end, next) :
|
103
|
+
next()
|
104
|
+
|
105
|
+
$active.removeClass('in')
|
106
|
+
}
|
107
|
+
}
|
108
|
+
|
109
|
+
|
110
|
+
/* TAB PLUGIN DEFINITION
|
111
|
+
* ===================== */
|
112
|
+
|
113
|
+
var old = $.fn.tab
|
114
|
+
|
115
|
+
$.fn.tab = function ( option ) {
|
116
|
+
return this.each(function () {
|
117
|
+
var $this = $(this)
|
118
|
+
, data = $this.data('tab')
|
119
|
+
if (!data) $this.data('tab', (data = new Tab(this)))
|
120
|
+
if (typeof option == 'string') data[option]()
|
121
|
+
})
|
122
|
+
}
|
123
|
+
|
124
|
+
$.fn.tab.Constructor = Tab
|
125
|
+
|
126
|
+
|
127
|
+
/* TAB NO CONFLICT
|
128
|
+
* =============== */
|
129
|
+
|
130
|
+
$.fn.tab.noConflict = function () {
|
131
|
+
$.fn.tab = old
|
132
|
+
return this
|
133
|
+
}
|
134
|
+
|
135
|
+
|
136
|
+
/* TAB DATA-API
|
137
|
+
* ============ */
|
138
|
+
|
139
|
+
$(document).on('click.tab.data-api', '[data-toggle="tab"], [data-toggle="pill"]', function (e) {
|
140
|
+
e.preventDefault()
|
141
|
+
$(this).tab('show')
|
142
|
+
})
|
143
|
+
|
144
|
+
}(window.jQuery);
|