1 /* ===================================================
2 * bootstrap-transition.js v2.0.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 * ========================================================== */
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"
52 /* ==========================================================
53 * bootstrap-alert.js v2.0.0
54 * http://twitter.github.com/bootstrap/javascript.html#alerts
55 * ==========================================================
56 * Copyright 2012 Twitter, Inc.
58 * Licensed under the Apache License, Version 2.0 (the "License");
59 * you may not use this file except in compliance with the License.
60 * You may obtain a copy of the License at
62 * http://www.apache.org/licenses/LICENSE-2.0
64 * Unless required by applicable law or agreed to in writing, software
65 * distributed under the License is distributed on an "AS IS" BASIS,
66 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
67 * See the License for the specific language governing permissions and
68 * limitations under the License.
69 * ========================================================== */
76 /* ALERT CLASS DEFINITION
77 * ====================== */
79 var dismiss
= '[data-dismiss="alert"]'
80 , Alert = function ( el
) {
81 $(el
).on('click', dismiss
, this.close
)
88 , close: function ( e
) {
90 , selector
= $this.attr('data-target')
94 selector
= $this.attr('href')
95 selector
= selector
&& selector
.replace(/.*(?=#[^\s]*$)/, '') //strip for ie7
99 $parent
.trigger('close')
101 e
&& e
.preventDefault()
103 $parent
.length
|| ($parent
= $this.hasClass('alert') ? $this : $this.parent())
105 $parent
.removeClass('in')
107 function removeElement() {
109 $parent
.trigger('closed')
112 $.support
.transition
&& $parent
.hasClass('fade') ?
113 $parent
.on($.support
.transition
.end
, removeElement
) :
120 /* ALERT PLUGIN DEFINITION
121 * ======================= */
123 $.fn
.alert = function ( option
) {
124 return this.each(function () {
126 , data
= $this.data('alert')
127 if (!data
) $this.data('alert', (data
= new Alert(this)))
128 if (typeof option
== 'string') data
[option
].call($this)
132 $.fn
.alert
.Constructor
= Alert
139 $('body').on('click.alert.data-api', dismiss
, Alert
.prototype.close
)
143 /* ============================================================
144 * bootstrap-button.js v2.0.0
145 * http://twitter.github.com/bootstrap/javascript.html#buttons
146 * ============================================================
147 * Copyright 2012 Twitter, Inc.
149 * Licensed under the Apache License, Version 2.0 (the "License");
150 * you may not use this file except in compliance with the License.
151 * You may obtain a copy of the License at
153 * http://www.apache.org/licenses/LICENSE-2.0
155 * Unless required by applicable law or agreed to in writing, software
156 * distributed under the License is distributed on an "AS IS" BASIS,
157 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
158 * See the License for the specific language governing permissions and
159 * limitations under the License.
160 * ============================================================ */
166 /* BUTTON PUBLIC CLASS DEFINITION
167 * ============================== */
169 var Button = function ( element
, options
) {
170 this.$element
= $(element
)
171 this.options
= $.extend({}, $.fn
.button
.defaults
, options
)
178 , setState: function ( state
) {
180 , $el
= this.$element
182 , val
= $el
.is('input') ? 'val' : 'html'
184 state
= state
+ 'Text'
185 data
.resetText
|| $el
.data('resetText', $el
[val
]())
187 $el
[val
](data
[state
] || this.options
[state
])
189 // push to event loop to allow forms to submit
190 setTimeout(function () {
191 state
== 'loadingText' ?
192 $el
.addClass(d
).attr(d
, d
) :
193 $el
.removeClass(d
).removeAttr(d
)
197 , toggle: function () {
198 var $parent
= this.$element
.parent('[data-toggle="buttons-radio"]')
202 .removeClass('active')
204 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
235 $('body').on('click.button.data-api', '[data-toggle^=button]', function ( e
) {
236 $(e
.target
).button('toggle')
241 /* ==========================================================
242 * bootstrap-carousel.js v2.0.0
243 * http://twitter.github.com/bootstrap/javascript.html#carousel
244 * ==========================================================
245 * Copyright 2012 Twitter, Inc.
247 * Licensed under the Apache License, Version 2.0 (the "License");
248 * you may not use this file except in compliance with the License.
249 * You may obtain a copy of the License at
251 * http://www.apache.org/licenses/LICENSE-2.0
253 * Unless required by applicable law or agreed to in writing, software
254 * distributed under the License is distributed on an "AS IS" BASIS,
255 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
256 * See the License for the specific language governing permissions and
257 * limitations under the License.
258 * ========================================================== */
265 /* CAROUSEL CLASS DEFINITION
266 * ========================= */
268 var Carousel = function (element
, options
) {
269 this.$element
= $(element
)
270 this.options
= $.extend({}, $.fn
.carousel
.defaults
, options
)
271 this.options
.slide
&& this.slide(this.options
.slide
)
274 Carousel
.prototype = {
277 this.interval
= setInterval($.proxy(this.next
, this), this.options
.interval
)
281 , to: function (pos
) {
282 var $active
= this.$element
.find('.active')
283 , children
= $active
.parent().children()
284 , activePos
= children
.index($active
)
287 if (pos
> (children
.length
- 1) || pos
< 0) return
290 return this.$element
.one('slid', function () {
295 if (activePos
== pos
) {
296 return this.pause().cycle()
299 return this.slide(pos
> activePos
? 'next' : 'prev', $(children
[pos
]))
302 , pause: function () {
303 clearInterval(this.interval
)
307 , next: function () {
308 if (this.sliding
) return
309 return this.slide('next')
312 , prev: function () {
313 if (this.sliding
) return
314 return this.slide('prev')
317 , slide: function (type
, next
) {
318 var $active
= this.$element
.find('.active')
319 , $next
= next
|| $active
[type
]()
320 , isCycling
= this.interval
321 , direction
= type
== 'next' ? 'left' : 'right'
322 , fallback
= type
== 'next' ? 'first' : 'last'
327 isCycling
&& this.pause()
329 $next
= $next
.length
? $next
: this.$element
.find('.item')[fallback
]()
331 if (!$.support
.transition
&& this.$element
.hasClass('slide')) {
332 this.$element
.trigger('slide')
333 $active
.removeClass('active')
334 $next
.addClass('active')
336 this.$element
.trigger('slid')
339 $next
[0].offsetWidth
// force reflow
340 $active
.addClass(direction
)
341 $next
.addClass(direction
)
342 this.$element
.trigger('slide')
343 this.$element
.one($.support
.transition
.end
, function () {
344 $next
.removeClass([type
, direction
].join(' ')).addClass('active')
345 $active
.removeClass(['active', direction
].join(' '))
347 setTimeout(function () { that
.$element
.trigger('slid') }, 0)
351 isCycling
&& this.cycle()
359 /* CAROUSEL PLUGIN DEFINITION
360 * ========================== */
362 $.fn
.carousel = function ( option
) {
363 return this.each(function () {
365 , data
= $this.data('carousel')
366 , options
= typeof option
== 'object' && option
367 if (!data
) $this.data('carousel', (data
= new Carousel(this, options
)))
368 if (typeof option
== 'number') data
.to(option
)
369 else if (typeof option
== 'string' || (option
= options
.slide
)) data
[option
]()
374 $.fn
.carousel
.defaults
= {
378 $.fn
.carousel
.Constructor
= Carousel
382 * ================= */
385 $('body').on('click.carousel.data-api', '[data-slide]', function ( e
) {
386 var $this = $(this), href
387 , $target
= $($this.attr('data-target') || (href
= $this.attr('href')) && href
.replace(/.*(?=#[^\s]+$)/, '')) //strip for ie7
388 , options
= !$target
.data('modal') && $.extend({}, $target
.data(), $this.data())
389 $target
.carousel(options
)
395 /* =============================================================
396 * bootstrap-collapse.js v2.0.0
397 * http://twitter.github.com/bootstrap/javascript.html#collapse
398 * =============================================================
399 * Copyright 2012 Twitter, Inc.
401 * Licensed under the Apache License, Version 2.0 (the "License");
402 * you may not use this file except in compliance with the License.
403 * You may obtain a copy of the License at
405 * http://www.apache.org/licenses/LICENSE-2.0
407 * Unless required by applicable law or agreed to in writing, software
408 * distributed under the License is distributed on an "AS IS" BASIS,
409 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
410 * See the License for the specific language governing permissions and
411 * limitations under the License.
412 * ============================================================ */
418 var Collapse = function ( element
, options
) {
419 this.$element
= $(element
)
420 this.options
= $.extend({}, $.fn
.collapse
.defaults
, options
)
422 if (this.options
["parent"]) {
423 this.$parent
= $(this.options
["parent"])
426 this.options
.toggle
&& this.toggle()
429 Collapse
.prototype = {
431 constructor: Collapse
433 , dimension: function () {
434 var hasWidth
= this.$element
.hasClass('width')
435 return hasWidth
? 'width' : 'height'
438 , show: function () {
439 var dimension
= this.dimension()
440 , scroll
= $.camelCase(['scroll', dimension
].join('-'))
441 , actives
= this.$parent
&& this.$parent
.find('.in')
444 if (actives
&& actives
.length
) {
445 hasData
= actives
.data('collapse')
446 actives
.collapse('hide')
447 hasData
|| actives
.data('collapse', null)
450 this.$element
[dimension
](0)
451 this.transition('addClass', 'show', 'shown')
452 this.$element
[dimension
](this.$element
[0][scroll
])
456 , hide: function () {
457 var dimension
= this.dimension()
458 this.reset(this.$element
[dimension
]())
459 this.transition('removeClass', 'hide', 'hidden')
460 this.$element
[dimension
](0)
463 , reset: function ( size
) {
464 var dimension
= this.dimension()
467 .removeClass('collapse')
468 [dimension
](size
|| 'auto')
471 this.$element
.addClass('collapse')
474 , transition: function ( method
, startEvent
, completeEvent
) {
476 , complete = function () {
477 if (startEvent
== 'show') that
.reset()
478 that
.$element
.trigger(completeEvent
)
485 $.support
.transition
&& this.$element
.hasClass('collapse') ?
486 this.$element
.one($.support
.transition
.end
, complete
) :
490 , toggle: function () {
491 this[this.$element
.hasClass('in') ? 'hide' : 'show']()
496 /* COLLAPSIBLE PLUGIN DEFINITION
497 * ============================== */
499 $.fn
.collapse = function ( option
) {
500 return this.each(function () {
502 , data
= $this.data('collapse')
503 , options
= typeof option
== 'object' && option
504 if (!data
) $this.data('collapse', (data
= new Collapse(this, options
)))
505 if (typeof option
== 'string') data
[option
]()
509 $.fn
.collapse
.defaults
= {
513 $.fn
.collapse
.Constructor
= Collapse
516 /* COLLAPSIBLE DATA-API
517 * ==================== */
520 $('body').on('click.collapse.data-api', '[data-toggle=collapse]', function ( e
) {
521 var $this = $(this), href
522 , target
= $this.attr('data-target')
523 || e
.preventDefault()
524 || (href
= $this.attr('href')) && href
.replace(/.*(?=#[^\s]+$)/, '') //strip for ie7
525 , option
= $(target
).data('collapse') ? 'toggle' : $this.data()
526 $(target
).collapse(option
)
531 /* ============================================================
532 * bootstrap-dropdown.js v2.0.0
533 * http://twitter.github.com/bootstrap/javascript.html#dropdowns
534 * ============================================================
535 * Copyright 2012 Twitter, Inc.
537 * Licensed under the Apache License, Version 2.0 (the "License");
538 * you may not use this file except in compliance with the License.
539 * You may obtain a copy of the License at
541 * http://www.apache.org/licenses/LICENSE-2.0
543 * Unless required by applicable law or agreed to in writing, software
544 * distributed under the License is distributed on an "AS IS" BASIS,
545 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
546 * See the License for the specific language governing permissions and
547 * limitations under the License.
548 * ============================================================ */
555 /* DROPDOWN CLASS DEFINITION
556 * ========================= */
558 var toggle
= '[data-toggle="dropdown"]'
559 , Dropdown = function ( element
) {
560 var $el
= $(element
).on('click.dropdown.data-api', this.toggle
)
561 $('html').on('click.dropdown.data-api', function () {
562 $el
.parent().removeClass('open')
566 Dropdown
.prototype = {
568 constructor: Dropdown
570 , toggle: function ( e
) {
572 , selector
= $this.attr('data-target')
577 selector
= $this.attr('href')
578 selector
= selector
&& selector
.replace(/.*(?=#[^\s]*$)/, '') //strip for ie7
581 $parent
= $(selector
)
582 $parent
.length
|| ($parent
= $this.parent())
584 isActive
= $parent
.hasClass('open')
587 !isActive
&& $parent
.toggleClass('open')
594 function clearMenus() {
595 $(toggle
).parent().removeClass('open')
599 /* DROPDOWN PLUGIN DEFINITION
600 * ========================== */
602 $.fn
.dropdown = function ( option
) {
603 return this.each(function () {
605 , data
= $this.data('dropdown')
606 if (!data
) $this.data('dropdown', (data
= new Dropdown(this)))
607 if (typeof option
== 'string') data
[option
].call($this)
611 $.fn
.dropdown
.Constructor
= Dropdown
614 /* APPLY TO STANDARD DROPDOWN ELEMENTS
615 * =================================== */
618 $('html').on('click.dropdown.data-api', clearMenus
)
619 $('body').on('click.dropdown.data-api', toggle
, Dropdown
.prototype.toggle
)
623 /* =========================================================
624 * bootstrap-modal.js v2.0.0
625 * http://twitter.github.com/bootstrap/javascript.html#modals
626 * =========================================================
627 * Copyright 2012 Twitter, Inc.
629 * Licensed under the Apache License, Version 2.0 (the "License");
630 * you may not use this file except in compliance with the License.
631 * You may obtain a copy of the License at
633 * http://www.apache.org/licenses/LICENSE-2.0
635 * Unless required by applicable law or agreed to in writing, software
636 * distributed under the License is distributed on an "AS IS" BASIS,
637 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
638 * See the License for the specific language governing permissions and
639 * limitations under the License.
640 * ========================================================= */
647 /* MODAL CLASS DEFINITION
648 * ====================== */
650 var Modal = function ( content
, options
) {
651 this.options
= $.extend({}, $.fn
.modal
.defaults
, options
)
652 this.$element
= $(content
)
653 .delegate('[data-dismiss="modal"]', 'click.dismiss.modal', $.proxy(this.hide
, this))
660 , toggle: function () {
661 return this[!this.isShown
? 'show' : 'hide']()
664 , show: function () {
667 if (this.isShown
) return
669 $('body').addClass('modal-open')
672 this.$element
.trigger('show')
675 backdrop
.call(this, function () {
676 var transition
= $.support
.transition
&& that
.$element
.hasClass('fade')
678 !that
.$element
.parent().length
&& that
.$element
.appendTo(document
.body
) //don't move modals dom position
684 that
.$element
[0].offsetWidth
// force reflow
687 that
.$element
.addClass('in')
690 that
.$element
.one($.support
.transition
.end
, function () { that
.$element
.trigger('shown') }) :
691 that
.$element
.trigger('shown')
696 , hide: function ( e
) {
697 e
&& e
.preventDefault()
699 if (!this.isShown
) return
704 $('body').removeClass('modal-open')
712 $.support
.transition
&& this.$element
.hasClass('fade') ?
713 hideWithTransition
.call(this) :
720 /* MODAL PRIVATE METHODS
721 * ===================== */
723 function hideWithTransition() {
725 , timeout
= setTimeout(function () {
726 that
.$element
.off($.support
.transition
.end
)
730 this.$element
.one($.support
.transition
.end
, function () {
731 clearTimeout(timeout
)
736 function hideModal( that
) {
744 function backdrop( callback
) {
746 , animate
= this.$element
.hasClass('fade') ? 'fade' : ''
748 if (this.isShown
&& this.options
.backdrop
) {
749 var doAnimate
= $.support
.transition
&& animate
751 this.$backdrop
= $('<div class="modal-backdrop ' + animate
+ '" />')
752 .appendTo(document
.body
)
754 if (this.options
.backdrop
!= 'static') {
755 this.$backdrop
.click($.proxy(this.hide
, this))
758 if (doAnimate
) this.$backdrop
[0].offsetWidth
// force reflow
760 this.$backdrop
.addClass('in')
763 this.$backdrop
.one($.support
.transition
.end
, callback
) :
766 } else if (!this.isShown
&& this.$backdrop
) {
767 this.$backdrop
.removeClass('in')
769 $.support
.transition
&& this.$element
.hasClass('fade')?
770 this.$backdrop
.one($.support
.transition
.end
, $.proxy(removeBackdrop
, this)) :
771 removeBackdrop
.call(this)
773 } else if (callback
) {
778 function removeBackdrop() {
779 this.$backdrop
.remove()
780 this.$backdrop
= null
785 if (this.isShown
&& this.options
.keyboard
) {
786 $(document
).on('keyup.dismiss.modal', function ( e
) {
787 e
.which
== 27 && that
.hide()
789 } else if (!this.isShown
) {
790 $(document
).off('keyup.dismiss.modal')
795 /* MODAL PLUGIN DEFINITION
796 * ======================= */
798 $.fn
.modal = function ( option
) {
799 return this.each(function () {
801 , data
= $this.data('modal')
802 , options
= typeof option
== 'object' && option
803 if (!data
) $this.data('modal', (data
= new Modal(this, options
)))
804 if (typeof option
== 'string') data
[option
]()
809 $.fn
.modal
.defaults
= {
814 $.fn
.modal
.Constructor
= Modal
821 $('body').on('click.modal.data-api', '[data-toggle="modal"]', function ( e
) {
822 var $this = $(this), href
823 , $target
= $($this.attr('data-target') || (href
= $this.attr('href')) && href
.replace(/.*(?=#[^\s]+$)/, '')) //strip for ie7
824 , option
= $target
.data('modal') ? 'toggle' : $.extend({}, $target
.data(), $this.data())
827 $target
.modal(option
)
832 /* ===========================================================
833 * bootstrap-tooltip.js v2.0.0
834 * http://twitter.github.com/bootstrap/javascript.html#tooltips
835 * Inspired by the original jQuery.tipsy by Jason Frame
836 * ===========================================================
837 * Copyright 2012 Twitter, Inc.
839 * Licensed under the Apache License, Version 2.0 (the "License");
840 * you may not use this file except in compliance with the License.
841 * You may obtain a copy of the License at
843 * http://www.apache.org/licenses/LICENSE-2.0
845 * Unless required by applicable law or agreed to in writing, software
846 * distributed under the License is distributed on an "AS IS" BASIS,
847 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
848 * See the License for the specific language governing permissions and
849 * limitations under the License.
850 * ========================================================== */
856 /* TOOLTIP PUBLIC CLASS DEFINITION
857 * =============================== */
859 var Tooltip = function ( element
, options
) {
860 this.init('tooltip', element
, options
)
863 Tooltip
.prototype = {
867 , init: function ( type
, element
, options
) {
872 this.$element
= $(element
)
873 this.options
= this.getOptions(options
)
876 if (this.options
.trigger
!= 'manual') {
877 eventIn
= this.options
.trigger
== 'hover' ? 'mouseenter' : 'focus'
878 eventOut
= this.options
.trigger
== 'hover' ? 'mouseleave' : 'blur'
879 this.$element
.on(eventIn
, this.options
.selector
, $.proxy(this.enter
, this))
880 this.$element
.on(eventOut
, this.options
.selector
, $.proxy(this.leave
, this))
883 this.options
.selector
?
884 (this._options
= $.extend({}, this.options
, { trigger
: 'manual', selector
: '' })) :
888 , getOptions: function ( options
) {
889 options
= $.extend({}, $.fn
[this.type
].defaults
, options
, this.$element
.data())
891 if (options
.delay
&& typeof options
.delay
== 'number') {
894 , hide
: options
.delay
901 , enter: function ( e
) {
902 var self
= $(e
.currentTarget
)[this.type
](this._options
).data(this.type
)
904 if (!self
.options
.delay
|| !self
.options
.delay
.show
) {
907 self
.hoverState
= 'in'
908 setTimeout(function() {
909 if (self
.hoverState
== 'in') {
912 }, self
.options
.delay
.show
)
916 , leave: function ( e
) {
917 var self
= $(e
.currentTarget
)[this.type
](this._options
).data(this.type
)
919 if (!self
.options
.delay
|| !self
.options
.delay
.hide
) {
922 self
.hoverState
= 'out'
923 setTimeout(function() {
924 if (self
.hoverState
== 'out') {
927 }, self
.options
.delay
.hide
)
931 , show: function () {
940 if (this.hasContent() && this.enabled
) {
944 if (this.options
.animation
) {
945 $tip
.addClass('fade')
948 placement
= typeof this.options
.placement
== 'function' ?
949 this.options
.placement
.call(this, $tip
[0], this.$element
[0]) :
950 this.options
.placement
952 inside
= /in/.test(placement
)
956 .css({ top
: 0, left
: 0, display
: 'block' })
957 .appendTo(inside
? this.$element
: document
.body
)
959 pos
= this.getPosition(inside
)
961 actualWidth
= $tip
[0].offsetWidth
962 actualHeight
= $tip
[0].offsetHeight
964 switch (inside
? placement
.split(' ')[1] : placement
) {
966 tp
= {top
: pos
.top
+ pos
.height
, left
: pos
.left
+ pos
.width
/ 2 - actualWidth
/ 2}
969 tp
= {top
: pos
.top
- actualHeight
, left
: pos
.left
+ pos
.width
/ 2 - actualWidth
/ 2}
972 tp
= {top
: pos
.top
+ pos
.height
/ 2 - actualHeight
/ 2, left
: pos
.left
- actualWidth
}
975 tp
= {top
: pos
.top
+ pos
.height
/ 2 - actualHeight
/ 2, left
: pos
.left
+ pos
.width
}
986 , setContent: function () {
987 var $tip
= this.tip()
988 $tip
.find('.tooltip-inner').html(this.getTitle())
989 $tip
.removeClass('fade in top bottom left right')
992 , hide: function () {
996 $tip
.removeClass('in')
998 function removeWithAnimation() {
999 var timeout
= setTimeout(function () {
1000 $tip
.off($.support
.transition
.end
).remove()
1003 $tip
.one($.support
.transition
.end
, function () {
1004 clearTimeout(timeout
)
1009 $.support
.transition
&& this.$tip
.hasClass('fade') ?
1010 removeWithAnimation() :
1014 , fixTitle: function () {
1015 var $e
= this.$element
1016 if ($e
.attr('title') || typeof($e
.attr('data-original-title')) != 'string') {
1017 $e
.attr('data-original-title', $e
.attr('title') || '').removeAttr('title')
1021 , hasContent: function () {
1022 return this.getTitle()
1025 , getPosition: function (inside
) {
1026 return $.extend({}, (inside
? {top
: 0, left
: 0} : this.$element
.offset()), {
1027 width
: this.$element
[0].offsetWidth
1028 , height
: this.$element
[0].offsetHeight
1032 , getTitle: function () {
1034 , $e
= this.$element
1037 title
= $e
.attr('data-original-title')
1038 || (typeof o
.title
== 'function' ? o
.title
.call($e
[0]) : o
.title
)
1040 title
= title
.toString().replace(/(^\s*|\s*$)/, "")
1045 , tip: function () {
1046 return this.$tip
= this.$tip
|| $(this.options
.template
)
1049 , validate: function () {
1050 if (!this.$element
[0].parentNode
) {
1052 this.$element
= null
1057 , enable: function () {
1061 , disable: function () {
1062 this.enabled
= false
1065 , toggleEnabled: function () {
1066 this.enabled
= !this.enabled
1069 , toggle: function () {
1070 this[this.tip().hasClass('in') ? 'hide' : 'show']()
1076 /* TOOLTIP PLUGIN DEFINITION
1077 * ========================= */
1079 $.fn
.tooltip = function ( option
) {
1080 return this.each(function () {
1082 , data
= $this.data('tooltip')
1083 , options
= typeof option
== 'object' && option
1084 if (!data
) $this.data('tooltip', (data
= new Tooltip(this, options
)))
1085 if (typeof option
== 'string') data
[option
]()
1089 $.fn
.tooltip
.Constructor
= Tooltip
1091 $.fn
.tooltip
.defaults
= {
1098 , template
: '<div class="tooltip"><div class="tooltip-arrow"></div><div class="tooltip-inner"></div></div>'
1102 /* ===========================================================
1103 * bootstrap-popover.js v2.0.0
1104 * http://twitter.github.com/bootstrap/javascript.html#popovers
1105 * ===========================================================
1106 * Copyright 2012 Twitter, Inc.
1108 * Licensed under the Apache License, Version 2.0 (the "License");
1109 * you may not use this file except in compliance with the License.
1110 * You may obtain a copy of the License at
1112 * http://www.apache.org/licenses/LICENSE-2.0
1114 * Unless required by applicable law or agreed to in writing, software
1115 * distributed under the License is distributed on an "AS IS" BASIS,
1116 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
1117 * See the License for the specific language governing permissions and
1118 * limitations under the License.
1119 * =========================================================== */
1126 var Popover = function ( element
, options
) {
1127 this.init('popover', element
, options
)
1130 /* NOTE: POPOVER EXTENDS BOOTSTRAP-TOOLTIP.js
1131 ========================================== */
1133 Popover
.prototype = $.extend({}, $.fn
.tooltip
.Constructor
.prototype, {
1135 constructor: Popover
1137 , setContent: function () {
1138 var $tip
= this.tip()
1139 , title
= this.getTitle()
1140 , content
= this.getContent()
1142 $tip
.find('.popover-title')[ $.type(title
) == 'object' ? 'append' : 'html' ](title
)
1143 $tip
.find('.popover-content > *')[ $.type(content
) == 'object' ? 'append' : 'html' ](content
)
1145 $tip
.removeClass('fade top bottom left right in')
1148 , hasContent: function () {
1149 return this.getTitle() || this.getContent()
1152 , getContent: function () {
1154 , $e
= this.$element
1157 content
= $e
.attr('data-content')
1158 || (typeof o
.content
== 'function' ? o
.content
.call($e
[0]) : o
.content
)
1160 content
= content
.toString().replace(/(^\s*|\s*$)/, "")
1167 this.$tip
= $(this.options
.template
)
1175 /* POPOVER PLUGIN DEFINITION
1176 * ======================= */
1178 $.fn
.popover = function ( option
) {
1179 return this.each(function () {
1181 , data
= $this.data('popover')
1182 , options
= typeof option
== 'object' && option
1183 if (!data
) $this.data('popover', (data
= new Popover(this, options
)))
1184 if (typeof option
== 'string') data
[option
]()
1188 $.fn
.popover
.Constructor
= Popover
1190 $.fn
.popover
.defaults
= $.extend({} , $.fn
.tooltip
.defaults
, {
1193 , 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>'
1197 /* =============================================================
1198 * bootstrap-scrollspy.js v2.0.0
1199 * http://twitter.github.com/bootstrap/javascript.html#scrollspy
1200 * =============================================================
1201 * Copyright 2012 Twitter, Inc.
1203 * Licensed under the Apache License, Version 2.0 (the "License");
1204 * you may not use this file except in compliance with the License.
1205 * You may obtain a copy of the License at
1207 * http://www.apache.org/licenses/LICENSE-2.0
1209 * Unless required by applicable law or agreed to in writing, software
1210 * distributed under the License is distributed on an "AS IS" BASIS,
1211 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
1212 * See the License for the specific language governing permissions and
1213 * limitations under the License.
1214 * ============================================================== */
1220 /* SCROLLSPY CLASS DEFINITION
1221 * ========================== */
1223 function ScrollSpy( element
, options
) {
1224 var process
= $.proxy(this.process
, this)
1225 , $element
= $(element
).is('body') ? $(window
) : $(element
)
1227 this.options
= $.extend({}, $.fn
.scrollspy
.defaults
, options
)
1228 this.$scrollElement
= $element
.on('scroll.scroll.data-api', process
)
1229 this.selector
= (this.options
.target
1230 || ((href
= $(element
).attr('href')) && href
.replace(/.*(?=#[^\s]+$)/, '')) //strip for ie7
1231 || '') + ' .nav li > a'
1232 this.$body
= $('body').on('click.scroll.data-api', this.selector
, process
)
1237 ScrollSpy
.prototype = {
1239 constructor: ScrollSpy
1241 , refresh: function () {
1242 this.targets
= this.$body
1243 .find(this.selector
)
1245 var href
= $(this).attr('href')
1246 return /^#\w/.test(href
) && $(href
).length
? href
: null
1249 this.offsets
= $.map(this.targets
, function (id
) {
1250 return $(id
).position().top
1254 , process: function () {
1255 var scrollTop
= this.$scrollElement
.scrollTop() + this.options
.offset
1256 , offsets
= this.offsets
1257 , targets
= this.targets
1258 , activeTarget
= this.activeTarget
1261 for (i
= offsets
.length
; i
--;) {
1262 activeTarget
!= targets
[i
]
1263 && scrollTop
>= offsets
[i
]
1264 && (!offsets
[i
+ 1] || scrollTop
<= offsets
[i
+ 1])
1265 && this.activate( targets
[i
] )
1269 , activate: function (target
) {
1272 this.activeTarget
= target
1275 .find(this.selector
).parent('.active')
1276 .removeClass('active')
1279 .find(this.selector
+ '[href="' + target
+ '"]')
1283 if ( active
.parent('.dropdown-menu') ) {
1284 active
.closest('li.dropdown').addClass('active')
1291 /* SCROLLSPY PLUGIN DEFINITION
1292 * =========================== */
1294 $.fn
.scrollspy = function ( option
) {
1295 return this.each(function () {
1297 , data
= $this.data('scrollspy')
1298 , options
= typeof option
== 'object' && option
1299 if (!data
) $this.data('scrollspy', (data
= new ScrollSpy(this, options
)))
1300 if (typeof option
== 'string') data
[option
]()
1304 $.fn
.scrollspy
.Constructor
= ScrollSpy
1306 $.fn
.scrollspy
.defaults
= {
1311 /* SCROLLSPY DATA-API
1312 * ================== */
1315 $('[data-spy="scroll"]').each(function () {
1317 $spy
.scrollspy($spy
.data())
1322 /* ========================================================
1323 * bootstrap-tab.js v2.0.0
1324 * http://twitter.github.com/bootstrap/javascript.html#tabs
1325 * ========================================================
1326 * Copyright 2012 Twitter, Inc.
1328 * Licensed under the Apache License, Version 2.0 (the "License");
1329 * you may not use this file except in compliance with the License.
1330 * You may obtain a copy of the License at
1332 * http://www.apache.org/licenses/LICENSE-2.0
1334 * Unless required by applicable law or agreed to in writing, software
1335 * distributed under the License is distributed on an "AS IS" BASIS,
1336 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
1337 * See the License for the specific language governing permissions and
1338 * limitations under the License.
1339 * ======================================================== */
1346 /* TAB CLASS DEFINITION
1347 * ==================== */
1349 var Tab = function ( element
) {
1350 this.element
= $(element
)
1357 , show: function () {
1358 var $this = this.element
1359 , $ul
= $this.closest('ul:not(.dropdown-menu)')
1360 , selector
= $this.attr('data-target')
1365 selector
= $this.attr('href')
1366 selector
= selector
&& selector
.replace(/.*(?=#[^\s]*$)/, '') //strip for ie7
1369 if ( $this.parent('li').hasClass('active') ) return
1371 previous
= $ul
.find('.active a').last()[0]
1375 , relatedTarget
: previous
1378 $target
= $(selector
)
1380 this.activate($this.parent('li'), $ul
)
1381 this.activate($target
, $target
.parent(), function () {
1384 , relatedTarget
: previous
1389 , activate: function ( element
, container
, callback
) {
1390 var $active
= container
.find('> .active')
1391 , transition
= callback
1392 && $.support
.transition
1393 && $active
.hasClass('fade')
1397 .removeClass('active')
1398 .find('> .dropdown-menu > .active')
1399 .removeClass('active')
1401 element
.addClass('active')
1404 element
[0].offsetWidth
// reflow for transition
1405 element
.addClass('in')
1407 element
.removeClass('fade')
1410 if ( element
.parent('.dropdown-menu') ) {
1411 element
.closest('li.dropdown').addClass('active')
1414 callback
&& callback()
1418 $active
.one($.support
.transition
.end
, next
) :
1421 $active
.removeClass('in')
1426 /* TAB PLUGIN DEFINITION
1427 * ===================== */
1429 $.fn
.tab = function ( option
) {
1430 return this.each(function () {
1432 , data
= $this.data('tab')
1433 if (!data
) $this.data('tab', (data
= new Tab(this)))
1434 if (typeof option
== 'string') data
[option
]()
1438 $.fn
.tab
.Constructor
= Tab
1445 $('body').on('click.tab.data-api', '[data-toggle="tab"], [data-toggle="pill"]', function (e
) {
1452 /* =============================================================
1453 * bootstrap-typeahead.js v2.0.0
1454 * http://twitter.github.com/bootstrap/javascript.html#typeahead
1455 * =============================================================
1456 * Copyright 2012 Twitter, Inc.
1458 * Licensed under the Apache License, Version 2.0 (the "License");
1459 * you may not use this file except in compliance with the License.
1460 * You may obtain a copy of the License at
1462 * http://www.apache.org/licenses/LICENSE-2.0
1464 * Unless required by applicable law or agreed to in writing, software
1465 * distributed under the License is distributed on an "AS IS" BASIS,
1466 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
1467 * See the License for the specific language governing permissions and
1468 * limitations under the License.
1469 * ============================================================ */
1475 var Typeahead = function ( element
, options
) {
1476 this.$element
= $(element
)
1477 this.options
= $.extend({}, $.fn
.typeahead
.defaults
, options
)
1478 this.matcher
= this.options
.matcher
|| this.matcher
1479 this.sorter
= this.options
.sorter
|| this.sorter
1480 this.highlighter
= this.options
.highlighter
|| this.highlighter
1481 this.$menu
= $(this.options
.menu
).appendTo('body')
1482 this.source
= this.options
.source
1487 Typeahead
.prototype = {
1489 constructor: Typeahead
1491 , select: function () {
1492 var val
= this.$menu
.find('.active').attr('data-value')
1493 this.$element
.val(val
)
1497 , show: function () {
1498 var pos
= $.extend({}, this.$element
.offset(), {
1499 height
: this.$element
[0].offsetHeight
1503 top
: pos
.top
+ pos
.height
1512 , hide: function () {
1518 , lookup: function (event
) {
1523 this.query
= this.$element
.val()
1526 return this.shown
? this.hide() : this
1529 items
= $.grep(this.source
, function (item
) {
1530 if (that
.matcher(item
)) return item
1533 items
= this.sorter(items
)
1535 if (!items
.length
) {
1536 return this.shown
? this.hide() : this
1539 return this.render(items
.slice(0, this.options
.items
)).show()
1542 , matcher: function (item
) {
1543 return ~item
.toLowerCase().indexOf(this.query
.toLowerCase())
1546 , sorter: function (items
) {
1548 , caseSensitive
= []
1549 , caseInsensitive
= []
1552 while (item
= items
.shift()) {
1553 if (!item
.toLowerCase().indexOf(this.query
.toLowerCase())) beginswith
.push(item
)
1554 else if (~item
.indexOf(this.query
)) caseSensitive
.push(item
)
1555 else caseInsensitive
.push(item
)
1558 return beginswith
.concat(caseSensitive
, caseInsensitive
)
1561 , highlighter: function (item
) {
1562 return item
.replace(new RegExp('(' + this.query
+ ')', 'ig'), function ($1, match
) {
1563 return '<strong>' + match
+ '</strong>'
1567 , render: function (items
) {
1570 items
= $(items
).map(function (i
, item
) {
1571 i
= $(that
.options
.item
).attr('data-value', item
)
1572 i
.find('a').html(that
.highlighter(item
))
1576 items
.first().addClass('active')
1577 this.$menu
.html(items
)
1581 , next: function (event
) {
1582 var active
= this.$menu
.find('.active').removeClass('active')
1583 , next
= active
.next()
1586 next
= $(this.$menu
.find('li')[0])
1589 next
.addClass('active')
1592 , prev: function (event
) {
1593 var active
= this.$menu
.find('.active').removeClass('active')
1594 , prev
= active
.prev()
1597 prev
= this.$menu
.find('li').last()
1600 prev
.addClass('active')
1603 , listen: function () {
1605 .on('blur', $.proxy(this.blur
, this))
1606 .on('keypress', $.proxy(this.keypress
, this))
1607 .on('keyup', $.proxy(this.keyup
, this))
1609 if ($.browser
.webkit
|| $.browser
.msie
) {
1610 this.$element
.on('keydown', $.proxy(this.keypress
, this))
1614 .on('click', $.proxy(this.click
, this))
1615 .on('mouseenter', 'li', $.proxy(this.mouseenter
, this))
1618 , keyup: function (e
) {
1623 case 40: // down arrow
1624 case 38: // up arrow
1629 if (!this.shown
) return
1643 , keypress: function (e
) {
1645 if (!this.shown
) return
1654 case 38: // up arrow
1659 case 40: // down arrow
1666 , blur: function (e
) {
1670 setTimeout(function () { that
.hide() }, 150)
1673 , click: function (e
) {
1679 , mouseenter: function (e
) {
1680 this.$menu
.find('.active').removeClass('active')
1681 $(e
.currentTarget
).addClass('active')
1687 /* TYPEAHEAD PLUGIN DEFINITION
1688 * =========================== */
1690 $.fn
.typeahead = function ( option
) {
1691 return this.each(function () {
1693 , data
= $this.data('typeahead')
1694 , options
= typeof option
== 'object' && option
1695 if (!data
) $this.data('typeahead', (data
= new Typeahead(this, options
)))
1696 if (typeof option
== 'string') data
[option
]()
1700 $.fn
.typeahead
.defaults
= {
1703 , menu
: '<ul class="typeahead dropdown-menu"></ul>'
1704 , item
: '<li><a href="#"></a></li>'
1707 $.fn
.typeahead
.Constructor
= Typeahead
1710 /* TYPEAHEAD DATA-API
1711 * ================== */
1714 $('body').on('focus.typeahead.data-api', '[data-provide="typeahead"]', function (e
) {
1716 if ($this.data('typeahead')) return
1718 $this.typeahead($this.data())