Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/twbs/bootstrap-rubygem.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
path: root/assets
diff options
context:
space:
mode:
authorGleb Mazovetskiy <glex.spb@gmail.com>2014-07-29 03:52:55 +0400
committerGleb Mazovetskiy <glex.spb@gmail.com>2014-07-29 03:52:55 +0400
commitfe69b69f9527c38e90924d2c05aa33e155aca3ce (patch)
tree4b850caed90263569e86b8b01c138e8bcb0ecebe /assets
parentf5ee26fc989b39f6ad8f623083140a070482ebb7 (diff)
rake convert
Diffstat (limited to 'assets')
-rw-r--r--assets/javascripts/bootstrap.js70
-rw-r--r--assets/javascripts/bootstrap/affix.js58
-rw-r--r--assets/javascripts/bootstrap/dropdown.js12
-rw-r--r--assets/stylesheets/bootstrap/_code.scss1
-rw-r--r--assets/stylesheets/bootstrap/_forms.scss7
-rw-r--r--assets/stylesheets/bootstrap/_panels.scss5
6 files changed, 111 insertions, 42 deletions
diff --git a/assets/javascripts/bootstrap.js b/assets/javascripts/bootstrap.js
index f1c5020..7bafe37 100644
--- a/assets/javascripts/bootstrap.js
+++ b/assets/javascripts/bootstrap.js
@@ -37,6 +37,28 @@
target: window
}
+ Affix.prototype.getState = function (scrollHeight, height, offsetTop, offsetBottom) {
+ var scrollTop = this.$target.scrollTop()
+ var position = this.$element.offset()
+ var targetHeight = this.$target.height()
+
+ if (offsetTop != null && this.affixed == 'top') return scrollTop < offsetTop ? 'top' : false
+
+ if (this.affixed == 'bottom') {
+ if (offsetTop != null) return (scrollTop + this.unpin <= position.top) ? false : 'bottom'
+ return (scrollTop + targetHeight <= scrollHeight - offsetBottom) ? false : 'bottom'
+ }
+
+ var initializing = this.affixed == null
+ var colliderTop = initializing ? scrollTop : position.top
+ var colliderHeight = initializing ? targetHeight : height
+
+ if (offsetTop != null && colliderTop <= offsetTop) return 'top'
+ if (offsetBottom != null && (colliderTop + colliderHeight >= scrollHeight - offsetBottom)) return 'bottom'
+
+ return false
+ }
+
Affix.prototype.getPinnedOffset = function () {
if (this.pinnedOffset) return this.pinnedOffset
this.$element.removeClass(Affix.RESET).addClass('affix')
@@ -52,42 +74,40 @@
Affix.prototype.checkPosition = function () {
if (!this.$element.is(':visible')) return
- var scrollHeight = $(document).height()
- var scrollTop = this.$target.scrollTop()
- var position = this.$element.offset()
+ var height = this.$element.height()
var offset = this.options.offset
var offsetTop = offset.top
var offsetBottom = offset.bottom
+ var scrollHeight = $('body').height()
if (typeof offset != 'object') offsetBottom = offsetTop = offset
if (typeof offsetTop == 'function') offsetTop = offset.top(this.$element)
if (typeof offsetBottom == 'function') offsetBottom = offset.bottom(this.$element)
- var affix = this.unpin != null && (scrollTop + this.unpin <= position.top) ? false :
- offsetBottom != null && (position.top + this.$element.height() >= scrollHeight - offsetBottom) ? 'bottom' :
- offsetTop != null && (scrollTop <= offsetTop) ? 'top' : false
+ var affix = this.getState(scrollHeight, height, offsetTop, offsetBottom)
- if (this.affixed === affix) return
- if (this.unpin != null) this.$element.css('top', '')
+ if (this.affixed != affix) {
+ if (this.unpin != null) this.$element.css('top', '')
- var affixType = 'affix' + (affix ? '-' + affix : '')
- var e = $.Event(affixType + '.bs.affix')
+ var affixType = 'affix' + (affix ? '-' + affix : '')
+ var e = $.Event(affixType + '.bs.affix')
- this.$element.trigger(e)
+ this.$element.trigger(e)
- if (e.isDefaultPrevented()) return
+ if (e.isDefaultPrevented()) return
- this.affixed = affix
- this.unpin = affix == 'bottom' ? this.getPinnedOffset() : null
+ this.affixed = affix
+ this.unpin = affix == 'bottom' ? this.getPinnedOffset() : null
- this.$element
- .removeClass(Affix.RESET)
- .addClass(affixType)
- .trigger(affixType.replace('affix', 'affixed') + '.bs.affix')
+ this.$element
+ .removeClass(Affix.RESET)
+ .addClass(affixType)
+ .trigger(affixType.replace('affix', 'affixed') + '.bs.affix')
+ }
if (affix == 'bottom') {
this.$element.offset({
- top: scrollHeight - this.$element.height() - offsetBottom
+ top: scrollHeight - height - offsetBottom
})
}
}
@@ -787,7 +807,9 @@
if (e.isDefaultPrevented()) return
- $this.trigger('focus')
+ $this
+ .trigger('focus')
+ .attr('aria-expanded', 'true')
$parent
.toggleClass('open')
@@ -833,11 +855,17 @@
if (e && e.which === 3) return
$(backdrop).remove()
$(toggle).each(function () {
- var $parent = getParent($(this))
+ var $this = $(this)
+ var $parent = getParent($this)
var relatedTarget = { relatedTarget: this }
+
if (!$parent.hasClass('open')) return
+
$parent.trigger(e = $.Event('hide.bs.dropdown', relatedTarget))
+
if (e.isDefaultPrevented()) return
+
+ $this.attr('aria-expanded', 'false')
$parent.removeClass('open').trigger('hidden.bs.dropdown', relatedTarget)
})
}
diff --git a/assets/javascripts/bootstrap/affix.js b/assets/javascripts/bootstrap/affix.js
index 26b09db..bd48fc2 100644
--- a/assets/javascripts/bootstrap/affix.js
+++ b/assets/javascripts/bootstrap/affix.js
@@ -37,6 +37,28 @@
target: window
}
+ Affix.prototype.getState = function (scrollHeight, height, offsetTop, offsetBottom) {
+ var scrollTop = this.$target.scrollTop()
+ var position = this.$element.offset()
+ var targetHeight = this.$target.height()
+
+ if (offsetTop != null && this.affixed == 'top') return scrollTop < offsetTop ? 'top' : false
+
+ if (this.affixed == 'bottom') {
+ if (offsetTop != null) return (scrollTop + this.unpin <= position.top) ? false : 'bottom'
+ return (scrollTop + targetHeight <= scrollHeight - offsetBottom) ? false : 'bottom'
+ }
+
+ var initializing = this.affixed == null
+ var colliderTop = initializing ? scrollTop : position.top
+ var colliderHeight = initializing ? targetHeight : height
+
+ if (offsetTop != null && colliderTop <= offsetTop) return 'top'
+ if (offsetBottom != null && (colliderTop + colliderHeight >= scrollHeight - offsetBottom)) return 'bottom'
+
+ return false
+ }
+
Affix.prototype.getPinnedOffset = function () {
if (this.pinnedOffset) return this.pinnedOffset
this.$element.removeClass(Affix.RESET).addClass('affix')
@@ -52,42 +74,40 @@
Affix.prototype.checkPosition = function () {
if (!this.$element.is(':visible')) return
- var scrollHeight = $(document).height()
- var scrollTop = this.$target.scrollTop()
- var position = this.$element.offset()
+ var height = this.$element.height()
var offset = this.options.offset
var offsetTop = offset.top
var offsetBottom = offset.bottom
+ var scrollHeight = $('body').height()
if (typeof offset != 'object') offsetBottom = offsetTop = offset
if (typeof offsetTop == 'function') offsetTop = offset.top(this.$element)
if (typeof offsetBottom == 'function') offsetBottom = offset.bottom(this.$element)
- var affix = this.unpin != null && (scrollTop + this.unpin <= position.top) ? false :
- offsetBottom != null && (position.top + this.$element.height() >= scrollHeight - offsetBottom) ? 'bottom' :
- offsetTop != null && (scrollTop <= offsetTop) ? 'top' : false
+ var affix = this.getState(scrollHeight, height, offsetTop, offsetBottom)
- if (this.affixed === affix) return
- if (this.unpin != null) this.$element.css('top', '')
+ if (this.affixed != affix) {
+ if (this.unpin != null) this.$element.css('top', '')
- var affixType = 'affix' + (affix ? '-' + affix : '')
- var e = $.Event(affixType + '.bs.affix')
+ var affixType = 'affix' + (affix ? '-' + affix : '')
+ var e = $.Event(affixType + '.bs.affix')
- this.$element.trigger(e)
+ this.$element.trigger(e)
- if (e.isDefaultPrevented()) return
+ if (e.isDefaultPrevented()) return
- this.affixed = affix
- this.unpin = affix == 'bottom' ? this.getPinnedOffset() : null
+ this.affixed = affix
+ this.unpin = affix == 'bottom' ? this.getPinnedOffset() : null
- this.$element
- .removeClass(Affix.RESET)
- .addClass(affixType)
- .trigger(affixType.replace('affix', 'affixed') + '.bs.affix')
+ this.$element
+ .removeClass(Affix.RESET)
+ .addClass(affixType)
+ .trigger(affixType.replace('affix', 'affixed') + '.bs.affix')
+ }
if (affix == 'bottom') {
this.$element.offset({
- top: scrollHeight - this.$element.height() - offsetBottom
+ top: scrollHeight - height - offsetBottom
})
}
}
diff --git a/assets/javascripts/bootstrap/dropdown.js b/assets/javascripts/bootstrap/dropdown.js
index 88f118c..756fc21 100644
--- a/assets/javascripts/bootstrap/dropdown.js
+++ b/assets/javascripts/bootstrap/dropdown.js
@@ -42,7 +42,9 @@
if (e.isDefaultPrevented()) return
- $this.trigger('focus')
+ $this
+ .trigger('focus')
+ .attr('aria-expanded', 'true')
$parent
.toggleClass('open')
@@ -88,11 +90,17 @@
if (e && e.which === 3) return
$(backdrop).remove()
$(toggle).each(function () {
- var $parent = getParent($(this))
+ var $this = $(this)
+ var $parent = getParent($this)
var relatedTarget = { relatedTarget: this }
+
if (!$parent.hasClass('open')) return
+
$parent.trigger(e = $.Event('hide.bs.dropdown', relatedTarget))
+
if (e.isDefaultPrevented()) return
+
+ $this.attr('aria-expanded', 'false')
$parent.removeClass('open').trigger('hidden.bs.dropdown', relatedTarget)
})
}
diff --git a/assets/stylesheets/bootstrap/_code.scss b/assets/stylesheets/bootstrap/_code.scss
index 8d83b14..caa5f06 100644
--- a/assets/stylesheets/bootstrap/_code.scss
+++ b/assets/stylesheets/bootstrap/_code.scss
@@ -32,6 +32,7 @@ kbd {
kbd {
padding: 0;
font-size: 100%;
+ font-weight: bold;
box-shadow: none;
}
}
diff --git a/assets/stylesheets/bootstrap/_forms.scss b/assets/stylesheets/bootstrap/_forms.scss
index c94cb76..139ef52 100644
--- a/assets/stylesheets/bootstrap/_forms.scss
+++ b/assets/stylesheets/bootstrap/_forms.scss
@@ -185,9 +185,11 @@ input[type="month"] {
&.input-sm {
line-height: $input-height-small;
+ line-height: $line-height-small #{\0};
}
&.input-lg {
line-height: $input-height-large;
+ line-height: $line-height-large #{\0};
}
}
@@ -415,6 +417,11 @@ input[type="checkbox"] {
vertical-align: middle;
}
+ // Make static controls behave like regular ones
+ .form-control-static {
+ display: inline-block;
+ }
+
.input-group {
display: inline-table;
vertical-align: middle;
diff --git a/assets/stylesheets/bootstrap/_panels.scss b/assets/stylesheets/bootstrap/_panels.scss
index 57cdcbc..6dcac46 100644
--- a/assets/stylesheets/bootstrap/_panels.scss
+++ b/assets/stylesheets/bootstrap/_panels.scss
@@ -100,6 +100,11 @@
> .table-responsive > .table,
> .panel-collapse > .table {
margin-bottom: 0;
+
+ caption {
+ padding-left: $panel-body-padding;
+ padding-right: $panel-body-padding;
+ }
}
// Add border top radius for first one
> .table:first-child,