1 /* ========================================================================
2 * Bootstrap: alert.js v3.0.0
3 * http://twbs.github.com/bootstrap/javascript.html#alerts
4 * ========================================================================
5 * Copyright 2013 Twitter, Inc.
7 * Licensed under the Apache License, Version 2.0 (the "License");
8 * you may not use this file except in compliance with the License.
9 * You may obtain a copy of the License at
11 * http://www.apache.org/licenses/LICENSE-2.0
13 * Unless required by applicable law or agreed to in writing, software
14 * distributed under the License is distributed on an "AS IS" BASIS,
15 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
16 * See the License for the specific language governing permissions and
17 * limitations under the License.
18 * ======================================================================== */
21 +function ($) { "use strict";
23 // ALERT CLASS DEFINITION
24 // ======================
26 var dismiss = '[data-dismiss="alert"]'
27 var Alert = function (el) {
28 $(el).on('click', dismiss, this.close)
31 Alert.prototype.close = function (e) {
33 var selector = $this.attr('data-target')
36 selector = $this.attr('href')
37 selector = selector && selector.replace(/.*(?=#[^\s]*$)/, '') // strip for ie7
40 var $parent = $(selector)
42 if (e) e.preventDefault()
44 if (!$parent.length) {
45 $parent = $this.hasClass('alert') ? $this : $this.parent()
48 $parent.trigger(e = $.Event('close.bs.alert'))
50 if (e.isDefaultPrevented()) return
52 $parent.removeClass('in')
54 function removeElement() {
55 $parent.trigger('closed.bs.alert').remove()
58 $.support.transition && $parent.hasClass('fade') ?
60 .one($.support.transition.end, removeElement)
61 .emulateTransitionEnd(150) :
66 // ALERT PLUGIN DEFINITION
67 // =======================
71 $.fn.alert = function (option) {
72 return this.each(function () {
74 var data = $this.data('bs.alert')
76 if (!data) $this.data('bs.alert', (data = new Alert(this)))
77 if (typeof option == 'string') data[option].call($this)
81 $.fn.alert.Constructor = Alert
87 $.fn.alert.noConflict = function () {
96 $(document).on('click.bs.alert.data-api', dismiss, Alert.prototype.close)
100 /* ========================================================================
101 * Bootstrap: button.js v3.0.0
102 * http://twbs.github.com/bootstrap/javascript.html#buttons
103 * ========================================================================
104 * Copyright 2013 Twitter, Inc.
106 * Licensed under the Apache License, Version 2.0 (the "License");
107 * you may not use this file except in compliance with the License.
108 * You may obtain a copy of the License at
110 * http://www.apache.org/licenses/LICENSE-2.0
112 * Unless required by applicable law or agreed to in writing, software
113 * distributed under the License is distributed on an "AS IS" BASIS,
114 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
115 * See the License for the specific language governing permissions and
116 * limitations under the License.
117 * ======================================================================== */
120 +function ($) { "use strict";
122 // BUTTON PUBLIC CLASS DEFINITION
123 // ==============================
125 var Button = function (element, options) {
126 this.$element = $(element)
127 this.options = $.extend({}, Button.DEFAULTS, options)
131 loadingText: 'loading...'
134 Button.prototype.setState = function (state) {
136 var $el = this.$element
137 var val = $el.is('input') ? 'val' : 'html'
138 var data = $el.data()
140 state = state + 'Text'
142 if (!data.resetText) $el.data('resetText', $el[val]())
144 $el[val](data[state] || this.options[state])
146 // push to event loop to allow forms to submit
147 setTimeout(function () {
148 state == 'loadingText' ?
149 $el.addClass(d).attr(d, d) :
150 $el.removeClass(d).removeAttr(d);
154 Button.prototype.toggle = function () {
155 var $parent = this.$element.closest('[data-toggle="buttons"]')
157 if ($parent.length) {
158 var $input = this.$element.find('input')
159 .prop('checked', !this.$element.hasClass('active'))
161 if ($input.prop('type') === 'radio') $parent.find('.active').removeClass('active')
164 this.$element.toggleClass('active')
168 // BUTTON PLUGIN DEFINITION
169 // ========================
171 var old = $.fn.button
173 $.fn.button = function (option) {
174 return this.each(function () {
176 var data = $this.data('bs.button')
177 var options = typeof option == 'object' && option
179 if (!data) $this.data('bs.button', (data = new Button(this, options)))
181 if (option == 'toggle') data.toggle()
182 else if (option) data.setState(option)
186 $.fn.button.Constructor = Button
189 // BUTTON NO CONFLICT
190 // ==================
192 $.fn.button.noConflict = function () {
201 $(document).on('click.bs.button.data-api', '[data-toggle^=button]', function (e) {
202 var $btn = $(e.target)
203 if (!$btn.hasClass('btn')) $btn = $btn.closest('.btn')
204 $btn.button('toggle')
210 /* ========================================================================
211 * Bootstrap: dropdown.js v3.0.0
212 * http://twbs.github.com/bootstrap/javascript.html#dropdowns
213 * ========================================================================
214 * Copyright 2012 Twitter, Inc.
216 * Licensed under the Apache License, Version 2.0 (the "License");
217 * you may not use this file except in compliance with the License.
218 * You may obtain a copy of the License at
220 * http://www.apache.org/licenses/LICENSE-2.0
222 * Unless required by applicable law or agreed to in writing, software
223 * distributed under the License is distributed on an "AS IS" BASIS,
224 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
225 * See the License for the specific language governing permissions and
226 * limitations under the License.
227 * ======================================================================== */
230 +function ($) { "use strict";
232 // DROPDOWN CLASS DEFINITION
233 // =========================
235 var backdrop = '.dropdown-backdrop'
236 var toggle = '[data-toggle=dropdown]'
237 var Dropdown = function (element) {
238 var $el = $(element).on('click.bs.dropdown', this.toggle)
241 Dropdown.prototype.toggle = function (e) {
244 if ($this.is('.disabled, :disabled')) return
246 var $parent = getParent($this)
247 var isActive = $parent.hasClass('open')
252 if ('ontouchstart' in document.documentElement && !$parent.closest('.navbar-nav').length) {
253 // if mobile we we use a backdrop because click events don't delegate
254 $('<div class="dropdown-backdrop"/>').insertAfter($(this)).on('click', clearMenus)
257 $parent.trigger(e = $.Event('show.bs.dropdown'))
259 if (e.isDefaultPrevented()) return
263 .trigger('shown.bs.dropdown')
271 Dropdown.prototype.keydown = function (e) {
272 if (!/(38|40|27)/.test(e.keyCode)) return
279 if ($this.is('.disabled, :disabled')) return
281 var $parent = getParent($this)
282 var isActive = $parent.hasClass('open')
284 if (!isActive || (isActive && e.keyCode == 27)) {
285 if (e.which == 27) $parent.find(toggle).focus()
289 var $items = $('[role=menu] li:not(.divider):visible a', $parent)
291 if (!$items.length) return
293 var index = $items.index($items.filter(':focus'))
295 if (e.keyCode == 38 && index > 0) index-- // up
296 if (e.keyCode == 40 && index < $items.length - 1) index++ // down
299 $items.eq(index).focus()
302 function clearMenus() {
304 $(toggle).each(function (e) {
305 var $parent = getParent($(this))
306 if (!$parent.hasClass('open')) return
307 $parent.trigger(e = $.Event('hide.bs.dropdown'))
308 if (e.isDefaultPrevented()) return
309 $parent.removeClass('open').trigger('hidden.bs.dropdown')
313 function getParent($this) {
314 var selector = $this.attr('data-target')
317 selector = $this.attr('href')
318 selector = selector && /#/.test(selector) && selector.replace(/.*(?=#[^\s]*$)/, '') //strip for ie7
321 var $parent = selector && $(selector)
323 return $parent && $parent.length ? $parent : $this.parent()
327 // DROPDOWN PLUGIN DEFINITION
328 // ==========================
330 var old = $.fn.dropdown
332 $.fn.dropdown = function (option) {
333 return this.each(function () {
335 var data = $this.data('dropdown')
337 if (!data) $this.data('dropdown', (data = new Dropdown(this)))
338 if (typeof option == 'string') data[option].call($this)
342 $.fn.dropdown.Constructor = Dropdown
345 // DROPDOWN NO CONFLICT
346 // ====================
348 $.fn.dropdown.noConflict = function () {
354 // APPLY TO STANDARD DROPDOWN ELEMENTS
355 // ===================================
358 .on('click.bs.dropdown.data-api', clearMenus)
359 .on('click.bs.dropdown.data-api', '.dropdown form', function (e) { e.stopPropagation() })
360 .on('click.bs.dropdown.data-api' , toggle, Dropdown.prototype.toggle)
361 .on('keydown.bs.dropdown.data-api', toggle + ', [role=menu]' , Dropdown.prototype.keydown)
365 /* ========================================================================
366 * Bootstrap: modal.js v3.0.0
367 * http://twbs.github.com/bootstrap/javascript.html#modals
368 * ========================================================================
369 * Copyright 2012 Twitter, Inc.
371 * Licensed under the Apache License, Version 2.0 (the "License");
372 * you may not use this file except in compliance with the License.
373 * You may obtain a copy of the License at
375 * http://www.apache.org/licenses/LICENSE-2.0
377 * Unless required by applicable law or agreed to in writing, software
378 * distributed under the License is distributed on an "AS IS" BASIS,
379 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
380 * See the License for the specific language governing permissions and
381 * limitations under the License.
382 * ======================================================================== */
385 +function ($) { "use strict";
387 // MODAL CLASS DEFINITION
388 // ======================
390 var Modal = function (element, options) {
391 this.options = options
392 this.$element = $(element)
396 if (this.options.remote) this.$element.load(this.options.remote)
405 Modal.prototype.toggle = function (_relatedTarget) {
406 return this[!this.isShown ? 'show' : 'hide'](_relatedTarget)
409 Modal.prototype.show = function (_relatedTarget) {
411 var e = $.Event('show.bs.modal', { relatedTarget: _relatedTarget })
413 this.$element.trigger(e)
415 if (this.isShown || e.isDefaultPrevented()) return
421 this.$element.on('click.dismiss.modal', '[data-dismiss="modal"]', $.proxy(this.hide, this))
423 this.backdrop(function () {
424 var transition = $.support.transition && that.$element.hasClass('fade')
426 if (!that.$element.parent().length) {
427 that.$element.appendTo(document.body) // don't move modals dom position
433 that.$element[0].offsetWidth // force reflow
438 .attr('aria-hidden', false)
442 var e = $.Event('shown.bs.modal', { relatedTarget: _relatedTarget })
445 that.$element.find('.modal-dialog') // wait for modal to slide in
446 .one($.support.transition.end, function () {
447 that.$element.focus().trigger(e)
449 .emulateTransitionEnd(300) :
450 that.$element.focus().trigger(e)
454 Modal.prototype.hide = function (e) {
455 if (e) e.preventDefault()
457 e = $.Event('hide.bs.modal')
459 this.$element.trigger(e)
461 if (!this.isShown || e.isDefaultPrevented()) return
467 $(document).off('focusin.bs.modal')
471 .attr('aria-hidden', true)
472 .off('click.dismiss.modal')
474 $.support.transition && this.$element.hasClass('fade') ?
476 .one($.support.transition.end, $.proxy(this.hideModal, this))
477 .emulateTransitionEnd(300) :
481 Modal.prototype.enforceFocus = function () {
483 .off('focusin.bs.modal') // guard against infinite focus loop
484 .on('focusin.bs.modal', $.proxy(function (e) {
485 if (this.$element[0] !== e.target && !this.$element.has(e.target).length) {
486 this.$element.focus()
491 Modal.prototype.escape = function () {
492 if (this.isShown && this.options.keyboard) {
493 this.$element.on('keyup.dismiss.bs.modal', $.proxy(function (e) {
494 e.which == 27 && this.hide()
496 } else if (!this.isShown) {
497 this.$element.off('keyup.dismiss.bs.modal')
501 Modal.prototype.hideModal = function () {
504 this.backdrop(function () {
505 that.removeBackdrop()
506 that.$element.trigger('hidden.bs.modal')
510 Modal.prototype.removeBackdrop = function () {
511 this.$backdrop && this.$backdrop.remove()
512 this.$backdrop = null
515 Modal.prototype.backdrop = function (callback) {
517 var animate = this.$element.hasClass('fade') ? 'fade' : ''
519 if (this.isShown && this.options.backdrop) {
520 var doAnimate = $.support.transition && animate
522 this.$backdrop = $('<div class="modal-backdrop ' + animate + '" />')
523 .appendTo(document.body)
525 this.$element.on('click.dismiss.modal', $.proxy(function (e) {
526 if (e.target !== e.currentTarget) return
527 this.options.backdrop == 'static'
528 ? this.$element[0].focus.call(this.$element[0])
529 : this.hide.call(this)
532 if (doAnimate) this.$backdrop[0].offsetWidth // force reflow
534 this.$backdrop.addClass('in')
536 if (!callback) return
540 .one($.support.transition.end, callback)
541 .emulateTransitionEnd(150) :
544 } else if (!this.isShown && this.$backdrop) {
545 this.$backdrop.removeClass('in')
547 $.support.transition && this.$element.hasClass('fade')?
549 .one($.support.transition.end, callback)
550 .emulateTransitionEnd(150) :
553 } else if (callback) {
559 // MODAL PLUGIN DEFINITION
560 // =======================
564 $.fn.modal = function (option, _relatedTarget) {
565 return this.each(function () {
567 var data = $this.data('bs.modal')
568 var options = $.extend({}, Modal.DEFAULTS, $this.data(), typeof option == 'object' && option)
570 if (!data) $this.data('bs.modal', (data = new Modal(this, options)))
571 if (typeof option == 'string') data[option](_relatedTarget)
572 else if (options.show) data.show(_relatedTarget)
576 $.fn.modal.Constructor = Modal
582 $.fn.modal.noConflict = function () {
591 $(document).on('click.bs.modal.data-api', '[data-toggle="modal"]', function (e) {
593 var href = $this.attr('href')
594 var $target = $($this.attr('data-target') || (href && href.replace(/.*(?=#[^\s]+$)/, ''))) //strip for ie7
595 var option = $target.data('modal') ? 'toggle' : $.extend({ remote: !/#/.test(href) && href }, $target.data(), $this.data())
601 .one('hide', function () {
602 $this.is(':visible') && $this.focus()
607 .on('show.bs.modal', '.modal', function () { $(document.body).addClass('modal-open') })
608 .on('hidden.bs.modal', '.modal', function () { $(document.body).removeClass('modal-open') })
612 /* ========================================================================
613 * Bootstrap: tooltip.js v3.0.0
614 * http://twbs.github.com/bootstrap/javascript.html#tooltip
615 * Inspired by the original jQuery.tipsy by Jason Frame
616 * ========================================================================
617 * Copyright 2012 Twitter, Inc.
619 * Licensed under the Apache License, Version 2.0 (the "License");
620 * you may not use this file except in compliance with the License.
621 * You may obtain a copy of the License at
623 * http://www.apache.org/licenses/LICENSE-2.0
625 * Unless required by applicable law or agreed to in writing, software
626 * distributed under the License is distributed on an "AS IS" BASIS,
627 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
628 * See the License for the specific language governing permissions and
629 * limitations under the License.
630 * ======================================================================== */
633 +function ($) { "use strict";
635 // TOOLTIP PUBLIC CLASS DEFINITION
636 // ===============================
638 var Tooltip = function (element, options) {
646 this.init('tooltip', element, options)
653 , template: '<div class="tooltip"><div class="tooltip-arrow"></div><div class="tooltip-inner"></div></div>'
654 , trigger: 'hover focus'
661 Tooltip.prototype.init = function (type, element, options) {
664 this.$element = $(element)
665 this.options = this.getOptions(options)
667 var triggers = this.options.trigger.split(' ')
669 for (var i = triggers.length; i--;) {
670 var trigger = triggers[i]
672 if (trigger == 'click') {
673 this.$element.on('click.' + this.type, this.options.selector, $.proxy(this.toggle, this))
674 } else if (trigger != 'manual') {
675 var eventIn = trigger == 'hover' ? 'mouseenter' : 'focus'
676 var eventOut = trigger == 'hover' ? 'mouseleave' : 'blur'
678 this.$element.on(eventIn + '.' + this.type, this.options.selector, $.proxy(this.enter, this))
679 this.$element.on(eventOut + '.' + this.type, this.options.selector, $.proxy(this.leave, this))
683 this.options.selector ?
684 (this._options = $.extend({}, this.options, { trigger: 'manual', selector: '' })) :
688 Tooltip.prototype.getDefaults = function () {
689 return Tooltip.DEFAULTS
692 Tooltip.prototype.getOptions = function (options) {
693 options = $.extend({}, this.getDefaults(), this.$element.data(), options)
695 if (options.delay && typeof options.delay == 'number') {
698 , hide: options.delay
705 Tooltip.prototype.getDelegateOptions = function () {
707 var defaults = this.getDefaults()
709 this._options && $.each(this._options, function (key, value) {
710 if (defaults[key] != value) options[key] = value
716 Tooltip.prototype.enter = function (obj) {
717 var self = obj instanceof this.constructor ?
718 obj : $(obj.currentTarget)[this.type](this.getDelegateOptions()).data('bs.' + this.type)
720 clearTimeout(self.timeout)
722 self.hoverState = 'in'
724 if (!self.options.delay || !self.options.delay.show) return self.show()
726 self.timeout = setTimeout(function () {
727 if (self.hoverState == 'in') self.show()
728 }, self.options.delay.show)
731 Tooltip.prototype.leave = function (obj) {
732 var self = obj instanceof this.constructor ?
733 obj : $(obj.currentTarget)[this.type](this.getDelegateOptions()).data('bs.' + this.type)
735 clearTimeout(self.timeout)
737 self.hoverState = 'out'
739 if (!self.options.delay || !self.options.delay.hide) return self.hide()
741 self.timeout = setTimeout(function () {
742 if (self.hoverState == 'out') self.hide()
743 }, self.options.delay.hide)
746 Tooltip.prototype.show = function () {
747 var e = $.Event('show.bs.'+ this.type)
749 if (this.hasContent() && this.enabled) {
750 this.$element.trigger(e)
752 if (e.isDefaultPrevented()) return
754 var $tip = this.tip()
758 if (this.options.animation) $tip.addClass('fade')
760 var placement = typeof this.options.placement == 'function' ?
761 this.options.placement.call(this, $tip[0], this.$element[0]) :
762 this.options.placement
764 var autoToken = /\s?auto?\s?/i
765 var autoPlace = autoToken.test(placement)
766 if (autoPlace) placement = placement.replace(autoToken, '') || 'top'
770 .css({ top: 0, left: 0, display: 'block' })
773 this.options.container ? $tip.appendTo(this.options.container) : $tip.insertAfter(this.$element)
775 var pos = this.getPosition()
776 var actualWidth = $tip[0].offsetWidth
777 var actualHeight = $tip[0].offsetHeight
780 var $parent = this.$element.parent()
782 var orgPlacement = placement
783 var docScroll = document.documentElement.scrollTop || document.body.scrollTop
784 var parentWidth = this.options.container == 'body' ? window.innerWidth : $parent.outerWidth()
785 var parentHeight = this.options.container == 'body' ? window.innerHeight : $parent.outerHeight()
786 var parentLeft = this.options.container == 'body' ? 0 : $parent.offset().left
788 placement = placement == 'bottom' && pos.top + pos.height + actualHeight - docScroll > parentHeight ? 'top' :
789 placement == 'top' && pos.top - docScroll - actualHeight < 0 ? 'bottom' :
790 placement == 'right' && pos.right + actualWidth > parentWidth ? 'left' :
791 placement == 'left' && pos.left - actualWidth < parentLeft ? 'right' :
795 .removeClass(orgPlacement)
799 var calculatedOffset = this.getCalculatedOffset(placement, pos, actualWidth, actualHeight)
801 this.applyPlacement(calculatedOffset, placement)
802 this.$element.trigger('shown.bs.' + this.type)
806 Tooltip.prototype.applyPlacement = function(offset, placement) {
808 var $tip = this.tip()
809 var width = $tip[0].offsetWidth
810 var height = $tip[0].offsetHeight
812 // manually read margins because getBoundingClientRect includes difference
813 var marginTop = parseInt($tip.css('margin-top'), 10)
814 var marginLeft = parseInt($tip.css('margin-left'), 10)
816 // we must check for NaN for ie 8/9
817 if (isNaN(marginTop)) marginTop = 0
818 if (isNaN(marginLeft)) marginLeft = 0
820 offset.top = offset.top + marginTop
821 offset.left = offset.left + marginLeft
827 // check to see if placing tip in new offset caused the tip to resize itself
828 var actualWidth = $tip[0].offsetWidth
829 var actualHeight = $tip[0].offsetHeight
831 if (placement == 'top' && actualHeight != height) {
833 offset.top = offset.top + height - actualHeight
836 if (/bottom|top/.test(placement)) {
839 if (offset.left < 0) {
840 delta = offset.left * -2
845 actualWidth = $tip[0].offsetWidth
846 actualHeight = $tip[0].offsetHeight
849 this.replaceArrow(delta - width + actualWidth, actualWidth, 'left')
851 this.replaceArrow(actualHeight - height, actualHeight, 'top')
854 if (replace) $tip.offset(offset)
857 Tooltip.prototype.replaceArrow = function(delta, dimension, position) {
858 this.arrow().css(position, delta ? (50 * (1 - delta / dimension) + "%") : '')
861 Tooltip.prototype.setContent = function () {
862 var $tip = this.tip()
863 var title = this.getTitle()
865 $tip.find('.tooltip-inner')[this.options.html ? 'html' : 'text'](title)
866 $tip.removeClass('fade in top bottom left right')
869 Tooltip.prototype.hide = function () {
871 var $tip = this.tip()
872 var e = $.Event('hide.bs.' + this.type)
874 function complete() {
875 if (that.hoverState != 'in') $tip.detach()
878 this.$element.trigger(e)
880 if (e.isDefaultPrevented()) return
882 $tip.removeClass('in')
884 $.support.transition && this.$tip.hasClass('fade') ?
886 .one($.support.transition.end, complete)
887 .emulateTransitionEnd(150) :
890 this.$element.trigger('hidden.bs.' + this.type)
895 Tooltip.prototype.fixTitle = function () {
896 var $e = this.$element
897 if ($e.attr('title') || typeof($e.attr('data-original-title')) != 'string') {
898 $e.attr('data-original-title', $e.attr('title') || '').attr('title', '')
902 Tooltip.prototype.hasContent = function () {
903 return this.getTitle()
906 Tooltip.prototype.getPosition = function () {
907 var el = this.$element[0]
908 return $.extend({}, (typeof el.getBoundingClientRect == 'function') ? el.getBoundingClientRect() : {
909 width: el.offsetWidth
910 , height: el.offsetHeight
911 }, this.$element.offset())
914 Tooltip.prototype.getCalculatedOffset = function (placement, pos, actualWidth, actualHeight) {
915 return placement == 'bottom' ? { top: pos.top + pos.height, left: pos.left + pos.width / 2 - actualWidth / 2 } :
916 placement == 'top' ? { top: pos.top - actualHeight, left: pos.left + pos.width / 2 - actualWidth / 2 } :
917 placement == 'left' ? { top: pos.top + pos.height / 2 - actualHeight / 2, left: pos.left - actualWidth } :
918 /* placement == 'right' */ { top: pos.top + pos.height / 2 - actualHeight / 2, left: pos.left + pos.width }
921 Tooltip.prototype.getTitle = function () {
923 var $e = this.$element
926 title = $e.attr('data-original-title')
927 || (typeof o.title == 'function' ? o.title.call($e[0]) : o.title)
932 Tooltip.prototype.tip = function () {
933 return this.$tip = this.$tip || $(this.options.template)
936 Tooltip.prototype.arrow = function () {
937 return this.$arrow = this.$arrow || this.tip().find('.tooltip-arrow')
940 Tooltip.prototype.validate = function () {
941 if (!this.$element[0].parentNode) {
948 Tooltip.prototype.enable = function () {
952 Tooltip.prototype.disable = function () {
956 Tooltip.prototype.toggleEnabled = function () {
957 this.enabled = !this.enabled
960 Tooltip.prototype.toggle = function (e) {
961 var self = e ? $(e.currentTarget)[this.type](this.getDelegateOptions()).data('bs.' + this.type) : this
962 self.tip().hasClass('in') ? self.leave(self) : self.enter(self)
965 Tooltip.prototype.destroy = function () {
966 this.hide().$element.off('.' + this.type).removeData('bs.' + this.type)
970 // TOOLTIP PLUGIN DEFINITION
971 // =========================
973 var old = $.fn.tooltip
975 $.fn.tooltip = function (option) {
976 return this.each(function () {
978 var data = $this.data('bs.tooltip')
979 var options = typeof option == 'object' && option
981 if (!data) $this.data('bs.tooltip', (data = new Tooltip(this, options)))
982 if (typeof option == 'string') data[option]()
986 $.fn.tooltip.Constructor = Tooltip
989 // TOOLTIP NO CONFLICT
990 // ===================
992 $.fn.tooltip.noConflict = function () {
999 /* ========================================================================
1000 * Bootstrap: popover.js v3.0.0
1001 * http://twbs.github.com/bootstrap/javascript.html#popovers
1002 * ========================================================================
1003 * Copyright 2012 Twitter, Inc.
1005 * Licensed under the Apache License, Version 2.0 (the "License");
1006 * you may not use this file except in compliance with the License.
1007 * You may obtain a copy of the License at
1009 * http://www.apache.org/licenses/LICENSE-2.0
1011 * Unless required by applicable law or agreed to in writing, software
1012 * distributed under the License is distributed on an "AS IS" BASIS,
1013 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
1014 * See the License for the specific language governing permissions and
1015 * limitations under the License.
1016 * ======================================================================== */
1019 +function ($) { "use strict";
1021 // POPOVER PUBLIC CLASS DEFINITION
1022 // ===============================
1024 var Popover = function (element, options) {
1025 this.init('popover', element, options)
1028 if (!$.fn.tooltip) throw new Error('Popover requires tooltip.js')
1030 Popover.DEFAULTS = $.extend({} , $.fn.tooltip.Constructor.DEFAULTS, {
1034 , template: '<div class="popover"><div class="arrow"></div><h3 class="popover-title"></h3><div class="popover-content"></div></div>'
1038 // NOTE: POPOVER EXTENDS tooltip.js
1039 // ================================
1041 Popover.prototype = $.extend({}, $.fn.tooltip.Constructor.prototype)
1043 Popover.prototype.constructor = Popover
1045 Popover.prototype.getDefaults = function () {
1046 return Popover.DEFAULTS
1049 Popover.prototype.setContent = function () {
1050 var $tip = this.tip()
1051 var title = this.getTitle()
1052 var content = this.getContent()
1054 $tip.find('.popover-title')[this.options.html ? 'html' : 'text'](title)
1055 $tip.find('.popover-content')[this.options.html ? 'html' : 'text'](content)
1057 $tip.removeClass('fade top bottom left right in')
1059 // IE8 doesn't accept hiding via the `:empty` pseudo selector, we have to do
1060 // this manually by checking the contents.
1061 if (!$tip.find('.popover-title').html()) $tip.find('.popover-title').hide()
1064 Popover.prototype.hasContent = function () {
1065 return this.getTitle() || this.getContent()
1068 Popover.prototype.getContent = function () {
1069 var $e = this.$element
1070 var o = this.options
1072 return $e.attr('data-content')
1073 || (typeof o.content == 'function' ?
1074 o.content.call($e[0]) :
1078 Popover.prototype.arrow = function () {
1079 return this.$arrow = this.$arrow || this.tip().find('.arrow')
1082 Popover.prototype.tip = function () {
1083 if (!this.$tip) this.$tip = $(this.options.template)
1088 // POPOVER PLUGIN DEFINITION
1089 // =========================
1091 var old = $.fn.popover
1093 $.fn.popover = function (option) {
1094 return this.each(function () {
1096 var data = $this.data('bs.popover')
1097 var options = typeof option == 'object' && option
1099 if (!data) $this.data('bs.popover', (data = new Popover(this, options)))
1100 if (typeof option == 'string') data[option]()
1104 $.fn.popover.Constructor = Popover
1107 // POPOVER NO CONFLICT
1108 // ===================
1110 $.fn.popover.noConflict = function () {
1117 /* ========================================================================
1118 * Bootstrap: tab.js v3.0.0
1119 * http://twbs.github.com/bootstrap/javascript.html#tabs
1120 * ========================================================================
1121 * Copyright 2012 Twitter, Inc.
1123 * Licensed under the Apache License, Version 2.0 (the "License");
1124 * you may not use this file except in compliance with the License.
1125 * You may obtain a copy of the License at
1127 * http://www.apache.org/licenses/LICENSE-2.0
1129 * Unless required by applicable law or agreed to in writing, software
1130 * distributed under the License is distributed on an "AS IS" BASIS,
1131 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
1132 * See the License for the specific language governing permissions and
1133 * limitations under the License.
1134 * ======================================================================== */
1137 +function ($) { "use strict";
1139 // TAB CLASS DEFINITION
1140 // ====================
1142 var Tab = function (element) {
1143 this.element = $(element)
1146 Tab.prototype.show = function () {
1147 var $this = this.element
1148 var $ul = $this.closest('ul:not(.dropdown-menu)')
1149 var selector = $this.attr('data-target')
1152 selector = $this.attr('href')
1153 selector = selector && selector.replace(/.*(?=#[^\s]*$)/, '') //strip for ie7
1156 if ($this.parent('li').hasClass('active')) return
1158 var previous = $ul.find('.active:last a')[0]
1159 var e = $.Event('show.bs.tab', {
1160 relatedTarget: previous
1165 if (e.isDefaultPrevented()) return
1167 var $target = $(selector)
1169 this.activate($this.parent('li'), $ul)
1170 this.activate($target, $target.parent(), function () {
1172 type: 'shown.bs.tab'
1173 , relatedTarget: previous
1178 Tab.prototype.activate = function (element, container, callback) {
1179 var $active = container.find('> .active')
1180 var transition = callback
1181 && $.support.transition
1182 && $active.hasClass('fade')
1186 .removeClass('active')
1187 .find('> .dropdown-menu > .active')
1188 .removeClass('active')
1190 element.addClass('active')
1193 element[0].offsetWidth // reflow for transition
1194 element.addClass('in')
1196 element.removeClass('fade')
1199 if (element.parent('.dropdown-menu')) {
1200 element.closest('li.dropdown').addClass('active')
1203 callback && callback()
1208 .one($.support.transition.end, next)
1209 .emulateTransitionEnd(150) :
1212 $active.removeClass('in')
1216 // TAB PLUGIN DEFINITION
1217 // =====================
1221 $.fn.tab = function ( option ) {
1222 return this.each(function () {
1224 var data = $this.data('bs.tab')
1226 if (!data) $this.data('bs.tab', (data = new Tab(this)))
1227 if (typeof option == 'string') data[option]()
1231 $.fn.tab.Constructor = Tab
1237 $.fn.tab.noConflict = function () {
1246 $(document).on('click.bs.tab.data-api', '[data-toggle="tab"], [data-toggle="pill"]', function (e) {
1253 /* ========================================================================
1254 * Bootstrap: collapse.js v3.0.0
1255 * http://twbs.github.com/bootstrap/javascript.html#collapse
1256 * ========================================================================
1257 * Copyright 2012 Twitter, Inc.
1259 * Licensed under the Apache License, Version 2.0 (the "License");
1260 * you may not use this file except in compliance with the License.
1261 * You may obtain a copy of the License at
1263 * http://www.apache.org/licenses/LICENSE-2.0
1265 * Unless required by applicable law or agreed to in writing, software
1266 * distributed under the License is distributed on an "AS IS" BASIS,
1267 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
1268 * See the License for the specific language governing permissions and
1269 * limitations under the License.
1270 * ======================================================================== */
1273 +function ($) { "use strict";
1275 // COLLAPSE PUBLIC CLASS DEFINITION
1276 // ================================
1278 var Collapse = function (element, options) {
1279 this.$element = $(element)
1280 this.options = $.extend({}, Collapse.DEFAULTS, options)
1281 this.transitioning = null
1283 if (this.options.parent) this.$parent = $(this.options.parent)
1284 if (this.options.toggle) this.toggle()
1287 Collapse.DEFAULTS = {
1291 Collapse.prototype.dimension = function () {
1292 var hasWidth = this.$element.hasClass('width')
1293 return hasWidth ? 'width' : 'height'
1296 Collapse.prototype.show = function () {
1297 if (this.transitioning || this.$element.hasClass('in')) return
1299 var startEvent = $.Event('show.bs.collapse')
1300 this.$element.trigger(startEvent)
1301 if (startEvent.isDefaultPrevented()) return
1303 var actives = this.$parent && this.$parent.find('> .panel > .in')
1305 if (actives && actives.length) {
1306 var hasData = actives.data('bs.collapse')
1307 if (hasData && hasData.transitioning) return
1308 actives.collapse('hide')
1309 hasData || actives.data('bs.collapse', null)
1312 var dimension = this.dimension()
1315 .removeClass('collapse')
1316 .addClass('collapsing')
1319 this.transitioning = 1
1321 var complete = function () {
1323 .removeClass('collapsing')
1326 this.transitioning = 0
1327 this.$element.trigger('shown.bs.collapse')
1330 if (!$.support.transition) return complete.call(this)
1332 var scrollSize = $.camelCase(['scroll', dimension].join('-'))
1335 .one($.support.transition.end, $.proxy(complete, this))
1336 .emulateTransitionEnd(350)
1337 [dimension](this.$element[0][scrollSize])
1340 Collapse.prototype.hide = function () {
1341 if (this.transitioning || !this.$element.hasClass('in')) return
1343 var startEvent = $.Event('hide.bs.collapse')
1344 this.$element.trigger(startEvent)
1345 if (startEvent.isDefaultPrevented()) return
1347 var dimension = this.dimension()
1350 [dimension](this.$element[dimension]())
1354 .addClass('collapsing')
1355 .removeClass('collapse')
1358 this.transitioning = 1
1360 var complete = function () {
1361 this.transitioning = 0
1363 .trigger('hidden.bs.collapse')
1364 .removeClass('collapsing')
1365 .addClass('collapse')
1368 if (!$.support.transition) return complete.call(this)
1372 .one($.support.transition.end, $.proxy(complete, this))
1373 .emulateTransitionEnd(350)
1376 Collapse.prototype.toggle = function () {
1377 this[this.$element.hasClass('in') ? 'hide' : 'show']()
1381 // COLLAPSE PLUGIN DEFINITION
1382 // ==========================
1384 var old = $.fn.collapse
1386 $.fn.collapse = function (option) {
1387 return this.each(function () {
1389 var data = $this.data('bs.collapse')
1390 var options = $.extend({}, Collapse.DEFAULTS, $this.data(), typeof option == 'object' && option)
1392 if (!data) $this.data('bs.collapse', (data = new Collapse(this, options)))
1393 if (typeof option == 'string') data[option]()
1397 $.fn.collapse.Constructor = Collapse
1400 // COLLAPSE NO CONFLICT
1401 // ====================
1403 $.fn.collapse.noConflict = function () {
1409 // COLLAPSE DATA-API
1410 // =================
1412 $(document).on('click.bs.collapse.data-api', '[data-toggle=collapse]', function (e) {
1413 var $this = $(this), href
1414 var target = $this.attr('data-target')
1415 || e.preventDefault()
1416 || (href = $this.attr('href')) && href.replace(/.*(?=#[^\s]+$)/, '') //strip for ie7
1417 var $target = $(target)
1418 var data = $target.data('bs.collapse')
1419 var option = data ? 'toggle' : $this.data()
1420 var parent = $this.attr('data-parent')
1421 var $parent = parent && $(parent)
1423 if (!data || !data.transitioning) {
1424 if ($parent) $parent.find('[data-toggle=collapse][data-parent="' + parent + '"]').not($this).addClass('collapsed')
1425 $this[$target.hasClass('in') ? 'addClass' : 'removeClass']('collapsed')
1428 $target.collapse(option)
1433 /* ========================================================================
1434 * Bootstrap: transition.js v3.0.0
1435 * http://twbs.github.com/bootstrap/javascript.html#transitions
1436 * ========================================================================
1437 * Copyright 2013 Twitter, Inc.
1439 * Licensed under the Apache License, Version 2.0 (the "License");
1440 * you may not use this file except in compliance with the License.
1441 * You may obtain a copy of the License at
1443 * http://www.apache.org/licenses/LICENSE-2.0
1445 * Unless required by applicable law or agreed to in writing, software
1446 * distributed under the License is distributed on an "AS IS" BASIS,
1447 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
1448 * See the License for the specific language governing permissions and
1449 * limitations under the License.
1450 * ======================================================================== */
1453 +function ($) { "use strict";
1455 // CSS TRANSITION SUPPORT (Shoutout: http://www.modernizr.com/)
1456 // ============================================================
1458 function transitionEnd() {
1459 var el = document.createElement('bootstrap')
1461 var transEndEventNames = {
1462 'WebkitTransition' : 'webkitTransitionEnd'
1463 , 'MozTransition' : 'transitionend'
1464 , 'OTransition' : 'oTransitionEnd otransitionend'
1465 , 'transition' : 'transitionend'
1468 for (var name in transEndEventNames) {
1469 if (el.style[name] !== undefined) {
1470 return { end: transEndEventNames[name] }
1475 // http://blog.alexmaccaw.com/css-transitions
1476 $.fn.emulateTransitionEnd = function (duration) {
1477 var called = false, $el = this
1478 $(this).one($.support.transition.end, function () { called = true })
1479 var callback = function () { if (!called) $($el).trigger($.support.transition.end) }
1480 setTimeout(callback, duration)
1485 $.support.transition = transitionEnd()