1 /* ===================================================
2 * bootstrap-transition.js v2.0.2
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 * ========================================================== */
26 /* CSS TRANSITION SUPPORT (https://gist.github.com/373874)
27 * ======================================================= */
29 $.support.transition = (function () {
30 var thisBody = document.body || document.documentElement
31 , thisStyle = thisBody.style
32 , support = thisStyle.transition !== undefined || thisStyle.WebkitTransition !== undefined || thisStyle.MozTransition !== undefined || thisStyle.MsTransition !== undefined || thisStyle.OTransition !== undefined
36 var transitionEnd = "TransitionEnd"
37 if ( $.browser.webkit ) {
38 transitionEnd = "webkitTransitionEnd"
39 } else if ( $.browser.mozilla ) {
40 transitionEnd = "transitionend"
41 } else if ( $.browser.opera ) {
42 transitionEnd = "oTransitionEnd"
51 }( window.jQuery );/* ==========================================================
52 * bootstrap-alert.js v2.0.2
53 * http://twitter.github.com/bootstrap/javascript.html#alerts
54 * ==========================================================
55 * Copyright 2012 Twitter, Inc.
57 * Licensed under the Apache License, Version 2.0 (the "License");
58 * you may not use this file except in compliance with the License.
59 * You may obtain a copy of the License at
61 * http://www.apache.org/licenses/LICENSE-2.0
63 * Unless required by applicable law or agreed to in writing, software
64 * distributed under the License is distributed on an "AS IS" BASIS,
65 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
66 * See the License for the specific language governing permissions and
67 * limitations under the License.
68 * ========================================================== */
75 /* ALERT CLASS DEFINITION
76 * ====================== */
78 var dismiss = '[data-dismiss="alert"]'
79 , Alert = function ( el ) {
80 $(el).on('click', dismiss, this.close)
87 , close: function ( e ) {
89 , selector = $this.attr('data-target')
93 selector = $this.attr('href')
94 selector = selector && selector.replace(/.*(?=#[^\s]*$)/, '') //strip for ie7
98 $parent.trigger('close')
100 e && e.preventDefault()
102 $parent.length || ($parent = $this.hasClass('alert') ? $this : $this.parent())
108 function removeElement() {
114 $.support.transition && $parent.hasClass('fade') ?
115 $parent.on($.support.transition.end, removeElement) :
122 /* ALERT PLUGIN DEFINITION
123 * ======================= */
125 $.fn.alert = function ( option ) {
126 return this.each(function () {
128 , data = $this.data('alert')
129 if (!data) $this.data('alert', (data = new Alert(this)))
130 if (typeof option == 'string') data[option].call($this)
134 $.fn.alert.Constructor = Alert
141 $('body').on('click.alert.data-api', dismiss, Alert.prototype.close)
144 }( window.jQuery );/* ============================================================
145 * bootstrap-button.js v2.0.2
146 * http://twitter.github.com/bootstrap/javascript.html#buttons
147 * ============================================================
148 * Copyright 2012 Twitter, Inc.
150 * Licensed under the Apache License, Version 2.0 (the "License");
151 * you may not use this file except in compliance with the License.
152 * You may obtain a copy of the License at
154 * http://www.apache.org/licenses/LICENSE-2.0
156 * Unless required by applicable law or agreed to in writing, software
157 * distributed under the License is distributed on an "AS IS" BASIS,
158 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
159 * See the License for the specific language governing permissions and
160 * limitations under the License.
161 * ============================================================ */
167 /* BUTTON PUBLIC CLASS DEFINITION
168 * ============================== */
170 var Button = function ( element, options ) {
171 this.$element = $(element)
172 this.options = $.extend({}, $.fn.button.defaults, options)
179 , setState: function ( state ) {
181 , $el = this.$element
183 , val = $el.is('input') ? 'val' : 'html'
185 state = state + 'Text'
186 data.resetText || $el.data('resetText', $el[val]())
188 $el[val](data[state] || this.options[state])
190 // push to event loop to allow forms to submit
191 setTimeout(function () {
192 state == 'loadingText' ?
193 $el.addClass(d).attr(d, d) :
194 $el.removeClass(d).removeAttr(d)
198 , toggle: function () {
199 var $parent = this.$element.parent('[data-toggle="buttons-radio"]')
203 .removeClass('active')
205 this.$element.toggleClass('active')
211 /* BUTTON PLUGIN DEFINITION
212 * ======================== */
214 $.fn.button = function ( option ) {
215 return this.each(function () {
217 , data = $this.data('button')
218 , options = typeof option == 'object' && option
219 if (!data) $this.data('button', (data = new Button(this, options)))
220 if (option == 'toggle') data.toggle()
221 else if (option) data.setState(option)
225 $.fn.button.defaults = {
226 loadingText: 'loading...'
229 $.fn.button.Constructor = Button
236 $('body').on('click.button.data-api', '[data-toggle^=button]', function ( e ) {
237 var $btn = $(e.target)
238 if (!$btn.hasClass('btn')) $btn = $btn.closest('.btn')
239 $btn.button('toggle')
243 }( window.jQuery );/* ==========================================================
244 * bootstrap-carousel.js v2.0.2
245 * http://twitter.github.com/bootstrap/javascript.html#carousel
246 * ==========================================================
247 * Copyright 2012 Twitter, Inc.
249 * Licensed under the Apache License, Version 2.0 (the "License");
250 * you may not use this file except in compliance with the License.
251 * You may obtain a copy of the License at
253 * http://www.apache.org/licenses/LICENSE-2.0
255 * Unless required by applicable law or agreed to in writing, software
256 * distributed under the License is distributed on an "AS IS" BASIS,
257 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
258 * See the License for the specific language governing permissions and
259 * limitations under the License.
260 * ========================================================== */
267 /* CAROUSEL CLASS DEFINITION
268 * ========================= */
270 var Carousel = function (element, options) {
271 this.$element = $(element)
272 this.options = $.extend({}, $.fn.carousel.defaults, options)
273 this.options.slide && this.slide(this.options.slide)
274 this.options.pause == 'hover' && this.$element
275 .on('mouseenter', $.proxy(this.pause, this))
276 .on('mouseleave', $.proxy(this.cycle, this))
279 Carousel.prototype = {
282 this.interval = setInterval($.proxy(this.next, this), this.options.interval)
286 , to: function (pos) {
287 var $active = this.$element.find('.active')
288 , children = $active.parent().children()
289 , activePos = children.index($active)
292 if (pos > (children.length - 1) || pos < 0) return
295 return this.$element.one('slid', function () {
300 if (activePos == pos) {
301 return this.pause().cycle()
304 return this.slide(pos > activePos ? 'next' : 'prev', $(children[pos]))
307 , pause: function () {
308 clearInterval(this.interval)
313 , next: function () {
314 if (this.sliding) return
315 return this.slide('next')
318 , prev: function () {
319 if (this.sliding) return
320 return this.slide('prev')
323 , slide: function (type, next) {
324 var $active = this.$element.find('.active')
325 , $next = next || $active[type]()
326 , isCycling = this.interval
327 , direction = type == 'next' ? 'left' : 'right'
328 , fallback = type == 'next' ? 'first' : 'last'
333 isCycling && this.pause()
335 $next = $next.length ? $next : this.$element.find('.item')[fallback]()
337 if ($next.hasClass('active')) return
339 if (!$.support.transition && this.$element.hasClass('slide')) {
340 this.$element.trigger('slide')
341 $active.removeClass('active')
342 $next.addClass('active')
344 this.$element.trigger('slid')
347 $next[0].offsetWidth // force reflow
348 $active.addClass(direction)
349 $next.addClass(direction)
350 this.$element.trigger('slide')
351 this.$element.one($.support.transition.end, function () {
352 $next.removeClass([type, direction].join(' ')).addClass('active')
353 $active.removeClass(['active', direction].join(' '))
355 setTimeout(function () { that.$element.trigger('slid') }, 0)
359 isCycling && this.cycle()
367 /* CAROUSEL PLUGIN DEFINITION
368 * ========================== */
370 $.fn.carousel = function ( option ) {
371 return this.each(function () {
373 , data = $this.data('carousel')
374 , options = typeof option == 'object' && option
375 if (!data) $this.data('carousel', (data = new Carousel(this, options)))
376 if (typeof option == 'number') data.to(option)
377 else if (typeof option == 'string' || (option = options.slide)) data[option]()
382 $.fn.carousel.defaults = {
387 $.fn.carousel.Constructor = Carousel
391 * ================= */
394 $('body').on('click.carousel.data-api', '[data-slide]', function ( e ) {
395 var $this = $(this), href
396 , $target = $($this.attr('data-target') || (href = $this.attr('href')) && href.replace(/.*(?=#[^\s]+$)/, '')) //strip for ie7
397 , options = !$target.data('modal') && $.extend({}, $target.data(), $this.data())
398 $target.carousel(options)
403 }( window.jQuery );/* =============================================================
404 * bootstrap-collapse.js v2.0.2
405 * http://twitter.github.com/bootstrap/javascript.html#collapse
406 * =============================================================
407 * Copyright 2012 Twitter, Inc.
409 * Licensed under the Apache License, Version 2.0 (the "License");
410 * you may not use this file except in compliance with the License.
411 * You may obtain a copy of the License at
413 * http://www.apache.org/licenses/LICENSE-2.0
415 * Unless required by applicable law or agreed to in writing, software
416 * distributed under the License is distributed on an "AS IS" BASIS,
417 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
418 * See the License for the specific language governing permissions and
419 * limitations under the License.
420 * ============================================================ */
426 var Collapse = function ( element, options ) {
427 this.$element = $(element)
428 this.options = $.extend({}, $.fn.collapse.defaults, options)
430 if (this.options["parent"]) {
431 this.$parent = $(this.options["parent"])
434 this.options.toggle && this.toggle()
437 Collapse.prototype = {
439 constructor: Collapse
441 , dimension: function () {
442 var hasWidth = this.$element.hasClass('width')
443 return hasWidth ? 'width' : 'height'
446 , show: function () {
447 var dimension = this.dimension()
448 , scroll = $.camelCase(['scroll', dimension].join('-'))
449 , actives = this.$parent && this.$parent.find('.in')
452 if (actives && actives.length) {
453 hasData = actives.data('collapse')
454 actives.collapse('hide')
455 hasData || actives.data('collapse', null)
458 this.$element[dimension](0)
459 this.transition('addClass', 'show', 'shown')
460 this.$element[dimension](this.$element[0][scroll])
464 , hide: function () {
465 var dimension = this.dimension()
466 this.reset(this.$element[dimension]())
467 this.transition('removeClass', 'hide', 'hidden')
468 this.$element[dimension](0)
471 , reset: function ( size ) {
472 var dimension = this.dimension()
475 .removeClass('collapse')
476 [dimension](size || 'auto')
479 this.$element[size ? 'addClass' : 'removeClass']('collapse')
484 , transition: function ( method, startEvent, completeEvent ) {
486 , complete = function () {
487 if (startEvent == 'show') that.reset()
488 that.$element.trigger(completeEvent)
495 $.support.transition && this.$element.hasClass('collapse') ?
496 this.$element.one($.support.transition.end, complete) :
500 , toggle: function () {
501 this[this.$element.hasClass('in') ? 'hide' : 'show']()
506 /* COLLAPSIBLE PLUGIN DEFINITION
507 * ============================== */
509 $.fn.collapse = function ( option ) {
510 return this.each(function () {
512 , data = $this.data('collapse')
513 , options = typeof option == 'object' && option
514 if (!data) $this.data('collapse', (data = new Collapse(this, options)))
515 if (typeof option == 'string') data[option]()
519 $.fn.collapse.defaults = {
523 $.fn.collapse.Constructor = Collapse
526 /* COLLAPSIBLE DATA-API
527 * ==================== */
530 $('body').on('click.collapse.data-api', '[data-toggle=collapse]', function ( e ) {
531 var $this = $(this), href
532 , target = $this.attr('data-target')
533 || e.preventDefault()
534 || (href = $this.attr('href')) && href.replace(/.*(?=#[^\s]+$)/, '') //strip for ie7
535 , option = $(target).data('collapse') ? 'toggle' : $this.data()
536 $(target).collapse(option)
540 }( window.jQuery );/* ============================================================
541 * bootstrap-dropdown.js v2.0.2
542 * http://twitter.github.com/bootstrap/javascript.html#dropdowns
543 * ============================================================
544 * Copyright 2012 Twitter, Inc.
546 * Licensed under the Apache License, Version 2.0 (the "License");
547 * you may not use this file except in compliance with the License.
548 * You may obtain a copy of the License at
550 * http://www.apache.org/licenses/LICENSE-2.0
552 * Unless required by applicable law or agreed to in writing, software
553 * distributed under the License is distributed on an "AS IS" BASIS,
554 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
555 * See the License for the specific language governing permissions and
556 * limitations under the License.
557 * ============================================================ */
564 /* DROPDOWN CLASS DEFINITION
565 * ========================= */
567 var toggle = '[data-toggle="dropdown"]'
568 , Dropdown = function ( element ) {
569 var $el = $(element).on('click.dropdown.data-api', this.toggle)
570 $('html').on('click.dropdown.data-api', function () {
571 $el.parent().removeClass('open')
575 Dropdown.prototype = {
577 constructor: Dropdown
579 , toggle: function ( e ) {
581 , selector = $this.attr('data-target')
586 selector = $this.attr('href')
587 selector = selector && selector.replace(/.*(?=#[^\s]*$)/, '') //strip for ie7
590 $parent = $(selector)
591 $parent.length || ($parent = $this.parent())
593 isActive = $parent.hasClass('open')
596 !isActive && $parent.toggleClass('open')
603 function clearMenus() {
604 $(toggle).parent().removeClass('open')
608 /* DROPDOWN PLUGIN DEFINITION
609 * ========================== */
611 $.fn.dropdown = function ( option ) {
612 return this.each(function () {
614 , data = $this.data('dropdown')
615 if (!data) $this.data('dropdown', (data = new Dropdown(this)))
616 if (typeof option == 'string') data[option].call($this)
620 $.fn.dropdown.Constructor = Dropdown
623 /* APPLY TO STANDARD DROPDOWN ELEMENTS
624 * =================================== */
627 $('html').on('click.dropdown.data-api', clearMenus)
628 $('body').on('click.dropdown.data-api', toggle, Dropdown.prototype.toggle)
631 }( window.jQuery );/* =========================================================
632 * bootstrap-modal.js v2.0.2
633 * http://twitter.github.com/bootstrap/javascript.html#modals
634 * =========================================================
635 * Copyright 2012 Twitter, Inc.
637 * Licensed under the Apache License, Version 2.0 (the "License");
638 * you may not use this file except in compliance with the License.
639 * You may obtain a copy of the License at
641 * http://www.apache.org/licenses/LICENSE-2.0
643 * Unless required by applicable law or agreed to in writing, software
644 * distributed under the License is distributed on an "AS IS" BASIS,
645 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
646 * See the License for the specific language governing permissions and
647 * limitations under the License.
648 * ========================================================= */
655 /* MODAL CLASS DEFINITION
656 * ====================== */
658 var Modal = function ( content, options ) {
659 this.options = options
660 this.$element = $(content)
661 .delegate('[data-dismiss="modal"]', 'click.dismiss.modal', $.proxy(this.hide, this))
668 , toggle: function () {
669 return this[!this.isShown ? 'show' : 'hide']()
672 , show: function () {
675 if (this.isShown) return
677 $('body').addClass('modal-open')
680 this.$element.trigger('show')
683 backdrop.call(this, function () {
684 var transition = $.support.transition && that.$element.hasClass('fade')
686 !that.$element.parent().length && that.$element.appendTo(document.body) //don't move modals dom position
692 that.$element[0].offsetWidth // force reflow
695 that.$element.addClass('in')
698 that.$element.one($.support.transition.end, function () { that.$element.trigger('shown') }) :
699 that.$element.trigger('shown')
704 , hide: function ( e ) {
705 e && e.preventDefault()
707 if (!this.isShown) return
712 $('body').removeClass('modal-open')
720 $.support.transition && this.$element.hasClass('fade') ?
721 hideWithTransition.call(this) :
728 /* MODAL PRIVATE METHODS
729 * ===================== */
731 function hideWithTransition() {
733 , timeout = setTimeout(function () {
734 that.$element.off($.support.transition.end)
738 this.$element.one($.support.transition.end, function () {
739 clearTimeout(timeout)
744 function hideModal( that ) {
752 function backdrop( callback ) {
754 , animate = this.$element.hasClass('fade') ? 'fade' : ''
756 if (this.isShown && this.options.backdrop) {
757 var doAnimate = $.support.transition && animate
759 this.$backdrop = $('<div class="modal-backdrop ' + animate + '" />')
760 .appendTo(document.body)
762 if (this.options.backdrop != 'static') {
763 this.$backdrop.click($.proxy(this.hide, this))
766 if (doAnimate) this.$backdrop[0].offsetWidth // force reflow
768 this.$backdrop.addClass('in')
771 this.$backdrop.one($.support.transition.end, callback) :
774 } else if (!this.isShown && this.$backdrop) {
775 this.$backdrop.removeClass('in')
777 $.support.transition && this.$element.hasClass('fade')?
778 this.$backdrop.one($.support.transition.end, $.proxy(removeBackdrop, this)) :
779 removeBackdrop.call(this)
781 } else if (callback) {
786 function removeBackdrop() {
787 this.$backdrop.remove()
788 this.$backdrop = null
793 if (this.isShown && this.options.keyboard) {
794 $(document).on('keyup.dismiss.modal', function ( e ) {
795 e.which == 27 && that.hide()
797 } else if (!this.isShown) {
798 $(document).off('keyup.dismiss.modal')
803 /* MODAL PLUGIN DEFINITION
804 * ======================= */
806 $.fn.modal = function ( option ) {
807 return this.each(function () {
809 , data = $this.data('modal')
810 , options = $.extend({}, $.fn.modal.defaults, $this.data(), typeof option == 'object' && option)
811 if (!data) $this.data('modal', (data = new Modal(this, options)))
812 if (typeof option == 'string') data[option]()
813 else if (options.show) data.show()
817 $.fn.modal.defaults = {
823 $.fn.modal.Constructor = Modal
830 $('body').on('click.modal.data-api', '[data-toggle="modal"]', function ( e ) {
831 var $this = $(this), href
832 , $target = $($this.attr('data-target') || (href = $this.attr('href')) && href.replace(/.*(?=#[^\s]+$)/, '')) //strip for ie7
833 , option = $target.data('modal') ? 'toggle' : $.extend({}, $target.data(), $this.data())
836 $target.modal(option)
840 }( window.jQuery );/* ===========================================================
841 * bootstrap-tooltip.js v2.0.2
842 * http://twitter.github.com/bootstrap/javascript.html#tooltips
843 * Inspired by the original jQuery.tipsy by Jason Frame
844 * ===========================================================
845 * Copyright 2012 Twitter, Inc.
847 * Licensed under the Apache License, Version 2.0 (the "License");
848 * you may not use this file except in compliance with the License.
849 * You may obtain a copy of the License at
851 * http://www.apache.org/licenses/LICENSE-2.0
853 * Unless required by applicable law or agreed to in writing, software
854 * distributed under the License is distributed on an "AS IS" BASIS,
855 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
856 * See the License for the specific language governing permissions and
857 * limitations under the License.
858 * ========================================================== */
864 /* TOOLTIP PUBLIC CLASS DEFINITION
865 * =============================== */
867 var Tooltip = function ( element, options ) {
868 this.init('tooltip', element, options)
871 Tooltip.prototype = {
875 , init: function ( type, element, options ) {
880 this.$element = $(element)
881 this.options = this.getOptions(options)
884 if (this.options.trigger != 'manual') {
885 eventIn = this.options.trigger == 'hover' ? 'mouseenter' : 'focus'
886 eventOut = this.options.trigger == 'hover' ? 'mouseleave' : 'blur'
887 this.$element.on(eventIn, this.options.selector, $.proxy(this.enter, this))
888 this.$element.on(eventOut, this.options.selector, $.proxy(this.leave, this))
891 this.options.selector ?
892 (this._options = $.extend({}, this.options, { trigger: 'manual', selector: '' })) :
896 , getOptions: function ( options ) {
897 options = $.extend({}, $.fn[this.type].defaults, options, this.$element.data())
899 if (options.delay && typeof options.delay == 'number') {
902 , hide: options.delay
909 , enter: function ( e ) {
910 var self = $(e.currentTarget)[this.type](this._options).data(this.type)
912 if (!self.options.delay || !self.options.delay.show) {
915 self.hoverState = 'in'
916 setTimeout(function() {
917 if (self.hoverState == 'in') {
920 }, self.options.delay.show)
924 , leave: function ( e ) {
925 var self = $(e.currentTarget)[this.type](this._options).data(this.type)
927 if (!self.options.delay || !self.options.delay.hide) {
930 self.hoverState = 'out'
931 setTimeout(function() {
932 if (self.hoverState == 'out') {
935 }, self.options.delay.hide)
939 , show: function () {
948 if (this.hasContent() && this.enabled) {
952 if (this.options.animation) {
953 $tip.addClass('fade')
956 placement = typeof this.options.placement == 'function' ?
957 this.options.placement.call(this, $tip[0], this.$element[0]) :
958 this.options.placement
960 inside = /in/.test(placement)
964 .css({ top: 0, left: 0, display: 'block' })
965 .appendTo(inside ? this.$element : document.body)
967 pos = this.getPosition(inside)
969 actualWidth = $tip[0].offsetWidth
970 actualHeight = $tip[0].offsetHeight
972 switch (inside ? placement.split(' ')[1] : placement) {
974 tp = {top: pos.top + pos.height, left: pos.left + pos.width / 2 - actualWidth / 2}
977 tp = {top: pos.top - actualHeight, left: pos.left + pos.width / 2 - actualWidth / 2}
980 tp = {top: pos.top + pos.height / 2 - actualHeight / 2, left: pos.left - actualWidth}
983 tp = {top: pos.top + pos.height / 2 - actualHeight / 2, left: pos.left + pos.width}
994 , setContent: function () {
995 var $tip = this.tip()
996 $tip.find('.tooltip-inner').html(this.getTitle())
997 $tip.removeClass('fade in top bottom left right')
1000 , hide: function () {
1004 $tip.removeClass('in')
1006 function removeWithAnimation() {
1007 var timeout = setTimeout(function () {
1008 $tip.off($.support.transition.end).remove()
1011 $tip.one($.support.transition.end, function () {
1012 clearTimeout(timeout)
1017 $.support.transition && this.$tip.hasClass('fade') ?
1018 removeWithAnimation() :
1022 , fixTitle: function () {
1023 var $e = this.$element
1024 if ($e.attr('title') || typeof($e.attr('data-original-title')) != 'string') {
1025 $e.attr('data-original-title', $e.attr('title') || '').removeAttr('title')
1029 , hasContent: function () {
1030 return this.getTitle()
1033 , getPosition: function (inside) {
1034 return $.extend({}, (inside ? {top: 0, left: 0} : this.$element.offset()), {
1035 width: this.$element[0].offsetWidth
1036 , height: this.$element[0].offsetHeight
1040 , getTitle: function () {
1042 , $e = this.$element
1045 title = $e.attr('data-original-title')
1046 || (typeof o.title == 'function' ? o.title.call($e[0]) : o.title)
1048 title = (title || '').toString().replace(/(^\s*|\s*$)/, "")
1053 , tip: function () {
1054 return this.$tip = this.$tip || $(this.options.template)
1057 , validate: function () {
1058 if (!this.$element[0].parentNode) {
1060 this.$element = null
1065 , enable: function () {
1069 , disable: function () {
1070 this.enabled = false
1073 , toggleEnabled: function () {
1074 this.enabled = !this.enabled
1077 , toggle: function () {
1078 this[this.tip().hasClass('in') ? 'hide' : 'show']()
1084 /* TOOLTIP PLUGIN DEFINITION
1085 * ========================= */
1087 $.fn.tooltip = function ( option ) {
1088 return this.each(function () {
1090 , data = $this.data('tooltip')
1091 , options = typeof option == 'object' && option
1092 if (!data) $this.data('tooltip', (data = new Tooltip(this, options)))
1093 if (typeof option == 'string') data[option]()
1097 $.fn.tooltip.Constructor = Tooltip
1099 $.fn.tooltip.defaults = {
1106 , template: '<div class="tooltip"><div class="tooltip-arrow"></div><div class="tooltip-inner"></div></div>'
1109 }( window.jQuery );/* ===========================================================
1110 * bootstrap-popover.js v2.0.2
1111 * http://twitter.github.com/bootstrap/javascript.html#popovers
1112 * ===========================================================
1113 * Copyright 2012 Twitter, Inc.
1115 * Licensed under the Apache License, Version 2.0 (the "License");
1116 * you may not use this file except in compliance with the License.
1117 * You may obtain a copy of the License at
1119 * http://www.apache.org/licenses/LICENSE-2.0
1121 * Unless required by applicable law or agreed to in writing, software
1122 * distributed under the License is distributed on an "AS IS" BASIS,
1123 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
1124 * See the License for the specific language governing permissions and
1125 * limitations under the License.
1126 * =========================================================== */
1133 var Popover = function ( element, options ) {
1134 this.init('popover', element, options)
1137 /* NOTE: POPOVER EXTENDS BOOTSTRAP-TOOLTIP.js
1138 ========================================== */
1140 Popover.prototype = $.extend({}, $.fn.tooltip.Constructor.prototype, {
1142 constructor: Popover
1144 , setContent: function () {
1145 var $tip = this.tip()
1146 , title = this.getTitle()
1147 , content = this.getContent()
1149 $tip.find('.popover-title')[ $.type(title) == 'object' ? 'append' : 'html' ](title)
1150 $tip.find('.popover-content > *')[ $.type(content) == 'object' ? 'append' : 'html' ](content)
1152 $tip.removeClass('fade top bottom left right in')
1155 , hasContent: function () {
1156 return this.getTitle() || this.getContent()
1159 , getContent: function () {
1161 , $e = this.$element
1164 content = $e.attr('data-content')
1165 || (typeof o.content == 'function' ? o.content.call($e[0]) : o.content)
1167 content = content.toString().replace(/(^\s*|\s*$)/, "")
1174 this.$tip = $(this.options.template)
1182 /* POPOVER PLUGIN DEFINITION
1183 * ======================= */
1185 $.fn.popover = function ( option ) {
1186 return this.each(function () {
1188 , data = $this.data('popover')
1189 , options = typeof option == 'object' && option
1190 if (!data) $this.data('popover', (data = new Popover(this, options)))
1191 if (typeof option == 'string') data[option]()
1195 $.fn.popover.Constructor = Popover
1197 $.fn.popover.defaults = $.extend({} , $.fn.tooltip.defaults, {
1200 , 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>'
1203 }( window.jQuery );/* =============================================================
1204 * bootstrap-scrollspy.js v2.0.2
1205 * http://twitter.github.com/bootstrap/javascript.html#scrollspy
1206 * =============================================================
1207 * Copyright 2012 Twitter, Inc.
1209 * Licensed under the Apache License, Version 2.0 (the "License");
1210 * you may not use this file except in compliance with the License.
1211 * You may obtain a copy of the License at
1213 * http://www.apache.org/licenses/LICENSE-2.0
1215 * Unless required by applicable law or agreed to in writing, software
1216 * distributed under the License is distributed on an "AS IS" BASIS,
1217 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
1218 * See the License for the specific language governing permissions and
1219 * limitations under the License.
1220 * ============================================================== */
1226 /* SCROLLSPY CLASS DEFINITION
1227 * ========================== */
1229 function ScrollSpy( element, options) {
1230 var process = $.proxy(this.process, this)
1231 , $element = $(element).is('body') ? $(window) : $(element)
1233 this.options = $.extend({}, $.fn.scrollspy.defaults, options)
1234 this.$scrollElement = $element.on('scroll.scroll.data-api', process)
1235 this.selector = (this.options.target
1236 || ((href = $(element).attr('href')) && href.replace(/.*(?=#[^\s]+$)/, '')) //strip for ie7
1237 || '') + ' .nav li > a'
1238 this.$body = $('body').on('click.scroll.data-api', this.selector, process)
1243 ScrollSpy.prototype = {
1245 constructor: ScrollSpy
1247 , refresh: function () {
1248 this.targets = this.$body
1249 .find(this.selector)
1251 var href = $(this).attr('href')
1252 return /^#\w/.test(href) && $(href).length ? href : null
1255 this.offsets = $.map(this.targets, function (id) {
1256 return $(id).position().top
1260 , process: function () {
1261 var scrollTop = this.$scrollElement.scrollTop() + this.options.offset
1262 , offsets = this.offsets
1263 , targets = this.targets
1264 , activeTarget = this.activeTarget
1267 for (i = offsets.length; i--;) {
1268 activeTarget != targets[i]
1269 && scrollTop >= offsets[i]
1270 && (!offsets[i + 1] || scrollTop <= offsets[i + 1])
1271 && this.activate( targets[i] )
1275 , activate: function (target) {
1278 this.activeTarget = target
1281 .find(this.selector).parent('.active')
1282 .removeClass('active')
1285 .find(this.selector + '[href="' + target + '"]')
1289 if ( active.parent('.dropdown-menu') ) {
1290 active.closest('li.dropdown').addClass('active')
1297 /* SCROLLSPY PLUGIN DEFINITION
1298 * =========================== */
1300 $.fn.scrollspy = function ( option ) {
1301 return this.each(function () {
1303 , data = $this.data('scrollspy')
1304 , options = typeof option == 'object' && option
1305 if (!data) $this.data('scrollspy', (data = new ScrollSpy(this, options)))
1306 if (typeof option == 'string') data[option]()
1310 $.fn.scrollspy.Constructor = ScrollSpy
1312 $.fn.scrollspy.defaults = {
1317 /* SCROLLSPY DATA-API
1318 * ================== */
1321 $('[data-spy="scroll"]').each(function () {
1323 $spy.scrollspy($spy.data())
1327 }( window.jQuery );/* ========================================================
1328 * bootstrap-tab.js v2.0.2
1329 * http://twitter.github.com/bootstrap/javascript.html#tabs
1330 * ========================================================
1331 * Copyright 2012 Twitter, Inc.
1333 * Licensed under the Apache License, Version 2.0 (the "License");
1334 * you may not use this file except in compliance with the License.
1335 * You may obtain a copy of the License at
1337 * http://www.apache.org/licenses/LICENSE-2.0
1339 * Unless required by applicable law or agreed to in writing, software
1340 * distributed under the License is distributed on an "AS IS" BASIS,
1341 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
1342 * See the License for the specific language governing permissions and
1343 * limitations under the License.
1344 * ======================================================== */
1351 /* TAB CLASS DEFINITION
1352 * ==================== */
1354 var Tab = function ( element ) {
1355 this.element = $(element)
1362 , show: function () {
1363 var $this = this.element
1364 , $ul = $this.closest('ul:not(.dropdown-menu)')
1365 , selector = $this.attr('data-target')
1370 selector = $this.attr('href')
1371 selector = selector && selector.replace(/.*(?=#[^\s]*$)/, '') //strip for ie7
1374 if ( $this.parent('li').hasClass('active') ) return
1376 previous = $ul.find('.active a').last()[0]
1380 , relatedTarget: previous
1383 $target = $(selector)
1385 this.activate($this.parent('li'), $ul)
1386 this.activate($target, $target.parent(), function () {
1389 , relatedTarget: previous
1394 , activate: function ( element, container, callback) {
1395 var $active = container.find('> .active')
1396 , transition = callback
1397 && $.support.transition
1398 && $active.hasClass('fade')
1402 .removeClass('active')
1403 .find('> .dropdown-menu > .active')
1404 .removeClass('active')
1406 element.addClass('active')
1409 element[0].offsetWidth // reflow for transition
1410 element.addClass('in')
1412 element.removeClass('fade')
1415 if ( element.parent('.dropdown-menu') ) {
1416 element.closest('li.dropdown').addClass('active')
1419 callback && callback()
1423 $active.one($.support.transition.end, next) :
1426 $active.removeClass('in')
1431 /* TAB PLUGIN DEFINITION
1432 * ===================== */
1434 $.fn.tab = function ( option ) {
1435 return this.each(function () {
1437 , data = $this.data('tab')
1438 if (!data) $this.data('tab', (data = new Tab(this)))
1439 if (typeof option == 'string') data[option]()
1443 $.fn.tab.Constructor = Tab
1450 $('body').on('click.tab.data-api', '[data-toggle="tab"], [data-toggle="pill"]', function (e) {
1456 }( window.jQuery );/* =============================================================
1457 * bootstrap-typeahead.js v2.0.2
1458 * http://twitter.github.com/bootstrap/javascript.html#typeahead
1459 * =============================================================
1460 * Copyright 2012 Twitter, Inc.
1462 * Licensed under the Apache License, Version 2.0 (the "License");
1463 * you may not use this file except in compliance with the License.
1464 * You may obtain a copy of the License at
1466 * http://www.apache.org/licenses/LICENSE-2.0
1468 * Unless required by applicable law or agreed to in writing, software
1469 * distributed under the License is distributed on an "AS IS" BASIS,
1470 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
1471 * See the License for the specific language governing permissions and
1472 * limitations under the License.
1473 * ============================================================ */
1479 var Typeahead = function ( element, options ) {
1480 this.$element = $(element)
1481 this.options = $.extend({}, $.fn.typeahead.defaults, options)
1482 this.matcher = this.options.matcher || this.matcher
1483 this.sorter = this.options.sorter || this.sorter
1484 this.highlighter = this.options.highlighter || this.highlighter
1485 this.$menu = $(this.options.menu).appendTo('body')
1486 this.source = this.options.source
1491 Typeahead.prototype = {
1493 constructor: Typeahead
1495 , select: function () {
1496 var val = this.$menu.find('.active').attr('data-value')
1497 this.$element.val(val)
1498 this.$element.change();
1502 , show: function () {
1503 var pos = $.extend({}, this.$element.offset(), {
1504 height: this.$element[0].offsetHeight
1508 top: pos.top + pos.height
1517 , hide: function () {
1523 , lookup: function (event) {
1528 this.query = this.$element.val()
1531 return this.shown ? this.hide() : this
1534 items = $.grep(this.source, function (item) {
1535 if (that.matcher(item)) return item
1538 items = this.sorter(items)
1540 if (!items.length) {
1541 return this.shown ? this.hide() : this
1544 return this.render(items.slice(0, this.options.items)).show()
1547 , matcher: function (item) {
1548 return ~item.toLowerCase().indexOf(this.query.toLowerCase())
1551 , sorter: function (items) {
1553 , caseSensitive = []
1554 , caseInsensitive = []
1557 while (item = items.shift()) {
1558 if (!item.toLowerCase().indexOf(this.query.toLowerCase())) beginswith.push(item)
1559 else if (~item.indexOf(this.query)) caseSensitive.push(item)
1560 else caseInsensitive.push(item)
1563 return beginswith.concat(caseSensitive, caseInsensitive)
1566 , highlighter: function (item) {
1567 return item.replace(new RegExp('(' + this.query + ')', 'ig'), function ($1, match) {
1568 return '<strong>' + match + '</strong>'
1572 , render: function (items) {
1575 items = $(items).map(function (i, item) {
1576 i = $(that.options.item).attr('data-value', item)
1577 i.find('a').html(that.highlighter(item))
1581 items.first().addClass('active')
1582 this.$menu.html(items)
1586 , next: function (event) {
1587 var active = this.$menu.find('.active').removeClass('active')
1588 , next = active.next()
1591 next = $(this.$menu.find('li')[0])
1594 next.addClass('active')
1597 , prev: function (event) {
1598 var active = this.$menu.find('.active').removeClass('active')
1599 , prev = active.prev()
1602 prev = this.$menu.find('li').last()
1605 prev.addClass('active')
1608 , listen: function () {
1610 .on('blur', $.proxy(this.blur, this))
1611 .on('keypress', $.proxy(this.keypress, this))
1612 .on('keyup', $.proxy(this.keyup, this))
1614 if ($.browser.webkit || $.browser.msie) {
1615 this.$element.on('keydown', $.proxy(this.keypress, this))
1619 .on('click', $.proxy(this.click, this))
1620 .on('mouseenter', 'li', $.proxy(this.mouseenter, this))
1623 , keyup: function (e) {
1625 case 40: // down arrow
1626 case 38: // up arrow
1631 if (!this.shown) return
1636 if (!this.shown) return
1648 , keypress: function (e) {
1649 if (!this.shown) return
1658 case 38: // up arrow
1663 case 40: // down arrow
1672 , blur: function (e) {
1674 setTimeout(function () { that.hide() }, 150)
1677 , click: function (e) {
1683 , mouseenter: function (e) {
1684 this.$menu.find('.active').removeClass('active')
1685 $(e.currentTarget).addClass('active')
1691 /* TYPEAHEAD PLUGIN DEFINITION
1692 * =========================== */
1694 $.fn.typeahead = function ( option ) {
1695 return this.each(function () {
1697 , data = $this.data('typeahead')
1698 , options = typeof option == 'object' && option
1699 if (!data) $this.data('typeahead', (data = new Typeahead(this, options)))
1700 if (typeof option == 'string') data[option]()
1704 $.fn.typeahead.defaults = {
1707 , menu: '<ul class="typeahead dropdown-menu"></ul>'
1708 , item: '<li><a href="#"></a></li>'
1711 $.fn.typeahead.Constructor = Typeahead
1714 /* TYPEAHEAD DATA-API
1715 * ================== */
1718 $('body').on('focus.typeahead.data-api', '[data-provide="typeahead"]', function (e) {
1720 if ($this.data('typeahead')) return
1722 $this.typeahead($this.data())