1 /* ===================================================
2 * bootstrap-transition.js v2.1.0
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 * ========================================================== */
25 "use strict"; // jshint ;_;
28 /* CSS TRANSITION SUPPORT (http://www.modernizr.com/)
29 * ======================================================= */
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.1.0
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
146 $('body').on('click.alert.data-api', dismiss, Alert.prototype.close)
149 }(window.jQuery);/* ============================================================
150 * bootstrap-button.js v2.1.0
151 * http://twitter.github.com/bootstrap/javascript.html#buttons
152 * ============================================================
153 * Copyright 2012 Twitter, Inc.
155 * Licensed under the Apache License, Version 2.0 (the "License");
156 * you may not use this file except in compliance with the License.
157 * You may obtain a copy of the License at
159 * http://www.apache.org/licenses/LICENSE-2.0
161 * Unless required by applicable law or agreed to in writing, software
162 * distributed under the License is distributed on an "AS IS" BASIS,
163 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
164 * See the License for the specific language governing permissions and
165 * limitations under the License.
166 * ============================================================ */
171 "use strict"; // jshint ;_;
174 /* BUTTON PUBLIC CLASS DEFINITION
175 * ============================== */
177 var Button = function (element, options) {
178 this.$element = $(element)
179 this.options = $.extend({}, $.fn.button.defaults, options)
182 Button.prototype.setState = function (state) {
184 , $el = this.$element
186 , val = $el.is('input') ? 'val' : 'html'
188 state = state + 'Text'
189 data.resetText || $el.data('resetText', $el[val]())
191 $el[val](data[state] || this.options[state])
193 // push to event loop to allow forms to submit
194 setTimeout(function () {
195 state == 'loadingText' ?
196 $el.addClass(d).attr(d, d) :
197 $el.removeClass(d).removeAttr(d)
201 Button.prototype.toggle = function () {
202 var $parent = this.$element.parent('[data-toggle="buttons-radio"]')
206 .removeClass('active')
208 this.$element.toggleClass('active')
212 /* BUTTON PLUGIN DEFINITION
213 * ======================== */
215 $.fn.button = function (option) {
216 return this.each(function () {
218 , data = $this.data('button')
219 , options = typeof option == 'object' && option
220 if (!data) $this.data('button', (data = new Button(this, options)))
221 if (option == 'toggle') data.toggle()
222 else if (option) data.setState(option)
226 $.fn.button.defaults = {
227 loadingText: 'loading...'
230 $.fn.button.Constructor = Button
237 $('body').on('click.button.data-api', '[data-toggle^=button]', function ( e ) {
238 var $btn = $(e.target)
239 if (!$btn.hasClass('btn')) $btn = $btn.closest('.btn')
240 $btn.button('toggle')
244 }(window.jQuery);/* ==========================================================
245 * bootstrap-carousel.js v2.1.0
246 * http://twitter.github.com/bootstrap/javascript.html#carousel
247 * ==========================================================
248 * Copyright 2012 Twitter, Inc.
250 * Licensed under the Apache License, Version 2.0 (the "License");
251 * you may not use this file except in compliance with the License.
252 * You may obtain a copy of the License at
254 * http://www.apache.org/licenses/LICENSE-2.0
256 * Unless required by applicable law or agreed to in writing, software
257 * distributed under the License is distributed on an "AS IS" BASIS,
258 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
259 * See the License for the specific language governing permissions and
260 * limitations under the License.
261 * ========================================================== */
266 "use strict"; // jshint ;_;
269 /* CAROUSEL CLASS DEFINITION
270 * ========================= */
272 var Carousel = function (element, options) {
273 this.$element = $(element)
274 this.options = options
275 this.options.slide && this.slide(this.options.slide)
276 this.options.pause == 'hover' && this.$element
277 .on('mouseenter', $.proxy(this.pause, this))
278 .on('mouseleave', $.proxy(this.cycle, this))
281 Carousel.prototype = {
283 cycle: function (e) {
284 if (!e) this.paused = false
285 this.options.interval
287 && (this.interval = setInterval($.proxy(this.next, this), this.options.interval))
291 , to: function (pos) {
292 var $active = this.$element.find('.item.active')
293 , children = $active.parent().children()
294 , activePos = children.index($active)
297 if (pos > (children.length - 1) || pos < 0) return
300 return this.$element.one('slid', function () {
305 if (activePos == pos) {
306 return this.pause().cycle()
309 return this.slide(pos > activePos ? 'next' : 'prev', $(children[pos]))
312 , pause: function (e) {
313 if (!e) this.paused = true
314 if (this.$element.find('.next, .prev').length && $.support.transition.end) {
315 this.$element.trigger($.support.transition.end)
318 clearInterval(this.interval)
323 , next: function () {
324 if (this.sliding) return
325 return this.slide('next')
328 , prev: function () {
329 if (this.sliding) return
330 return this.slide('prev')
333 , slide: function (type, next) {
334 var $active = this.$element.find('.item.active')
335 , $next = next || $active[type]()
336 , isCycling = this.interval
337 , direction = type == 'next' ? 'left' : 'right'
338 , fallback = type == 'next' ? 'first' : 'last'
340 , e = $.Event('slide', {
341 relatedTarget: $next[0]
346 isCycling && this.pause()
348 $next = $next.length ? $next : this.$element.find('.item')[fallback]()
350 if ($next.hasClass('active')) return
352 if ($.support.transition && this.$element.hasClass('slide')) {
353 this.$element.trigger(e)
354 if (e.isDefaultPrevented()) return
356 $next[0].offsetWidth // force reflow
357 $active.addClass(direction)
358 $next.addClass(direction)
359 this.$element.one($.support.transition.end, function () {
360 $next.removeClass([type, direction].join(' ')).addClass('active')
361 $active.removeClass(['active', direction].join(' '))
363 setTimeout(function () { that.$element.trigger('slid') }, 0)
366 this.$element.trigger(e)
367 if (e.isDefaultPrevented()) return
368 $active.removeClass('active')
369 $next.addClass('active')
371 this.$element.trigger('slid')
374 isCycling && this.cycle()
382 /* CAROUSEL PLUGIN DEFINITION
383 * ========================== */
385 $.fn.carousel = function (option) {
386 return this.each(function () {
388 , data = $this.data('carousel')
389 , options = $.extend({}, $.fn.carousel.defaults, typeof option == 'object' && option)
390 , action = typeof option == 'string' ? option : options.slide
391 if (!data) $this.data('carousel', (data = new Carousel(this, options)))
392 if (typeof option == 'number') data.to(option)
393 else if (action) data[action]()
394 else if (options.interval) data.cycle()
398 $.fn.carousel.defaults = {
403 $.fn.carousel.Constructor = Carousel
407 * ================= */
410 $('body').on('click.carousel.data-api', '[data-slide]', function ( e ) {
411 var $this = $(this), href
412 , $target = $($this.attr('data-target') || (href = $this.attr('href')) && href.replace(/.*(?=#[^\s]+$)/, '')) //strip for ie7
413 , options = !$target.data('modal') && $.extend({}, $target.data(), $this.data())
414 $target.carousel(options)
419 }(window.jQuery);/* =============================================================
420 * bootstrap-collapse.js v2.1.0
421 * http://twitter.github.com/bootstrap/javascript.html#collapse
422 * =============================================================
423 * Copyright 2012 Twitter, Inc.
425 * Licensed under the Apache License, Version 2.0 (the "License");
426 * you may not use this file except in compliance with the License.
427 * You may obtain a copy of the License at
429 * http://www.apache.org/licenses/LICENSE-2.0
431 * Unless required by applicable law or agreed to in writing, software
432 * distributed under the License is distributed on an "AS IS" BASIS,
433 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
434 * See the License for the specific language governing permissions and
435 * limitations under the License.
436 * ============================================================ */
441 "use strict"; // jshint ;_;
444 /* COLLAPSE PUBLIC CLASS DEFINITION
445 * ================================ */
447 var Collapse = function (element, options) {
448 this.$element = $(element)
449 this.options = $.extend({}, $.fn.collapse.defaults, options)
451 if (this.options.parent) {
452 this.$parent = $(this.options.parent)
455 this.options.toggle && this.toggle()
458 Collapse.prototype = {
460 constructor: Collapse
462 , dimension: function () {
463 var hasWidth = this.$element.hasClass('width')
464 return hasWidth ? 'width' : 'height'
467 , show: function () {
473 if (this.transitioning) return
475 dimension = this.dimension()
476 scroll = $.camelCase(['scroll', dimension].join('-'))
477 actives = this.$parent && this.$parent.find('> .accordion-group > .in')
479 if (actives && actives.length) {
480 hasData = actives.data('collapse')
481 if (hasData && hasData.transitioning) return
482 actives.collapse('hide')
483 hasData || actives.data('collapse', null)
486 this.$element[dimension](0)
487 this.transition('addClass', $.Event('show'), 'shown')
488 $.support.transition && this.$element[dimension](this.$element[0][scroll])
491 , hide: function () {
493 if (this.transitioning) return
494 dimension = this.dimension()
495 this.reset(this.$element[dimension]())
496 this.transition('removeClass', $.Event('hide'), 'hidden')
497 this.$element[dimension](0)
500 , reset: function (size) {
501 var dimension = this.dimension()
504 .removeClass('collapse')
505 [dimension](size || 'auto')
508 this.$element[size !== null ? 'addClass' : 'removeClass']('collapse')
513 , transition: function (method, startEvent, completeEvent) {
515 , complete = function () {
516 if (startEvent.type == 'show') that.reset()
517 that.transitioning = 0
518 that.$element.trigger(completeEvent)
521 this.$element.trigger(startEvent)
523 if (startEvent.isDefaultPrevented()) return
525 this.transitioning = 1
527 this.$element[method]('in')
529 $.support.transition && this.$element.hasClass('collapse') ?
530 this.$element.one($.support.transition.end, complete) :
534 , toggle: function () {
535 this[this.$element.hasClass('in') ? 'hide' : 'show']()
541 /* COLLAPSIBLE PLUGIN DEFINITION
542 * ============================== */
544 $.fn.collapse = function (option) {
545 return this.each(function () {
547 , data = $this.data('collapse')
548 , options = typeof option == 'object' && option
549 if (!data) $this.data('collapse', (data = new Collapse(this, options)))
550 if (typeof option == 'string') data[option]()
554 $.fn.collapse.defaults = {
558 $.fn.collapse.Constructor = Collapse
561 /* COLLAPSIBLE DATA-API
562 * ==================== */
565 $('body').on('click.collapse.data-api', '[data-toggle=collapse]', function (e) {
566 var $this = $(this), href
567 , target = $this.attr('data-target')
568 || e.preventDefault()
569 || (href = $this.attr('href')) && href.replace(/.*(?=#[^\s]+$)/, '') //strip for ie7
570 , option = $(target).data('collapse') ? 'toggle' : $this.data()
571 $this[$(target).hasClass('in') ? 'addClass' : 'removeClass']('collapsed')
572 $(target).collapse(option)
576 }(window.jQuery);/* ============================================================
577 * bootstrap-dropdown.js v2.1.0
578 * http://twitter.github.com/bootstrap/javascript.html#dropdowns
579 * ============================================================
580 * Copyright 2012 Twitter, Inc.
582 * Licensed under the Apache License, Version 2.0 (the "License");
583 * you may not use this file except in compliance with the License.
584 * You may obtain a copy of the License at
586 * http://www.apache.org/licenses/LICENSE-2.0
588 * Unless required by applicable law or agreed to in writing, software
589 * distributed under the License is distributed on an "AS IS" BASIS,
590 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
591 * See the License for the specific language governing permissions and
592 * limitations under the License.
593 * ============================================================ */
598 "use strict"; // jshint ;_;
601 /* DROPDOWN CLASS DEFINITION
602 * ========================= */
604 var toggle = '[data-toggle=dropdown]'
605 , Dropdown = function (element) {
606 var $el = $(element).on('click.dropdown.data-api', this.toggle)
607 $('html').on('click.dropdown.data-api', function () {
608 $el.parent().removeClass('open')
612 Dropdown.prototype = {
614 constructor: Dropdown
616 , toggle: function (e) {
621 if ($this.is('.disabled, :disabled')) return
623 $parent = getParent($this)
625 isActive = $parent.hasClass('open')
630 $parent.toggleClass('open')
637 , keydown: function (e) {
645 if (!/(38|40|27)/.test(e.keyCode)) return
652 if ($this.is('.disabled, :disabled')) return
654 $parent = getParent($this)
656 isActive = $parent.hasClass('open')
658 if (!isActive || (isActive && e.keyCode == 27)) return $this.click()
660 $items = $('[role=menu] li:not(.divider) a', $parent)
662 if (!$items.length) return
664 index = $items.index($items.filter(':focus'))
666 if (e.keyCode == 38 && index > 0) index-- // up
667 if (e.keyCode == 40 && index < $items.length - 1) index++ // down
668 if (!~index) index = 0
677 function clearMenus() {
682 function getParent($this) {
683 var selector = $this.attr('data-target')
687 selector = $this.attr('href')
688 selector = selector && selector.replace(/.*(?=#[^\s]*$)/, '') //strip for ie7
691 $parent = $(selector)
692 $parent.length || ($parent = $this.parent())
698 /* DROPDOWN PLUGIN DEFINITION
699 * ========================== */
701 $.fn.dropdown = function (option) {
702 return this.each(function () {
704 , data = $this.data('dropdown')
705 if (!data) $this.data('dropdown', (data = new Dropdown(this)))
706 if (typeof option == 'string') data[option].call($this)
710 $.fn.dropdown.Constructor = Dropdown
713 /* APPLY TO STANDARD DROPDOWN ELEMENTS
714 * =================================== */
718 .on('click.dropdown.data-api touchstart.dropdown.data-api', clearMenus)
720 .on('click.dropdown touchstart.dropdown.data-api', '.dropdown', function (e) { e.stopPropagation() })
721 .on('click.dropdown.data-api touchstart.dropdown.data-api' , toggle, Dropdown.prototype.toggle)
722 .on('keydown.dropdown.data-api touchstart.dropdown.data-api', toggle + ', [role=menu]' , Dropdown.prototype.keydown)
725 }(window.jQuery);/* =========================================================
726 * bootstrap-modal.js v2.1.0
727 * http://twitter.github.com/bootstrap/javascript.html#modals
728 * =========================================================
729 * Copyright 2012 Twitter, Inc.
731 * Licensed under the Apache License, Version 2.0 (the "License");
732 * you may not use this file except in compliance with the License.
733 * You may obtain a copy of the License at
735 * http://www.apache.org/licenses/LICENSE-2.0
737 * Unless required by applicable law or agreed to in writing, software
738 * distributed under the License is distributed on an "AS IS" BASIS,
739 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
740 * See the License for the specific language governing permissions and
741 * limitations under the License.
742 * ========================================================= */
747 "use strict"; // jshint ;_;
750 /* MODAL CLASS DEFINITION
751 * ====================== */
753 var Modal = function (element, options) {
754 this.options = options
755 this.$element = $(element)
756 .delegate('[data-dismiss="modal"]', 'click.dismiss.modal', $.proxy(this.hide, this))
757 this.options.remote && this.$element.find('.modal-body').load(this.options.remote)
764 , toggle: function () {
765 return this[!this.isShown ? 'show' : 'hide']()
768 , show: function () {
770 , e = $.Event('show')
772 this.$element.trigger(e)
774 if (this.isShown || e.isDefaultPrevented()) return
776 $('body').addClass('modal-open')
782 this.backdrop(function () {
783 var transition = $.support.transition && that.$element.hasClass('fade')
785 if (!that.$element.parent().length) {
786 that.$element.appendTo(document.body) //don't move modals dom position
793 that.$element[0].offsetWidth // force reflow
798 .attr('aria-hidden', false)
804 that.$element.one($.support.transition.end, function () { that.$element.trigger('shown') }) :
805 that.$element.trigger('shown')
810 , hide: function (e) {
811 e && e.preventDefault()
817 this.$element.trigger(e)
819 if (!this.isShown || e.isDefaultPrevented()) return
823 $('body').removeClass('modal-open')
827 $(document).off('focusin.modal')
831 .attr('aria-hidden', true)
833 $.support.transition && this.$element.hasClass('fade') ?
834 this.hideWithTransition() :
838 , enforceFocus: function () {
840 $(document).on('focusin.modal', function (e) {
841 if (that.$element[0] !== e.target && !that.$element.has(e.target).length) {
842 that.$element.focus()
847 , escape: function () {
849 if (this.isShown && this.options.keyboard) {
850 this.$element.on('keyup.dismiss.modal', function ( e ) {
851 e.which == 27 && that.hide()
853 } else if (!this.isShown) {
854 this.$element.off('keyup.dismiss.modal')
858 , hideWithTransition: function () {
860 , timeout = setTimeout(function () {
861 that.$element.off($.support.transition.end)
865 this.$element.one($.support.transition.end, function () {
866 clearTimeout(timeout)
871 , hideModal: function (that) {
879 , removeBackdrop: function () {
880 this.$backdrop.remove()
881 this.$backdrop = null
884 , backdrop: function (callback) {
886 , animate = this.$element.hasClass('fade') ? 'fade' : ''
888 if (this.isShown && this.options.backdrop) {
889 var doAnimate = $.support.transition && animate
891 this.$backdrop = $('<div class="modal-backdrop ' + animate + '" />')
892 .appendTo(document.body)
894 if (this.options.backdrop != 'static') {
895 this.$backdrop.click($.proxy(this.hide, this))
898 if (doAnimate) this.$backdrop[0].offsetWidth // force reflow
900 this.$backdrop.addClass('in')
903 this.$backdrop.one($.support.transition.end, callback) :
906 } else if (!this.isShown && this.$backdrop) {
907 this.$backdrop.removeClass('in')
909 $.support.transition && this.$element.hasClass('fade')?
910 this.$backdrop.one($.support.transition.end, $.proxy(this.removeBackdrop, this)) :
911 this.removeBackdrop()
913 } else if (callback) {
920 /* MODAL PLUGIN DEFINITION
921 * ======================= */
923 $.fn.modal = function (option) {
924 return this.each(function () {
926 , data = $this.data('modal')
927 , options = $.extend({}, $.fn.modal.defaults, $this.data(), typeof option == 'object' && option)
928 if (!data) $this.data('modal', (data = new Modal(this, options)))
929 if (typeof option == 'string') data[option]()
930 else if (options.show) data.show()
934 $.fn.modal.defaults = {
940 $.fn.modal.Constructor = Modal
947 $('body').on('click.modal.data-api', '[data-toggle="modal"]', function ( e ) {
949 , href = $this.attr('href')
950 , $target = $($this.attr('data-target') || (href && href.replace(/.*(?=#[^\s]+$)/, ''))) //strip for ie7
951 , option = $target.data('modal') ? 'toggle' : $.extend({ remote: !/#/.test(href) && href }, $target.data(), $this.data())
957 .one('hide', function () {
963 }(window.jQuery);/* ===========================================================
964 * bootstrap-tooltip.js v2.1.0
965 * http://twitter.github.com/bootstrap/javascript.html#tooltips
966 * Inspired by the original jQuery.tipsy by Jason Frame
967 * ===========================================================
968 * Copyright 2012 Twitter, Inc.
970 * Licensed under the Apache License, Version 2.0 (the "License");
971 * you may not use this file except in compliance with the License.
972 * You may obtain a copy of the License at
974 * http://www.apache.org/licenses/LICENSE-2.0
976 * Unless required by applicable law or agreed to in writing, software
977 * distributed under the License is distributed on an "AS IS" BASIS,
978 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
979 * See the License for the specific language governing permissions and
980 * limitations under the License.
981 * ========================================================== */
986 "use strict"; // jshint ;_;
989 /* TOOLTIP PUBLIC CLASS DEFINITION
990 * =============================== */
992 var Tooltip = function (element, options) {
993 this.init('tooltip', element, options)
996 Tooltip.prototype = {
1000 , init: function (type, element, options) {
1005 this.$element = $(element)
1006 this.options = this.getOptions(options)
1009 if (this.options.trigger == 'click') {
1010 this.$element.on('click.' + this.type, this.options.selector, $.proxy(this.toggle, this))
1011 } else if (this.options.trigger != 'manual') {
1012 eventIn = this.options.trigger == 'hover' ? 'mouseenter' : 'focus'
1013 eventOut = this.options.trigger == 'hover' ? 'mouseleave' : 'blur'
1014 this.$element.on(eventIn + '.' + this.type, this.options.selector, $.proxy(this.enter, this))
1015 this.$element.on(eventOut + '.' + this.type, this.options.selector, $.proxy(this.leave, this))
1018 this.options.selector ?
1019 (this._options = $.extend({}, this.options, { trigger: 'manual', selector: '' })) :
1023 , getOptions: function (options) {
1024 options = $.extend({}, $.fn[this.type].defaults, options, this.$element.data())
1026 if (options.delay && typeof options.delay == 'number') {
1029 , hide: options.delay
1036 , enter: function (e) {
1037 var self = $(e.currentTarget)[this.type](this._options).data(this.type)
1039 if (!self.options.delay || !self.options.delay.show) return self.show()
1041 clearTimeout(this.timeout)
1042 self.hoverState = 'in'
1043 this.timeout = setTimeout(function() {
1044 if (self.hoverState == 'in') self.show()
1045 }, self.options.delay.show)
1048 , leave: function (e) {
1049 var self = $(e.currentTarget)[this.type](this._options).data(this.type)
1051 if (this.timeout) clearTimeout(this.timeout)
1052 if (!self.options.delay || !self.options.delay.hide) return self.hide()
1054 self.hoverState = 'out'
1055 this.timeout = setTimeout(function() {
1056 if (self.hoverState == 'out') self.hide()
1057 }, self.options.delay.hide)
1060 , show: function () {
1069 if (this.hasContent() && this.enabled) {
1073 if (this.options.animation) {
1074 $tip.addClass('fade')
1077 placement = typeof this.options.placement == 'function' ?
1078 this.options.placement.call(this, $tip[0], this.$element[0]) :
1079 this.options.placement
1081 inside = /in/.test(placement)
1085 .css({ top: 0, left: 0, display: 'block' })
1086 .appendTo(inside ? this.$element : document.body)
1088 pos = this.getPosition(inside)
1090 actualWidth = $tip[0].offsetWidth
1091 actualHeight = $tip[0].offsetHeight
1093 switch (inside ? placement.split(' ')[1] : placement) {
1095 tp = {top: pos.top + pos.height, left: pos.left + pos.width / 2 - actualWidth / 2}
1098 tp = {top: pos.top - actualHeight, left: pos.left + pos.width / 2 - actualWidth / 2}
1101 tp = {top: pos.top + pos.height / 2 - actualHeight / 2, left: pos.left - actualWidth}
1104 tp = {top: pos.top + pos.height / 2 - actualHeight / 2, left: pos.left + pos.width}
1110 .addClass(placement)
1115 , setContent: function () {
1116 var $tip = this.tip()
1117 , title = this.getTitle()
1119 $tip.find('.tooltip-inner')[this.options.html ? 'html' : 'text'](title)
1120 $tip.removeClass('fade in top bottom left right')
1123 , hide: function () {
1127 $tip.removeClass('in')
1129 function removeWithAnimation() {
1130 var timeout = setTimeout(function () {
1131 $tip.off($.support.transition.end).remove()
1134 $tip.one($.support.transition.end, function () {
1135 clearTimeout(timeout)
1140 $.support.transition && this.$tip.hasClass('fade') ?
1141 removeWithAnimation() :
1147 , fixTitle: function () {
1148 var $e = this.$element
1149 if ($e.attr('title') || typeof($e.attr('data-original-title')) != 'string') {
1150 $e.attr('data-original-title', $e.attr('title') || '').removeAttr('title')
1154 , hasContent: function () {
1155 return this.getTitle()
1158 , getPosition: function (inside) {
1159 return $.extend({}, (inside ? {top: 0, left: 0} : this.$element.offset()), {
1160 width: this.$element[0].offsetWidth
1161 , height: this.$element[0].offsetHeight
1165 , getTitle: function () {
1167 , $e = this.$element
1170 title = $e.attr('data-original-title')
1171 || (typeof o.title == 'function' ? o.title.call($e[0]) : o.title)
1176 , tip: function () {
1177 return this.$tip = this.$tip || $(this.options.template)
1180 , validate: function () {
1181 if (!this.$element[0].parentNode) {
1183 this.$element = null
1188 , enable: function () {
1192 , disable: function () {
1193 this.enabled = false
1196 , toggleEnabled: function () {
1197 this.enabled = !this.enabled
1200 , toggle: function () {
1201 this[this.tip().hasClass('in') ? 'hide' : 'show']()
1204 , destroy: function () {
1205 this.hide().$element.off('.' + this.type).removeData(this.type)
1211 /* TOOLTIP PLUGIN DEFINITION
1212 * ========================= */
1214 $.fn.tooltip = function ( option ) {
1215 return this.each(function () {
1217 , data = $this.data('tooltip')
1218 , options = typeof option == 'object' && option
1219 if (!data) $this.data('tooltip', (data = new Tooltip(this, options)))
1220 if (typeof option == 'string') data[option]()
1224 $.fn.tooltip.Constructor = Tooltip
1226 $.fn.tooltip.defaults = {
1230 , template: '<div class="tooltip"><div class="tooltip-arrow"></div><div class="tooltip-inner"></div></div>'
1238 /* ===========================================================
1239 * bootstrap-popover.js v2.1.0
1240 * http://twitter.github.com/bootstrap/javascript.html#popovers
1241 * ===========================================================
1242 * Copyright 2012 Twitter, Inc.
1244 * Licensed under the Apache License, Version 2.0 (the "License");
1245 * you may not use this file except in compliance with the License.
1246 * You may obtain a copy of the License at
1248 * http://www.apache.org/licenses/LICENSE-2.0
1250 * Unless required by applicable law or agreed to in writing, software
1251 * distributed under the License is distributed on an "AS IS" BASIS,
1252 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
1253 * See the License for the specific language governing permissions and
1254 * limitations under the License.
1255 * =========================================================== */
1260 "use strict"; // jshint ;_;
1263 /* POPOVER PUBLIC CLASS DEFINITION
1264 * =============================== */
1266 var Popover = function (element, options) {
1267 this.init('popover', element, options)
1271 /* NOTE: POPOVER EXTENDS BOOTSTRAP-TOOLTIP.js
1272 ========================================== */
1274 Popover.prototype = $.extend({}, $.fn.tooltip.Constructor.prototype, {
1276 constructor: Popover
1278 , setContent: function () {
1279 var $tip = this.tip()
1280 , title = this.getTitle()
1281 , content = this.getContent()
1283 $tip.find('.popover-title')[this.options.html ? 'html' : 'text'](title)
1284 $tip.find('.popover-content > *')[this.options.html ? 'html' : 'text'](content)
1286 $tip.removeClass('fade top bottom left right in')
1289 , hasContent: function () {
1290 return this.getTitle() || this.getContent()
1293 , getContent: function () {
1295 , $e = this.$element
1298 content = $e.attr('data-content')
1299 || (typeof o.content == 'function' ? o.content.call($e[0]) : o.content)
1304 , tip: function () {
1306 this.$tip = $(this.options.template)
1311 , destroy: function () {
1312 this.hide().$element.off('.' + this.type).removeData(this.type)
1318 /* POPOVER PLUGIN DEFINITION
1319 * ======================= */
1321 $.fn.popover = function (option) {
1322 return this.each(function () {
1324 , data = $this.data('popover')
1325 , options = typeof option == 'object' && option
1326 if (!data) $this.data('popover', (data = new Popover(this, options)))
1327 if (typeof option == 'string') data[option]()
1331 $.fn.popover.Constructor = Popover
1333 $.fn.popover.defaults = $.extend({} , $.fn.tooltip.defaults, {
1337 , 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>'
1340 }(window.jQuery);/* =============================================================
1341 * bootstrap-scrollspy.js v2.1.0
1342 * http://twitter.github.com/bootstrap/javascript.html#scrollspy
1343 * =============================================================
1344 * Copyright 2012 Twitter, Inc.
1346 * Licensed under the Apache License, Version 2.0 (the "License");
1347 * you may not use this file except in compliance with the License.
1348 * You may obtain a copy of the License at
1350 * http://www.apache.org/licenses/LICENSE-2.0
1352 * Unless required by applicable law or agreed to in writing, software
1353 * distributed under the License is distributed on an "AS IS" BASIS,
1354 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
1355 * See the License for the specific language governing permissions and
1356 * limitations under the License.
1357 * ============================================================== */
1362 "use strict"; // jshint ;_;
1365 /* SCROLLSPY CLASS DEFINITION
1366 * ========================== */
1368 function ScrollSpy(element, options) {
1369 var process = $.proxy(this.process, this)
1370 , $element = $(element).is('body') ? $(window) : $(element)
1372 this.options = $.extend({}, $.fn.scrollspy.defaults, options)
1373 this.$scrollElement = $element.on('scroll.scroll-spy.data-api', process)
1374 this.selector = (this.options.target
1375 || ((href = $(element).attr('href')) && href.replace(/.*(?=#[^\s]+$)/, '')) //strip for ie7
1376 || '') + ' .nav li > a'
1377 this.$body = $('body')
1382 ScrollSpy.prototype = {
1384 constructor: ScrollSpy
1386 , refresh: function () {
1390 this.offsets = $([])
1391 this.targets = $([])
1393 $targets = this.$body
1394 .find(this.selector)
1397 , href = $el.data('target') || $el.attr('href')
1398 , $href = /^#\w/.test(href) && $(href)
1401 && [[ $href.position().top, href ]] ) || null
1403 .sort(function (a, b) { return a[0] - b[0] })
1405 self.offsets.push(this[0])
1406 self.targets.push(this[1])
1410 , process: function () {
1411 var scrollTop = this.$scrollElement.scrollTop() + this.options.offset
1412 , scrollHeight = this.$scrollElement[0].scrollHeight || this.$body[0].scrollHeight
1413 , maxScroll = scrollHeight - this.$scrollElement.height()
1414 , offsets = this.offsets
1415 , targets = this.targets
1416 , activeTarget = this.activeTarget
1419 if (scrollTop >= maxScroll) {
1420 return activeTarget != (i = targets.last()[0])
1421 && this.activate ( i )
1424 for (i = offsets.length; i--;) {
1425 activeTarget != targets[i]
1426 && scrollTop >= offsets[i]
1427 && (!offsets[i + 1] || scrollTop <= offsets[i + 1])
1428 && this.activate( targets[i] )
1432 , activate: function (target) {
1436 this.activeTarget = target
1440 .removeClass('active')
1442 selector = this.selector
1443 + '[data-target="' + target + '"],'
1444 + this.selector + '[href="' + target + '"]'
1446 active = $(selector)
1450 if (active.parent('.dropdown-menu').length) {
1451 active = active.closest('li.dropdown').addClass('active')
1454 active.trigger('activate')
1460 /* SCROLLSPY PLUGIN DEFINITION
1461 * =========================== */
1463 $.fn.scrollspy = function (option) {
1464 return this.each(function () {
1466 , data = $this.data('scrollspy')
1467 , options = typeof option == 'object' && option
1468 if (!data) $this.data('scrollspy', (data = new ScrollSpy(this, options)))
1469 if (typeof option == 'string') data[option]()
1473 $.fn.scrollspy.Constructor = ScrollSpy
1475 $.fn.scrollspy.defaults = {
1480 /* SCROLLSPY DATA-API
1481 * ================== */
1483 $(window).on('load', function () {
1484 $('[data-spy="scroll"]').each(function () {
1486 $spy.scrollspy($spy.data())
1490 }(window.jQuery);/* ========================================================
1491 * bootstrap-tab.js v2.1.0
1492 * http://twitter.github.com/bootstrap/javascript.html#tabs
1493 * ========================================================
1494 * Copyright 2012 Twitter, Inc.
1496 * Licensed under the Apache License, Version 2.0 (the "License");
1497 * you may not use this file except in compliance with the License.
1498 * You may obtain a copy of the License at
1500 * http://www.apache.org/licenses/LICENSE-2.0
1502 * Unless required by applicable law or agreed to in writing, software
1503 * distributed under the License is distributed on an "AS IS" BASIS,
1504 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
1505 * See the License for the specific language governing permissions and
1506 * limitations under the License.
1507 * ======================================================== */
1512 "use strict"; // jshint ;_;
1515 /* TAB CLASS DEFINITION
1516 * ==================== */
1518 var Tab = function (element) {
1519 this.element = $(element)
1526 , show: function () {
1527 var $this = this.element
1528 , $ul = $this.closest('ul:not(.dropdown-menu)')
1529 , selector = $this.attr('data-target')
1535 selector = $this.attr('href')
1536 selector = selector && selector.replace(/.*(?=#[^\s]*$)/, '') //strip for ie7
1539 if ( $this.parent('li').hasClass('active') ) return
1541 previous = $ul.find('.active a').last()[0]
1543 e = $.Event('show', {
1544 relatedTarget: previous
1549 if (e.isDefaultPrevented()) return
1551 $target = $(selector)
1553 this.activate($this.parent('li'), $ul)
1554 this.activate($target, $target.parent(), function () {
1557 , relatedTarget: previous
1562 , activate: function ( element, container, callback) {
1563 var $active = container.find('> .active')
1564 , transition = callback
1565 && $.support.transition
1566 && $active.hasClass('fade')
1570 .removeClass('active')
1571 .find('> .dropdown-menu > .active')
1572 .removeClass('active')
1574 element.addClass('active')
1577 element[0].offsetWidth // reflow for transition
1578 element.addClass('in')
1580 element.removeClass('fade')
1583 if ( element.parent('.dropdown-menu') ) {
1584 element.closest('li.dropdown').addClass('active')
1587 callback && callback()
1591 $active.one($.support.transition.end, next) :
1594 $active.removeClass('in')
1599 /* TAB PLUGIN DEFINITION
1600 * ===================== */
1602 $.fn.tab = function ( option ) {
1603 return this.each(function () {
1605 , data = $this.data('tab')
1606 if (!data) $this.data('tab', (data = new Tab(this)))
1607 if (typeof option == 'string') data[option]()
1611 $.fn.tab.Constructor = Tab
1618 $('body').on('click.tab.data-api', '[data-toggle="tab"], [data-toggle="pill"]', function (e) {
1624 }(window.jQuery);/* =============================================================
1625 * bootstrap-typeahead.js v2.1.0
1626 * http://twitter.github.com/bootstrap/javascript.html#typeahead
1627 * =============================================================
1628 * Copyright 2012 Twitter, Inc.
1630 * Licensed under the Apache License, Version 2.0 (the "License");
1631 * you may not use this file except in compliance with the License.
1632 * You may obtain a copy of the License at
1634 * http://www.apache.org/licenses/LICENSE-2.0
1636 * Unless required by applicable law or agreed to in writing, software
1637 * distributed under the License is distributed on an "AS IS" BASIS,
1638 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
1639 * See the License for the specific language governing permissions and
1640 * limitations under the License.
1641 * ============================================================ */
1646 "use strict"; // jshint ;_;
1649 /* TYPEAHEAD PUBLIC CLASS DEFINITION
1650 * ================================= */
1652 var Typeahead = function (element, options) {
1653 this.$element = $(element)
1654 this.options = $.extend({}, $.fn.typeahead.defaults, options)
1655 this.matcher = this.options.matcher || this.matcher
1656 this.sorter = this.options.sorter || this.sorter
1657 this.highlighter = this.options.highlighter || this.highlighter
1658 this.updater = this.options.updater || this.updater
1659 this.$menu = $(this.options.menu).appendTo('body')
1660 this.source = this.options.source
1665 Typeahead.prototype = {
1667 constructor: Typeahead
1669 , select: function () {
1670 var val = this.$menu.find('.active').attr('data-value')
1672 .val(this.updater(val))
1677 , updater: function (item) {
1681 , show: function () {
1682 var pos = $.extend({}, this.$element.offset(), {
1683 height: this.$element[0].offsetHeight
1687 top: pos.top + pos.height
1696 , hide: function () {
1702 , lookup: function (event) {
1705 this.query = this.$element.val()
1707 if (!this.query || this.query.length < this.options.minLength) {
1708 return this.shown ? this.hide() : this
1711 items = $.isFunction(this.source) ? this.source(this.query, $.proxy(this.process, this)) : this.source
1713 return items ? this.process(items) : this
1716 , process: function (items) {
1719 items = $.grep(items, function (item) {
1720 return that.matcher(item)
1723 items = this.sorter(items)
1725 if (!items.length) {
1726 return this.shown ? this.hide() : this
1729 return this.render(items.slice(0, this.options.items)).show()
1732 , matcher: function (item) {
1733 return ~item.toLowerCase().indexOf(this.query.toLowerCase())
1736 , sorter: function (items) {
1738 , caseSensitive = []
1739 , caseInsensitive = []
1742 while (item = items.shift()) {
1743 if (!item.toLowerCase().indexOf(this.query.toLowerCase())) beginswith.push(item)
1744 else if (~item.indexOf(this.query)) caseSensitive.push(item)
1745 else caseInsensitive.push(item)
1748 return beginswith.concat(caseSensitive, caseInsensitive)
1751 , highlighter: function (item) {
1752 var query = this.query.replace(/[\-\[\]{}()*+?.,\\\^$|#\s]/g, '\\$&')
1753 return item.replace(new RegExp('(' + query + ')', 'ig'), function ($1, match) {
1754 return '<strong>' + match + '</strong>'
1758 , render: function (items) {
1761 items = $(items).map(function (i, item) {
1762 i = $(that.options.item).attr('data-value', item)
1763 i.find('a').html(that.highlighter(item))
1767 items.first().addClass('active')
1768 this.$menu.html(items)
1772 , next: function (event) {
1773 var active = this.$menu.find('.active').removeClass('active')
1774 , next = active.next()
1777 next = $(this.$menu.find('li')[0])
1780 next.addClass('active')
1783 , prev: function (event) {
1784 var active = this.$menu.find('.active').removeClass('active')
1785 , prev = active.prev()
1788 prev = this.$menu.find('li').last()
1791 prev.addClass('active')
1794 , listen: function () {
1796 .on('blur', $.proxy(this.blur, this))
1797 .on('keypress', $.proxy(this.keypress, this))
1798 .on('keyup', $.proxy(this.keyup, this))
1800 if ($.browser.webkit || $.browser.msie) {
1801 this.$element.on('keydown', $.proxy(this.keydown, this))
1805 .on('click', $.proxy(this.click, this))
1806 .on('mouseenter', 'li', $.proxy(this.mouseenter, this))
1809 , move: function (e) {
1810 if (!this.shown) return
1819 case 38: // up arrow
1824 case 40: // down arrow
1833 , keydown: function (e) {
1834 this.suppressKeyPressRepeat = !~$.inArray(e.keyCode, [40,38,9,13,27])
1838 , keypress: function (e) {
1839 if (this.suppressKeyPressRepeat) return
1843 , keyup: function (e) {
1845 case 40: // down arrow
1846 case 38: // up arrow
1851 if (!this.shown) return
1856 if (!this.shown) return
1868 , blur: function (e) {
1870 setTimeout(function () { that.hide() }, 150)
1873 , click: function (e) {
1879 , mouseenter: function (e) {
1880 this.$menu.find('.active').removeClass('active')
1881 $(e.currentTarget).addClass('active')
1887 /* TYPEAHEAD PLUGIN DEFINITION
1888 * =========================== */
1890 $.fn.typeahead = function (option) {
1891 return this.each(function () {
1893 , data = $this.data('typeahead')
1894 , options = typeof option == 'object' && option
1895 if (!data) $this.data('typeahead', (data = new Typeahead(this, options)))
1896 if (typeof option == 'string') data[option]()
1900 $.fn.typeahead.defaults = {
1903 , menu: '<ul class="typeahead dropdown-menu"></ul>'
1904 , item: '<li><a href="#"></a></li>'
1908 $.fn.typeahead.Constructor = Typeahead
1911 /* TYPEAHEAD DATA-API
1912 * ================== */
1915 $('body').on('focus.typeahead.data-api', '[data-provide="typeahead"]', function (e) {
1917 if ($this.data('typeahead')) return
1919 $this.typeahead($this.data())
1924 /* ==========================================================
1925 * bootstrap-affix.js v2.1.0
1926 * http://twitter.github.com/bootstrap/javascript.html#affix
1927 * ==========================================================
1928 * Copyright 2012 Twitter, Inc.
1930 * Licensed under the Apache License, Version 2.0 (the "License");
1931 * you may not use this file except in compliance with the License.
1932 * You may obtain a copy of the License at
1934 * http://www.apache.org/licenses/LICENSE-2.0
1936 * Unless required by applicable law or agreed to in writing, software
1937 * distributed under the License is distributed on an "AS IS" BASIS,
1938 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
1939 * See the License for the specific language governing permissions and
1940 * limitations under the License.
1941 * ========================================================== */
1946 "use strict"; // jshint ;_;
1949 /* AFFIX CLASS DEFINITION
1950 * ====================== */
1952 var Affix = function (element, options) {
1953 this.options = $.extend({}, $.fn.affix.defaults, options)
1954 this.$window = $(window).on('scroll.affix.data-api', $.proxy(this.checkPosition, this))
1955 this.$element = $(element)
1956 this.checkPosition()
1959 Affix.prototype.checkPosition = function () {
1960 if (!this.$element.is(':visible')) return
1962 var scrollHeight = $(document).height()
1963 , scrollTop = this.$window.scrollTop()
1964 , position = this.$element.offset()
1965 , offset = this.options.offset
1966 , offsetBottom = offset.bottom
1967 , offsetTop = offset.top
1968 , reset = 'affix affix-top affix-bottom'
1971 if (typeof offset != 'object') offsetBottom = offsetTop = offset
1972 if (typeof offsetTop == 'function') offsetTop = offset.top()
1973 if (typeof offsetBottom == 'function') offsetBottom = offset.bottom()
1975 affix = this.unpin != null && (scrollTop + this.unpin <= position.top) ?
1976 false : offsetBottom != null && (position.top + this.$element.height() >= scrollHeight - offsetBottom) ?
1977 'bottom' : offsetTop != null && scrollTop <= offsetTop ?
1980 if (this.affixed === affix) return
1982 this.affixed = affix
1983 this.unpin = affix == 'bottom' ? position.top - scrollTop : null
1985 this.$element.removeClass(reset).addClass('affix' + (affix ? '-' + affix : ''))
1989 /* AFFIX PLUGIN DEFINITION
1990 * ======================= */
1992 $.fn.affix = function (option) {
1993 return this.each(function () {
1995 , data = $this.data('affix')
1996 , options = typeof option == 'object' && option
1997 if (!data) $this.data('affix', (data = new Affix(this, options)))
1998 if (typeof option == 'string') data[option]()
2002 $.fn.affix.Constructor = Affix
2004 $.fn.affix.defaults = {
2012 $(window).on('load', function () {
2013 $('[data-spy="affix"]').each(function () {
2015 , data = $spy.data()
2017 data.offset = data.offset || {}
2019 data.offsetBottom && (data.offset.bottom = data.offsetBottom)
2020 data.offsetTop && (data.offset.top = data.offsetTop)