1 if (typeof jQuery === 'undefined') { throw new Error('Bootstrap\'s JavaScript requires jQuery') }
3 /* ========================================================================
4 * Bootstrap: transition.js v3.1.1
5 * http://getbootstrap.com/javascript/#transitions
6 * ========================================================================
7 * Copyright 2011-2014 Twitter, Inc.
8 * Licensed under MIT (https://github.com/twbs/bootstrap/blob/master/LICENSE)
9 * ======================================================================== */
15 // CSS TRANSITION SUPPORT (Shoutout: http://www.modernizr.com/)
16 // ============================================================
18 function transitionEnd() {
19 var el = document.createElement('bootstrap')
21 var transEndEventNames = {
22 'WebkitTransition' : 'webkitTransitionEnd',
23 'MozTransition' : 'transitionend',
24 'OTransition' : 'oTransitionEnd otransitionend',
25 'transition' : 'transitionend'
28 for (var name in transEndEventNames) {
29 if (el.style[name] !== undefined) {
30 return { end: transEndEventNames[name] }
34 return false // explicit for ie8 ( ._.)
37 // http://blog.alexmaccaw.com/css-transitions
38 $.fn.emulateTransitionEnd = function (duration) {
39 var called = false, $el = this
40 $(this).one($.support.transition.end, function () { called = true })
41 var callback = function () { if (!called) $($el).trigger($.support.transition.end) }
42 setTimeout(callback, duration)
47 $.support.transition = transitionEnd()
52 /* ========================================================================
53 * Bootstrap: alert.js v3.1.1
54 * http://getbootstrap.com/javascript/#alerts
55 * ========================================================================
56 * Copyright 2011-2014 Twitter, Inc.
57 * Licensed under MIT (https://github.com/twbs/bootstrap/blob/master/LICENSE)
58 * ======================================================================== */
64 // ALERT CLASS DEFINITION
65 // ======================
67 var dismiss = '[data-dismiss="alert"]'
68 var Alert = function (el) {
69 $(el).on('click', dismiss, this.close)
72 Alert.prototype.close = function (e) {
74 var selector = $this.attr('data-target')
77 selector = $this.attr('href')
78 selector = selector && selector.replace(/.*(?=#[^\s]*$)/, '') // strip for ie7
81 var $parent = $(selector)
83 if (e) e.preventDefault()
85 if (!$parent.length) {
86 $parent = $this.hasClass('alert') ? $this : $this.parent()
89 $parent.trigger(e = $.Event('close.bs.alert'))
91 if (e.isDefaultPrevented()) return
93 $parent.removeClass('in')
95 function removeElement() {
96 $parent.trigger('closed.bs.alert').remove()
99 $.support.transition && $parent.hasClass('fade') ?
101 .one($.support.transition.end, removeElement)
102 .emulateTransitionEnd(150) :
107 // ALERT PLUGIN DEFINITION
108 // =======================
112 $.fn.alert = function (option) {
113 return this.each(function () {
115 var data = $this.data('bs.alert')
117 if (!data) $this.data('bs.alert', (data = new Alert(this)))
118 if (typeof option == 'string') data[option].call($this)
122 $.fn.alert.Constructor = Alert
128 $.fn.alert.noConflict = function () {
137 $(document).on('click.bs.alert.data-api', dismiss, Alert.prototype.close)
141 /* ========================================================================
142 * Bootstrap: button.js v3.1.1
143 * http://getbootstrap.com/javascript/#buttons
144 * ========================================================================
145 * Copyright 2011-2014 Twitter, Inc.
146 * Licensed under MIT (https://github.com/twbs/bootstrap/blob/master/LICENSE)
147 * ======================================================================== */
153 // BUTTON PUBLIC CLASS DEFINITION
154 // ==============================
156 var Button = function (element, options) {
157 this.$element = $(element)
158 this.options = $.extend({}, Button.DEFAULTS, options)
159 this.isLoading = false
163 loadingText: 'loading...'
166 Button.prototype.setState = function (state) {
168 var $el = this.$element
169 var val = $el.is('input') ? 'val' : 'html'
170 var data = $el.data()
172 state = state + 'Text'
174 if (!data.resetText) $el.data('resetText', $el[val]())
176 $el[val](data[state] || this.options[state])
178 // push to event loop to allow forms to submit
179 setTimeout($.proxy(function () {
180 if (state == 'loadingText') {
181 this.isLoading = true
182 $el.addClass(d).attr(d, d)
183 } else if (this.isLoading) {
184 this.isLoading = false
185 $el.removeClass(d).removeAttr(d)
190 Button.prototype.toggle = function () {
192 var $parent = this.$element.closest('[data-toggle="buttons"]')
194 if ($parent.length) {
195 var $input = this.$element.find('input')
196 if ($input.prop('type') == 'radio') {
197 if ($input.prop('checked') && this.$element.hasClass('active')) changed = false
198 else $parent.find('.active').removeClass('active')
200 if (changed) $input.prop('checked', !this.$element.hasClass('active')).trigger('change')
203 if (changed) this.$element.toggleClass('active')
207 // BUTTON PLUGIN DEFINITION
208 // ========================
210 var old = $.fn.button
212 $.fn.button = function (option) {
213 return this.each(function () {
215 var data = $this.data('bs.button')
216 var options = typeof option == 'object' && option
218 if (!data) $this.data('bs.button', (data = new Button(this, options)))
220 if (option == 'toggle') data.toggle()
221 else if (option) data.setState(option)
225 $.fn.button.Constructor = Button
228 // BUTTON NO CONFLICT
229 // ==================
231 $.fn.button.noConflict = function () {
240 $(document).on('click.bs.button.data-api', '[data-toggle^=button]', function (e) {
241 var $btn = $(e.target)
242 if (!$btn.hasClass('btn')) $btn = $btn.closest('.btn')
243 $btn.button('toggle')
249 /* ========================================================================
250 * Bootstrap: carousel.js v3.1.1
251 * http://getbootstrap.com/javascript/#carousel
252 * ========================================================================
253 * Copyright 2011-2014 Twitter, Inc.
254 * Licensed under MIT (https://github.com/twbs/bootstrap/blob/master/LICENSE)
255 * ======================================================================== */
261 // CAROUSEL CLASS DEFINITION
262 // =========================
264 var Carousel = function (element, options) {
265 this.$element = $(element)
266 this.$indicators = this.$element.find('.carousel-indicators')
267 this.options = options
274 this.options.pause == 'hover' && this.$element
275 .on('mouseenter', $.proxy(this.pause, this))
276 .on('mouseleave', $.proxy(this.cycle, this))
279 Carousel.DEFAULTS = {
285 Carousel.prototype.cycle = function (e) {
286 e || (this.paused = false)
288 this.interval && clearInterval(this.interval)
290 this.options.interval
292 && (this.interval = setInterval($.proxy(this.next, this), this.options.interval))
297 Carousel.prototype.getActiveIndex = function () {
298 this.$active = this.$element.find('.item.active')
299 this.$items = this.$active.parent().children()
301 return this.$items.index(this.$active)
304 Carousel.prototype.to = function (pos) {
306 var activeIndex = this.getActiveIndex()
308 if (pos > (this.$items.length - 1) || pos < 0) return
310 if (this.sliding) return this.$element.one('slid.bs.carousel', function () { that.to(pos) })
311 if (activeIndex == pos) return this.pause().cycle()
313 return this.slide(pos > activeIndex ? 'next' : 'prev', $(this.$items[pos]))
316 Carousel.prototype.pause = function (e) {
317 e || (this.paused = true)
319 if (this.$element.find('.next, .prev').length && $.support.transition) {
320 this.$element.trigger($.support.transition.end)
324 this.interval = clearInterval(this.interval)
329 Carousel.prototype.next = function () {
330 if (this.sliding) return
331 return this.slide('next')
334 Carousel.prototype.prev = function () {
335 if (this.sliding) return
336 return this.slide('prev')
339 Carousel.prototype.slide = function (type, next) {
340 var $active = this.$element.find('.item.active')
341 var $next = next || $active[type]()
342 var isCycling = this.interval
343 var direction = type == 'next' ? 'left' : 'right'
344 var fallback = type == 'next' ? 'first' : 'last'
348 if (!this.options.wrap) return
349 $next = this.$element.find('.item')[fallback]()
352 if ($next.hasClass('active')) return this.sliding = false
354 var e = $.Event('slide.bs.carousel', { relatedTarget: $next[0], direction: direction })
355 this.$element.trigger(e)
356 if (e.isDefaultPrevented()) return
360 isCycling && this.pause()
362 if (this.$indicators.length) {
363 this.$indicators.find('.active').removeClass('active')
364 this.$element.one('slid.bs.carousel', function () {
365 var $nextIndicator = $(that.$indicators.children()[that.getActiveIndex()])
366 $nextIndicator && $nextIndicator.addClass('active')
370 if ($.support.transition && this.$element.hasClass('slide')) {
372 $next[0].offsetWidth // force reflow
373 $active.addClass(direction)
374 $next.addClass(direction)
376 .one($.support.transition.end, function () {
377 $next.removeClass([type, direction].join(' ')).addClass('active')
378 $active.removeClass(['active', direction].join(' '))
380 setTimeout(function () { that.$element.trigger('slid.bs.carousel') }, 0)
382 .emulateTransitionEnd($active.css('transition-duration').slice(0, -1) * 1000)
384 $active.removeClass('active')
385 $next.addClass('active')
387 this.$element.trigger('slid.bs.carousel')
390 isCycling && this.cycle()
396 // CAROUSEL PLUGIN DEFINITION
397 // ==========================
399 var old = $.fn.carousel
401 $.fn.carousel = function (option) {
402 return this.each(function () {
404 var data = $this.data('bs.carousel')
405 var options = $.extend({}, Carousel.DEFAULTS, $this.data(), typeof option == 'object' && option)
406 var action = typeof option == 'string' ? option : options.slide
408 if (!data) $this.data('bs.carousel', (data = new Carousel(this, options)))
409 if (typeof option == 'number') data.to(option)
410 else if (action) data[action]()
411 else if (options.interval) data.pause().cycle()
415 $.fn.carousel.Constructor = Carousel
418 // CAROUSEL NO CONFLICT
419 // ====================
421 $.fn.carousel.noConflict = function () {
430 $(document).on('click.bs.carousel.data-api', '[data-slide], [data-slide-to]', function (e) {
431 var $this = $(this), href
432 var $target = $($this.attr('data-target') || (href = $this.attr('href')) && href.replace(/.*(?=#[^\s]+$)/, '')) //strip for ie7
433 var options = $.extend({}, $target.data(), $this.data())
434 var slideIndex = $this.attr('data-slide-to')
435 if (slideIndex) options.interval = false
437 $target.carousel(options)
439 if (slideIndex = $this.attr('data-slide-to')) {
440 $target.data('bs.carousel').to(slideIndex)
446 $(window).on('load', function () {
447 $('[data-ride="carousel"]').each(function () {
448 var $carousel = $(this)
449 $carousel.carousel($carousel.data())
455 /* ========================================================================
456 * Bootstrap: collapse.js v3.1.1
457 * http://getbootstrap.com/javascript/#collapse
458 * ========================================================================
459 * Copyright 2011-2014 Twitter, Inc.
460 * Licensed under MIT (https://github.com/twbs/bootstrap/blob/master/LICENSE)
461 * ======================================================================== */
467 // COLLAPSE PUBLIC CLASS DEFINITION
468 // ================================
470 var Collapse = function (element, options) {
471 this.$element = $(element)
472 this.options = $.extend({}, Collapse.DEFAULTS, options)
473 this.transitioning = null
475 if (this.options.parent) this.$parent = $(this.options.parent)
476 if (this.options.toggle) this.toggle()
479 Collapse.DEFAULTS = {
483 Collapse.prototype.dimension = function () {
484 var hasWidth = this.$element.hasClass('width')
485 return hasWidth ? 'width' : 'height'
488 Collapse.prototype.show = function () {
489 if (this.transitioning || this.$element.hasClass('in')) return
491 var startEvent = $.Event('show.bs.collapse')
492 this.$element.trigger(startEvent)
493 if (startEvent.isDefaultPrevented()) return
495 var actives = this.$parent && this.$parent.find('> .panel > .in')
497 if (actives && actives.length) {
498 var hasData = actives.data('bs.collapse')
499 if (hasData && hasData.transitioning) return
500 actives.collapse('hide')
501 hasData || actives.data('bs.collapse', null)
504 var dimension = this.dimension()
507 .removeClass('collapse')
508 .addClass('collapsing')
511 this.transitioning = 1
513 var complete = function () {
515 .removeClass('collapsing')
516 .addClass('collapse in')
518 this.transitioning = 0
519 this.$element.trigger('shown.bs.collapse')
522 if (!$.support.transition) return complete.call(this)
524 var scrollSize = $.camelCase(['scroll', dimension].join('-'))
527 .one($.support.transition.end, $.proxy(complete, this))
528 .emulateTransitionEnd(350)
529 [dimension](this.$element[0][scrollSize])
532 Collapse.prototype.hide = function () {
533 if (this.transitioning || !this.$element.hasClass('in')) return
535 var startEvent = $.Event('hide.bs.collapse')
536 this.$element.trigger(startEvent)
537 if (startEvent.isDefaultPrevented()) return
539 var dimension = this.dimension()
542 [dimension](this.$element[dimension]())
546 .addClass('collapsing')
547 .removeClass('collapse')
550 this.transitioning = 1
552 var complete = function () {
553 this.transitioning = 0
555 .trigger('hidden.bs.collapse')
556 .removeClass('collapsing')
557 .addClass('collapse')
560 if (!$.support.transition) return complete.call(this)
564 .one($.support.transition.end, $.proxy(complete, this))
565 .emulateTransitionEnd(350)
568 Collapse.prototype.toggle = function () {
569 this[this.$element.hasClass('in') ? 'hide' : 'show']()
573 // COLLAPSE PLUGIN DEFINITION
574 // ==========================
576 var old = $.fn.collapse
578 $.fn.collapse = function (option) {
579 return this.each(function () {
581 var data = $this.data('bs.collapse')
582 var options = $.extend({}, Collapse.DEFAULTS, $this.data(), typeof option == 'object' && option)
584 if (!data && options.toggle && option == 'show') option = !option
585 if (!data) $this.data('bs.collapse', (data = new Collapse(this, options)))
586 if (typeof option == 'string') data[option]()
590 $.fn.collapse.Constructor = Collapse
593 // COLLAPSE NO CONFLICT
594 // ====================
596 $.fn.collapse.noConflict = function () {
605 $(document).on('click.bs.collapse.data-api', '[data-toggle=collapse]', function (e) {
606 var $this = $(this), href
607 var target = $this.attr('data-target')
608 || e.preventDefault()
609 || (href = $this.attr('href')) && href.replace(/.*(?=#[^\s]+$)/, '') //strip for ie7
610 var $target = $(target)
611 var data = $target.data('bs.collapse')
612 var option = data ? 'toggle' : $this.data()
613 var parent = $this.attr('data-parent')
614 var $parent = parent && $(parent)
616 if (!data || !data.transitioning) {
617 if ($parent) $parent.find('[data-toggle=collapse][data-parent="' + parent + '"]').not($this).addClass('collapsed')
618 $this[$target.hasClass('in') ? 'addClass' : 'removeClass']('collapsed')
621 $target.collapse(option)
626 /* ========================================================================
627 * Bootstrap: dropdown.js v3.1.1
628 * http://getbootstrap.com/javascript/#dropdowns
629 * ========================================================================
630 * Copyright 2011-2014 Twitter, Inc.
631 * Licensed under MIT (https://github.com/twbs/bootstrap/blob/master/LICENSE)
632 * ======================================================================== */
638 // DROPDOWN CLASS DEFINITION
639 // =========================
641 var backdrop = '.dropdown-backdrop'
642 var toggle = '[data-toggle=dropdown]'
643 var Dropdown = function (element) {
644 $(element).on('click.bs.dropdown', this.toggle)
647 Dropdown.prototype.toggle = function (e) {
650 if ($this.is('.disabled, :disabled')) return
652 var $parent = getParent($this)
653 var isActive = $parent.hasClass('open')
658 if ('ontouchstart' in document.documentElement && !$parent.closest('.navbar-nav').length) {
659 // if mobile we use a backdrop because click events don't delegate
660 $('<div class="dropdown-backdrop"/>').insertAfter($(this)).on('click', clearMenus)
663 var relatedTarget = { relatedTarget: this }
664 $parent.trigger(e = $.Event('show.bs.dropdown', relatedTarget))
666 if (e.isDefaultPrevented()) return
670 .trigger('shown.bs.dropdown', relatedTarget)
678 Dropdown.prototype.keydown = function (e) {
679 if (!/(38|40|27)/.test(e.keyCode)) return
686 if ($this.is('.disabled, :disabled')) return
688 var $parent = getParent($this)
689 var isActive = $parent.hasClass('open')
691 if (!isActive || (isActive && e.keyCode == 27)) {
692 if (e.which == 27) $parent.find(toggle).focus()
696 var desc = ' li:not(.divider):visible a'
697 var $items = $parent.find('[role=menu]' + desc + ', [role=listbox]' + desc)
699 if (!$items.length) return
701 var index = $items.index($items.filter(':focus'))
703 if (e.keyCode == 38 && index > 0) index-- // up
704 if (e.keyCode == 40 && index < $items.length - 1) index++ // down
705 if (!~index) index = 0
707 $items.eq(index).focus()
710 function clearMenus(e) {
712 $(toggle).each(function () {
713 var $parent = getParent($(this))
714 var relatedTarget = { relatedTarget: this }
715 if (!$parent.hasClass('open')) return
716 $parent.trigger(e = $.Event('hide.bs.dropdown', relatedTarget))
717 if (e.isDefaultPrevented()) return
718 $parent.removeClass('open').trigger('hidden.bs.dropdown', relatedTarget)
722 function getParent($this) {
723 var selector = $this.attr('data-target')
726 selector = $this.attr('href')
727 selector = selector && /#[A-Za-z]/.test(selector) && selector.replace(/.*(?=#[^\s]*$)/, '') //strip for ie7
730 var $parent = selector && $(selector)
732 return $parent && $parent.length ? $parent : $this.parent()
736 // DROPDOWN PLUGIN DEFINITION
737 // ==========================
739 var old = $.fn.dropdown
741 $.fn.dropdown = function (option) {
742 return this.each(function () {
744 var data = $this.data('bs.dropdown')
746 if (!data) $this.data('bs.dropdown', (data = new Dropdown(this)))
747 if (typeof option == 'string') data[option].call($this)
751 $.fn.dropdown.Constructor = Dropdown
754 // DROPDOWN NO CONFLICT
755 // ====================
757 $.fn.dropdown.noConflict = function () {
763 // APPLY TO STANDARD DROPDOWN ELEMENTS
764 // ===================================
767 .on('click.bs.dropdown.data-api', clearMenus)
768 .on('click.bs.dropdown.data-api', '.dropdown form', function (e) { e.stopPropagation() })
769 .on('click.bs.dropdown.data-api', toggle, Dropdown.prototype.toggle)
770 .on('keydown.bs.dropdown.data-api', toggle + ', [role=menu], [role=listbox]', Dropdown.prototype.keydown)
774 /* ========================================================================
775 * Bootstrap: modal.js v3.1.1
776 * http://getbootstrap.com/javascript/#modals
777 * ========================================================================
778 * Copyright 2011-2014 Twitter, Inc.
779 * Licensed under MIT (https://github.com/twbs/bootstrap/blob/master/LICENSE)
780 * ======================================================================== */
786 // MODAL CLASS DEFINITION
787 // ======================
789 var Modal = function (element, options) {
790 this.options = options
791 this.$element = $(element)
795 if (this.options.remote) {
797 .find('.modal-content')
798 .load(this.options.remote, $.proxy(function () {
799 this.$element.trigger('loaded.bs.modal')
810 Modal.prototype.toggle = function (_relatedTarget) {
811 return this[!this.isShown ? 'show' : 'hide'](_relatedTarget)
814 Modal.prototype.show = function (_relatedTarget) {
816 var e = $.Event('show.bs.modal', { relatedTarget: _relatedTarget })
818 this.$element.trigger(e)
820 if (this.isShown || e.isDefaultPrevented()) return
826 this.$element.on('click.dismiss.bs.modal', '[data-dismiss="modal"]', $.proxy(this.hide, this))
828 this.backdrop(function () {
829 var transition = $.support.transition && that.$element.hasClass('fade')
831 if (!that.$element.parent().length) {
832 that.$element.appendTo(document.body) // don't move modals dom position
840 that.$element[0].offsetWidth // force reflow
845 .attr('aria-hidden', false)
849 var e = $.Event('shown.bs.modal', { relatedTarget: _relatedTarget })
852 that.$element.find('.modal-dialog') // wait for modal to slide in
853 .one($.support.transition.end, function () {
854 that.$element.focus().trigger(e)
856 .emulateTransitionEnd(300) :
857 that.$element.focus().trigger(e)
861 Modal.prototype.hide = function (e) {
862 if (e) e.preventDefault()
864 e = $.Event('hide.bs.modal')
866 this.$element.trigger(e)
868 if (!this.isShown || e.isDefaultPrevented()) return
874 $(document).off('focusin.bs.modal')
878 .attr('aria-hidden', true)
879 .off('click.dismiss.bs.modal')
881 $.support.transition && this.$element.hasClass('fade') ?
883 .one($.support.transition.end, $.proxy(this.hideModal, this))
884 .emulateTransitionEnd(300) :
888 Modal.prototype.enforceFocus = function () {
890 .off('focusin.bs.modal') // guard against infinite focus loop
891 .on('focusin.bs.modal', $.proxy(function (e) {
892 if (this.$element[0] !== e.target && !this.$element.has(e.target).length) {
893 this.$element.focus()
898 Modal.prototype.escape = function () {
899 if (this.isShown && this.options.keyboard) {
900 this.$element.on('keyup.dismiss.bs.modal', $.proxy(function (e) {
901 e.which == 27 && this.hide()
903 } else if (!this.isShown) {
904 this.$element.off('keyup.dismiss.bs.modal')
908 Modal.prototype.hideModal = function () {
911 this.backdrop(function () {
912 that.removeBackdrop()
913 that.$element.trigger('hidden.bs.modal')
917 Modal.prototype.removeBackdrop = function () {
918 this.$backdrop && this.$backdrop.remove()
919 this.$backdrop = null
922 Modal.prototype.backdrop = function (callback) {
923 var animate = this.$element.hasClass('fade') ? 'fade' : ''
925 if (this.isShown && this.options.backdrop) {
926 var doAnimate = $.support.transition && animate
928 this.$backdrop = $('<div class="modal-backdrop ' + animate + '" />')
929 .appendTo(document.body)
931 this.$element.on('click.dismiss.bs.modal', $.proxy(function (e) {
932 if (e.target !== e.currentTarget) return
933 this.options.backdrop == 'static'
934 ? this.$element[0].focus.call(this.$element[0])
935 : this.hide.call(this)
938 if (doAnimate) this.$backdrop[0].offsetWidth // force reflow
940 this.$backdrop.addClass('in')
942 if (!callback) return
946 .one($.support.transition.end, callback)
947 .emulateTransitionEnd(150) :
950 } else if (!this.isShown && this.$backdrop) {
951 this.$backdrop.removeClass('in')
953 $.support.transition && this.$element.hasClass('fade') ?
955 .one($.support.transition.end, callback)
956 .emulateTransitionEnd(150) :
959 } else if (callback) {
965 // MODAL PLUGIN DEFINITION
966 // =======================
970 $.fn.modal = function (option, _relatedTarget) {
971 return this.each(function () {
973 var data = $this.data('bs.modal')
974 var options = $.extend({}, Modal.DEFAULTS, $this.data(), typeof option == 'object' && option)
976 if (!data) $this.data('bs.modal', (data = new Modal(this, options)))
977 if (typeof option == 'string') data[option](_relatedTarget)
978 else if (options.show) data.show(_relatedTarget)
982 $.fn.modal.Constructor = Modal
988 $.fn.modal.noConflict = function () {
997 $(document).on('click.bs.modal.data-api', '[data-toggle="modal"]', function (e) {
999 var href = $this.attr('href')
1000 var $target = $($this.attr('data-target') || (href && href.replace(/.*(?=#[^\s]+$)/, ''))) //strip for ie7
1001 var option = $target.data('bs.modal') ? 'toggle' : $.extend({ remote: !/#/.test(href) && href }, $target.data(), $this.data())
1003 if ($this.is('a')) e.preventDefault()
1006 .modal(option, this)
1007 .one('hide', function () {
1008 $this.is(':visible') && $this.focus()
1013 .on('show.bs.modal', '.modal', function () { $(document.body).addClass('modal-open') })
1014 .on('hidden.bs.modal', '.modal', function () { $(document.body).removeClass('modal-open') })
1018 /* ========================================================================
1019 * Bootstrap: tooltip.js v3.1.1
1020 * http://getbootstrap.com/javascript/#tooltip
1021 * Inspired by the original jQuery.tipsy by Jason Frame
1022 * ========================================================================
1023 * Copyright 2011-2014 Twitter, Inc.
1024 * Licensed under MIT (https://github.com/twbs/bootstrap/blob/master/LICENSE)
1025 * ======================================================================== */
1031 // TOOLTIP PUBLIC CLASS DEFINITION
1032 // ===============================
1034 var Tooltip = function (element, options) {
1040 this.$element = null
1042 this.init('tooltip', element, options)
1045 Tooltip.DEFAULTS = {
1049 template: '<div class="tooltip"><div class="tooltip-arrow"></div><div class="tooltip-inner"></div></div>',
1050 trigger: 'hover focus',
1057 Tooltip.prototype.init = function (type, element, options) {
1060 this.$element = $(element)
1061 this.options = this.getOptions(options)
1063 var triggers = this.options.trigger.split(' ')
1065 for (var i = triggers.length; i--;) {
1066 var trigger = triggers[i]
1068 if (trigger == 'click') {
1069 this.$element.on('click.' + this.type, this.options.selector, $.proxy(this.toggle, this))
1070 } else if (trigger != 'manual') {
1071 var eventIn = trigger == 'hover' ? 'mouseenter' : 'focusin'
1072 var eventOut = trigger == 'hover' ? 'mouseleave' : 'focusout'
1074 this.$element.on(eventIn + '.' + this.type, this.options.selector, $.proxy(this.enter, this))
1075 this.$element.on(eventOut + '.' + this.type, this.options.selector, $.proxy(this.leave, this))
1079 this.options.selector ?
1080 (this._options = $.extend({}, this.options, { trigger: 'manual', selector: '' })) :
1084 Tooltip.prototype.getDefaults = function () {
1085 return Tooltip.DEFAULTS
1088 Tooltip.prototype.getOptions = function (options) {
1089 options = $.extend({}, this.getDefaults(), this.$element.data(), options)
1091 if (options.delay && typeof options.delay == 'number') {
1093 show: options.delay,
1101 Tooltip.prototype.getDelegateOptions = function () {
1103 var defaults = this.getDefaults()
1105 this._options && $.each(this._options, function (key, value) {
1106 if (defaults[key] != value) options[key] = value
1112 Tooltip.prototype.enter = function (obj) {
1113 var self = obj instanceof this.constructor ?
1114 obj : $(obj.currentTarget)[this.type](this.getDelegateOptions()).data('bs.' + this.type)
1116 clearTimeout(self.timeout)
1118 self.hoverState = 'in'
1120 if (!self.options.delay || !self.options.delay.show) return self.show()
1122 self.timeout = setTimeout(function () {
1123 if (self.hoverState == 'in') self.show()
1124 }, self.options.delay.show)
1127 Tooltip.prototype.leave = function (obj) {
1128 var self = obj instanceof this.constructor ?
1129 obj : $(obj.currentTarget)[this.type](this.getDelegateOptions()).data('bs.' + this.type)
1131 clearTimeout(self.timeout)
1133 self.hoverState = 'out'
1135 if (!self.options.delay || !self.options.delay.hide) return self.hide()
1137 self.timeout = setTimeout(function () {
1138 if (self.hoverState == 'out') self.hide()
1139 }, self.options.delay.hide)
1142 Tooltip.prototype.show = function () {
1143 var e = $.Event('show.bs.' + this.type)
1145 if (this.hasContent() && this.enabled) {
1146 this.$element.trigger(e)
1148 if (e.isDefaultPrevented()) return
1151 var $tip = this.tip()
1155 if (this.options.animation) $tip.addClass('fade')
1157 var placement = typeof this.options.placement == 'function' ?
1158 this.options.placement.call(this, $tip[0], this.$element[0]) :
1159 this.options.placement
1161 var autoToken = /\s?auto?\s?/i
1162 var autoPlace = autoToken.test(placement)
1163 if (autoPlace) placement = placement.replace(autoToken, '') || 'top'
1167 .css({ top: 0, left: 0, display: 'block' })
1168 .addClass(placement)
1170 this.options.container ? $tip.appendTo(this.options.container) : $tip.insertAfter(this.$element)
1172 var pos = this.getPosition()
1173 var actualWidth = $tip[0].offsetWidth
1174 var actualHeight = $tip[0].offsetHeight
1177 var $parent = this.$element.parent()
1179 var orgPlacement = placement
1180 var docScroll = document.documentElement.scrollTop || document.body.scrollTop
1181 var parentWidth = this.options.container == 'body' ? window.innerWidth : $parent.outerWidth()
1182 var parentHeight = this.options.container == 'body' ? window.innerHeight : $parent.outerHeight()
1183 var parentLeft = this.options.container == 'body' ? 0 : $parent.offset().left
1185 placement = placement == 'bottom' && pos.top + pos.height + actualHeight - docScroll > parentHeight ? 'top' :
1186 placement == 'top' && pos.top - docScroll - actualHeight < 0 ? 'bottom' :
1187 placement == 'right' && pos.right + actualWidth > parentWidth ? 'left' :
1188 placement == 'left' && pos.left - actualWidth < parentLeft ? 'right' :
1192 .removeClass(orgPlacement)
1193 .addClass(placement)
1196 var calculatedOffset = this.getCalculatedOffset(placement, pos, actualWidth, actualHeight)
1198 this.applyPlacement(calculatedOffset, placement)
1199 this.hoverState = null
1201 var complete = function() {
1202 that.$element.trigger('shown.bs.' + that.type)
1205 $.support.transition && this.$tip.hasClass('fade') ?
1207 .one($.support.transition.end, complete)
1208 .emulateTransitionEnd(150) :
1213 Tooltip.prototype.applyPlacement = function (offset, placement) {
1215 var $tip = this.tip()
1216 var width = $tip[0].offsetWidth
1217 var height = $tip[0].offsetHeight
1219 // manually read margins because getBoundingClientRect includes difference
1220 var marginTop = parseInt($tip.css('margin-top'), 10)
1221 var marginLeft = parseInt($tip.css('margin-left'), 10)
1223 // we must check for NaN for ie 8/9
1224 if (isNaN(marginTop)) marginTop = 0
1225 if (isNaN(marginLeft)) marginLeft = 0
1227 offset.top = offset.top + marginTop
1228 offset.left = offset.left + marginLeft
1230 // $.fn.offset doesn't round pixel values
1231 // so we use setOffset directly with our own function B-0
1232 $.offset.setOffset($tip[0], $.extend({
1233 using: function (props) {
1235 top: Math.round(props.top),
1236 left: Math.round(props.left)
1243 // check to see if placing tip in new offset caused the tip to resize itself
1244 var actualWidth = $tip[0].offsetWidth
1245 var actualHeight = $tip[0].offsetHeight
1247 if (placement == 'top' && actualHeight != height) {
1249 offset.top = offset.top + height - actualHeight
1252 if (/bottom|top/.test(placement)) {
1255 if (offset.left < 0) {
1256 delta = offset.left * -2
1261 actualWidth = $tip[0].offsetWidth
1262 actualHeight = $tip[0].offsetHeight
1265 this.replaceArrow(delta - width + actualWidth, actualWidth, 'left')
1267 this.replaceArrow(actualHeight - height, actualHeight, 'top')
1270 if (replace) $tip.offset(offset)
1273 Tooltip.prototype.replaceArrow = function (delta, dimension, position) {
1274 this.arrow().css(position, delta ? (50 * (1 - delta / dimension) + '%') : '')
1277 Tooltip.prototype.setContent = function () {
1278 var $tip = this.tip()
1279 var title = this.getTitle()
1281 $tip.find('.tooltip-inner')[this.options.html ? 'html' : 'text'](title)
1282 $tip.removeClass('fade in top bottom left right')
1285 Tooltip.prototype.hide = function () {
1287 var $tip = this.tip()
1288 var e = $.Event('hide.bs.' + this.type)
1290 function complete() {
1291 if (that.hoverState != 'in') $tip.detach()
1292 that.$element.trigger('hidden.bs.' + that.type)
1295 this.$element.trigger(e)
1297 if (e.isDefaultPrevented()) return
1299 $tip.removeClass('in')
1301 $.support.transition && this.$tip.hasClass('fade') ?
1303 .one($.support.transition.end, complete)
1304 .emulateTransitionEnd(150) :
1307 this.hoverState = null
1312 Tooltip.prototype.fixTitle = function () {
1313 var $e = this.$element
1314 if ($e.attr('title') || typeof($e.attr('data-original-title')) != 'string') {
1315 $e.attr('data-original-title', $e.attr('title') || '').attr('title', '')
1319 Tooltip.prototype.hasContent = function () {
1320 return this.getTitle()
1323 Tooltip.prototype.getPosition = function () {
1324 var el = this.$element[0]
1325 return $.extend({}, (typeof el.getBoundingClientRect == 'function') ? el.getBoundingClientRect() : {
1326 width: el.offsetWidth,
1327 height: el.offsetHeight
1328 }, this.$element.offset())
1331 Tooltip.prototype.getCalculatedOffset = function (placement, pos, actualWidth, actualHeight) {
1332 return placement == 'bottom' ? { top: pos.top + pos.height, left: pos.left + pos.width / 2 - actualWidth / 2 } :
1333 placement == 'top' ? { top: pos.top - actualHeight, left: pos.left + pos.width / 2 - actualWidth / 2 } :
1334 placement == 'left' ? { top: pos.top + pos.height / 2 - actualHeight / 2, left: pos.left - actualWidth } :
1335 /* placement == 'right' */ { top: pos.top + pos.height / 2 - actualHeight / 2, left: pos.left + pos.width }
1338 Tooltip.prototype.getTitle = function () {
1340 var $e = this.$element
1341 var o = this.options
1343 title = $e.attr('data-original-title')
1344 || (typeof o.title == 'function' ? o.title.call($e[0]) : o.title)
1349 Tooltip.prototype.tip = function () {
1350 return this.$tip = this.$tip || $(this.options.template)
1353 Tooltip.prototype.arrow = function () {
1354 return this.$arrow = this.$arrow || this.tip().find('.tooltip-arrow')
1357 Tooltip.prototype.validate = function () {
1358 if (!this.$element[0].parentNode) {
1360 this.$element = null
1365 Tooltip.prototype.enable = function () {
1369 Tooltip.prototype.disable = function () {
1370 this.enabled = false
1373 Tooltip.prototype.toggleEnabled = function () {
1374 this.enabled = !this.enabled
1377 Tooltip.prototype.toggle = function (e) {
1378 var self = e ? $(e.currentTarget)[this.type](this.getDelegateOptions()).data('bs.' + this.type) : this
1379 self.tip().hasClass('in') ? self.leave(self) : self.enter(self)
1382 Tooltip.prototype.destroy = function () {
1383 clearTimeout(this.timeout)
1384 this.hide().$element.off('.' + this.type).removeData('bs.' + this.type)
1388 // TOOLTIP PLUGIN DEFINITION
1389 // =========================
1391 var old = $.fn.tooltip
1393 $.fn.tooltip = function (option) {
1394 return this.each(function () {
1396 var data = $this.data('bs.tooltip')
1397 var options = typeof option == 'object' && option
1399 if (!data && option == 'destroy') return
1400 if (!data) $this.data('bs.tooltip', (data = new Tooltip(this, options)))
1401 if (typeof option == 'string') data[option]()
1405 $.fn.tooltip.Constructor = Tooltip
1408 // TOOLTIP NO CONFLICT
1409 // ===================
1411 $.fn.tooltip.noConflict = function () {
1418 /* ========================================================================
1419 * Bootstrap: popover.js v3.1.1
1420 * http://getbootstrap.com/javascript/#popovers
1421 * ========================================================================
1422 * Copyright 2011-2014 Twitter, Inc.
1423 * Licensed under MIT (https://github.com/twbs/bootstrap/blob/master/LICENSE)
1424 * ======================================================================== */
1430 // POPOVER PUBLIC CLASS DEFINITION
1431 // ===============================
1433 var Popover = function (element, options) {
1434 this.init('popover', element, options)
1437 if (!$.fn.tooltip) throw new Error('Popover requires tooltip.js')
1439 Popover.DEFAULTS = $.extend({}, $.fn.tooltip.Constructor.DEFAULTS, {
1443 template: '<div class="popover"><div class="arrow"></div><h3 class="popover-title"></h3><div class="popover-content"></div></div>'
1447 // NOTE: POPOVER EXTENDS tooltip.js
1448 // ================================
1450 Popover.prototype = $.extend({}, $.fn.tooltip.Constructor.prototype)
1452 Popover.prototype.constructor = Popover
1454 Popover.prototype.getDefaults = function () {
1455 return Popover.DEFAULTS
1458 Popover.prototype.setContent = function () {
1459 var $tip = this.tip()
1460 var title = this.getTitle()
1461 var content = this.getContent()
1463 $tip.find('.popover-title')[this.options.html ? 'html' : 'text'](title)
1464 $tip.find('.popover-content')[ // we use append for html objects to maintain js events
1465 this.options.html ? (typeof content == 'string' ? 'html' : 'append') : 'text'
1468 $tip.removeClass('fade top bottom left right in')
1470 // IE8 doesn't accept hiding via the `:empty` pseudo selector, we have to do
1471 // this manually by checking the contents.
1472 if (!$tip.find('.popover-title').html()) $tip.find('.popover-title').hide()
1475 Popover.prototype.hasContent = function () {
1476 return this.getTitle() || this.getContent()
1479 Popover.prototype.getContent = function () {
1480 var $e = this.$element
1481 var o = this.options
1483 return $e.attr('data-content')
1484 || (typeof o.content == 'function' ?
1485 o.content.call($e[0]) :
1489 Popover.prototype.arrow = function () {
1490 return this.$arrow = this.$arrow || this.tip().find('.arrow')
1493 Popover.prototype.tip = function () {
1494 if (!this.$tip) this.$tip = $(this.options.template)
1499 // POPOVER PLUGIN DEFINITION
1500 // =========================
1502 var old = $.fn.popover
1504 $.fn.popover = function (option) {
1505 return this.each(function () {
1507 var data = $this.data('bs.popover')
1508 var options = typeof option == 'object' && option
1510 if (!data && option == 'destroy') return
1511 if (!data) $this.data('bs.popover', (data = new Popover(this, options)))
1512 if (typeof option == 'string') data[option]()
1516 $.fn.popover.Constructor = Popover
1519 // POPOVER NO CONFLICT
1520 // ===================
1522 $.fn.popover.noConflict = function () {
1529 /* ========================================================================
1530 * Bootstrap: scrollspy.js v3.1.1
1531 * http://getbootstrap.com/javascript/#scrollspy
1532 * ========================================================================
1533 * Copyright 2011-2014 Twitter, Inc.
1534 * Licensed under MIT (https://github.com/twbs/bootstrap/blob/master/LICENSE)
1535 * ======================================================================== */
1541 // SCROLLSPY CLASS DEFINITION
1542 // ==========================
1544 function ScrollSpy(element, options) {
1546 var process = $.proxy(this.process, this)
1548 this.$element = $(element).is('body') ? $(window) : $(element)
1549 this.$body = $('body')
1550 this.$scrollElement = this.$element.on('scroll.bs.scroll-spy.data-api', process)
1551 this.options = $.extend({}, ScrollSpy.DEFAULTS, options)
1552 this.selector = (this.options.target
1553 || ((href = $(element).attr('href')) && href.replace(/.*(?=#[^\s]+$)/, '')) //strip for ie7
1554 || '') + ' .nav li > a'
1555 this.offsets = $([])
1556 this.targets = $([])
1557 this.activeTarget = null
1563 ScrollSpy.DEFAULTS = {
1567 ScrollSpy.prototype.refresh = function () {
1568 var offsetMethod = this.$element[0] == window ? 'offset' : 'position'
1570 this.offsets = $([])
1571 this.targets = $([])
1574 var $targets = this.$body
1575 .find(this.selector)
1578 var href = $el.data('target') || $el.attr('href')
1579 var $href = /^#./.test(href) && $(href)
1583 && $href.is(':visible')
1584 && [[ $href[offsetMethod]().top + (!$.isWindow(self.$scrollElement.get(0)) && self.$scrollElement.scrollTop()), href ]]) || null
1586 .sort(function (a, b) { return a[0] - b[0] })
1588 self.offsets.push(this[0])
1589 self.targets.push(this[1])
1593 ScrollSpy.prototype.process = function () {
1594 var scrollTop = this.$scrollElement.scrollTop() + this.options.offset
1595 var scrollHeight = this.$scrollElement[0].scrollHeight || this.$body[0].scrollHeight
1596 var maxScroll = scrollHeight - this.$scrollElement.height()
1597 var offsets = this.offsets
1598 var targets = this.targets
1599 var activeTarget = this.activeTarget
1602 if (scrollTop >= maxScroll) {
1603 return activeTarget != (i = targets.last()[0]) && this.activate(i)
1606 if (activeTarget && scrollTop <= offsets[0]) {
1607 return activeTarget != (i = targets[0]) && this.activate(i)
1610 for (i = offsets.length; i--;) {
1611 activeTarget != targets[i]
1612 && scrollTop >= offsets[i]
1613 && (!offsets[i + 1] || scrollTop <= offsets[i + 1])
1614 && this.activate( targets[i] )
1618 ScrollSpy.prototype.activate = function (target) {
1619 this.activeTarget = target
1622 .parentsUntil(this.options.target, '.active')
1623 .removeClass('active')
1625 var selector = this.selector +
1626 '[data-target="' + target + '"],' +
1627 this.selector + '[href="' + target + '"]'
1629 var active = $(selector)
1633 if (active.parent('.dropdown-menu').length) {
1635 .closest('li.dropdown')
1639 active.trigger('activate.bs.scrollspy')
1643 // SCROLLSPY PLUGIN DEFINITION
1644 // ===========================
1646 var old = $.fn.scrollspy
1648 $.fn.scrollspy = function (option) {
1649 return this.each(function () {
1651 var data = $this.data('bs.scrollspy')
1652 var options = typeof option == 'object' && option
1654 if (!data) $this.data('bs.scrollspy', (data = new ScrollSpy(this, options)))
1655 if (typeof option == 'string') data[option]()
1659 $.fn.scrollspy.Constructor = ScrollSpy
1662 // SCROLLSPY NO CONFLICT
1663 // =====================
1665 $.fn.scrollspy.noConflict = function () {
1666 $.fn.scrollspy = old
1671 // SCROLLSPY DATA-API
1672 // ==================
1674 $(window).on('load', function () {
1675 $('[data-spy="scroll"]').each(function () {
1677 $spy.scrollspy($spy.data())
1683 /* ========================================================================
1684 * Bootstrap: tab.js v3.1.1
1685 * http://getbootstrap.com/javascript/#tabs
1686 * ========================================================================
1687 * Copyright 2011-2014 Twitter, Inc.
1688 * Licensed under MIT (https://github.com/twbs/bootstrap/blob/master/LICENSE)
1689 * ======================================================================== */
1695 // TAB CLASS DEFINITION
1696 // ====================
1698 var Tab = function (element) {
1699 this.element = $(element)
1702 Tab.prototype.show = function () {
1703 var $this = this.element
1704 var $ul = $this.closest('ul:not(.dropdown-menu)')
1705 var selector = $this.data('target')
1708 selector = $this.attr('href')
1709 selector = selector && selector.replace(/.*(?=#[^\s]*$)/, '') //strip for ie7
1712 if ($this.parent('li').hasClass('active')) return
1714 var previous = $ul.find('.active:last a')[0]
1715 var e = $.Event('show.bs.tab', {
1716 relatedTarget: previous
1721 if (e.isDefaultPrevented()) return
1723 var $target = $(selector)
1725 this.activate($this.parent('li'), $ul)
1726 this.activate($target, $target.parent(), function () {
1728 type: 'shown.bs.tab',
1729 relatedTarget: previous
1734 Tab.prototype.activate = function (element, container, callback) {
1735 var $active = container.find('> .active')
1736 var transition = callback
1737 && $.support.transition
1738 && $active.hasClass('fade')
1742 .removeClass('active')
1743 .find('> .dropdown-menu > .active')
1744 .removeClass('active')
1746 element.addClass('active')
1749 element[0].offsetWidth // reflow for transition
1750 element.addClass('in')
1752 element.removeClass('fade')
1755 if (element.parent('.dropdown-menu')) {
1756 element.closest('li.dropdown').addClass('active')
1759 callback && callback()
1764 .one($.support.transition.end, next)
1765 .emulateTransitionEnd(150) :
1768 $active.removeClass('in')
1772 // TAB PLUGIN DEFINITION
1773 // =====================
1777 $.fn.tab = function ( option ) {
1778 return this.each(function () {
1780 var data = $this.data('bs.tab')
1782 if (!data) $this.data('bs.tab', (data = new Tab(this)))
1783 if (typeof option == 'string') data[option]()
1787 $.fn.tab.Constructor = Tab
1793 $.fn.tab.noConflict = function () {
1802 $(document).on('click.bs.tab.data-api', '[data-toggle="tab"], [data-toggle="pill"]', function (e) {
1809 /* ========================================================================
1810 * Bootstrap: affix.js v3.1.1
1811 * http://getbootstrap.com/javascript/#affix
1812 * ========================================================================
1813 * Copyright 2011-2014 Twitter, Inc.
1814 * Licensed under MIT (https://github.com/twbs/bootstrap/blob/master/LICENSE)
1815 * ======================================================================== */
1821 // AFFIX CLASS DEFINITION
1822 // ======================
1824 var Affix = function (element, options) {
1825 this.options = $.extend({}, Affix.DEFAULTS, options)
1826 this.$window = $(window)
1827 .on('scroll.bs.affix.data-api', $.proxy(this.checkPosition, this))
1828 .on('click.bs.affix.data-api', $.proxy(this.checkPositionWithEventLoop, this))
1830 this.$element = $(element)
1833 this.pinnedOffset = null
1835 this.checkPosition()
1838 Affix.RESET = 'affix affix-top affix-bottom'
1844 Affix.prototype.getPinnedOffset = function () {
1845 if (this.pinnedOffset) return this.pinnedOffset
1846 this.$element.removeClass(Affix.RESET).addClass('affix')
1847 var scrollTop = this.$window.scrollTop()
1848 var position = this.$element.offset()
1849 return (this.pinnedOffset = position.top - scrollTop)
1852 Affix.prototype.checkPositionWithEventLoop = function () {
1853 setTimeout($.proxy(this.checkPosition, this), 1)
1856 Affix.prototype.checkPosition = function () {
1857 if (!this.$element.is(':visible')) return
1859 var scrollHeight = $(document).height()
1860 var scrollTop = this.$window.scrollTop()
1861 var position = this.$element.offset()
1862 var offset = this.options.offset
1863 var offsetTop = offset.top
1864 var offsetBottom = offset.bottom
1866 if (this.affixed == 'top') position.top += scrollTop
1868 if (typeof offset != 'object') offsetBottom = offsetTop = offset
1869 if (typeof offsetTop == 'function') offsetTop = offset.top(this.$element)
1870 if (typeof offsetBottom == 'function') offsetBottom = offset.bottom(this.$element)
1872 var affix = this.unpin != null && (scrollTop + this.unpin <= position.top) ? false :
1873 offsetBottom != null && (position.top + this.$element.height() >= scrollHeight - offsetBottom) ? 'bottom' :
1874 offsetTop != null && (scrollTop <= offsetTop) ? 'top' : false
1876 if (this.affixed === affix) return
1877 if (this.unpin) this.$element.css('top', '')
1879 var affixType = 'affix' + (affix ? '-' + affix : '')
1880 var e = $.Event(affixType + '.bs.affix')
1882 this.$element.trigger(e)
1884 if (e.isDefaultPrevented()) return
1886 this.affixed = affix
1887 this.unpin = affix == 'bottom' ? this.getPinnedOffset() : null
1890 .removeClass(Affix.RESET)
1891 .addClass(affixType)
1892 .trigger($.Event(affixType.replace('affix', 'affixed')))
1894 if (affix == 'bottom') {
1895 this.$element.offset({ top: scrollHeight - offsetBottom - this.$element.height() })
1900 // AFFIX PLUGIN DEFINITION
1901 // =======================
1903 var old = $.fn.affix
1905 $.fn.affix = function (option) {
1906 return this.each(function () {
1908 var data = $this.data('bs.affix')
1909 var options = typeof option == 'object' && option
1911 if (!data) $this.data('bs.affix', (data = new Affix(this, options)))
1912 if (typeof option == 'string') data[option]()
1916 $.fn.affix.Constructor = Affix
1919 // AFFIX NO CONFLICT
1920 // =================
1922 $.fn.affix.noConflict = function () {
1931 $(window).on('load', function () {
1932 $('[data-spy="affix"]').each(function () {
1934 var data = $spy.data()
1936 data.offset = data.offset || {}
1938 if (data.offsetBottom) data.offset.bottom = data.offsetBottom
1939 if (data.offsetTop) data.offset.top = data.offsetTop