1 /* ===================================================
2 * bootstrap-transition.js v2.2.1
3 * http://twitter.github.com/bootstrap/javascript.html#transitions
4 * ===================================================
5 * Copyright 2012 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 * ========================================================== */
23 "use strict"; // jshint ;_;
26 /* CSS TRANSITION SUPPORT (http://www.modernizr.com/)
27 * ======================================================= */
31 $.support.transition = (function () {
33 var transitionEnd = (function () {
35 var el = document.createElement('bootstrap')
36 , transEndEventNames = {
37 'WebkitTransition' : 'webkitTransitionEnd'
38 , 'MozTransition' : 'transitionend'
39 , 'OTransition' : 'oTransitionEnd otransitionend'
40 , 'transition' : 'transitionend'
44 for (name in transEndEventNames){
45 if (el.style[name] !== undefined) {
46 return transEndEventNames[name]
52 return transitionEnd && {
60 }(window.jQuery);/* ==========================================================
61 * bootstrap-alert.js v2.2.1
62 * http://twitter.github.com/bootstrap/javascript.html#alerts
63 * ==========================================================
64 * Copyright 2012 Twitter, Inc.
66 * Licensed under the Apache License, Version 2.0 (the "License");
67 * you may not use this file except in compliance with the License.
68 * You may obtain a copy of the License at
70 * http://www.apache.org/licenses/LICENSE-2.0
72 * Unless required by applicable law or agreed to in writing, software
73 * distributed under the License is distributed on an "AS IS" BASIS,
74 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
75 * See the License for the specific language governing permissions and
76 * limitations under the License.
77 * ========================================================== */
82 "use strict"; // jshint ;_;
85 /* ALERT CLASS DEFINITION
86 * ====================== */
88 var dismiss = '[data-dismiss="alert"]'
89 , Alert = function (el) {
90 $(el).on('click', dismiss, this.close)
93 Alert.prototype.close = function (e) {
95 , selector = $this.attr('data-target')
99 selector = $this.attr('href')
100 selector = selector && selector.replace(/.*(?=#[^\s]*$)/, '') //strip for ie7
103 $parent = $(selector)
105 e && e.preventDefault()
107 $parent.length || ($parent = $this.hasClass('alert') ? $this : $this.parent())
109 $parent.trigger(e = $.Event('close'))
111 if (e.isDefaultPrevented()) return
113 $parent.removeClass('in')
115 function removeElement() {
121 $.support.transition && $parent.hasClass('fade') ?
122 $parent.on($.support.transition.end, removeElement) :
127 /* ALERT PLUGIN DEFINITION
128 * ======================= */
130 $.fn.alert = function (option) {
131 return this.each(function () {
133 , data = $this.data('alert')
134 if (!data) $this.data('alert', (data = new Alert(this)))
135 if (typeof option == 'string') data[option].call($this)
139 $.fn.alert.Constructor = Alert
145 $(document).on('click.alert.data-api', dismiss, Alert.prototype.close)
147 }(window.jQuery);/* ============================================================
148 * bootstrap-button.js v2.2.1
149 * http://twitter.github.com/bootstrap/javascript.html#buttons
150 * ============================================================
151 * Copyright 2012 Twitter, Inc.
153 * Licensed under the Apache License, Version 2.0 (the "License");
154 * you may not use this file except in compliance with the License.
155 * You may obtain a copy of the License at
157 * http://www.apache.org/licenses/LICENSE-2.0
159 * Unless required by applicable law or agreed to in writing, software
160 * distributed under the License is distributed on an "AS IS" BASIS,
161 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
162 * See the License for the specific language governing permissions and
163 * limitations under the License.
164 * ============================================================ */
169 "use strict"; // jshint ;_;
172 /* BUTTON PUBLIC CLASS DEFINITION
173 * ============================== */
175 var Button = function (element, options) {
176 this.$element = $(element)
177 this.options = $.extend({}, $.fn.button.defaults, options)
180 Button.prototype.setState = function (state) {
182 , $el = this.$element
184 , val = $el.is('input') ? 'val' : 'html'
186 state = state + 'Text'
187 data.resetText || $el.data('resetText', $el[val]())
189 $el[val](data[state] || this.options[state])
191 // push to event loop to allow forms to submit
192 setTimeout(function () {
193 state == 'loadingText' ?
194 $el.addClass(d).attr(d, d) :
195 $el.removeClass(d).removeAttr(d)
199 Button.prototype.toggle = function () {
200 var $parent = this.$element.closest('[data-toggle="buttons-radio"]')
204 .removeClass('active')
206 this.$element.toggleClass('active')
210 /* BUTTON PLUGIN DEFINITION
211 * ======================== */
213 $.fn.button = function (option) {
214 return this.each(function () {
216 , data = $this.data('button')
217 , options = typeof option == 'object' && option
218 if (!data) $this.data('button', (data = new Button(this, options)))
219 if (option == 'toggle') data.toggle()
220 else if (option) data.setState(option)
224 $.fn.button.defaults = {
225 loadingText: 'loading...'
228 $.fn.button.Constructor = Button
234 $(document).on('click.button.data-api', '[data-toggle^=button]', function (e) {
235 var $btn = $(e.target)
236 if (!$btn.hasClass('btn')) $btn = $btn.closest('.btn')
237 $btn.button('toggle')
240 }(window.jQuery);/* ==========================================================
241 * bootstrap-carousel.js v2.2.1
242 * http://twitter.github.com/bootstrap/javascript.html#carousel
243 * ==========================================================
244 * Copyright 2012 Twitter, Inc.
246 * Licensed under the Apache License, Version 2.0 (the "License");
247 * you may not use this file except in compliance with the License.
248 * You may obtain a copy of the License at
250 * http://www.apache.org/licenses/LICENSE-2.0
252 * Unless required by applicable law or agreed to in writing, software
253 * distributed under the License is distributed on an "AS IS" BASIS,
254 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
255 * See the License for the specific language governing permissions and
256 * limitations under the License.
257 * ========================================================== */
262 "use strict"; // jshint ;_;
265 /* CAROUSEL CLASS DEFINITION
266 * ========================= */
268 var Carousel = function (element, options) {
269 this.$element = $(element)
270 this.options = options
271 this.options.slide && this.slide(this.options.slide)
272 this.options.pause == 'hover' && this.$element
273 .on('mouseenter', $.proxy(this.pause, this))
274 .on('mouseleave', $.proxy(this.cycle, this))
277 Carousel.prototype = {
279 cycle: function (e) {
280 if (!e) this.paused = false
281 this.options.interval
283 && (this.interval = setInterval($.proxy(this.next, this), this.options.interval))
287 , to: function (pos) {
288 var $active = this.$element.find('.item.active')
289 , children = $active.parent().children()
290 , activePos = children.index($active)
293 if (pos > (children.length - 1) || pos < 0) return
296 return this.$element.one('slid', function () {
301 if (activePos == pos) {
302 return this.pause().cycle()
305 return this.slide(pos > activePos ? 'next' : 'prev', $(children[pos]))
308 , pause: function (e) {
309 if (!e) this.paused = true
310 if (this.$element.find('.next, .prev').length && $.support.transition.end) {
311 this.$element.trigger($.support.transition.end)
314 clearInterval(this.interval)
319 , next: function () {
320 if (this.sliding) return
321 return this.slide('next')
324 , prev: function () {
325 if (this.sliding) return
326 return this.slide('prev')
329 , slide: function (type, next) {
330 var $active = this.$element.find('.item.active')
331 , $next = next || $active[type]()
332 , isCycling = this.interval
333 , direction = type == 'next' ? 'left' : 'right'
334 , fallback = type == 'next' ? 'first' : 'last'
340 isCycling && this.pause()
342 $next = $next.length ? $next : this.$element.find('.item')[fallback]()
344 e = $.Event('slide', {
345 relatedTarget: $next[0]
348 if ($next.hasClass('active')) return
350 if ($.support.transition && this.$element.hasClass('slide')) {
351 this.$element.trigger(e)
352 if (e.isDefaultPrevented()) return
354 $next[0].offsetWidth // force reflow
355 $active.addClass(direction)
356 $next.addClass(direction)
357 this.$element.one($.support.transition.end, function () {
358 $next.removeClass([type, direction].join(' ')).addClass('active')
359 $active.removeClass(['active', direction].join(' '))
361 setTimeout(function () { that.$element.trigger('slid') }, 0)
364 this.$element.trigger(e)
365 if (e.isDefaultPrevented()) return
366 $active.removeClass('active')
367 $next.addClass('active')
369 this.$element.trigger('slid')
372 isCycling && this.cycle()
380 /* CAROUSEL PLUGIN DEFINITION
381 * ========================== */
383 $.fn.carousel = function (option) {
384 return this.each(function () {
386 , data = $this.data('carousel')
387 , options = $.extend({}, $.fn.carousel.defaults, typeof option == 'object' && option)
388 , action = typeof option == 'string' ? option : options.slide
389 if (!data) $this.data('carousel', (data = new Carousel(this, options)))
390 if (typeof option == 'number') data.to(option)
391 else if (action) data[action]()
392 else if (options.interval) data.cycle()
396 $.fn.carousel.defaults = {
401 $.fn.carousel.Constructor = Carousel
405 * ================= */
407 $(document).on('click.carousel.data-api', '[data-slide]', function (e) {
408 var $this = $(this), href
409 , $target = $($this.attr('data-target') || (href = $this.attr('href')) && href.replace(/.*(?=#[^\s]+$)/, '')) //strip for ie7
410 , options = $.extend({}, $target.data(), $this.data())
411 $target.carousel(options)
415 }(window.jQuery);/* =============================================================
416 * bootstrap-collapse.js v2.2.1
417 * http://twitter.github.com/bootstrap/javascript.html#collapse
418 * =============================================================
419 * Copyright 2012 Twitter, Inc.
421 * Licensed under the Apache License, Version 2.0 (the "License");
422 * you may not use this file except in compliance with the License.
423 * You may obtain a copy of the License at
425 * http://www.apache.org/licenses/LICENSE-2.0
427 * Unless required by applicable law or agreed to in writing, software
428 * distributed under the License is distributed on an "AS IS" BASIS,
429 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
430 * See the License for the specific language governing permissions and
431 * limitations under the License.
432 * ============================================================ */
437 "use strict"; // jshint ;_;
440 /* COLLAPSE PUBLIC CLASS DEFINITION
441 * ================================ */
443 var Collapse = function (element, options) {
444 this.$element = $(element)
445 this.options = $.extend({}, $.fn.collapse.defaults, options)
447 if (this.options.parent) {
448 this.$parent = $(this.options.parent)
451 this.options.toggle && this.toggle()
454 Collapse.prototype = {
456 constructor: Collapse
458 , dimension: function () {
459 var hasWidth = this.$element.hasClass('width')
460 return hasWidth ? 'width' : 'height'
463 , show: function () {
469 if (this.transitioning) return
471 dimension = this.dimension()
472 scroll = $.camelCase(['scroll', dimension].join('-'))
473 actives = this.$parent && this.$parent.find('> .accordion-group > .in')
475 if (actives && actives.length) {
476 hasData = actives.data('collapse')
477 if (hasData && hasData.transitioning) return
478 actives.collapse('hide')
479 hasData || actives.data('collapse', null)
482 this.$element[dimension](0)
483 this.transition('addClass', $.Event('show'), 'shown')
484 $.support.transition && this.$element[dimension](this.$element[0][scroll])
487 , hide: function () {
489 if (this.transitioning) return
490 dimension = this.dimension()
491 this.reset(this.$element[dimension]())
492 this.transition('removeClass', $.Event('hide'), 'hidden')
493 this.$element[dimension](0)
496 , reset: function (size) {
497 var dimension = this.dimension()
500 .removeClass('collapse')
501 [dimension](size || 'auto')
504 this.$element[size !== null ? 'addClass' : 'removeClass']('collapse')
509 , transition: function (method, startEvent, completeEvent) {
511 , complete = function () {
512 if (startEvent.type == 'show') that.reset()
513 that.transitioning = 0
514 that.$element.trigger(completeEvent)
517 this.$element.trigger(startEvent)
519 if (startEvent.isDefaultPrevented()) return
521 this.transitioning = 1
523 this.$element[method]('in')
525 $.support.transition && this.$element.hasClass('collapse') ?
526 this.$element.one($.support.transition.end, complete) :
530 , toggle: function () {
531 this[this.$element.hasClass('in') ? 'hide' : 'show']()
537 /* COLLAPSIBLE PLUGIN DEFINITION
538 * ============================== */
540 $.fn.collapse = function (option) {
541 return this.each(function () {
543 , data = $this.data('collapse')
544 , options = typeof option == 'object' && option
545 if (!data) $this.data('collapse', (data = new Collapse(this, options)))
546 if (typeof option == 'string') data[option]()
550 $.fn.collapse.defaults = {
554 $.fn.collapse.Constructor = Collapse
557 /* COLLAPSIBLE DATA-API
558 * ==================== */
560 $(document).on('click.collapse.data-api', '[data-toggle=collapse]', function (e) {
561 var $this = $(this), href
562 , target = $this.attr('data-target')
563 || e.preventDefault()
564 || (href = $this.attr('href')) && href.replace(/.*(?=#[^\s]+$)/, '') //strip for ie7
565 , option = $(target).data('collapse') ? 'toggle' : $this.data()
566 $this[$(target).hasClass('in') ? 'addClass' : 'removeClass']('collapsed')
567 $(target).collapse(option)
570 }(window.jQuery);/* ============================================================
571 * bootstrap-dropdown.js v2.2.1
572 * http://twitter.github.com/bootstrap/javascript.html#dropdowns
573 * ============================================================
574 * Copyright 2012 Twitter, Inc.
576 * Licensed under the Apache License, Version 2.0 (the "License");
577 * you may not use this file except in compliance with the License.
578 * You may obtain a copy of the License at
580 * http://www.apache.org/licenses/LICENSE-2.0
582 * Unless required by applicable law or agreed to in writing, software
583 * distributed under the License is distributed on an "AS IS" BASIS,
584 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
585 * See the License for the specific language governing permissions and
586 * limitations under the License.
587 * ============================================================ */
592 "use strict"; // jshint ;_;
595 /* DROPDOWN CLASS DEFINITION
596 * ========================= */
598 var toggle = '[data-toggle=dropdown]'
599 , Dropdown = function (element) {
600 var $el = $(element).on('click.dropdown.data-api', this.toggle)
601 $('html').on('click.dropdown.data-api', function () {
602 $el.parent().removeClass('open')
606 Dropdown.prototype = {
608 constructor: Dropdown
610 , toggle: function (e) {
615 if ($this.is('.disabled, :disabled')) return
617 $parent = getParent($this)
619 isActive = $parent.hasClass('open')
624 $parent.toggleClass('open')
631 , keydown: function (e) {
639 if (!/(38|40|27)/.test(e.keyCode)) return
646 if ($this.is('.disabled, :disabled')) return
648 $parent = getParent($this)
650 isActive = $parent.hasClass('open')
652 if (!isActive || (isActive && e.keyCode == 27)) return $this.click()
654 $items = $('[role=menu] li:not(.divider) a', $parent)
656 if (!$items.length) return
658 index = $items.index($items.filter(':focus'))
660 if (e.keyCode == 38 && index > 0) index-- // up
661 if (e.keyCode == 40 && index < $items.length - 1) index++ // down
662 if (!~index) index = 0
671 function clearMenus() {
672 $(toggle).each(function () {
673 getParent($(this)).removeClass('open')
677 function getParent($this) {
678 var selector = $this.attr('data-target')
682 selector = $this.attr('href')
683 selector = selector && /#/.test(selector) && selector.replace(/.*(?=#[^\s]*$)/, '') //strip for ie7
686 $parent = $(selector)
687 $parent.length || ($parent = $this.parent())
693 /* DROPDOWN PLUGIN DEFINITION
694 * ========================== */
696 $.fn.dropdown = function (option) {
697 return this.each(function () {
699 , data = $this.data('dropdown')
700 if (!data) $this.data('dropdown', (data = new Dropdown(this)))
701 if (typeof option == 'string') data[option].call($this)
705 $.fn.dropdown.Constructor = Dropdown
708 /* APPLY TO STANDARD DROPDOWN ELEMENTS
709 * =================================== */
712 .on('click.dropdown.data-api touchstart.dropdown.data-api', clearMenus)
713 .on('click.dropdown touchstart.dropdown.data-api', '.dropdown form', function (e) { e.stopPropagation() })
714 .on('click.dropdown.data-api touchstart.dropdown.data-api' , toggle, Dropdown.prototype.toggle)
715 .on('keydown.dropdown.data-api touchstart.dropdown.data-api', toggle + ', [role=menu]' , Dropdown.prototype.keydown)
717 }(window.jQuery);/* =========================================================
718 * bootstrap-modal.js v2.2.1
719 * http://twitter.github.com/bootstrap/javascript.html#modals
720 * =========================================================
721 * Copyright 2012 Twitter, Inc.
723 * Licensed under the Apache License, Version 2.0 (the "License");
724 * you may not use this file except in compliance with the License.
725 * You may obtain a copy of the License at
727 * http://www.apache.org/licenses/LICENSE-2.0
729 * Unless required by applicable law or agreed to in writing, software
730 * distributed under the License is distributed on an "AS IS" BASIS,
731 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
732 * See the License for the specific language governing permissions and
733 * limitations under the License.
734 * ========================================================= */
739 "use strict"; // jshint ;_;
742 /* MODAL CLASS DEFINITION
743 * ====================== */
745 var Modal = function (element, options) {
746 this.options = options
747 this.$element = $(element)
748 .delegate('[data-dismiss="modal"]', 'click.dismiss.modal', $.proxy(this.hide, this))
749 this.options.remote && this.$element.find('.modal-body').load(this.options.remote)
756 , toggle: function () {
757 return this[!this.isShown ? 'show' : 'hide']()
760 , show: function () {
762 , e = $.Event('show')
764 this.$element.trigger(e)
766 if (this.isShown || e.isDefaultPrevented()) return
772 this.backdrop(function () {
773 var transition = $.support.transition && that.$element.hasClass('fade')
775 if (!that.$element.parent().length) {
776 that.$element.appendTo(document.body) //don't move modals dom position
783 that.$element[0].offsetWidth // force reflow
788 .attr('aria-hidden', false)
793 that.$element.one($.support.transition.end, function () { that.$element.focus().trigger('shown') }) :
794 that.$element.focus().trigger('shown')
799 , hide: function (e) {
800 e && e.preventDefault()
806 this.$element.trigger(e)
808 if (!this.isShown || e.isDefaultPrevented()) return
814 $(document).off('focusin.modal')
818 .attr('aria-hidden', true)
820 $.support.transition && this.$element.hasClass('fade') ?
821 this.hideWithTransition() :
825 , enforceFocus: function () {
827 $(document).on('focusin.modal', function (e) {
828 if (that.$element[0] !== e.target && !that.$element.has(e.target).length) {
829 that.$element.focus()
834 , escape: function () {
836 if (this.isShown && this.options.keyboard) {
837 this.$element.on('keyup.dismiss.modal', function ( e ) {
838 e.which == 27 && that.hide()
840 } else if (!this.isShown) {
841 this.$element.off('keyup.dismiss.modal')
845 , hideWithTransition: function () {
847 , timeout = setTimeout(function () {
848 that.$element.off($.support.transition.end)
852 this.$element.one($.support.transition.end, function () {
853 clearTimeout(timeout)
858 , hideModal: function (that) {
866 , removeBackdrop: function () {
867 this.$backdrop.remove()
868 this.$backdrop = null
871 , backdrop: function (callback) {
873 , animate = this.$element.hasClass('fade') ? 'fade' : ''
875 if (this.isShown && this.options.backdrop) {
876 var doAnimate = $.support.transition && animate
878 this.$backdrop = $('<div class="modal-backdrop ' + animate + '" />')
879 .appendTo(document.body)
881 this.$backdrop.click(
882 this.options.backdrop == 'static' ?
883 $.proxy(this.$element[0].focus, this.$element[0])
884 : $.proxy(this.hide, this)
887 if (doAnimate) this.$backdrop[0].offsetWidth // force reflow
889 this.$backdrop.addClass('in')
892 this.$backdrop.one($.support.transition.end, callback) :
895 } else if (!this.isShown && this.$backdrop) {
896 this.$backdrop.removeClass('in')
898 $.support.transition && this.$element.hasClass('fade')?
899 this.$backdrop.one($.support.transition.end, $.proxy(this.removeBackdrop, this)) :
900 this.removeBackdrop()
902 } else if (callback) {
909 /* MODAL PLUGIN DEFINITION
910 * ======================= */
912 $.fn.modal = function (option) {
913 return this.each(function () {
915 , data = $this.data('modal')
916 , options = $.extend({}, $.fn.modal.defaults, $this.data(), typeof option == 'object' && option)
917 if (!data) $this.data('modal', (data = new Modal(this, options)))
918 if (typeof option == 'string') data[option]()
919 else if (options.show) data.show()
923 $.fn.modal.defaults = {
929 $.fn.modal.Constructor = Modal
935 $(document).on('click.modal.data-api', '[data-toggle="modal"]', function (e) {
937 , href = $this.attr('href')
938 , $target = $($this.attr('data-target') || (href && href.replace(/.*(?=#[^\s]+$)/, ''))) //strip for ie7
939 , option = $target.data('modal') ? 'toggle' : $.extend({ remote:!/#/.test(href) && href }, $target.data(), $this.data())
945 .one('hide', function () {
951 /* ===========================================================
952 * bootstrap-tooltip.js v2.2.1
953 * http://twitter.github.com/bootstrap/javascript.html#tooltips
954 * Inspired by the original jQuery.tipsy by Jason Frame
955 * ===========================================================
956 * Copyright 2012 Twitter, Inc.
958 * Licensed under the Apache License, Version 2.0 (the "License");
959 * you may not use this file except in compliance with the License.
960 * You may obtain a copy of the License at
962 * http://www.apache.org/licenses/LICENSE-2.0
964 * Unless required by applicable law or agreed to in writing, software
965 * distributed under the License is distributed on an "AS IS" BASIS,
966 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
967 * See the License for the specific language governing permissions and
968 * limitations under the License.
969 * ========================================================== */
974 "use strict"; // jshint ;_;
977 /* TOOLTIP PUBLIC CLASS DEFINITION
978 * =============================== */
980 var Tooltip = function (element, options) {
981 this.init('tooltip', element, options)
984 Tooltip.prototype = {
988 , init: function (type, element, options) {
993 this.$element = $(element)
994 this.options = this.getOptions(options)
997 if (this.options.trigger == 'click') {
998 this.$element.on('click.' + this.type, this.options.selector, $.proxy(this.toggle, this))
999 } else if (this.options.trigger != 'manual') {
1000 eventIn = this.options.trigger == 'hover' ? 'mouseenter' : 'focus'
1001 eventOut = this.options.trigger == 'hover' ? 'mouseleave' : 'blur'
1002 this.$element.on(eventIn + '.' + this.type, this.options.selector, $.proxy(this.enter, this))
1003 this.$element.on(eventOut + '.' + this.type, this.options.selector, $.proxy(this.leave, this))
1006 this.options.selector ?
1007 (this._options = $.extend({}, this.options, { trigger: 'manual', selector: '' })) :
1011 , getOptions: function (options) {
1012 options = $.extend({}, $.fn[this.type].defaults, options, this.$element.data())
1014 if (options.delay && typeof options.delay == 'number') {
1017 , hide: options.delay
1024 , enter: function (e) {
1025 var self = $(e.currentTarget)[this.type](this._options).data(this.type)
1027 if (!self.options.delay || !self.options.delay.show) return self.show()
1029 clearTimeout(this.timeout)
1030 self.hoverState = 'in'
1031 this.timeout = setTimeout(function() {
1032 if (self.hoverState == 'in') self.show()
1033 }, self.options.delay.show)
1036 , leave: function (e) {
1037 var self = $(e.currentTarget)[this.type](this._options).data(this.type)
1039 if (this.timeout) clearTimeout(this.timeout)
1040 if (!self.options.delay || !self.options.delay.hide) return self.hide()
1042 self.hoverState = 'out'
1043 this.timeout = setTimeout(function() {
1044 if (self.hoverState == 'out') self.hide()
1045 }, self.options.delay.hide)
1048 , show: function () {
1057 if (this.hasContent() && this.enabled) {
1061 if (this.options.animation) {
1062 $tip.addClass('fade')
1065 placement = typeof this.options.placement == 'function' ?
1066 this.options.placement.call(this, $tip[0], this.$element[0]) :
1067 this.options.placement
1069 inside = /in/.test(placement)
1073 .css({ top: 0, left: 0, display: 'block' })
1074 .insertAfter(this.$element)
1076 pos = this.getPosition(inside)
1078 actualWidth = $tip[0].offsetWidth
1079 actualHeight = $tip[0].offsetHeight
1081 switch (inside ? placement.split(' ')[1] : placement) {
1083 tp = {top: pos.top + pos.height, left: pos.left + pos.width / 2 - actualWidth / 2}
1086 tp = {top: pos.top - actualHeight, left: pos.left + pos.width / 2 - actualWidth / 2}
1089 tp = {top: pos.top + pos.height / 2 - actualHeight / 2, left: pos.left - actualWidth}
1092 tp = {top: pos.top + pos.height / 2 - actualHeight / 2, left: pos.left + pos.width}
1098 .addClass(placement)
1103 , setContent: function () {
1104 var $tip = this.tip()
1105 , title = this.getTitle()
1107 $tip.find('.tooltip-inner')[this.options.html ? 'html' : 'text'](title)
1108 $tip.removeClass('fade in top bottom left right')
1111 , hide: function () {
1115 $tip.removeClass('in')
1117 function removeWithAnimation() {
1118 var timeout = setTimeout(function () {
1119 $tip.off($.support.transition.end).detach()
1122 $tip.one($.support.transition.end, function () {
1123 clearTimeout(timeout)
1128 $.support.transition && this.$tip.hasClass('fade') ?
1129 removeWithAnimation() :
1135 , fixTitle: function () {
1136 var $e = this.$element
1137 if ($e.attr('title') || typeof($e.attr('data-original-title')) != 'string') {
1138 $e.attr('data-original-title', $e.attr('title') || '').removeAttr('title')
1142 , hasContent: function () {
1143 return this.getTitle()
1146 , getPosition: function (inside) {
1147 return $.extend({}, (inside ? {top: 0, left: 0} : this.$element.offset()), {
1148 width: this.$element[0].offsetWidth
1149 , height: this.$element[0].offsetHeight
1153 , getTitle: function () {
1155 , $e = this.$element
1158 title = $e.attr('data-original-title')
1159 || (typeof o.title == 'function' ? o.title.call($e[0]) : o.title)
1164 , tip: function () {
1165 return this.$tip = this.$tip || $(this.options.template)
1168 , validate: function () {
1169 if (!this.$element[0].parentNode) {
1171 this.$element = null
1176 , enable: function () {
1180 , disable: function () {
1181 this.enabled = false
1184 , toggleEnabled: function () {
1185 this.enabled = !this.enabled
1188 , toggle: function (e) {
1189 var self = $(e.currentTarget)[this.type](this._options).data(this.type)
1190 self[self.tip().hasClass('in') ? 'hide' : 'show']()
1193 , destroy: function () {
1194 this.hide().$element.off('.' + this.type).removeData(this.type)
1200 /* TOOLTIP PLUGIN DEFINITION
1201 * ========================= */
1203 $.fn.tooltip = function ( option ) {
1204 return this.each(function () {
1206 , data = $this.data('tooltip')
1207 , options = typeof option == 'object' && option
1208 if (!data) $this.data('tooltip', (data = new Tooltip(this, options)))
1209 if (typeof option == 'string') data[option]()
1213 $.fn.tooltip.Constructor = Tooltip
1215 $.fn.tooltip.defaults = {
1219 , template: '<div class="tooltip"><div class="tooltip-arrow"></div><div class="tooltip-inner"></div></div>'
1226 }(window.jQuery);/* ===========================================================
1227 * bootstrap-popover.js v2.2.1
1228 * http://twitter.github.com/bootstrap/javascript.html#popovers
1229 * ===========================================================
1230 * Copyright 2012 Twitter, Inc.
1232 * Licensed under the Apache License, Version 2.0 (the "License");
1233 * you may not use this file except in compliance with the License.
1234 * You may obtain a copy of the License at
1236 * http://www.apache.org/licenses/LICENSE-2.0
1238 * Unless required by applicable law or agreed to in writing, software
1239 * distributed under the License is distributed on an "AS IS" BASIS,
1240 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
1241 * See the License for the specific language governing permissions and
1242 * limitations under the License.
1243 * =========================================================== */
1248 "use strict"; // jshint ;_;
1251 /* POPOVER PUBLIC CLASS DEFINITION
1252 * =============================== */
1254 var Popover = function (element, options) {
1255 this.init('popover', element, options)
1259 /* NOTE: POPOVER EXTENDS BOOTSTRAP-TOOLTIP.js
1260 ========================================== */
1262 Popover.prototype = $.extend({}, $.fn.tooltip.Constructor.prototype, {
1264 constructor: Popover
1266 , setContent: function () {
1267 var $tip = this.tip()
1268 , title = this.getTitle()
1269 , content = this.getContent()
1271 $tip.find('.popover-title')[this.options.html ? 'html' : 'text'](title)
1272 $tip.find('.popover-content > *')[this.options.html ? 'html' : 'text'](content)
1274 $tip.removeClass('fade top bottom left right in')
1277 , hasContent: function () {
1278 return this.getTitle() || this.getContent()
1281 , getContent: function () {
1283 , $e = this.$element
1286 content = $e.attr('data-content')
1287 || (typeof o.content == 'function' ? o.content.call($e[0]) : o.content)
1292 , tip: function () {
1294 this.$tip = $(this.options.template)
1299 , destroy: function () {
1300 this.hide().$element.off('.' + this.type).removeData(this.type)
1306 /* POPOVER PLUGIN DEFINITION
1307 * ======================= */
1309 $.fn.popover = function (option) {
1310 return this.each(function () {
1312 , data = $this.data('popover')
1313 , options = typeof option == 'object' && option
1314 if (!data) $this.data('popover', (data = new Popover(this, options)))
1315 if (typeof option == 'string') data[option]()
1319 $.fn.popover.Constructor = Popover
1321 $.fn.popover.defaults = $.extend({} , $.fn.tooltip.defaults, {
1325 , template: '<div class="popover"><div class="arrow"></div><div class="popover-inner"><h3 class="popover-title"></h3><div class="popover-content"><p></p></div></div></div>'
1328 }(window.jQuery);/* =============================================================
1329 * bootstrap-scrollspy.js v2.2.1
1330 * http://twitter.github.com/bootstrap/javascript.html#scrollspy
1331 * =============================================================
1332 * Copyright 2012 Twitter, Inc.
1334 * Licensed under the Apache License, Version 2.0 (the "License");
1335 * you may not use this file except in compliance with the License.
1336 * You may obtain a copy of the License at
1338 * http://www.apache.org/licenses/LICENSE-2.0
1340 * Unless required by applicable law or agreed to in writing, software
1341 * distributed under the License is distributed on an "AS IS" BASIS,
1342 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
1343 * See the License for the specific language governing permissions and
1344 * limitations under the License.
1345 * ============================================================== */
1350 "use strict"; // jshint ;_;
1353 /* SCROLLSPY CLASS DEFINITION
1354 * ========================== */
1356 function ScrollSpy(element, options) {
1357 var process = $.proxy(this.process, this)
1358 , $element = $(element).is('body') ? $(window) : $(element)
1360 this.options = $.extend({}, $.fn.scrollspy.defaults, options)
1361 this.$scrollElement = $element.on('scroll.scroll-spy.data-api', process)
1362 this.selector = (this.options.target
1363 || ((href = $(element).attr('href')) && href.replace(/.*(?=#[^\s]+$)/, '')) //strip for ie7
1364 || '') + ' .nav li > a'
1365 this.$body = $('body')
1370 ScrollSpy.prototype = {
1372 constructor: ScrollSpy
1374 , refresh: function () {
1378 this.offsets = $([])
1379 this.targets = $([])
1381 $targets = this.$body
1382 .find(this.selector)
1385 , href = $el.data('target') || $el.attr('href')
1386 , $href = /^#\w/.test(href) && $(href)
1389 && [[ $href.position().top, href ]] ) || null
1391 .sort(function (a, b) { return a[0] - b[0] })
1393 self.offsets.push(this[0])
1394 self.targets.push(this[1])
1398 , process: function () {
1399 var scrollTop = this.$scrollElement.scrollTop() + this.options.offset
1400 , scrollHeight = this.$scrollElement[0].scrollHeight || this.$body[0].scrollHeight
1401 , maxScroll = scrollHeight - this.$scrollElement.height()
1402 , offsets = this.offsets
1403 , targets = this.targets
1404 , activeTarget = this.activeTarget
1407 if (scrollTop >= maxScroll) {
1408 return activeTarget != (i = targets.last()[0])
1409 && this.activate ( i )
1412 for (i = offsets.length; i--;) {
1413 activeTarget != targets[i]
1414 && scrollTop >= offsets[i]
1415 && (!offsets[i + 1] || scrollTop <= offsets[i + 1])
1416 && this.activate( targets[i] )
1420 , activate: function (target) {
1424 this.activeTarget = target
1428 .removeClass('active')
1430 selector = this.selector
1431 + '[data-target="' + target + '"],'
1432 + this.selector + '[href="' + target + '"]'
1434 active = $(selector)
1438 if (active.parent('.dropdown-menu').length) {
1439 active = active.closest('li.dropdown').addClass('active')
1442 active.trigger('activate')
1448 /* SCROLLSPY PLUGIN DEFINITION
1449 * =========================== */
1451 $.fn.scrollspy = function (option) {
1452 return this.each(function () {
1454 , data = $this.data('scrollspy')
1455 , options = typeof option == 'object' && option
1456 if (!data) $this.data('scrollspy', (data = new ScrollSpy(this, options)))
1457 if (typeof option == 'string') data[option]()
1461 $.fn.scrollspy.Constructor = ScrollSpy
1463 $.fn.scrollspy.defaults = {
1468 /* SCROLLSPY DATA-API
1469 * ================== */
1471 $(window).on('load', function () {
1472 $('[data-spy="scroll"]').each(function () {
1474 $spy.scrollspy($spy.data())
1478 }(window.jQuery);/* ========================================================
1479 * bootstrap-tab.js v2.2.1
1480 * http://twitter.github.com/bootstrap/javascript.html#tabs
1481 * ========================================================
1482 * Copyright 2012 Twitter, Inc.
1484 * Licensed under the Apache License, Version 2.0 (the "License");
1485 * you may not use this file except in compliance with the License.
1486 * You may obtain a copy of the License at
1488 * http://www.apache.org/licenses/LICENSE-2.0
1490 * Unless required by applicable law or agreed to in writing, software
1491 * distributed under the License is distributed on an "AS IS" BASIS,
1492 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
1493 * See the License for the specific language governing permissions and
1494 * limitations under the License.
1495 * ======================================================== */
1500 "use strict"; // jshint ;_;
1503 /* TAB CLASS DEFINITION
1504 * ==================== */
1506 var Tab = function (element) {
1507 this.element = $(element)
1514 , show: function () {
1515 var $this = this.element
1516 , $ul = $this.closest('ul:not(.dropdown-menu)')
1517 , selector = $this.attr('data-target')
1523 selector = $this.attr('href')
1524 selector = selector && selector.replace(/.*(?=#[^\s]*$)/, '') //strip for ie7
1527 if ( $this.parent('li').hasClass('active') ) return
1529 previous = $ul.find('.active:last a')[0]
1531 e = $.Event('show', {
1532 relatedTarget: previous
1537 if (e.isDefaultPrevented()) return
1539 $target = $(selector)
1541 this.activate($this.parent('li'), $ul)
1542 this.activate($target, $target.parent(), function () {
1545 , relatedTarget: previous
1550 , activate: function ( element, container, callback) {
1551 var $active = container.find('> .active')
1552 , transition = callback
1553 && $.support.transition
1554 && $active.hasClass('fade')
1558 .removeClass('active')
1559 .find('> .dropdown-menu > .active')
1560 .removeClass('active')
1562 element.addClass('active')
1565 element[0].offsetWidth // reflow for transition
1566 element.addClass('in')
1568 element.removeClass('fade')
1571 if ( element.parent('.dropdown-menu') ) {
1572 element.closest('li.dropdown').addClass('active')
1575 callback && callback()
1579 $active.one($.support.transition.end, next) :
1582 $active.removeClass('in')
1587 /* TAB PLUGIN DEFINITION
1588 * ===================== */
1590 $.fn.tab = function ( option ) {
1591 return this.each(function () {
1593 , data = $this.data('tab')
1594 if (!data) $this.data('tab', (data = new Tab(this)))
1595 if (typeof option == 'string') data[option]()
1599 $.fn.tab.Constructor = Tab
1605 $(document).on('click.tab.data-api', '[data-toggle="tab"], [data-toggle="pill"]', function (e) {
1610 }(window.jQuery);/* =============================================================
1611 * bootstrap-typeahead.js v2.2.1
1612 * http://twitter.github.com/bootstrap/javascript.html#typeahead
1613 * =============================================================
1614 * Copyright 2012 Twitter, Inc.
1616 * Licensed under the Apache License, Version 2.0 (the "License");
1617 * you may not use this file except in compliance with the License.
1618 * You may obtain a copy of the License at
1620 * http://www.apache.org/licenses/LICENSE-2.0
1622 * Unless required by applicable law or agreed to in writing, software
1623 * distributed under the License is distributed on an "AS IS" BASIS,
1624 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
1625 * See the License for the specific language governing permissions and
1626 * limitations under the License.
1627 * ============================================================ */
1632 "use strict"; // jshint ;_;
1635 /* TYPEAHEAD PUBLIC CLASS DEFINITION
1636 * ================================= */
1638 var Typeahead = function (element, options) {
1639 this.$element = $(element)
1640 this.options = $.extend({}, $.fn.typeahead.defaults, options)
1641 this.matcher = this.options.matcher || this.matcher
1642 this.sorter = this.options.sorter || this.sorter
1643 this.highlighter = this.options.highlighter || this.highlighter
1644 this.updater = this.options.updater || this.updater
1645 this.$menu = $(this.options.menu).appendTo('body')
1646 this.source = this.options.source
1651 Typeahead.prototype = {
1653 constructor: Typeahead
1655 , select: function () {
1656 var val = this.$menu.find('.active').attr('data-value')
1658 .val(this.updater(val))
1663 , updater: function (item) {
1667 , show: function () {
1668 var pos = $.extend({}, this.$element.offset(), {
1669 height: this.$element[0].offsetHeight
1673 top: pos.top + pos.height
1682 , hide: function () {
1688 , lookup: function (event) {
1691 this.query = this.$element.val()
1693 if (!this.query || this.query.length < this.options.minLength) {
1694 return this.shown ? this.hide() : this
1697 items = $.isFunction(this.source) ? this.source(this.query, $.proxy(this.process, this)) : this.source
1699 return items ? this.process(items) : this
1702 , process: function (items) {
1705 items = $.grep(items, function (item) {
1706 return that.matcher(item)
1709 items = this.sorter(items)
1711 if (!items.length) {
1712 return this.shown ? this.hide() : this
1715 return this.render(items.slice(0, this.options.items)).show()
1718 , matcher: function (item) {
1719 return ~item.toLowerCase().indexOf(this.query.toLowerCase())
1722 , sorter: function (items) {
1724 , caseSensitive = []
1725 , caseInsensitive = []
1728 while (item = items.shift()) {
1729 if (!item.toLowerCase().indexOf(this.query.toLowerCase())) beginswith.push(item)
1730 else if (~item.indexOf(this.query)) caseSensitive.push(item)
1731 else caseInsensitive.push(item)
1734 return beginswith.concat(caseSensitive, caseInsensitive)
1737 , highlighter: function (item) {
1738 var query = this.query.replace(/[\-\[\]{}()*+?.,\\\^$|#\s]/g, '\\$&')
1739 return item.replace(new RegExp('(' + query + ')', 'ig'), function ($1, match) {
1740 return '<strong>' + match + '</strong>'
1744 , render: function (items) {
1747 items = $(items).map(function (i, item) {
1748 i = $(that.options.item).attr('data-value', item)
1749 i.find('a').html(that.highlighter(item))
1753 items.first().addClass('active')
1754 this.$menu.html(items)
1758 , next: function (event) {
1759 var active = this.$menu.find('.active').removeClass('active')
1760 , next = active.next()
1763 next = $(this.$menu.find('li')[0])
1766 next.addClass('active')
1769 , prev: function (event) {
1770 var active = this.$menu.find('.active').removeClass('active')
1771 , prev = active.prev()
1774 prev = this.$menu.find('li').last()
1777 prev.addClass('active')
1780 , listen: function () {
1782 .on('blur', $.proxy(this.blur, this))
1783 .on('keypress', $.proxy(this.keypress, this))
1784 .on('keyup', $.proxy(this.keyup, this))
1786 if (this.eventSupported('keydown')) {
1787 this.$element.on('keydown', $.proxy(this.keydown, this))
1791 .on('click', $.proxy(this.click, this))
1792 .on('mouseenter', 'li', $.proxy(this.mouseenter, this))
1795 , eventSupported: function(eventName) {
1796 var isSupported = eventName in this.$element
1798 this.$element.setAttribute(eventName, 'return;')
1799 isSupported = typeof this.$element[eventName] === 'function'
1804 , move: function (e) {
1805 if (!this.shown) return
1814 case 38: // up arrow
1819 case 40: // down arrow
1828 , keydown: function (e) {
1829 this.suppressKeyPressRepeat = !~$.inArray(e.keyCode, [40,38,9,13,27])
1833 , keypress: function (e) {
1834 if (this.suppressKeyPressRepeat) return
1838 , keyup: function (e) {
1840 case 40: // down arrow
1841 case 38: // up arrow
1849 if (!this.shown) return
1854 if (!this.shown) return
1866 , blur: function (e) {
1868 setTimeout(function () { that.hide() }, 150)
1871 , click: function (e) {
1877 , mouseenter: function (e) {
1878 this.$menu.find('.active').removeClass('active')
1879 $(e.currentTarget).addClass('active')
1885 /* TYPEAHEAD PLUGIN DEFINITION
1886 * =========================== */
1888 $.fn.typeahead = function (option) {
1889 return this.each(function () {
1891 , data = $this.data('typeahead')
1892 , options = typeof option == 'object' && option
1893 if (!data) $this.data('typeahead', (data = new Typeahead(this, options)))
1894 if (typeof option == 'string') data[option]()
1898 $.fn.typeahead.defaults = {
1901 , menu: '<ul class="typeahead dropdown-menu"></ul>'
1902 , item: '<li><a href="#"></a></li>'
1906 $.fn.typeahead.Constructor = Typeahead
1909 /* TYPEAHEAD DATA-API
1910 * ================== */
1912 $(document).on('focus.typeahead.data-api', '[data-provide="typeahead"]', function (e) {
1914 if ($this.data('typeahead')) return
1916 $this.typeahead($this.data())
1920 /* ==========================================================
1921 * bootstrap-affix.js v2.2.1
1922 * http://twitter.github.com/bootstrap/javascript.html#affix
1923 * ==========================================================
1924 * Copyright 2012 Twitter, Inc.
1926 * Licensed under the Apache License, Version 2.0 (the "License");
1927 * you may not use this file except in compliance with the License.
1928 * You may obtain a copy of the License at
1930 * http://www.apache.org/licenses/LICENSE-2.0
1932 * Unless required by applicable law or agreed to in writing, software
1933 * distributed under the License is distributed on an "AS IS" BASIS,
1934 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
1935 * See the License for the specific language governing permissions and
1936 * limitations under the License.
1937 * ========================================================== */
1942 "use strict"; // jshint ;_;
1945 /* AFFIX CLASS DEFINITION
1946 * ====================== */
1948 var Affix = function (element, options) {
1949 this.options = $.extend({}, $.fn.affix.defaults, options)
1950 this.$window = $(window)
1951 .on('scroll.affix.data-api', $.proxy(this.checkPosition, this))
1952 .on('click.affix.data-api', $.proxy(function () { setTimeout($.proxy(this.checkPosition, this), 1) }, this))
1953 this.$element = $(element)
1954 this.checkPosition()
1957 Affix.prototype.checkPosition = function () {
1958 if (!this.$element.is(':visible')) return
1960 var scrollHeight = $(document).height()
1961 , scrollTop = this.$window.scrollTop()
1962 , position = this.$element.offset()
1963 , offset = this.options.offset
1964 , offsetBottom = offset.bottom
1965 , offsetTop = offset.top
1966 , reset = 'affix affix-top affix-bottom'
1969 if (typeof offset != 'object') offsetBottom = offsetTop = offset
1970 if (typeof offsetTop == 'function') offsetTop = offset.top()
1971 if (typeof offsetBottom == 'function') offsetBottom = offset.bottom()
1973 affix = this.unpin != null && (scrollTop + this.unpin <= position.top) ?
1974 false : offsetBottom != null && (position.top + this.$element.height() >= scrollHeight - offsetBottom) ?
1975 'bottom' : offsetTop != null && scrollTop <= offsetTop ?
1978 if (this.affixed === affix) return
1980 this.affixed = affix
1981 this.unpin = affix == 'bottom' ? position.top - scrollTop : null
1983 this.$element.removeClass(reset).addClass('affix' + (affix ? '-' + affix : ''))
1987 /* AFFIX PLUGIN DEFINITION
1988 * ======================= */
1990 $.fn.affix = function (option) {
1991 return this.each(function () {
1993 , data = $this.data('affix')
1994 , options = typeof option == 'object' && option
1995 if (!data) $this.data('affix', (data = new Affix(this, options)))
1996 if (typeof option == 'string') data[option]()
2000 $.fn.affix.Constructor = Affix
2002 $.fn.affix.defaults = {
2010 $(window).on('load', function () {
2011 $('[data-spy="affix"]').each(function () {
2013 , data = $spy.data()
2015 data.offset = data.offset || {}
2017 data.offsetBottom && (data.offset.bottom = data.offsetBottom)
2018 data.offsetTop && (data.offset.top = data.offsetTop)