mirror of
https://github.com/zhigang1992/bootstrap-tokenfield.git
synced 2026-05-01 05:12:34 +08:00
Include newer BS deps for docs-assets
This commit is contained in:
@@ -1,24 +1,14 @@
|
|||||||
/* ========================================================================
|
/* ========================================================================
|
||||||
* Bootstrap: affix.js v3.0.3
|
* Bootstrap: affix.js v3.1.1
|
||||||
* http://getbootstrap.com/javascript/#affix
|
* http://getbootstrap.com/javascript/#affix
|
||||||
* ========================================================================
|
* ========================================================================
|
||||||
* Copyright 2013 Twitter, Inc.
|
* Copyright 2011-2014 Twitter, Inc.
|
||||||
*
|
* Licensed under MIT (https://github.com/twbs/bootstrap/blob/master/LICENSE)
|
||||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
||||||
* you may not use this file except in compliance with the License.
|
|
||||||
* You may obtain a copy of the License at
|
|
||||||
*
|
|
||||||
* http://www.apache.org/licenses/LICENSE-2.0
|
|
||||||
*
|
|
||||||
* Unless required by applicable law or agreed to in writing, software
|
|
||||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
||||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
||||||
* See the License for the specific language governing permissions and
|
|
||||||
* limitations under the License.
|
|
||||||
* ======================================================================== */
|
* ======================================================================== */
|
||||||
|
|
||||||
|
|
||||||
+function ($) { "use strict";
|
+function ($) {
|
||||||
|
'use strict';
|
||||||
|
|
||||||
// AFFIX CLASS DEFINITION
|
// AFFIX CLASS DEFINITION
|
||||||
// ======================
|
// ======================
|
||||||
@@ -29,9 +19,10 @@
|
|||||||
.on('scroll.bs.affix.data-api', $.proxy(this.checkPosition, this))
|
.on('scroll.bs.affix.data-api', $.proxy(this.checkPosition, this))
|
||||||
.on('click.bs.affix.data-api', $.proxy(this.checkPositionWithEventLoop, this))
|
.on('click.bs.affix.data-api', $.proxy(this.checkPositionWithEventLoop, this))
|
||||||
|
|
||||||
this.$element = $(element)
|
this.$element = $(element)
|
||||||
this.affixed =
|
this.affixed =
|
||||||
this.unpin = null
|
this.unpin =
|
||||||
|
this.pinnedOffset = null
|
||||||
|
|
||||||
this.checkPosition()
|
this.checkPosition()
|
||||||
}
|
}
|
||||||
@@ -42,6 +33,14 @@
|
|||||||
offset: 0
|
offset: 0
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Affix.prototype.getPinnedOffset = function () {
|
||||||
|
if (this.pinnedOffset) return this.pinnedOffset
|
||||||
|
this.$element.removeClass(Affix.RESET).addClass('affix')
|
||||||
|
var scrollTop = this.$window.scrollTop()
|
||||||
|
var position = this.$element.offset()
|
||||||
|
return (this.pinnedOffset = position.top - scrollTop)
|
||||||
|
}
|
||||||
|
|
||||||
Affix.prototype.checkPositionWithEventLoop = function () {
|
Affix.prototype.checkPositionWithEventLoop = function () {
|
||||||
setTimeout($.proxy(this.checkPosition, this), 1)
|
setTimeout($.proxy(this.checkPosition, this), 1)
|
||||||
}
|
}
|
||||||
@@ -56,9 +55,11 @@
|
|||||||
var offsetTop = offset.top
|
var offsetTop = offset.top
|
||||||
var offsetBottom = offset.bottom
|
var offsetBottom = offset.bottom
|
||||||
|
|
||||||
|
if (this.affixed == 'top') position.top += scrollTop
|
||||||
|
|
||||||
if (typeof offset != 'object') offsetBottom = offsetTop = offset
|
if (typeof offset != 'object') offsetBottom = offsetTop = offset
|
||||||
if (typeof offsetTop == 'function') offsetTop = offset.top()
|
if (typeof offsetTop == 'function') offsetTop = offset.top(this.$element)
|
||||||
if (typeof offsetBottom == 'function') offsetBottom = offset.bottom()
|
if (typeof offsetBottom == 'function') offsetBottom = offset.bottom(this.$element)
|
||||||
|
|
||||||
var affix = this.unpin != null && (scrollTop + this.unpin <= position.top) ? false :
|
var affix = this.unpin != null && (scrollTop + this.unpin <= position.top) ? false :
|
||||||
offsetBottom != null && (position.top + this.$element.height() >= scrollHeight - offsetBottom) ? 'bottom' :
|
offsetBottom != null && (position.top + this.$element.height() >= scrollHeight - offsetBottom) ? 'bottom' :
|
||||||
@@ -67,13 +68,23 @@
|
|||||||
if (this.affixed === affix) return
|
if (this.affixed === affix) return
|
||||||
if (this.unpin) this.$element.css('top', '')
|
if (this.unpin) this.$element.css('top', '')
|
||||||
|
|
||||||
this.affixed = affix
|
var affixType = 'affix' + (affix ? '-' + affix : '')
|
||||||
this.unpin = affix == 'bottom' ? position.top - scrollTop : null
|
var e = $.Event(affixType + '.bs.affix')
|
||||||
|
|
||||||
this.$element.removeClass(Affix.RESET).addClass('affix' + (affix ? '-' + affix : ''))
|
this.$element.trigger(e)
|
||||||
|
|
||||||
|
if (e.isDefaultPrevented()) return
|
||||||
|
|
||||||
|
this.affixed = affix
|
||||||
|
this.unpin = affix == 'bottom' ? this.getPinnedOffset() : null
|
||||||
|
|
||||||
|
this.$element
|
||||||
|
.removeClass(Affix.RESET)
|
||||||
|
.addClass(affixType)
|
||||||
|
.trigger($.Event(affixType.replace('affix', 'affixed')))
|
||||||
|
|
||||||
if (affix == 'bottom') {
|
if (affix == 'bottom') {
|
||||||
this.$element.offset({ top: document.body.offsetHeight - offsetBottom - this.$element.height() })
|
this.$element.offset({ top: scrollHeight - offsetBottom - this.$element.height() })
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -1,24 +1,14 @@
|
|||||||
/* ========================================================================
|
/* ========================================================================
|
||||||
* Bootstrap: scrollspy.js v3.0.3
|
* Bootstrap: scrollspy.js v3.1.1
|
||||||
* http://getbootstrap.com/javascript/#scrollspy
|
* http://getbootstrap.com/javascript/#scrollspy
|
||||||
* ========================================================================
|
* ========================================================================
|
||||||
* Copyright 2013 Twitter, Inc.
|
* Copyright 2011-2014 Twitter, Inc.
|
||||||
*
|
* Licensed under MIT (https://github.com/twbs/bootstrap/blob/master/LICENSE)
|
||||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
||||||
* you may not use this file except in compliance with the License.
|
|
||||||
* You may obtain a copy of the License at
|
|
||||||
*
|
|
||||||
* http://www.apache.org/licenses/LICENSE-2.0
|
|
||||||
*
|
|
||||||
* Unless required by applicable law or agreed to in writing, software
|
|
||||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
||||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
||||||
* See the License for the specific language governing permissions and
|
|
||||||
* limitations under the License.
|
|
||||||
* ======================================================================== */
|
* ======================================================================== */
|
||||||
|
|
||||||
|
|
||||||
+function ($) { "use strict";
|
+function ($) {
|
||||||
|
'use strict';
|
||||||
|
|
||||||
// SCROLLSPY CLASS DEFINITION
|
// SCROLLSPY CLASS DEFINITION
|
||||||
// ==========================
|
// ==========================
|
||||||
@@ -58,10 +48,11 @@
|
|||||||
.map(function () {
|
.map(function () {
|
||||||
var $el = $(this)
|
var $el = $(this)
|
||||||
var href = $el.data('target') || $el.attr('href')
|
var href = $el.data('target') || $el.attr('href')
|
||||||
var $href = /^#\w/.test(href) && $(href)
|
var $href = /^#./.test(href) && $(href)
|
||||||
|
|
||||||
return ($href
|
return ($href
|
||||||
&& $href.length
|
&& $href.length
|
||||||
|
&& $href.is(':visible')
|
||||||
&& [[ $href[offsetMethod]().top + (!$.isWindow(self.$scrollElement.get(0)) && self.$scrollElement.scrollTop()), href ]]) || null
|
&& [[ $href[offsetMethod]().top + (!$.isWindow(self.$scrollElement.get(0)) && self.$scrollElement.scrollTop()), href ]]) || null
|
||||||
})
|
})
|
||||||
.sort(function (a, b) { return a[0] - b[0] })
|
.sort(function (a, b) { return a[0] - b[0] })
|
||||||
@@ -84,6 +75,10 @@
|
|||||||
return activeTarget != (i = targets.last()[0]) && this.activate(i)
|
return activeTarget != (i = targets.last()[0]) && this.activate(i)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (activeTarget && scrollTop <= offsets[0]) {
|
||||||
|
return activeTarget != (i = targets[0]) && this.activate(i)
|
||||||
|
}
|
||||||
|
|
||||||
for (i = offsets.length; i--;) {
|
for (i = offsets.length; i--;) {
|
||||||
activeTarget != targets[i]
|
activeTarget != targets[i]
|
||||||
&& scrollTop >= offsets[i]
|
&& scrollTop >= offsets[i]
|
||||||
@@ -96,18 +91,18 @@
|
|||||||
this.activeTarget = target
|
this.activeTarget = target
|
||||||
|
|
||||||
$(this.selector)
|
$(this.selector)
|
||||||
.parents('.active')
|
.parentsUntil(this.options.target, '.active')
|
||||||
.removeClass('active')
|
.removeClass('active')
|
||||||
|
|
||||||
var selector = this.selector
|
var selector = this.selector +
|
||||||
+ '[data-target="' + target + '"],'
|
'[data-target="' + target + '"],' +
|
||||||
+ this.selector + '[href="' + target + '"]'
|
this.selector + '[href="' + target + '"]'
|
||||||
|
|
||||||
var active = $(selector)
|
var active = $(selector)
|
||||||
.parents('li')
|
.parents('li')
|
||||||
.addClass('active')
|
.addClass('active')
|
||||||
|
|
||||||
if (active.parent('.dropdown-menu').length) {
|
if (active.parent('.dropdown-menu').length) {
|
||||||
active = active
|
active = active
|
||||||
.closest('li.dropdown')
|
.closest('li.dropdown')
|
||||||
.addClass('active')
|
.addClass('active')
|
||||||
|
|||||||
Reference in New Issue
Block a user