Path: blob/main/website/GAUSS/js/bootstrap.js
2941 views
/*!1* Bootstrap v3.1.1 (http://getbootstrap.com)2* Copyright 2011-2014 Twitter, Inc.3* Licensed under MIT (https://github.com/twbs/bootstrap/blob/master/LICENSE)4*/56if (typeof jQuery === 'undefined') { throw new Error('Bootstrap\'s JavaScript requires jQuery') }78/* ========================================================================9* Bootstrap: transition.js v3.1.110* http://getbootstrap.com/javascript/#transitions11* ========================================================================12* Copyright 2011-2014 Twitter, Inc.13* Licensed under MIT (https://github.com/twbs/bootstrap/blob/master/LICENSE)14* ======================================================================== */151617+function ($) {18'use strict';1920// CSS TRANSITION SUPPORT (Shoutout: http://www.modernizr.com/)21// ============================================================2223function transitionEnd() {24var el = document.createElement('bootstrap')2526var transEndEventNames = {27'WebkitTransition' : 'webkitTransitionEnd',28'MozTransition' : 'transitionend',29'OTransition' : 'oTransitionEnd otransitionend',30'transition' : 'transitionend'31}3233for (var name in transEndEventNames) {34if (el.style[name] !== undefined) {35return { end: transEndEventNames[name] }36}37}3839return false // explicit for ie8 ( ._.)40}4142// http://blog.alexmaccaw.com/css-transitions43$.fn.emulateTransitionEnd = function (duration) {44var called = false, $el = this45$(this).one($.support.transition.end, function () { called = true })46var callback = function () { if (!called) $($el).trigger($.support.transition.end) }47setTimeout(callback, duration)48return this49}5051$(function () {52$.support.transition = transitionEnd()53})5455}(jQuery);5657/* ========================================================================58* Bootstrap: alert.js v3.1.159* http://getbootstrap.com/javascript/#alerts60* ========================================================================61* Copyright 2011-2014 Twitter, Inc.62* Licensed under MIT (https://github.com/twbs/bootstrap/blob/master/LICENSE)63* ======================================================================== */646566+function ($) {67'use strict';6869// ALERT CLASS DEFINITION70// ======================7172var dismiss = '[data-dismiss="alert"]'73var Alert = function (el) {74$(el).on('click', dismiss, this.close)75}7677Alert.prototype.close = function (e) {78var $this = $(this)79var selector = $this.attr('data-target')8081if (!selector) {82selector = $this.attr('href')83selector = selector && selector.replace(/.*(?=#[^\s]*$)/, '') // strip for ie784}8586var $parent = $(selector)8788if (e) e.preventDefault()8990if (!$parent.length) {91$parent = $this.hasClass('alert') ? $this : $this.parent()92}9394$parent.trigger(e = $.Event('close.bs.alert'))9596if (e.isDefaultPrevented()) return9798$parent.removeClass('in')99100function removeElement() {101$parent.trigger('closed.bs.alert').remove()102}103104$.support.transition && $parent.hasClass('fade') ?105$parent106.one($.support.transition.end, removeElement)107.emulateTransitionEnd(150) :108removeElement()109}110111112// ALERT PLUGIN DEFINITION113// =======================114115var old = $.fn.alert116117$.fn.alert = function (option) {118return this.each(function () {119var $this = $(this)120var data = $this.data('bs.alert')121122if (!data) $this.data('bs.alert', (data = new Alert(this)))123if (typeof option == 'string') data[option].call($this)124})125}126127$.fn.alert.Constructor = Alert128129130// ALERT NO CONFLICT131// =================132133$.fn.alert.noConflict = function () {134$.fn.alert = old135return this136}137138139// ALERT DATA-API140// ==============141142$(document).on('click.bs.alert.data-api', dismiss, Alert.prototype.close)143144}(jQuery);145146/* ========================================================================147* Bootstrap: button.js v3.1.1148* http://getbootstrap.com/javascript/#buttons149* ========================================================================150* Copyright 2011-2014 Twitter, Inc.151* Licensed under MIT (https://github.com/twbs/bootstrap/blob/master/LICENSE)152* ======================================================================== */153154155+function ($) {156'use strict';157158// BUTTON PUBLIC CLASS DEFINITION159// ==============================160161var Button = function (element, options) {162this.$element = $(element)163this.options = $.extend({}, Button.DEFAULTS, options)164this.isLoading = false165}166167Button.DEFAULTS = {168loadingText: 'loading...'169}170171Button.prototype.setState = function (state) {172var d = 'disabled'173var $el = this.$element174var val = $el.is('input') ? 'val' : 'html'175var data = $el.data()176177state = state + 'Text'178179if (!data.resetText) $el.data('resetText', $el[val]())180181$el[val](data[state] || this.options[state])182183// push to event loop to allow forms to submit184setTimeout($.proxy(function () {185if (state == 'loadingText') {186this.isLoading = true187$el.addClass(d).attr(d, d)188} else if (this.isLoading) {189this.isLoading = false190$el.removeClass(d).removeAttr(d)191}192}, this), 0)193}194195Button.prototype.toggle = function () {196var changed = true197var $parent = this.$element.closest('[data-toggle="buttons"]')198199if ($parent.length) {200var $input = this.$element.find('input')201if ($input.prop('type') == 'radio') {202if ($input.prop('checked') && this.$element.hasClass('active')) changed = false203else $parent.find('.active').removeClass('active')204}205if (changed) $input.prop('checked', !this.$element.hasClass('active')).trigger('change')206}207208if (changed) this.$element.toggleClass('active')209}210211212// BUTTON PLUGIN DEFINITION213// ========================214215var old = $.fn.button216217$.fn.button = function (option) {218return this.each(function () {219var $this = $(this)220var data = $this.data('bs.button')221var options = typeof option == 'object' && option222223if (!data) $this.data('bs.button', (data = new Button(this, options)))224225if (option == 'toggle') data.toggle()226else if (option) data.setState(option)227})228}229230$.fn.button.Constructor = Button231232233// BUTTON NO CONFLICT234// ==================235236$.fn.button.noConflict = function () {237$.fn.button = old238return this239}240241242// BUTTON DATA-API243// ===============244245$(document).on('click.bs.button.data-api', '[data-toggle^=button]', function (e) {246var $btn = $(e.target)247if (!$btn.hasClass('btn')) $btn = $btn.closest('.btn')248$btn.button('toggle')249e.preventDefault()250})251252}(jQuery);253254/* ========================================================================255* Bootstrap: carousel.js v3.1.1256* http://getbootstrap.com/javascript/#carousel257* ========================================================================258* Copyright 2011-2014 Twitter, Inc.259* Licensed under MIT (https://github.com/twbs/bootstrap/blob/master/LICENSE)260* ======================================================================== */261262263+function ($) {264'use strict';265266// CAROUSEL CLASS DEFINITION267// =========================268269var Carousel = function (element, options) {270this.$element = $(element)271this.$indicators = this.$element.find('.carousel-indicators')272this.options = options273this.paused =274this.sliding =275this.interval =276this.$active =277this.$items = null278279this.options.pause == 'hover' && this.$element280.on('mouseenter', $.proxy(this.pause, this))281.on('mouseleave', $.proxy(this.cycle, this))282}283284Carousel.DEFAULTS = {285interval: 5000,286pause: 'hover',287wrap: true288}289290Carousel.prototype.cycle = function (e) {291e || (this.paused = false)292293this.interval && clearInterval(this.interval)294295this.options.interval296&& !this.paused297&& (this.interval = setInterval($.proxy(this.next, this), this.options.interval))298299return this300}301302Carousel.prototype.getActiveIndex = function () {303this.$active = this.$element.find('.item.active')304this.$items = this.$active.parent().children()305306return this.$items.index(this.$active)307}308309Carousel.prototype.to = function (pos) {310var that = this311var activeIndex = this.getActiveIndex()312313if (pos > (this.$items.length - 1) || pos < 0) return314315if (this.sliding) return this.$element.one('slid.bs.carousel', function () { that.to(pos) })316if (activeIndex == pos) return this.pause().cycle()317318return this.slide(pos > activeIndex ? 'next' : 'prev', $(this.$items[pos]))319}320321Carousel.prototype.pause = function (e) {322e || (this.paused = true)323324if (this.$element.find('.next, .prev').length && $.support.transition) {325this.$element.trigger($.support.transition.end)326this.cycle(true)327}328329this.interval = clearInterval(this.interval)330331return this332}333334Carousel.prototype.next = function () {335if (this.sliding) return336return this.slide('next')337}338339Carousel.prototype.prev = function () {340if (this.sliding) return341return this.slide('prev')342}343344Carousel.prototype.slide = function (type, next) {345var $active = this.$element.find('.item.active')346var $next = next || $active[type]()347var isCycling = this.interval348var direction = type == 'next' ? 'left' : 'right'349var fallback = type == 'next' ? 'first' : 'last'350var that = this351352if (!$next.length) {353if (!this.options.wrap) return354$next = this.$element.find('.item')[fallback]()355}356357if ($next.hasClass('active')) return this.sliding = false358359var e = $.Event('slide.bs.carousel', { relatedTarget: $next[0], direction: direction })360this.$element.trigger(e)361if (e.isDefaultPrevented()) return362363this.sliding = true364365isCycling && this.pause()366367if (this.$indicators.length) {368this.$indicators.find('.active').removeClass('active')369this.$element.one('slid.bs.carousel', function () {370var $nextIndicator = $(that.$indicators.children()[that.getActiveIndex()])371$nextIndicator && $nextIndicator.addClass('active')372})373}374375if ($.support.transition && this.$element.hasClass('slide')) {376$next.addClass(type)377$next[0].offsetWidth // force reflow378$active.addClass(direction)379$next.addClass(direction)380$active381.one($.support.transition.end, function () {382$next.removeClass([type, direction].join(' ')).addClass('active')383$active.removeClass(['active', direction].join(' '))384that.sliding = false385setTimeout(function () { that.$element.trigger('slid.bs.carousel') }, 0)386})387.emulateTransitionEnd($active.css('transition-duration').slice(0, -1) * 1000)388} else {389$active.removeClass('active')390$next.addClass('active')391this.sliding = false392this.$element.trigger('slid.bs.carousel')393}394395isCycling && this.cycle()396397return this398}399400401// CAROUSEL PLUGIN DEFINITION402// ==========================403404var old = $.fn.carousel405406$.fn.carousel = function (option) {407return this.each(function () {408var $this = $(this)409var data = $this.data('bs.carousel')410var options = $.extend({}, Carousel.DEFAULTS, $this.data(), typeof option == 'object' && option)411var action = typeof option == 'string' ? option : options.slide412413if (!data) $this.data('bs.carousel', (data = new Carousel(this, options)))414if (typeof option == 'number') data.to(option)415else if (action) data[action]()416else if (options.interval) data.pause().cycle()417})418}419420$.fn.carousel.Constructor = Carousel421422423// CAROUSEL NO CONFLICT424// ====================425426$.fn.carousel.noConflict = function () {427$.fn.carousel = old428return this429}430431432// CAROUSEL DATA-API433// =================434435$(document).on('click.bs.carousel.data-api', '[data-slide], [data-slide-to]', function (e) {436var $this = $(this), href437var $target = $($this.attr('data-target') || (href = $this.attr('href')) && href.replace(/.*(?=#[^\s]+$)/, '')) //strip for ie7438var options = $.extend({}, $target.data(), $this.data())439var slideIndex = $this.attr('data-slide-to')440if (slideIndex) options.interval = false441442$target.carousel(options)443444if (slideIndex = $this.attr('data-slide-to')) {445$target.data('bs.carousel').to(slideIndex)446}447448e.preventDefault()449})450451$(window).on('load', function () {452$('[data-ride="carousel"]').each(function () {453var $carousel = $(this)454$carousel.carousel($carousel.data())455})456})457458}(jQuery);459460/* ========================================================================461* Bootstrap: collapse.js v3.1.1462* http://getbootstrap.com/javascript/#collapse463* ========================================================================464* Copyright 2011-2014 Twitter, Inc.465* Licensed under MIT (https://github.com/twbs/bootstrap/blob/master/LICENSE)466* ======================================================================== */467468469+function ($) {470'use strict';471472// COLLAPSE PUBLIC CLASS DEFINITION473// ================================474475var Collapse = function (element, options) {476this.$element = $(element)477this.options = $.extend({}, Collapse.DEFAULTS, options)478this.transitioning = null479480if (this.options.parent) this.$parent = $(this.options.parent)481if (this.options.toggle) this.toggle()482}483484Collapse.DEFAULTS = {485toggle: true486}487488Collapse.prototype.dimension = function () {489var hasWidth = this.$element.hasClass('width')490return hasWidth ? 'width' : 'height'491}492493Collapse.prototype.show = function () {494if (this.transitioning || this.$element.hasClass('in')) return495496var startEvent = $.Event('show.bs.collapse')497this.$element.trigger(startEvent)498if (startEvent.isDefaultPrevented()) return499500var actives = this.$parent && this.$parent.find('> .panel > .in')501502if (actives && actives.length) {503var hasData = actives.data('bs.collapse')504if (hasData && hasData.transitioning) return505actives.collapse('hide')506hasData || actives.data('bs.collapse', null)507}508509var dimension = this.dimension()510511this.$element512.removeClass('collapse')513.addClass('collapsing')514[dimension](0)515516this.transitioning = 1517518var complete = function () {519this.$element520.removeClass('collapsing')521.addClass('collapse in')522[dimension]('auto')523this.transitioning = 0524this.$element.trigger('shown.bs.collapse')525}526527if (!$.support.transition) return complete.call(this)528529var scrollSize = $.camelCase(['scroll', dimension].join('-'))530531this.$element532.one($.support.transition.end, $.proxy(complete, this))533.emulateTransitionEnd(350)534[dimension](this.$element[0][scrollSize])535}536537Collapse.prototype.hide = function () {538if (this.transitioning || !this.$element.hasClass('in')) return539540var startEvent = $.Event('hide.bs.collapse')541this.$element.trigger(startEvent)542if (startEvent.isDefaultPrevented()) return543544var dimension = this.dimension()545546this.$element547[dimension](this.$element[dimension]())548[0].offsetHeight549550this.$element551.addClass('collapsing')552.removeClass('collapse')553.removeClass('in')554555this.transitioning = 1556557var complete = function () {558this.transitioning = 0559this.$element560.trigger('hidden.bs.collapse')561.removeClass('collapsing')562.addClass('collapse')563}564565if (!$.support.transition) return complete.call(this)566567this.$element568[dimension](0)569.one($.support.transition.end, $.proxy(complete, this))570.emulateTransitionEnd(350)571}572573Collapse.prototype.toggle = function () {574this[this.$element.hasClass('in') ? 'hide' : 'show']()575}576577578// COLLAPSE PLUGIN DEFINITION579// ==========================580581var old = $.fn.collapse582583$.fn.collapse = function (option) {584return this.each(function () {585var $this = $(this)586var data = $this.data('bs.collapse')587var options = $.extend({}, Collapse.DEFAULTS, $this.data(), typeof option == 'object' && option)588589if (!data && options.toggle && option == 'show') option = !option590if (!data) $this.data('bs.collapse', (data = new Collapse(this, options)))591if (typeof option == 'string') data[option]()592})593}594595$.fn.collapse.Constructor = Collapse596597598// COLLAPSE NO CONFLICT599// ====================600601$.fn.collapse.noConflict = function () {602$.fn.collapse = old603return this604}605606607// COLLAPSE DATA-API608// =================609610$(document).on('click.bs.collapse.data-api', '[data-toggle=collapse]', function (e) {611var $this = $(this), href612var target = $this.attr('data-target')613|| e.preventDefault()614|| (href = $this.attr('href')) && href.replace(/.*(?=#[^\s]+$)/, '') //strip for ie7615var $target = $(target)616var data = $target.data('bs.collapse')617var option = data ? 'toggle' : $this.data()618var parent = $this.attr('data-parent')619var $parent = parent && $(parent)620621if (!data || !data.transitioning) {622if ($parent) $parent.find('[data-toggle=collapse][data-parent="' + parent + '"]').not($this).addClass('collapsed')623$this[$target.hasClass('in') ? 'addClass' : 'removeClass']('collapsed')624}625626$target.collapse(option)627})628629}(jQuery);630631/* ========================================================================632* Bootstrap: dropdown.js v3.1.1633* http://getbootstrap.com/javascript/#dropdowns634* ========================================================================635* Copyright 2011-2014 Twitter, Inc.636* Licensed under MIT (https://github.com/twbs/bootstrap/blob/master/LICENSE)637* ======================================================================== */638639640+function ($) {641'use strict';642643// DROPDOWN CLASS DEFINITION644// =========================645646var backdrop = '.dropdown-backdrop'647var toggle = '[data-toggle=dropdown]'648var Dropdown = function (element) {649$(element).on('click.bs.dropdown', this.toggle)650}651652Dropdown.prototype.toggle = function (e) {653var $this = $(this)654655if ($this.is('.disabled, :disabled')) return656657var $parent = getParent($this)658var isActive = $parent.hasClass('open')659660clearMenus()661662if (!isActive) {663if ('ontouchstart' in document.documentElement && !$parent.closest('.navbar-nav').length) {664// if mobile we use a backdrop because click events don't delegate665$('<div class="dropdown-backdrop"/>').insertAfter($(this)).on('click', clearMenus)666}667668var relatedTarget = { relatedTarget: this }669$parent.trigger(e = $.Event('show.bs.dropdown', relatedTarget))670671if (e.isDefaultPrevented()) return672673$parent674.toggleClass('open')675.trigger('shown.bs.dropdown', relatedTarget)676677$this.focus()678}679680return false681}682683Dropdown.prototype.keydown = function (e) {684if (!/(38|40|27)/.test(e.keyCode)) return685686var $this = $(this)687688e.preventDefault()689e.stopPropagation()690691if ($this.is('.disabled, :disabled')) return692693var $parent = getParent($this)694var isActive = $parent.hasClass('open')695696if (!isActive || (isActive && e.keyCode == 27)) {697if (e.which == 27) $parent.find(toggle).focus()698return $this.click()699}700701var desc = ' li:not(.divider):visible a'702var $items = $parent.find('[role=menu]' + desc + ', [role=listbox]' + desc)703704if (!$items.length) return705706var index = $items.index($items.filter(':focus'))707708if (e.keyCode == 38 && index > 0) index-- // up709if (e.keyCode == 40 && index < $items.length - 1) index++ // down710if (!~index) index = 0711712$items.eq(index).focus()713}714715function clearMenus(e) {716$(backdrop).remove()717$(toggle).each(function () {718var $parent = getParent($(this))719var relatedTarget = { relatedTarget: this }720if (!$parent.hasClass('open')) return721$parent.trigger(e = $.Event('hide.bs.dropdown', relatedTarget))722if (e.isDefaultPrevented()) return723$parent.removeClass('open').trigger('hidden.bs.dropdown', relatedTarget)724})725}726727function getParent($this) {728var selector = $this.attr('data-target')729730if (!selector) {731selector = $this.attr('href')732selector = selector && /#[A-Za-z]/.test(selector) && selector.replace(/.*(?=#[^\s]*$)/, '') //strip for ie7733}734735var $parent = selector && $(selector)736737return $parent && $parent.length ? $parent : $this.parent()738}739740741// DROPDOWN PLUGIN DEFINITION742// ==========================743744var old = $.fn.dropdown745746$.fn.dropdown = function (option) {747return this.each(function () {748var $this = $(this)749var data = $this.data('bs.dropdown')750751if (!data) $this.data('bs.dropdown', (data = new Dropdown(this)))752if (typeof option == 'string') data[option].call($this)753})754}755756$.fn.dropdown.Constructor = Dropdown757758759// DROPDOWN NO CONFLICT760// ====================761762$.fn.dropdown.noConflict = function () {763$.fn.dropdown = old764return this765}766767768// APPLY TO STANDARD DROPDOWN ELEMENTS769// ===================================770771$(document)772.on('click.bs.dropdown.data-api', clearMenus)773.on('click.bs.dropdown.data-api', '.dropdown form', function (e) { e.stopPropagation() })774.on('click.bs.dropdown.data-api', toggle, Dropdown.prototype.toggle)775.on('keydown.bs.dropdown.data-api', toggle + ', [role=menu], [role=listbox]', Dropdown.prototype.keydown)776777}(jQuery);778779/* ========================================================================780* Bootstrap: modal.js v3.1.1781* http://getbootstrap.com/javascript/#modals782* ========================================================================783* Copyright 2011-2014 Twitter, Inc.784* Licensed under MIT (https://github.com/twbs/bootstrap/blob/master/LICENSE)785* ======================================================================== */786787788+function ($) {789'use strict';790791// MODAL CLASS DEFINITION792// ======================793794var Modal = function (element, options) {795this.options = options796this.$element = $(element)797this.$backdrop =798this.isShown = null799800if (this.options.remote) {801this.$element802.find('.modal-content')803.load(this.options.remote, $.proxy(function () {804this.$element.trigger('loaded.bs.modal')805}, this))806}807}808809Modal.DEFAULTS = {810backdrop: true,811keyboard: true,812show: true813}814815Modal.prototype.toggle = function (_relatedTarget) {816return this[!this.isShown ? 'show' : 'hide'](_relatedTarget)817}818819Modal.prototype.show = function (_relatedTarget) {820var that = this821var e = $.Event('show.bs.modal', { relatedTarget: _relatedTarget })822823this.$element.trigger(e)824825if (this.isShown || e.isDefaultPrevented()) return826827this.isShown = true828829this.escape()830831this.$element.on('click.dismiss.bs.modal', '[data-dismiss="modal"]', $.proxy(this.hide, this))832833this.backdrop(function () {834var transition = $.support.transition && that.$element.hasClass('fade')835836if (!that.$element.parent().length) {837that.$element.appendTo(document.body) // don't move modals dom position838}839840that.$element841.show()842.scrollTop(0)843844if (transition) {845that.$element[0].offsetWidth // force reflow846}847848that.$element849.addClass('in')850.attr('aria-hidden', false)851852that.enforceFocus()853854var e = $.Event('shown.bs.modal', { relatedTarget: _relatedTarget })855856transition ?857that.$element.find('.modal-dialog') // wait for modal to slide in858.one($.support.transition.end, function () {859that.$element.focus().trigger(e)860})861.emulateTransitionEnd(300) :862that.$element.focus().trigger(e)863})864}865866Modal.prototype.hide = function (e) {867if (e) e.preventDefault()868869e = $.Event('hide.bs.modal')870871this.$element.trigger(e)872873if (!this.isShown || e.isDefaultPrevented()) return874875this.isShown = false876877this.escape()878879$(document).off('focusin.bs.modal')880881this.$element882.removeClass('in')883.attr('aria-hidden', true)884.off('click.dismiss.bs.modal')885886$.support.transition && this.$element.hasClass('fade') ?887this.$element888.one($.support.transition.end, $.proxy(this.hideModal, this))889.emulateTransitionEnd(300) :890this.hideModal()891}892893Modal.prototype.enforceFocus = function () {894$(document)895.off('focusin.bs.modal') // guard against infinite focus loop896.on('focusin.bs.modal', $.proxy(function (e) {897if (this.$element[0] !== e.target && !this.$element.has(e.target).length) {898this.$element.focus()899}900}, this))901}902903Modal.prototype.escape = function () {904if (this.isShown && this.options.keyboard) {905this.$element.on('keyup.dismiss.bs.modal', $.proxy(function (e) {906e.which == 27 && this.hide()907}, this))908} else if (!this.isShown) {909this.$element.off('keyup.dismiss.bs.modal')910}911}912913Modal.prototype.hideModal = function () {914var that = this915this.$element.hide()916this.backdrop(function () {917that.removeBackdrop()918that.$element.trigger('hidden.bs.modal')919})920}921922Modal.prototype.removeBackdrop = function () {923this.$backdrop && this.$backdrop.remove()924this.$backdrop = null925}926927Modal.prototype.backdrop = function (callback) {928var animate = this.$element.hasClass('fade') ? 'fade' : ''929930if (this.isShown && this.options.backdrop) {931var doAnimate = $.support.transition && animate932933this.$backdrop = $('<div class="modal-backdrop ' + animate + '" />')934.appendTo(document.body)935936this.$element.on('click.dismiss.bs.modal', $.proxy(function (e) {937if (e.target !== e.currentTarget) return938this.options.backdrop == 'static'939? this.$element[0].focus.call(this.$element[0])940: this.hide.call(this)941}, this))942943if (doAnimate) this.$backdrop[0].offsetWidth // force reflow944945this.$backdrop.addClass('in')946947if (!callback) return948949doAnimate ?950this.$backdrop951.one($.support.transition.end, callback)952.emulateTransitionEnd(150) :953callback()954955} else if (!this.isShown && this.$backdrop) {956this.$backdrop.removeClass('in')957958$.support.transition && this.$element.hasClass('fade') ?959this.$backdrop960.one($.support.transition.end, callback)961.emulateTransitionEnd(150) :962callback()963964} else if (callback) {965callback()966}967}968969970// MODAL PLUGIN DEFINITION971// =======================972973var old = $.fn.modal974975$.fn.modal = function (option, _relatedTarget) {976return this.each(function () {977var $this = $(this)978var data = $this.data('bs.modal')979var options = $.extend({}, Modal.DEFAULTS, $this.data(), typeof option == 'object' && option)980981if (!data) $this.data('bs.modal', (data = new Modal(this, options)))982if (typeof option == 'string') data[option](_relatedTarget)983else if (options.show) data.show(_relatedTarget)984})985}986987$.fn.modal.Constructor = Modal988989990// MODAL NO CONFLICT991// =================992993$.fn.modal.noConflict = function () {994$.fn.modal = old995return this996}997998999// MODAL DATA-API1000// ==============10011002$(document).on('click.bs.modal.data-api', '[data-toggle="modal"]', function (e) {1003var $this = $(this)1004var href = $this.attr('href')1005var $target = $($this.attr('data-target') || (href && href.replace(/.*(?=#[^\s]+$)/, ''))) //strip for ie71006var option = $target.data('bs.modal') ? 'toggle' : $.extend({ remote: !/#/.test(href) && href }, $target.data(), $this.data())10071008if ($this.is('a')) e.preventDefault()10091010$target1011.modal(option, this)1012.one('hide', function () {1013$this.is(':visible') && $this.focus()1014})1015})10161017$(document)1018.on('show.bs.modal', '.modal', function () { $(document.body).addClass('modal-open') })1019.on('hidden.bs.modal', '.modal', function () { $(document.body).removeClass('modal-open') })10201021}(jQuery);10221023/* ========================================================================1024* Bootstrap: tooltip.js v3.1.11025* http://getbootstrap.com/javascript/#tooltip1026* Inspired by the original jQuery.tipsy by Jason Frame1027* ========================================================================1028* Copyright 2011-2014 Twitter, Inc.1029* Licensed under MIT (https://github.com/twbs/bootstrap/blob/master/LICENSE)1030* ======================================================================== */103110321033+function ($) {1034'use strict';10351036// TOOLTIP PUBLIC CLASS DEFINITION1037// ===============================10381039var Tooltip = function (element, options) {1040this.type =1041this.options =1042this.enabled =1043this.timeout =1044this.hoverState =1045this.$element = null10461047this.init('tooltip', element, options)1048}10491050Tooltip.DEFAULTS = {1051animation: true,1052placement: 'top',1053selector: false,1054template: '<div class="tooltip"><div class="tooltip-arrow"></div><div class="tooltip-inner"></div></div>',1055trigger: 'hover focus',1056title: '',1057delay: 0,1058html: false,1059container: false1060}10611062Tooltip.prototype.init = function (type, element, options) {1063this.enabled = true1064this.type = type1065this.$element = $(element)1066this.options = this.getOptions(options)10671068var triggers = this.options.trigger.split(' ')10691070for (var i = triggers.length; i--;) {1071var trigger = triggers[i]10721073if (trigger == 'click') {1074this.$element.on('click.' + this.type, this.options.selector, $.proxy(this.toggle, this))1075} else if (trigger != 'manual') {1076var eventIn = trigger == 'hover' ? 'mouseenter' : 'focusin'1077var eventOut = trigger == 'hover' ? 'mouseleave' : 'focusout'10781079this.$element.on(eventIn + '.' + this.type, this.options.selector, $.proxy(this.enter, this))1080this.$element.on(eventOut + '.' + this.type, this.options.selector, $.proxy(this.leave, this))1081}1082}10831084this.options.selector ?1085(this._options = $.extend({}, this.options, { trigger: 'manual', selector: '' })) :1086this.fixTitle()1087}10881089Tooltip.prototype.getDefaults = function () {1090return Tooltip.DEFAULTS1091}10921093Tooltip.prototype.getOptions = function (options) {1094options = $.extend({}, this.getDefaults(), this.$element.data(), options)10951096if (options.delay && typeof options.delay == 'number') {1097options.delay = {1098show: options.delay,1099hide: options.delay1100}1101}11021103return options1104}11051106Tooltip.prototype.getDelegateOptions = function () {1107var options = {}1108var defaults = this.getDefaults()11091110this._options && $.each(this._options, function (key, value) {1111if (defaults[key] != value) options[key] = value1112})11131114return options1115}11161117Tooltip.prototype.enter = function (obj) {1118var self = obj instanceof this.constructor ?1119obj : $(obj.currentTarget)[this.type](this.getDelegateOptions()).data('bs.' + this.type)11201121clearTimeout(self.timeout)11221123self.hoverState = 'in'11241125if (!self.options.delay || !self.options.delay.show) return self.show()11261127self.timeout = setTimeout(function () {1128if (self.hoverState == 'in') self.show()1129}, self.options.delay.show)1130}11311132Tooltip.prototype.leave = function (obj) {1133var self = obj instanceof this.constructor ?1134obj : $(obj.currentTarget)[this.type](this.getDelegateOptions()).data('bs.' + this.type)11351136clearTimeout(self.timeout)11371138self.hoverState = 'out'11391140if (!self.options.delay || !self.options.delay.hide) return self.hide()11411142self.timeout = setTimeout(function () {1143if (self.hoverState == 'out') self.hide()1144}, self.options.delay.hide)1145}11461147Tooltip.prototype.show = function () {1148var e = $.Event('show.bs.' + this.type)11491150if (this.hasContent() && this.enabled) {1151this.$element.trigger(e)11521153if (e.isDefaultPrevented()) return1154var that = this;11551156var $tip = this.tip()11571158this.setContent()11591160if (this.options.animation) $tip.addClass('fade')11611162var placement = typeof this.options.placement == 'function' ?1163this.options.placement.call(this, $tip[0], this.$element[0]) :1164this.options.placement11651166var autoToken = /\s?auto?\s?/i1167var autoPlace = autoToken.test(placement)1168if (autoPlace) placement = placement.replace(autoToken, '') || 'top'11691170$tip1171.detach()1172.css({ top: 0, left: 0, display: 'block' })1173.addClass(placement)11741175this.options.container ? $tip.appendTo(this.options.container) : $tip.insertAfter(this.$element)11761177var pos = this.getPosition()1178var actualWidth = $tip[0].offsetWidth1179var actualHeight = $tip[0].offsetHeight11801181if (autoPlace) {1182var $parent = this.$element.parent()11831184var orgPlacement = placement1185var docScroll = document.documentElement.scrollTop || document.body.scrollTop1186var parentWidth = this.options.container == 'body' ? window.innerWidth : $parent.outerWidth()1187var parentHeight = this.options.container == 'body' ? window.innerHeight : $parent.outerHeight()1188var parentLeft = this.options.container == 'body' ? 0 : $parent.offset().left11891190placement = placement == 'bottom' && pos.top + pos.height + actualHeight - docScroll > parentHeight ? 'top' :1191placement == 'top' && pos.top - docScroll - actualHeight < 0 ? 'bottom' :1192placement == 'right' && pos.right + actualWidth > parentWidth ? 'left' :1193placement == 'left' && pos.left - actualWidth < parentLeft ? 'right' :1194placement11951196$tip1197.removeClass(orgPlacement)1198.addClass(placement)1199}12001201var calculatedOffset = this.getCalculatedOffset(placement, pos, actualWidth, actualHeight)12021203this.applyPlacement(calculatedOffset, placement)1204this.hoverState = null12051206var complete = function() {1207that.$element.trigger('shown.bs.' + that.type)1208}12091210$.support.transition && this.$tip.hasClass('fade') ?1211$tip1212.one($.support.transition.end, complete)1213.emulateTransitionEnd(150) :1214complete()1215}1216}12171218Tooltip.prototype.applyPlacement = function (offset, placement) {1219var replace1220var $tip = this.tip()1221var width = $tip[0].offsetWidth1222var height = $tip[0].offsetHeight12231224// manually read margins because getBoundingClientRect includes difference1225var marginTop = parseInt($tip.css('margin-top'), 10)1226var marginLeft = parseInt($tip.css('margin-left'), 10)12271228// we must check for NaN for ie 8/91229if (isNaN(marginTop)) marginTop = 01230if (isNaN(marginLeft)) marginLeft = 012311232offset.top = offset.top + marginTop1233offset.left = offset.left + marginLeft12341235// $.fn.offset doesn't round pixel values1236// so we use setOffset directly with our own function B-01237$.offset.setOffset($tip[0], $.extend({1238using: function (props) {1239$tip.css({1240top: Math.round(props.top),1241left: Math.round(props.left)1242})1243}1244}, offset), 0)12451246$tip.addClass('in')12471248// check to see if placing tip in new offset caused the tip to resize itself1249var actualWidth = $tip[0].offsetWidth1250var actualHeight = $tip[0].offsetHeight12511252if (placement == 'top' && actualHeight != height) {1253replace = true1254offset.top = offset.top + height - actualHeight1255}12561257if (/bottom|top/.test(placement)) {1258var delta = 012591260if (offset.left < 0) {1261delta = offset.left * -21262offset.left = 012631264$tip.offset(offset)12651266actualWidth = $tip[0].offsetWidth1267actualHeight = $tip[0].offsetHeight1268}12691270this.replaceArrow(delta - width + actualWidth, actualWidth, 'left')1271} else {1272this.replaceArrow(actualHeight - height, actualHeight, 'top')1273}12741275if (replace) $tip.offset(offset)1276}12771278Tooltip.prototype.replaceArrow = function (delta, dimension, position) {1279this.arrow().css(position, delta ? (50 * (1 - delta / dimension) + '%') : '')1280}12811282Tooltip.prototype.setContent = function () {1283var $tip = this.tip()1284var title = this.getTitle()12851286$tip.find('.tooltip-inner')[this.options.html ? 'html' : 'text'](title)1287$tip.removeClass('fade in top bottom left right')1288}12891290Tooltip.prototype.hide = function () {1291var that = this1292var $tip = this.tip()1293var e = $.Event('hide.bs.' + this.type)12941295function complete() {1296if (that.hoverState != 'in') $tip.detach()1297that.$element.trigger('hidden.bs.' + that.type)1298}12991300this.$element.trigger(e)13011302if (e.isDefaultPrevented()) return13031304$tip.removeClass('in')13051306$.support.transition && this.$tip.hasClass('fade') ?1307$tip1308.one($.support.transition.end, complete)1309.emulateTransitionEnd(150) :1310complete()13111312this.hoverState = null13131314return this1315}13161317Tooltip.prototype.fixTitle = function () {1318var $e = this.$element1319if ($e.attr('title') || typeof($e.attr('data-original-title')) != 'string') {1320$e.attr('data-original-title', $e.attr('title') || '').attr('title', '')1321}1322}13231324Tooltip.prototype.hasContent = function () {1325return this.getTitle()1326}13271328Tooltip.prototype.getPosition = function () {1329var el = this.$element[0]1330return $.extend({}, (typeof el.getBoundingClientRect == 'function') ? el.getBoundingClientRect() : {1331width: el.offsetWidth,1332height: el.offsetHeight1333}, this.$element.offset())1334}13351336Tooltip.prototype.getCalculatedOffset = function (placement, pos, actualWidth, actualHeight) {1337return placement == 'bottom' ? { top: pos.top + pos.height, left: pos.left + pos.width / 2 - actualWidth / 2 } :1338placement == 'top' ? { top: pos.top - actualHeight, left: pos.left + pos.width / 2 - actualWidth / 2 } :1339placement == 'left' ? { top: pos.top + pos.height / 2 - actualHeight / 2, left: pos.left - actualWidth } :1340/* placement == 'right' */ { top: pos.top + pos.height / 2 - actualHeight / 2, left: pos.left + pos.width }1341}13421343Tooltip.prototype.getTitle = function () {1344var title1345var $e = this.$element1346var o = this.options13471348title = $e.attr('data-original-title')1349|| (typeof o.title == 'function' ? o.title.call($e[0]) : o.title)13501351return title1352}13531354Tooltip.prototype.tip = function () {1355return this.$tip = this.$tip || $(this.options.template)1356}13571358Tooltip.prototype.arrow = function () {1359return this.$arrow = this.$arrow || this.tip().find('.tooltip-arrow')1360}13611362Tooltip.prototype.validate = function () {1363if (!this.$element[0].parentNode) {1364this.hide()1365this.$element = null1366this.options = null1367}1368}13691370Tooltip.prototype.enable = function () {1371this.enabled = true1372}13731374Tooltip.prototype.disable = function () {1375this.enabled = false1376}13771378Tooltip.prototype.toggleEnabled = function () {1379this.enabled = !this.enabled1380}13811382Tooltip.prototype.toggle = function (e) {1383var self = e ? $(e.currentTarget)[this.type](this.getDelegateOptions()).data('bs.' + this.type) : this1384self.tip().hasClass('in') ? self.leave(self) : self.enter(self)1385}13861387Tooltip.prototype.destroy = function () {1388clearTimeout(this.timeout)1389this.hide().$element.off('.' + this.type).removeData('bs.' + this.type)1390}139113921393// TOOLTIP PLUGIN DEFINITION1394// =========================13951396var old = $.fn.tooltip13971398$.fn.tooltip = function (option) {1399return this.each(function () {1400var $this = $(this)1401var data = $this.data('bs.tooltip')1402var options = typeof option == 'object' && option14031404if (!data && option == 'destroy') return1405if (!data) $this.data('bs.tooltip', (data = new Tooltip(this, options)))1406if (typeof option == 'string') data[option]()1407})1408}14091410$.fn.tooltip.Constructor = Tooltip141114121413// TOOLTIP NO CONFLICT1414// ===================14151416$.fn.tooltip.noConflict = function () {1417$.fn.tooltip = old1418return this1419}14201421}(jQuery);14221423/* ========================================================================1424* Bootstrap: popover.js v3.1.11425* http://getbootstrap.com/javascript/#popovers1426* ========================================================================1427* Copyright 2011-2014 Twitter, Inc.1428* Licensed under MIT (https://github.com/twbs/bootstrap/blob/master/LICENSE)1429* ======================================================================== */143014311432+function ($) {1433'use strict';14341435// POPOVER PUBLIC CLASS DEFINITION1436// ===============================14371438var Popover = function (element, options) {1439this.init('popover', element, options)1440}14411442if (!$.fn.tooltip) throw new Error('Popover requires tooltip.js')14431444Popover.DEFAULTS = $.extend({}, $.fn.tooltip.Constructor.DEFAULTS, {1445placement: 'right',1446trigger: 'click',1447content: '',1448template: '<div class="popover"><div class="arrow"></div><h3 class="popover-title"></h3><div class="popover-content"></div></div>'1449})145014511452// NOTE: POPOVER EXTENDS tooltip.js1453// ================================14541455Popover.prototype = $.extend({}, $.fn.tooltip.Constructor.prototype)14561457Popover.prototype.constructor = Popover14581459Popover.prototype.getDefaults = function () {1460return Popover.DEFAULTS1461}14621463Popover.prototype.setContent = function () {1464var $tip = this.tip()1465var title = this.getTitle()1466var content = this.getContent()14671468$tip.find('.popover-title')[this.options.html ? 'html' : 'text'](title)1469$tip.find('.popover-content')[ // we use append for html objects to maintain js events1470this.options.html ? (typeof content == 'string' ? 'html' : 'append') : 'text'1471](content)14721473$tip.removeClass('fade top bottom left right in')14741475// IE8 doesn't accept hiding via the `:empty` pseudo selector, we have to do1476// this manually by checking the contents.1477if (!$tip.find('.popover-title').html()) $tip.find('.popover-title').hide()1478}14791480Popover.prototype.hasContent = function () {1481return this.getTitle() || this.getContent()1482}14831484Popover.prototype.getContent = function () {1485var $e = this.$element1486var o = this.options14871488return $e.attr('data-content')1489|| (typeof o.content == 'function' ?1490o.content.call($e[0]) :1491o.content)1492}14931494Popover.prototype.arrow = function () {1495return this.$arrow = this.$arrow || this.tip().find('.arrow')1496}14971498Popover.prototype.tip = function () {1499if (!this.$tip) this.$tip = $(this.options.template)1500return this.$tip1501}150215031504// POPOVER PLUGIN DEFINITION1505// =========================15061507var old = $.fn.popover15081509$.fn.popover = function (option) {1510return this.each(function () {1511var $this = $(this)1512var data = $this.data('bs.popover')1513var options = typeof option == 'object' && option15141515if (!data && option == 'destroy') return1516if (!data) $this.data('bs.popover', (data = new Popover(this, options)))1517if (typeof option == 'string') data[option]()1518})1519}15201521$.fn.popover.Constructor = Popover152215231524// POPOVER NO CONFLICT1525// ===================15261527$.fn.popover.noConflict = function () {1528$.fn.popover = old1529return this1530}15311532}(jQuery);15331534/* ========================================================================1535* Bootstrap: scrollspy.js v3.1.11536* http://getbootstrap.com/javascript/#scrollspy1537* ========================================================================1538* Copyright 2011-2014 Twitter, Inc.1539* Licensed under MIT (https://github.com/twbs/bootstrap/blob/master/LICENSE)1540* ======================================================================== */154115421543+function ($) {1544'use strict';15451546// SCROLLSPY CLASS DEFINITION1547// ==========================15481549function ScrollSpy(element, options) {1550var href1551var process = $.proxy(this.process, this)15521553this.$element = $(element).is('body') ? $(window) : $(element)1554this.$body = $('body')1555this.$scrollElement = this.$element.on('scroll.bs.scroll-spy.data-api', process)1556this.options = $.extend({}, ScrollSpy.DEFAULTS, options)1557this.selector = (this.options.target1558|| ((href = $(element).attr('href')) && href.replace(/.*(?=#[^\s]+$)/, '')) //strip for ie71559|| '') + ' .nav li > a'1560this.offsets = $([])1561this.targets = $([])1562this.activeTarget = null15631564this.refresh()1565this.process()1566}15671568ScrollSpy.DEFAULTS = {1569offset: 101570}15711572ScrollSpy.prototype.refresh = function () {1573var offsetMethod = this.$element[0] == window ? 'offset' : 'position'15741575this.offsets = $([])1576this.targets = $([])15771578var self = this1579var $targets = this.$body1580.find(this.selector)1581.map(function () {1582var $el = $(this)1583var href = $el.data('target') || $el.attr('href')1584var $href = /^#./.test(href) && $(href)15851586return ($href1587&& $href.length1588&& $href.is(':visible')1589&& [[ $href[offsetMethod]().top + (!$.isWindow(self.$scrollElement.get(0)) && self.$scrollElement.scrollTop()), href ]]) || null1590})1591.sort(function (a, b) { return a[0] - b[0] })1592.each(function () {1593self.offsets.push(this[0])1594self.targets.push(this[1])1595})1596}15971598ScrollSpy.prototype.process = function () {1599var scrollTop = this.$scrollElement.scrollTop() + this.options.offset1600var scrollHeight = this.$scrollElement[0].scrollHeight || this.$body[0].scrollHeight1601var maxScroll = scrollHeight - this.$scrollElement.height()1602var offsets = this.offsets1603var targets = this.targets1604var activeTarget = this.activeTarget1605var i16061607if (scrollTop >= maxScroll) {1608return activeTarget != (i = targets.last()[0]) && this.activate(i)1609}16101611if (activeTarget && scrollTop <= offsets[0]) {1612return activeTarget != (i = targets[0]) && this.activate(i)1613}16141615for (i = offsets.length; i--;) {1616activeTarget != targets[i]1617&& scrollTop >= offsets[i]1618&& (!offsets[i + 1] || scrollTop <= offsets[i + 1])1619&& this.activate( targets[i] )1620}1621}16221623ScrollSpy.prototype.activate = function (target) {1624this.activeTarget = target16251626$(this.selector)1627.parentsUntil(this.options.target, '.active')1628.removeClass('active')16291630var selector = this.selector +1631'[data-target="' + target + '"],' +1632this.selector + '[href="' + target + '"]'16331634var active = $(selector)1635.parents('li')1636.addClass('active')16371638if (active.parent('.dropdown-menu').length) {1639active = active1640.closest('li.dropdown')1641.addClass('active')1642}16431644active.trigger('activate.bs.scrollspy')1645}164616471648// SCROLLSPY PLUGIN DEFINITION1649// ===========================16501651var old = $.fn.scrollspy16521653$.fn.scrollspy = function (option) {1654return this.each(function () {1655var $this = $(this)1656var data = $this.data('bs.scrollspy')1657var options = typeof option == 'object' && option16581659if (!data) $this.data('bs.scrollspy', (data = new ScrollSpy(this, options)))1660if (typeof option == 'string') data[option]()1661})1662}16631664$.fn.scrollspy.Constructor = ScrollSpy166516661667// SCROLLSPY NO CONFLICT1668// =====================16691670$.fn.scrollspy.noConflict = function () {1671$.fn.scrollspy = old1672return this1673}167416751676// SCROLLSPY DATA-API1677// ==================16781679$(window).on('load', function () {1680$('[data-spy="scroll"]').each(function () {1681var $spy = $(this)1682$spy.scrollspy($spy.data())1683})1684})16851686}(jQuery);16871688/* ========================================================================1689* Bootstrap: tab.js v3.1.11690* http://getbootstrap.com/javascript/#tabs1691* ========================================================================1692* Copyright 2011-2014 Twitter, Inc.1693* Licensed under MIT (https://github.com/twbs/bootstrap/blob/master/LICENSE)1694* ======================================================================== */169516961697+function ($) {1698'use strict';16991700// TAB CLASS DEFINITION1701// ====================17021703var Tab = function (element) {1704this.element = $(element)1705}17061707Tab.prototype.show = function () {1708var $this = this.element1709var $ul = $this.closest('ul:not(.dropdown-menu)')1710var selector = $this.data('target')17111712if (!selector) {1713selector = $this.attr('href')1714selector = selector && selector.replace(/.*(?=#[^\s]*$)/, '') //strip for ie71715}17161717if ($this.parent('li').hasClass('active')) return17181719var previous = $ul.find('.active:last a')[0]1720var e = $.Event('show.bs.tab', {1721relatedTarget: previous1722})17231724$this.trigger(e)17251726if (e.isDefaultPrevented()) return17271728var $target = $(selector)17291730this.activate($this.parent('li'), $ul)1731this.activate($target, $target.parent(), function () {1732$this.trigger({1733type: 'shown.bs.tab',1734relatedTarget: previous1735})1736})1737}17381739Tab.prototype.activate = function (element, container, callback) {1740var $active = container.find('> .active')1741var transition = callback1742&& $.support.transition1743&& $active.hasClass('fade')17441745function next() {1746$active1747.removeClass('active')1748.find('> .dropdown-menu > .active')1749.removeClass('active')17501751element.addClass('active')17521753if (transition) {1754element[0].offsetWidth // reflow for transition1755element.addClass('in')1756} else {1757element.removeClass('fade')1758}17591760if (element.parent('.dropdown-menu')) {1761element.closest('li.dropdown').addClass('active')1762}17631764callback && callback()1765}17661767transition ?1768$active1769.one($.support.transition.end, next)1770.emulateTransitionEnd(150) :1771next()17721773$active.removeClass('in')1774}177517761777// TAB PLUGIN DEFINITION1778// =====================17791780var old = $.fn.tab17811782$.fn.tab = function ( option ) {1783return this.each(function () {1784var $this = $(this)1785var data = $this.data('bs.tab')17861787if (!data) $this.data('bs.tab', (data = new Tab(this)))1788if (typeof option == 'string') data[option]()1789})1790}17911792$.fn.tab.Constructor = Tab179317941795// TAB NO CONFLICT1796// ===============17971798$.fn.tab.noConflict = function () {1799$.fn.tab = old1800return this1801}180218031804// TAB DATA-API1805// ============18061807$(document).on('click.bs.tab.data-api', '[data-toggle="tab"], [data-toggle="pill"]', function (e) {1808e.preventDefault()1809$(this).tab('show')1810})18111812}(jQuery);18131814/* ========================================================================1815* Bootstrap: affix.js v3.1.11816* http://getbootstrap.com/javascript/#affix1817* ========================================================================1818* Copyright 2011-2014 Twitter, Inc.1819* Licensed under MIT (https://github.com/twbs/bootstrap/blob/master/LICENSE)1820* ======================================================================== */182118221823+function ($) {1824'use strict';18251826// AFFIX CLASS DEFINITION1827// ======================18281829var Affix = function (element, options) {1830this.options = $.extend({}, Affix.DEFAULTS, options)1831this.$window = $(window)1832.on('scroll.bs.affix.data-api', $.proxy(this.checkPosition, this))1833.on('click.bs.affix.data-api', $.proxy(this.checkPositionWithEventLoop, this))18341835this.$element = $(element)1836this.affixed =1837this.unpin =1838this.pinnedOffset = null18391840this.checkPosition()1841}18421843Affix.RESET = 'affix affix-top affix-bottom'18441845Affix.DEFAULTS = {1846offset: 01847}18481849Affix.prototype.getPinnedOffset = function () {1850if (this.pinnedOffset) return this.pinnedOffset1851this.$element.removeClass(Affix.RESET).addClass('affix')1852var scrollTop = this.$window.scrollTop()1853var position = this.$element.offset()1854return (this.pinnedOffset = position.top - scrollTop)1855}18561857Affix.prototype.checkPositionWithEventLoop = function () {1858setTimeout($.proxy(this.checkPosition, this), 1)1859}18601861Affix.prototype.checkPosition = function () {1862if (!this.$element.is(':visible')) return18631864var scrollHeight = $(document).height()1865var scrollTop = this.$window.scrollTop()1866var position = this.$element.offset()1867var offset = this.options.offset1868var offsetTop = offset.top1869var offsetBottom = offset.bottom18701871if (this.affixed == 'top') position.top += scrollTop18721873if (typeof offset != 'object') offsetBottom = offsetTop = offset1874if (typeof offsetTop == 'function') offsetTop = offset.top(this.$element)1875if (typeof offsetBottom == 'function') offsetBottom = offset.bottom(this.$element)18761877var affix = this.unpin != null && (scrollTop + this.unpin <= position.top) ? false :1878offsetBottom != null && (position.top + this.$element.height() >= scrollHeight - offsetBottom) ? 'bottom' :1879offsetTop != null && (scrollTop <= offsetTop) ? 'top' : false18801881if (this.affixed === affix) return1882if (this.unpin) this.$element.css('top', '')18831884var affixType = 'affix' + (affix ? '-' + affix : '')1885var e = $.Event(affixType + '.bs.affix')18861887this.$element.trigger(e)18881889if (e.isDefaultPrevented()) return18901891this.affixed = affix1892this.unpin = affix == 'bottom' ? this.getPinnedOffset() : null18931894this.$element1895.removeClass(Affix.RESET)1896.addClass(affixType)1897.trigger($.Event(affixType.replace('affix', 'affixed')))18981899if (affix == 'bottom') {1900this.$element.offset({ top: scrollHeight - offsetBottom - this.$element.height() })1901}1902}190319041905// AFFIX PLUGIN DEFINITION1906// =======================19071908var old = $.fn.affix19091910$.fn.affix = function (option) {1911return this.each(function () {1912var $this = $(this)1913var data = $this.data('bs.affix')1914var options = typeof option == 'object' && option19151916if (!data) $this.data('bs.affix', (data = new Affix(this, options)))1917if (typeof option == 'string') data[option]()1918})1919}19201921$.fn.affix.Constructor = Affix192219231924// AFFIX NO CONFLICT1925// =================19261927$.fn.affix.noConflict = function () {1928$.fn.affix = old1929return this1930}193119321933// AFFIX DATA-API1934// ==============19351936$(window).on('load', function () {1937$('[data-spy="affix"]').each(function () {1938var $spy = $(this)1939var data = $spy.data()19401941data.offset = data.offset || {}19421943if (data.offsetBottom) data.offset.bottom = data.offsetBottom1944if (data.offsetTop) data.offset.top = data.offsetTop19451946$spy.affix(data)1947})1948})19491950}(jQuery);195119521953