Skip to content

Commit 1964331

Browse files
committed
Updated to Bootstrap 3.3.0
1 parent 71d7071 commit 1964331

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

51 files changed

+623
-400
lines changed

README.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
1-
Bootstrap Stylus 3.2.0
1+
Bootstrap Stylus 3.3.0
22
======================
33

4-
Port of the amazing [Bootstrap 3.2.0](https://github.com/twbs/bootstrap) to [Stylus 0.47.0](http://learnboost.github.com/stylus/).
4+
Port of the amazing [Bootstrap 3.3.0](https://github.com/twbs/bootstrap) to [Stylus 0.47.0](http://learnboost.github.com/stylus/).
55

66
There might be some slight color differences due to the differences between the color functions in LESS and those in Stylus.
77

bower.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "bootstrap-stylus",
3-
"version": "3.2.0",
3+
"version": "3.3.0",
44
"main": "stylus/bootstrap.styl",
55
"description": "A port of Bootstrap to Stylus",
66
"ignore": [

fonts/glyphicons-halflings-regular.svg

Lines changed: 1 addition & 1 deletion
Loading

js/affix.js

Lines changed: 43 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/* ========================================================================
2-
* Bootstrap: affix.js v3.2.0
2+
* Bootstrap: affix.js v3.3.0
33
* http://getbootstrap.com/javascript/#affix
44
* ========================================================================
55
* Copyright 2011-2014 Twitter, Inc.
@@ -28,7 +28,7 @@
2828
this.checkPosition()
2929
}
3030

31-
Affix.VERSION = '3.2.0'
31+
Affix.VERSION = '3.3.0'
3232

3333
Affix.RESET = 'affix affix-top affix-bottom'
3434

@@ -37,6 +37,28 @@
3737
target: window
3838
}
3939

40+
Affix.prototype.getState = function (scrollHeight, height, offsetTop, offsetBottom) {
41+
var scrollTop = this.$target.scrollTop()
42+
var position = this.$element.offset()
43+
var targetHeight = this.$target.height()
44+
45+
if (offsetTop != null && this.affixed == 'top') return scrollTop < offsetTop ? 'top' : false
46+
47+
if (this.affixed == 'bottom') {
48+
if (offsetTop != null) return (scrollTop + this.unpin <= position.top) ? false : 'bottom'
49+
return (scrollTop + targetHeight <= scrollHeight - offsetBottom) ? false : 'bottom'
50+
}
51+
52+
var initializing = this.affixed == null
53+
var colliderTop = initializing ? scrollTop : position.top
54+
var colliderHeight = initializing ? targetHeight : height
55+
56+
if (offsetTop != null && colliderTop <= offsetTop) return 'top'
57+
if (offsetBottom != null && (colliderTop + colliderHeight >= scrollHeight - offsetBottom)) return 'bottom'
58+
59+
return false
60+
}
61+
4062
Affix.prototype.getPinnedOffset = function () {
4163
if (this.pinnedOffset) return this.pinnedOffset
4264
this.$element.removeClass(Affix.RESET).addClass('affix')
@@ -52,42 +74,40 @@
5274
Affix.prototype.checkPosition = function () {
5375
if (!this.$element.is(':visible')) return
5476

55-
var scrollHeight = $(document).height()
56-
var scrollTop = this.$target.scrollTop()
57-
var position = this.$element.offset()
77+
var height = this.$element.height()
5878
var offset = this.options.offset
5979
var offsetTop = offset.top
6080
var offsetBottom = offset.bottom
81+
var scrollHeight = $('body').height()
6182

6283
if (typeof offset != 'object') offsetBottom = offsetTop = offset
6384
if (typeof offsetTop == 'function') offsetTop = offset.top(this.$element)
6485
if (typeof offsetBottom == 'function') offsetBottom = offset.bottom(this.$element)
6586

66-
var affix = this.unpin != null && (scrollTop + this.unpin <= position.top) ? false :
67-
offsetBottom != null && (position.top + this.$element.height() >= scrollHeight - offsetBottom) ? 'bottom' :
68-
offsetTop != null && (scrollTop <= offsetTop) ? 'top' : false
87+
var affix = this.getState(scrollHeight, height, offsetTop, offsetBottom)
6988

70-
if (this.affixed === affix) return
71-
if (this.unpin != null) this.$element.css('top', '')
89+
if (this.affixed != affix) {
90+
if (this.unpin != null) this.$element.css('top', '')
7291

73-
var affixType = 'affix' + (affix ? '-' + affix : '')
74-
var e = $.Event(affixType + '.bs.affix')
92+
var affixType = 'affix' + (affix ? '-' + affix : '')
93+
var e = $.Event(affixType + '.bs.affix')
7594

76-
this.$element.trigger(e)
95+
this.$element.trigger(e)
7796

78-
if (e.isDefaultPrevented()) return
97+
if (e.isDefaultPrevented()) return
7998

80-
this.affixed = affix
81-
this.unpin = affix == 'bottom' ? this.getPinnedOffset() : null
99+
this.affixed = affix
100+
this.unpin = affix == 'bottom' ? this.getPinnedOffset() : null
82101

83-
this.$element
84-
.removeClass(Affix.RESET)
85-
.addClass(affixType)
86-
.trigger($.Event(affixType.replace('affix', 'affixed')))
102+
this.$element
103+
.removeClass(Affix.RESET)
104+
.addClass(affixType)
105+
.trigger(affixType.replace('affix', 'affixed') + '.bs.affix')
106+
}
87107

88108
if (affix == 'bottom') {
89109
this.$element.offset({
90-
top: scrollHeight - this.$element.height() - offsetBottom
110+
top: scrollHeight - height - offsetBottom
91111
})
92112
}
93113
}
@@ -132,8 +152,8 @@
132152

133153
data.offset = data.offset || {}
134154

135-
if (data.offsetBottom) data.offset.bottom = data.offsetBottom
136-
if (data.offsetTop) data.offset.top = data.offsetTop
155+
if (data.offsetBottom != null) data.offset.bottom = data.offsetBottom
156+
if (data.offsetTop != null) data.offset.top = data.offsetTop
137157

138158
Plugin.call($spy, data)
139159
})

js/alert.js

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/* ========================================================================
2-
* Bootstrap: alert.js v3.2.0
2+
* Bootstrap: alert.js v3.3.0
33
* http://getbootstrap.com/javascript/#alerts
44
* ========================================================================
55
* Copyright 2011-2014 Twitter, Inc.
@@ -18,7 +18,9 @@
1818
$(el).on('click', dismiss, this.close)
1919
}
2020

21-
Alert.VERSION = '3.2.0'
21+
Alert.VERSION = '3.3.0'
22+
23+
Alert.TRANSITION_DURATION = 150
2224

2325
Alert.prototype.close = function (e) {
2426
var $this = $(this)
@@ -34,7 +36,7 @@
3436
if (e) e.preventDefault()
3537

3638
if (!$parent.length) {
37-
$parent = $this.hasClass('alert') ? $this : $this.parent()
39+
$parent = $this.closest('.alert')
3840
}
3941

4042
$parent.trigger(e = $.Event('close.bs.alert'))
@@ -51,7 +53,7 @@
5153
$.support.transition && $parent.hasClass('fade') ?
5254
$parent
5355
.one('bsTransitionEnd', removeElement)
54-
.emulateTransitionEnd(150) :
56+
.emulateTransitionEnd(Alert.TRANSITION_DURATION) :
5557
removeElement()
5658
}
5759

js/button.js

Lines changed: 16 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/* ========================================================================
2-
* Bootstrap: button.js v3.2.0
2+
* Bootstrap: button.js v3.3.0
33
* http://getbootstrap.com/javascript/#buttons
44
* ========================================================================
55
* Copyright 2011-2014 Twitter, Inc.
@@ -19,7 +19,7 @@
1919
this.isLoading = false
2020
}
2121

22-
Button.VERSION = '3.2.0'
22+
Button.VERSION = '3.3.0'
2323

2424
Button.DEFAULTS = {
2525
loadingText: 'loading...'
@@ -35,10 +35,10 @@
3535

3636
if (data.resetText == null) $el.data('resetText', $el[val]())
3737

38-
$el[val](data[state] == null ? this.options[state] : data[state])
39-
4038
// push to event loop to allow forms to submit
4139
setTimeout($.proxy(function () {
40+
$el[val](data[state] == null ? this.options[state] : data[state])
41+
4242
if (state == 'loadingText') {
4343
this.isLoading = true
4444
$el.addClass(d).attr(d, d)
@@ -60,6 +60,8 @@
6060
else $parent.find('.active').removeClass('active')
6161
}
6262
if (changed) $input.prop('checked', !this.$element.hasClass('active')).trigger('change')
63+
} else {
64+
this.$element.attr('aria-pressed', !this.$element.hasClass('active'))
6365
}
6466

6567
if (changed) this.$element.toggleClass('active')
@@ -100,11 +102,15 @@
100102
// BUTTON DATA-API
101103
// ===============
102104

103-
$(document).on('click.bs.button.data-api', '[data-toggle^="button"]', function (e) {
104-
var $btn = $(e.target)
105-
if (!$btn.hasClass('btn')) $btn = $btn.closest('.btn')
106-
Plugin.call($btn, 'toggle')
107-
e.preventDefault()
108-
})
105+
$(document)
106+
.on('click.bs.button.data-api', '[data-toggle^="button"]', function (e) {
107+
var $btn = $(e.target)
108+
if (!$btn.hasClass('btn')) $btn = $btn.closest('.btn')
109+
Plugin.call($btn, 'toggle')
110+
e.preventDefault()
111+
})
112+
.on('focus.bs.button.data-api blur.bs.button.data-api', '[data-toggle^="button"]', function (e) {
113+
$(e.target).closest('.btn').toggleClass('focus', e.type == 'focus')
114+
})
109115

110116
}(jQuery);

js/carousel.js

Lines changed: 26 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/* ========================================================================
2-
* Bootstrap: carousel.js v3.2.0
2+
* Bootstrap: carousel.js v3.3.0
33
* http://getbootstrap.com/javascript/#carousel
44
* ========================================================================
55
* Copyright 2011-2014 Twitter, Inc.
@@ -14,7 +14,7 @@
1414
// =========================
1515

1616
var Carousel = function (element, options) {
17-
this.$element = $(element).on('keydown.bs.carousel', $.proxy(this.keydown, this))
17+
this.$element = $(element)
1818
this.$indicators = this.$element.find('.carousel-indicators')
1919
this.options = options
2020
this.paused =
@@ -23,17 +23,22 @@
2323
this.$active =
2424
this.$items = null
2525

26-
this.options.pause == 'hover' && this.$element
26+
this.options.keyboard && this.$element.on('keydown.bs.carousel', $.proxy(this.keydown, this))
27+
28+
this.options.pause == 'hover' && !('ontouchstart' in document.documentElement) && this.$element
2729
.on('mouseenter.bs.carousel', $.proxy(this.pause, this))
2830
.on('mouseleave.bs.carousel', $.proxy(this.cycle, this))
2931
}
3032

31-
Carousel.VERSION = '3.2.0'
33+
Carousel.VERSION = '3.3.0'
34+
35+
Carousel.TRANSITION_DURATION = 600
3236

3337
Carousel.DEFAULTS = {
3438
interval: 5000,
3539
pause: 'hover',
36-
wrap: true
40+
wrap: true,
41+
keyboard: true
3742
}
3843

3944
Carousel.prototype.keydown = function (e) {
@@ -63,6 +68,13 @@
6368
return this.$items.index(item || this.$active)
6469
}
6570

71+
Carousel.prototype.getItemForDirection = function (direction, active) {
72+
var delta = direction == 'prev' ? -1 : 1
73+
var activeIndex = this.getItemIndex(active)
74+
var itemIndex = (activeIndex + delta) % this.$items.length
75+
return this.$items.eq(itemIndex)
76+
}
77+
6678
Carousel.prototype.to = function (pos) {
6779
var that = this
6880
var activeIndex = this.getItemIndex(this.$active = this.$element.find('.item.active'))
@@ -72,7 +84,7 @@
7284
if (this.sliding) return this.$element.one('slid.bs.carousel', function () { that.to(pos) }) // yes, "slid"
7385
if (activeIndex == pos) return this.pause().cycle()
7486

75-
return this.slide(pos > activeIndex ? 'next' : 'prev', $(this.$items[pos]))
87+
return this.slide(pos > activeIndex ? 'next' : 'prev', this.$items.eq(pos))
7688
}
7789

7890
Carousel.prototype.pause = function (e) {
@@ -100,7 +112,7 @@
100112

101113
Carousel.prototype.slide = function (type, next) {
102114
var $active = this.$element.find('.item.active')
103-
var $next = next || $active[type]()
115+
var $next = next || this.getItemForDirection(type, $active)
104116
var isCycling = this.interval
105117
var direction = type == 'next' ? 'left' : 'right'
106118
var fallback = type == 'next' ? 'first' : 'last'
@@ -146,7 +158,7 @@
146158
that.$element.trigger(slidEvent)
147159
}, 0)
148160
})
149-
.emulateTransitionEnd($active.css('transition-duration').slice(0, -1) * 1000)
161+
.emulateTransitionEnd(Carousel.TRANSITION_DURATION)
150162
} else {
151163
$active.removeClass('active')
152164
$next.addClass('active')
@@ -195,7 +207,7 @@
195207
// CAROUSEL DATA-API
196208
// =================
197209

198-
$(document).on('click.bs.carousel.data-api', '[data-slide], [data-slide-to]', function (e) {
210+
var clickHandler = function (e) {
199211
var href
200212
var $this = $(this)
201213
var $target = $($this.attr('data-target') || (href = $this.attr('href')) && href.replace(/.*(?=#[^\s]+$)/, '')) // strip for ie7
@@ -211,7 +223,11 @@
211223
}
212224

213225
e.preventDefault()
214-
})
226+
}
227+
228+
$(document)
229+
.on('click.bs.carousel.data-api', '[data-slide]', clickHandler)
230+
.on('click.bs.carousel.data-api', '[data-slide-to]', clickHandler)
215231

216232
$(window).on('load', function () {
217233
$('[data-ride="carousel"]').each(function () {

0 commit comments

Comments
 (0)