Skip to content

Commit

Permalink
Update Demo theme: Bootstrap v3.3.4
Browse files Browse the repository at this point in the history
  • Loading branch information
daftspunk committed Apr 6, 2015
1 parent ace4175 commit ce29b92
Show file tree
Hide file tree
Showing 81 changed files with 3,896 additions and 2,255 deletions.
1,322 changes: 919 additions & 403 deletions themes/demo/assets/css/theme.css

Large diffs are not rendered by default.

95 changes: 60 additions & 35 deletions themes/demo/assets/vendor/bootstrap/js/affix.js
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
/* ========================================================================
* Bootstrap: affix.js v3.1.0
* Bootstrap: affix.js v3.3.4
* http://getbootstrap.com/javascript/#affix
* ========================================================================
* Copyright 2011-2014 Twitter, Inc.
* Copyright 2011-2015 Twitter, Inc.
* Licensed under MIT (https://github.com/twbs/bootstrap/blob/master/LICENSE)
* ======================================================================== */

Expand All @@ -15,28 +15,54 @@

var Affix = function (element, options) {
this.options = $.extend({}, Affix.DEFAULTS, options)
this.$window = $(window)

this.$target = $(this.options.target)
.on('scroll.bs.affix.data-api', $.proxy(this.checkPosition, this))
.on('click.bs.affix.data-api', $.proxy(this.checkPositionWithEventLoop, this))

this.$element = $(element)
this.affixed =
this.unpin =
this.affixed = null
this.unpin = null
this.pinnedOffset = null

this.checkPosition()
}

Affix.RESET = 'affix affix-top affix-bottom'
Affix.VERSION = '3.3.4'

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

Affix.DEFAULTS = {
offset: 0
offset: 0,
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 && scrollTop <= 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')
var scrollTop = this.$window.scrollTop()
var scrollTop = this.$target.scrollTop()
var position = this.$element.offset()
return (this.pinnedOffset = position.top - scrollTop)
}
Expand All @@ -48,53 +74,49 @@
Affix.prototype.checkPosition = function () {
if (!this.$element.is(':visible')) return

var scrollHeight = $(document).height()
var scrollTop = this.$window.scrollTop()
var position = this.$element.offset()
var height = this.$element.height()
var offset = this.options.offset
var offsetTop = offset.top
var offsetBottom = offset.bottom

if (this.affixed == 'top') position.top += scrollTop
var scrollHeight = $(document.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) 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($.Event(affixType.replace('affix', 'affixed')))
this.$element
.removeClass(Affix.RESET)
.addClass(affixType)
.trigger(affixType.replace('affix', 'affixed') + '.bs.affix')
}

if (affix == 'bottom') {
this.$element.offset({ top: scrollHeight - offsetBottom - this.$element.height() })
this.$element.offset({
top: scrollHeight - height - offsetBottom
})
}
}


// AFFIX PLUGIN DEFINITION
// =======================

var old = $.fn.affix

$.fn.affix = function (option) {
function Plugin(option) {
return this.each(function () {
var $this = $(this)
var data = $this.data('bs.affix')
Expand All @@ -105,6 +127,9 @@
})
}

var old = $.fn.affix

$.fn.affix = Plugin
$.fn.affix.Constructor = Affix


Expand All @@ -127,10 +152,10 @@

data.offset = data.offset || {}

if (data.offsetBottom) data.offset.bottom = data.offsetBottom
if (data.offsetTop) data.offset.top = data.offsetTop
if (data.offsetBottom != null) data.offset.bottom = data.offsetBottom
if (data.offsetTop != null) data.offset.top = data.offsetTop

$spy.affix(data)
Plugin.call($spy, data)
})
})

Expand Down
24 changes: 15 additions & 9 deletions themes/demo/assets/vendor/bootstrap/js/alert.js
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
/* ========================================================================
* Bootstrap: alert.js v3.1.0
* Bootstrap: alert.js v3.3.4
* http://getbootstrap.com/javascript/#alerts
* ========================================================================
* Copyright 2011-2014 Twitter, Inc.
* Copyright 2011-2015 Twitter, Inc.
* Licensed under MIT (https://github.com/twbs/bootstrap/blob/master/LICENSE)
* ======================================================================== */

Expand All @@ -18,6 +18,10 @@
$(el).on('click', dismiss, this.close)
}

Alert.VERSION = '3.3.4'

Alert.TRANSITION_DURATION = 150

Alert.prototype.close = function (e) {
var $this = $(this)
var selector = $this.attr('data-target')
Expand All @@ -32,7 +36,7 @@
if (e) e.preventDefault()

if (!$parent.length) {
$parent = $this.hasClass('alert') ? $this : $this.parent()
$parent = $this.closest('.alert')
}

$parent.trigger(e = $.Event('close.bs.alert'))
Expand All @@ -42,23 +46,22 @@
$parent.removeClass('in')

function removeElement() {
$parent.trigger('closed.bs.alert').remove()
// detach from parent, fire event then clean up data
$parent.detach().trigger('closed.bs.alert').remove()
}

$.support.transition && $parent.hasClass('fade') ?
$parent
.one($.support.transition.end, removeElement)
.emulateTransitionEnd(150) :
.one('bsTransitionEnd', removeElement)
.emulateTransitionEnd(Alert.TRANSITION_DURATION) :
removeElement()
}


// ALERT PLUGIN DEFINITION
// =======================

var old = $.fn.alert

$.fn.alert = function (option) {
function Plugin(option) {
return this.each(function () {
var $this = $(this)
var data = $this.data('bs.alert')
Expand All @@ -68,6 +71,9 @@
})
}

var old = $.fn.alert

$.fn.alert = Plugin
$.fn.alert.Constructor = Alert


Expand Down
37 changes: 23 additions & 14 deletions themes/demo/assets/vendor/bootstrap/js/button.js
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
/* ========================================================================
* Bootstrap: button.js v3.1.0
* Bootstrap: button.js v3.3.4
* http://getbootstrap.com/javascript/#buttons
* ========================================================================
* Copyright 2011-2014 Twitter, Inc.
* Copyright 2011-2015 Twitter, Inc.
* Licensed under MIT (https://github.com/twbs/bootstrap/blob/master/LICENSE)
* ======================================================================== */

Expand All @@ -19,6 +19,8 @@
this.isLoading = false
}

Button.VERSION = '3.3.4'

Button.DEFAULTS = {
loadingText: 'loading...'
}
Expand All @@ -31,12 +33,12 @@

state = state + 'Text'

if (!data.resetText) $el.data('resetText', $el[val]())

$el[val](data[state] || this.options[state])
if (data.resetText == null) $el.data('resetText', $el[val]())

// push to event loop to allow forms to submit
setTimeout($.proxy(function () {
$el[val](data[state] == null ? this.options[state] : data[state])

if (state == 'loadingText') {
this.isLoading = true
$el.addClass(d).attr(d, d)
Expand All @@ -58,6 +60,8 @@
else $parent.find('.active').removeClass('active')
}
if (changed) $input.prop('checked', !this.$element.hasClass('active')).trigger('change')
} else {
this.$element.attr('aria-pressed', !this.$element.hasClass('active'))
}

if (changed) this.$element.toggleClass('active')
Expand All @@ -67,9 +71,7 @@
// BUTTON PLUGIN DEFINITION
// ========================

var old = $.fn.button

$.fn.button = function (option) {
function Plugin(option) {
return this.each(function () {
var $this = $(this)
var data = $this.data('bs.button')
Expand All @@ -82,6 +84,9 @@
})
}

var old = $.fn.button

$.fn.button = Plugin
$.fn.button.Constructor = Button


Expand All @@ -97,11 +102,15 @@
// BUTTON DATA-API
// ===============

$(document).on('click.bs.button.data-api', '[data-toggle^=button]', function (e) {
var $btn = $(e.target)
if (!$btn.hasClass('btn')) $btn = $btn.closest('.btn')
$btn.button('toggle')
e.preventDefault()
})
$(document)
.on('click.bs.button.data-api', '[data-toggle^="button"]', function (e) {
var $btn = $(e.target)
if (!$btn.hasClass('btn')) $btn = $btn.closest('.btn')
Plugin.call($btn, 'toggle')
e.preventDefault()
})
.on('focus.bs.button.data-api blur.bs.button.data-api', '[data-toggle^="button"]', function (e) {
$(e.target).closest('.btn').toggleClass('focus', /^focus(in)?$/.test(e.type))
})

}(jQuery);
Loading

0 comments on commit ce29b92

Please sign in to comment.