2 * bootstrap.js v3.0.0 by @fat and @mdo
3 * Copyright 2013 Twitter Inc.
4 * http://www.apache.org/licenses/LICENSE-2.0
6 if (!jQuery
) { throw new Error("Bootstrap requires jQuery") }
8 /* ========================================================================
9 * Bootstrap: transition.js v3.0.0
10 * http://twbs.github.com/bootstrap/javascript.html#transitions
11 * ========================================================================
12 * Copyright 2013 Twitter, Inc.
14 * Licensed under the Apache License, Version 2.0 (the "License");
15 * you may not use this file except in compliance with the License.
16 * You may obtain a copy of the License at
18 * http://www.apache.org/licenses/LICENSE-2.0
20 * Unless required by applicable law or agreed to in writing, software
21 * distributed under the License is distributed on an "AS IS" BASIS,
22 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
23 * See the License for the specific language governing permissions and
24 * limitations under the License.
25 * ======================================================================== */
28 +function ($) { "use strict";
30 // CSS TRANSITION SUPPORT (Shoutout: http://www.modernizr.com/)
31 // ============================================================
33 function transitionEnd() {
34 var el
= document
.createElement('bootstrap')
36 var transEndEventNames
= {
37 'WebkitTransition' : 'webkitTransitionEnd'
38 , 'MozTransition' : 'transitionend'
39 , 'OTransition' : 'oTransitionEnd otransitionend'
40 , 'transition' : 'transitionend'
43 for (var name
in transEndEventNames
) {
44 if (el
.style
[name
] !== undefined) {
45 return { end
: transEndEventNames
[name
] }
50 // http://blog.alexmaccaw.com/css-transitions
51 $.fn
.emulateTransitionEnd = function (duration
) {
52 var called
= false, $el
= this
53 $(this).one($.support
.transition
.end
, function () { called
= true })
54 var callback = function () { if (!called
) $($el
).trigger($.support
.transition
.end
) }
55 setTimeout(callback
, duration
)
60 $.support
.transition
= transitionEnd()
65 /* ========================================================================
66 * Bootstrap: alert.js v3.0.0
67 * http://twbs.github.com/bootstrap/javascript.html#alerts
68 * ========================================================================
69 * Copyright 2013 Twitter, Inc.
71 * Licensed under the Apache License, Version 2.0 (the "License");
72 * you may not use this file except in compliance with the License.
73 * You may obtain a copy of the License at
75 * http://www.apache.org/licenses/LICENSE-2.0
77 * Unless required by applicable law or agreed to in writing, software
78 * distributed under the License is distributed on an "AS IS" BASIS,
79 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
80 * See the License for the specific language governing permissions and
81 * limitations under the License.
82 * ======================================================================== */
85 +function ($) { "use strict";
87 // ALERT CLASS DEFINITION
88 // ======================
90 var dismiss
= '[data-dismiss="alert"]'
91 var Alert = function (el
) {
92 $(el
).on('click', dismiss
, this.close
)
95 Alert
.prototype.close = function (e
) {
97 var selector
= $this.attr('data-target')
100 selector
= $this.attr('href')
101 selector
= selector
&& selector
.replace(/.*(?=#[^\s]*$)/, '') // strip for ie7
104 var $parent
= $(selector
)
106 if (e
) e
.preventDefault()
108 if (!$parent
.length
) {
109 $parent
= $this.hasClass('alert') ? $this : $this.parent()
112 $parent
.trigger(e
= $.Event('close.bs.alert'))
114 if (e
.isDefaultPrevented()) return
116 $parent
.removeClass('in')
118 function removeElement() {
119 $parent
.trigger('closed.bs.alert').remove()
122 $.support
.transition
&& $parent
.hasClass('fade') ?
124 .one($.support
.transition
.end
, removeElement
)
125 .emulateTransitionEnd(150) :
130 // ALERT PLUGIN DEFINITION
131 // =======================
135 $.fn
.alert = function (option
) {
136 return this.each(function () {
138 var data
= $this.data('bs.alert')
140 if (!data
) $this.data('bs.alert', (data
= new Alert(this)))
141 if (typeof option
== 'string') data
[option
].call($this)
145 $.fn
.alert
.Constructor
= Alert
151 $.fn
.alert
.noConflict = function () {
160 $(document
).on('click.bs.alert.data-api', dismiss
, Alert
.prototype.close
)
164 /* ========================================================================
165 * Bootstrap: button.js v3.0.0
166 * http://twbs.github.com/bootstrap/javascript.html#buttons
167 * ========================================================================
168 * Copyright 2013 Twitter, Inc.
170 * Licensed under the Apache License, Version 2.0 (the "License");
171 * you may not use this file except in compliance with the License.
172 * You may obtain a copy of the License at
174 * http://www.apache.org/licenses/LICENSE-2.0
176 * Unless required by applicable law or agreed to in writing, software
177 * distributed under the License is distributed on an "AS IS" BASIS,
178 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
179 * See the License for the specific language governing permissions and
180 * limitations under the License.
181 * ======================================================================== */
184 +function ($) { "use strict";
186 // BUTTON PUBLIC CLASS DEFINITION
187 // ==============================
189 var Button = function (element
, options
) {
190 this.$element
= $(element
)
191 this.options
= $.extend({}, Button
.DEFAULTS
, options
)
195 loadingText
: 'loading...'
198 Button
.prototype.setState = function (state
) {
200 var $el
= this.$element
201 var val
= $el
.is('input') ? 'val' : 'html'
202 var data
= $el
.data()
204 state
= state
+ 'Text'
206 if (!data
.resetText
) $el
.data('resetText', $el
[val
]())
208 $el
[val
](data
[state
] || this.options
[state
])
210 // push to event loop to allow forms to submit
211 setTimeout(function () {
212 state
== 'loadingText' ?
213 $el
.addClass(d
).attr(d
, d
) :
214 $el
.removeClass(d
).removeAttr(d
);
218 Button
.prototype.toggle = function () {
219 var $parent
= this.$element
.closest('[data-toggle="buttons"]')
221 if ($parent
.length
) {
222 var $input
= this.$element
.find('input')
223 .prop('checked', !this.$element
.hasClass('active'))
225 if ($input
.prop('type') === 'radio') $parent
.find('.active').removeClass('active')
228 this.$element
.toggleClass('active')
232 // BUTTON PLUGIN DEFINITION
233 // ========================
235 var old
= $.fn
.button
237 $.fn
.button = function (option
) {
238 return this.each(function () {
240 var data
= $this.data('bs.button')
241 var options
= typeof option
== 'object' && option
243 if (!data
) $this.data('bs.button', (data
= new Button(this, options
)))
245 if (option
== 'toggle') data
.toggle()
246 else if (option
) data
.setState(option
)
250 $.fn
.button
.Constructor
= Button
253 // BUTTON NO CONFLICT
254 // ==================
256 $.fn
.button
.noConflict = function () {
265 $(document
).on('click.bs.button.data-api', '[data-toggle^=button]', function (e
) {
266 var $btn
= $(e
.target
)
267 if (!$btn
.hasClass('btn')) $btn
= $btn
.closest('.btn')
268 $btn
.button('toggle')
274 /* ========================================================================
275 * Bootstrap: carousel.js v3.0.0
276 * http://twbs.github.com/bootstrap/javascript.html#carousel
277 * ========================================================================
278 * Copyright 2012 Twitter, Inc.
280 * Licensed under the Apache License, Version 2.0 (the "License");
281 * you may not use this file except in compliance with the License.
282 * You may obtain a copy of the License at
284 * http://www.apache.org/licenses/LICENSE-2.0
286 * Unless required by applicable law or agreed to in writing, software
287 * distributed under the License is distributed on an "AS IS" BASIS,
288 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
289 * See the License for the specific language governing permissions and
290 * limitations under the License.
291 * ======================================================================== */
294 +function ($) { "use strict";
296 // CAROUSEL CLASS DEFINITION
297 // =========================
299 var Carousel = function (element
, options
) {
300 this.$element
= $(element
)
301 this.$indicators
= this.$element
.find('.carousel-indicators')
302 this.options
= options
309 this.options
.pause
== 'hover' && this.$element
310 .on('mouseenter', $.proxy(this.pause
, this))
311 .on('mouseleave', $.proxy(this.cycle
, this))
314 Carousel
.DEFAULTS
= {
320 Carousel
.prototype.cycle = function (e
) {
321 e
|| (this.paused
= false)
323 this.interval
&& clearInterval(this.interval
)
325 this.options
.interval
327 && (this.interval
= setInterval($.proxy(this.next
, this), this.options
.interval
))
332 Carousel
.prototype.getActiveIndex = function () {
333 this.$active
= this.$element
.find('.item.active')
334 this.$items
= this.$active
.parent().children()
336 return this.$items
.index(this.$active
)
339 Carousel
.prototype.to = function (pos
) {
341 var activeIndex
= this.getActiveIndex()
343 if (pos
> (this.$items
.length
- 1) || pos
< 0) return
345 if (this.sliding
) return this.$element
.one('slid', function () { that
.to(pos
) })
346 if (activeIndex
== pos
) return this.pause().cycle()
348 return this.slide(pos
> activeIndex
? 'next' : 'prev', $(this.$items
[pos
]))
351 Carousel
.prototype.pause = function (e
) {
352 e
|| (this.paused
= true)
354 if (this.$element
.find('.next, .prev').length
&& $.support
.transition
.end
) {
355 this.$element
.trigger($.support
.transition
.end
)
359 this.interval
= clearInterval(this.interval
)
364 Carousel
.prototype.next = function () {
365 if (this.sliding
) return
366 return this.slide('next')
369 Carousel
.prototype.prev = function () {
370 if (this.sliding
) return
371 return this.slide('prev')
374 Carousel
.prototype.slide = function (type
, next
) {
375 var $active
= this.$element
.find('.item.active')
376 var $next
= next
|| $active
[type
]()
377 var isCycling
= this.interval
378 var direction
= type
== 'next' ? 'left' : 'right'
379 var fallback
= type
== 'next' ? 'first' : 'last'
383 if (!this.options
.wrap
) return
384 $next
= this.$element
.find('.item')[fallback
]()
389 isCycling
&& this.pause()
391 var e
= $.Event('slide.bs.carousel', { relatedTarget
: $next
[0], direction
: direction
})
393 if ($next
.hasClass('active')) return
395 if (this.$indicators
.length
) {
396 this.$indicators
.find('.active').removeClass('active')
397 this.$element
.one('slid', function () {
398 var $nextIndicator
= $(that
.$indicators
.children()[that
.getActiveIndex()])
399 $nextIndicator
&& $nextIndicator
.addClass('active')
403 if ($.support
.transition
&& this.$element
.hasClass('slide')) {
404 this.$element
.trigger(e
)
405 if (e
.isDefaultPrevented()) return
407 $next
[0].offsetWidth
// force reflow
408 $active
.addClass(direction
)
409 $next
.addClass(direction
)
411 .one($.support
.transition
.end
, function () {
412 $next
.removeClass([type
, direction
].join(' ')).addClass('active')
413 $active
.removeClass(['active', direction
].join(' '))
415 setTimeout(function () { that
.$element
.trigger('slid') }, 0)
417 .emulateTransitionEnd(600)
419 this.$element
.trigger(e
)
420 if (e
.isDefaultPrevented()) return
421 $active
.removeClass('active')
422 $next
.addClass('active')
424 this.$element
.trigger('slid')
427 isCycling
&& this.cycle()
433 // CAROUSEL PLUGIN DEFINITION
434 // ==========================
436 var old
= $.fn
.carousel
438 $.fn
.carousel = function (option
) {
439 return this.each(function () {
441 var data
= $this.data('bs.carousel')
442 var options
= $.extend({}, Carousel
.DEFAULTS
, $this.data(), typeof option
== 'object' && option
)
443 var action
= typeof option
== 'string' ? option
: options
.slide
445 if (!data
) $this.data('bs.carousel', (data
= new Carousel(this, options
)))
446 if (typeof option
== 'number') data
.to(option
)
447 else if (action
) data
[action
]()
448 else if (options
.interval
) data
.pause().cycle()
452 $.fn
.carousel
.Constructor
= Carousel
455 // CAROUSEL NO CONFLICT
456 // ====================
458 $.fn
.carousel
.noConflict = function () {
467 $(document
).on('click.bs.carousel.data-api', '[data-slide], [data-slide-to]', function (e
) {
468 var $this = $(this), href
469 var $target
= $($this.attr('data-target') || (href
= $this.attr('href')) && href
.replace(/.*(?=#[^\s]+$)/, '')) //strip for ie7
470 var options
= $.extend({}, $target
.data(), $this.data())
471 var slideIndex
= $this.attr('data-slide-to')
472 if (slideIndex
) options
.interval
= false
474 $target
.carousel(options
)
476 if (slideIndex
= $this.attr('data-slide-to')) {
477 $target
.data('bs.carousel').to(slideIndex
)
483 $(window
).on('load', function () {
484 $('[data-ride="carousel"]').each(function () {
485 var $carousel
= $(this)
486 $carousel
.carousel($carousel
.data())
492 /* ========================================================================
493 * Bootstrap: collapse.js v3.0.0
494 * http://twbs.github.com/bootstrap/javascript.html#collapse
495 * ========================================================================
496 * Copyright 2012 Twitter, Inc.
498 * Licensed under the Apache License, Version 2.0 (the "License");
499 * you may not use this file except in compliance with the License.
500 * You may obtain a copy of the License at
502 * http://www.apache.org/licenses/LICENSE-2.0
504 * Unless required by applicable law or agreed to in writing, software
505 * distributed under the License is distributed on an "AS IS" BASIS,
506 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
507 * See the License for the specific language governing permissions and
508 * limitations under the License.
509 * ======================================================================== */
512 +function ($) { "use strict";
514 // COLLAPSE PUBLIC CLASS DEFINITION
515 // ================================
517 var Collapse = function (element
, options
) {
518 this.$element
= $(element
)
519 this.options
= $.extend({}, Collapse
.DEFAULTS
, options
)
520 this.transitioning
= null
522 if (this.options
.parent
) this.$parent
= $(this.options
.parent
)
523 if (this.options
.toggle
) this.toggle()
526 Collapse
.DEFAULTS
= {
530 Collapse
.prototype.dimension = function () {
531 var hasWidth
= this.$element
.hasClass('width')
532 return hasWidth
? 'width' : 'height'
535 Collapse
.prototype.show = function () {
536 if (this.transitioning
|| this.$element
.hasClass('in')) return
538 var startEvent
= $.Event('show.bs.collapse')
539 this.$element
.trigger(startEvent
)
540 if (startEvent
.isDefaultPrevented()) return
542 var actives
= this.$parent
&& this.$parent
.find('> .panel > .in')
544 if (actives
&& actives
.length
) {
545 var hasData
= actives
.data('bs.collapse')
546 if (hasData
&& hasData
.transitioning
) return
547 actives
.collapse('hide')
548 hasData
|| actives
.data('bs.collapse', null)
551 var dimension
= this.dimension()
554 .removeClass('collapse')
555 .addClass('collapsing')
558 this.transitioning
= 1
560 var complete = function () {
562 .removeClass('collapsing')
565 this.transitioning
= 0
566 this.$element
.trigger('shown.bs.collapse')
569 if (!$.support
.transition
) return complete
.call(this)
571 var scrollSize
= $.camelCase(['scroll', dimension
].join('-'))
574 .one($.support
.transition
.end
, $.proxy(complete
, this))
575 .emulateTransitionEnd(350)
576 [dimension
](this.$element
[0][scrollSize
])
579 Collapse
.prototype.hide = function () {
580 if (this.transitioning
|| !this.$element
.hasClass('in')) return
582 var startEvent
= $.Event('hide.bs.collapse')
583 this.$element
.trigger(startEvent
)
584 if (startEvent
.isDefaultPrevented()) return
586 var dimension
= this.dimension()
589 [dimension
](this.$element
[dimension
]())
593 .addClass('collapsing')
594 .removeClass('collapse')
597 this.transitioning
= 1
599 var complete = function () {
600 this.transitioning
= 0
602 .trigger('hidden.bs.collapse')
603 .removeClass('collapsing')
604 .addClass('collapse')
607 if (!$.support
.transition
) return complete
.call(this)
611 .one($.support
.transition
.end
, $.proxy(complete
, this))
612 .emulateTransitionEnd(350)
615 Collapse
.prototype.toggle = function () {
616 this[this.$element
.hasClass('in') ? 'hide' : 'show']()
620 // COLLAPSE PLUGIN DEFINITION
621 // ==========================
623 var old
= $.fn
.collapse
625 $.fn
.collapse = function (option
) {
626 return this.each(function () {
628 var data
= $this.data('bs.collapse')
629 var options
= $.extend({}, Collapse
.DEFAULTS
, $this.data(), typeof option
== 'object' && option
)
631 if (!data
) $this.data('bs.collapse', (data
= new Collapse(this, options
)))
632 if (typeof option
== 'string') data
[option
]()
636 $.fn
.collapse
.Constructor
= Collapse
639 // COLLAPSE NO CONFLICT
640 // ====================
642 $.fn
.collapse
.noConflict = function () {
651 $(document
).on('click.bs.collapse.data-api', '[data-toggle=collapse]', function (e
) {
652 var $this = $(this), href
653 var target
= $this.attr('data-target')
654 || e
.preventDefault()
655 || (href
= $this.attr('href')) && href
.replace(/.*(?=#[^\s]+$)/, '') //strip for ie7
656 var $target
= $(target
)
657 var data
= $target
.data('bs.collapse')
658 var option
= data
? 'toggle' : $this.data()
659 var parent
= $this.attr('data-parent')
660 var $parent
= parent
&& $(parent
)
662 if (!data
|| !data
.transitioning
) {
663 if ($parent
) $parent
.find('[data-toggle=collapse][data-parent="' + parent
+ '"]').not($this).addClass('collapsed')
664 $this[$target
.hasClass('in') ? 'addClass' : 'removeClass']('collapsed')
667 $target
.collapse(option
)
672 /* ========================================================================
673 * Bootstrap: dropdown.js v3.0.0
674 * http://twbs.github.com/bootstrap/javascript.html#dropdowns
675 * ========================================================================
676 * Copyright 2012 Twitter, Inc.
678 * Licensed under the Apache License, Version 2.0 (the "License");
679 * you may not use this file except in compliance with the License.
680 * You may obtain a copy of the License at
682 * http://www.apache.org/licenses/LICENSE-2.0
684 * Unless required by applicable law or agreed to in writing, software
685 * distributed under the License is distributed on an "AS IS" BASIS,
686 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
687 * See the License for the specific language governing permissions and
688 * limitations under the License.
689 * ======================================================================== */
692 +function ($) { "use strict";
694 // DROPDOWN CLASS DEFINITION
695 // =========================
697 var backdrop
= '.dropdown-backdrop'
698 var toggle
= '[data-toggle=dropdown]'
699 var Dropdown = function (element
) {
700 var $el
= $(element
).on('click.bs.dropdown', this.toggle
)
703 Dropdown
.prototype.toggle = function (e
) {
706 if ($this.is('.disabled, :disabled')) return
708 var $parent
= getParent($this)
709 var isActive
= $parent
.hasClass('open')
714 if ('ontouchstart' in document
.documentElement
&& !$parent
.closest('.navbar-nav').length
) {
715 // if mobile we we use a backdrop because click events don't delegate
716 $('<div class="dropdown-backdrop"/>').insertAfter($(this)).on('click', clearMenus
)
719 $parent
.trigger(e
= $.Event('show.bs.dropdown'))
721 if (e
.isDefaultPrevented()) return
725 .trigger('shown.bs.dropdown')
733 Dropdown
.prototype.keydown = function (e
) {
734 if (!/(38|40|27)/.test(e
.keyCode
)) return
741 if ($this.is('.disabled, :disabled')) return
743 var $parent
= getParent($this)
744 var isActive
= $parent
.hasClass('open')
746 if (!isActive
|| (isActive
&& e
.keyCode
== 27)) {
747 if (e
.which
== 27) $parent
.find(toggle
).focus()
751 var $items
= $('[role=menu] li:not(.divider):visible a', $parent
)
753 if (!$items
.length
) return
755 var index
= $items
.index($items
.filter(':focus'))
757 if (e
.keyCode
== 38 && index
> 0) index
-- // up
758 if (e
.keyCode
== 40 && index
< $items
.length
- 1) index
++ // down
761 $items
.eq(index
).focus()
764 function clearMenus() {
766 $(toggle
).each(function (e
) {
767 var $parent
= getParent($(this))
768 if (!$parent
.hasClass('open')) return
769 $parent
.trigger(e
= $.Event('hide.bs.dropdown'))
770 if (e
.isDefaultPrevented()) return
771 $parent
.removeClass('open').trigger('hidden.bs.dropdown')
775 function getParent($this) {
776 var selector
= $this.attr('data-target')
779 selector
= $this.attr('href')
780 selector
= selector
&& /#/.test(selector) && selector.replace(/.*(?=#[^\s
]*$)/, '') //strip
for ie7
783 var $parent
= selector
&& $(selector
)
785 return $parent
&& $parent
.length
? $parent
: $this.parent()
789 // DROPDOWN PLUGIN DEFINITION
790 // ==========================
792 var old
= $.fn
.dropdown
794 $.fn
.dropdown = function (option
) {
795 return this.each(function () {
797 var data
= $this.data('dropdown')
799 if (!data
) $this.data('dropdown', (data
= new Dropdown(this)))
800 if (typeof option
== 'string') data
[option
].call($this)
804 $.fn
.dropdown
.Constructor
= Dropdown
807 // DROPDOWN NO CONFLICT
808 // ====================
810 $.fn
.dropdown
.noConflict = function () {
816 // APPLY TO STANDARD DROPDOWN ELEMENTS
817 // ===================================
820 .on('click.bs.dropdown.data-api', clearMenus
)
821 .on('click.bs.dropdown.data-api', '.dropdown form', function (e
) { e
.stopPropagation() })
822 .on('click.bs.dropdown.data-api' , toggle
, Dropdown
.prototype.toggle
)
823 .on('keydown.bs.dropdown.data-api', toggle
+ ', [role=menu]' , Dropdown
.prototype.keydown
)
827 /* ========================================================================
828 * Bootstrap: modal.js v3.0.0
829 * http://twbs.github.com/bootstrap/javascript.html#modals
830 * ========================================================================
831 * Copyright 2012 Twitter, Inc.
833 * Licensed under the Apache License, Version 2.0 (the "License");
834 * you may not use this file except in compliance with the License.
835 * You may obtain a copy of the License at
837 * http://www.apache.org/licenses/LICENSE-2.0
839 * Unless required by applicable law or agreed to in writing, software
840 * distributed under the License is distributed on an "AS IS" BASIS,
841 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
842 * See the License for the specific language governing permissions and
843 * limitations under the License.
844 * ======================================================================== */
847 +function ($) { "use strict";
849 // MODAL CLASS DEFINITION
850 // ======================
852 var Modal = function (element
, options
) {
853 this.options
= options
854 this.$element
= $(element
)
858 if (this.options
.remote
) this.$element
.load(this.options
.remote
)
867 Modal
.prototype.toggle = function (_relatedTarget
) {
868 return this[!this.isShown
? 'show' : 'hide'](_relatedTarget
)
871 Modal
.prototype.show = function (_relatedTarget
) {
873 var e
= $.Event('show.bs.modal', { relatedTarget
: _relatedTarget
})
875 this.$element
.trigger(e
)
877 if (this.isShown
|| e
.isDefaultPrevented()) return
883 this.$element
.on('click.dismiss.modal', '[data-dismiss="modal"]', $.proxy(this.hide
, this))
885 this.backdrop(function () {
886 var transition
= $.support
.transition
&& that
.$element
.hasClass('fade')
888 if (!that
.$element
.parent().length
) {
889 that
.$element
.appendTo(document
.body
) // don't move modals dom position
895 that
.$element
[0].offsetWidth
// force reflow
900 .attr('aria-hidden', false)
904 var e
= $.Event('shown.bs.modal', { relatedTarget
: _relatedTarget
})
907 that
.$element
.find('.modal-dialog') // wait for modal to slide in
908 .one($.support
.transition
.end
, function () {
909 that
.$element
.focus().trigger(e
)
911 .emulateTransitionEnd(300) :
912 that
.$element
.focus().trigger(e
)
916 Modal
.prototype.hide = function (e
) {
917 if (e
) e
.preventDefault()
919 e
= $.Event('hide.bs.modal')
921 this.$element
.trigger(e
)
923 if (!this.isShown
|| e
.isDefaultPrevented()) return
929 $(document
).off('focusin.bs.modal')
933 .attr('aria-hidden', true)
934 .off('click.dismiss.modal')
936 $.support
.transition
&& this.$element
.hasClass('fade') ?
938 .one($.support
.transition
.end
, $.proxy(this.hideModal
, this))
939 .emulateTransitionEnd(300) :
943 Modal
.prototype.enforceFocus = function () {
945 .off('focusin.bs.modal') // guard against infinite focus loop
946 .on('focusin.bs.modal', $.proxy(function (e
) {
947 if (this.$element
[0] !== e
.target
&& !this.$element
.has(e
.target
).length
) {
948 this.$element
.focus()
953 Modal
.prototype.escape = function () {
954 if (this.isShown
&& this.options
.keyboard
) {
955 this.$element
.on('keyup.dismiss.bs.modal', $.proxy(function (e
) {
956 e
.which
== 27 && this.hide()
958 } else if (!this.isShown
) {
959 this.$element
.off('keyup.dismiss.bs.modal')
963 Modal
.prototype.hideModal = function () {
966 this.backdrop(function () {
967 that
.removeBackdrop()
968 that
.$element
.trigger('hidden.bs.modal')
972 Modal
.prototype.removeBackdrop = function () {
973 this.$backdrop
&& this.$backdrop
.remove()
974 this.$backdrop
= null
977 Modal
.prototype.backdrop = function (callback
) {
979 var animate
= this.$element
.hasClass('fade') ? 'fade' : ''
981 if (this.isShown
&& this.options
.backdrop
) {
982 var doAnimate
= $.support
.transition
&& animate
984 this.$backdrop
= $('<div class="modal-backdrop ' + animate
+ '" />')
985 .appendTo(document
.body
)
987 this.$element
.on('click.dismiss.modal', $.proxy(function (e
) {
988 if (e
.target
!== e
.currentTarget
) return
989 this.options
.backdrop
== 'static'
990 ? this.$element
[0].focus
.call(this.$element
[0])
991 : this.hide
.call(this)
994 if (doAnimate
) this.$backdrop
[0].offsetWidth
// force reflow
996 this.$backdrop
.addClass('in')
998 if (!callback
) return
1002 .one($.support
.transition
.end
, callback
)
1003 .emulateTransitionEnd(150) :
1006 } else if (!this.isShown
&& this.$backdrop
) {
1007 this.$backdrop
.removeClass('in')
1009 $.support
.transition
&& this.$element
.hasClass('fade')?
1011 .one($.support
.transition
.end
, callback
)
1012 .emulateTransitionEnd(150) :
1015 } else if (callback
) {
1021 // MODAL PLUGIN DEFINITION
1022 // =======================
1024 var old
= $.fn
.modal
1026 $.fn
.modal = function (option
, _relatedTarget
) {
1027 return this.each(function () {
1029 var data
= $this.data('bs.modal')
1030 var options
= $.extend({}, Modal
.DEFAULTS
, $this.data(), typeof option
== 'object' && option
)
1032 if (!data
) $this.data('bs.modal', (data
= new Modal(this, options
)))
1033 if (typeof option
== 'string') data
[option
](_relatedTarget
)
1034 else if (options
.show
) data
.show(_relatedTarget
)
1038 $.fn
.modal
.Constructor
= Modal
1041 // MODAL NO CONFLICT
1042 // =================
1044 $.fn
.modal
.noConflict = function () {
1053 $(document
).on('click.bs.modal.data-api', '[data-toggle="modal"]', function (e
) {
1055 var href
= $this.attr('href')
1056 var $target
= $($this.attr('data-target') || (href
&& href
.replace(/.*(?=#[^\s]+$)/, ''))) //strip for ie7
1057 var option
= $target
.data('modal') ? 'toggle' : $.extend({ remote
: !/#/.test(href
) && href
}, $target
.data(), $this.data())
1062 .modal(option
, this)
1063 .one('hide', function () {
1064 $this.is(':visible') && $this.focus()
1069 .on('show.bs.modal', '.modal', function () { $(document
.body
).addClass('modal-open') })
1070 .on('hidden.bs.modal', '.modal', function () { $(document
.body
).removeClass('modal-open') })
1074 /* ========================================================================
1075 * Bootstrap: tooltip.js v3.0.0
1076 * http://twbs.github.com/bootstrap/javascript.html#tooltip
1077 * Inspired by the original jQuery.tipsy by Jason Frame
1078 * ========================================================================
1079 * Copyright 2012 Twitter, Inc.
1081 * Licensed under the Apache License, Version 2.0 (the "License");
1082 * you may not use this file except in compliance with the License.
1083 * You may obtain a copy of the License at
1085 * http://www.apache.org/licenses/LICENSE-2.0
1087 * Unless required by applicable law or agreed to in writing, software
1088 * distributed under the License is distributed on an "AS IS" BASIS,
1089 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
1090 * See the License for the specific language governing permissions and
1091 * limitations under the License.
1092 * ======================================================================== */
1095 +function ($) { "use strict";
1097 // TOOLTIP PUBLIC CLASS DEFINITION
1098 // ===============================
1100 var Tooltip = function (element
, options
) {
1106 this.$element
= null
1108 this.init('tooltip', element
, options
)
1111 Tooltip
.DEFAULTS
= {
1115 , template
: '<div class="tooltip"><div class="tooltip-arrow"></div><div class="tooltip-inner"></div></div>'
1116 , trigger
: 'hover focus'
1123 Tooltip
.prototype.init = function (type
, element
, options
) {
1126 this.$element
= $(element
)
1127 this.options
= this.getOptions(options
)
1129 var triggers
= this.options
.trigger
.split(' ')
1131 for (var i
= triggers
.length
; i
--;) {
1132 var trigger
= triggers
[i
]
1134 if (trigger
== 'click') {
1135 this.$element
.on('click.' + this.type
, this.options
.selector
, $.proxy(this.toggle
, this))
1136 } else if (trigger
!= 'manual') {
1137 var eventIn
= trigger
== 'hover' ? 'mouseenter' : 'focus'
1138 var eventOut
= trigger
== 'hover' ? 'mouseleave' : 'blur'
1140 this.$element
.on(eventIn
+ '.' + this.type
, this.options
.selector
, $.proxy(this.enter
, this))
1141 this.$element
.on(eventOut
+ '.' + this.type
, this.options
.selector
, $.proxy(this.leave
, this))
1145 this.options
.selector
?
1146 (this._options
= $.extend({}, this.options
, { trigger
: 'manual', selector
: '' })) :
1150 Tooltip
.prototype.getDefaults = function () {
1151 return Tooltip
.DEFAULTS
1154 Tooltip
.prototype.getOptions = function (options
) {
1155 options
= $.extend({}, this.getDefaults(), this.$element
.data(), options
)
1157 if (options
.delay
&& typeof options
.delay
== 'number') {
1160 , hide
: options
.delay
1167 Tooltip
.prototype.getDelegateOptions = function () {
1169 var defaults
= this.getDefaults()
1171 this._options
&& $.each(this._options
, function (key
, value
) {
1172 if (defaults
[key
] != value
) options
[key
] = value
1178 Tooltip
.prototype.enter = function (obj
) {
1179 var self
= obj
instanceof this.constructor ?
1180 obj
: $(obj
.currentTarget
)[this.type
](this.getDelegateOptions()).data('bs.' + this.type
)
1182 clearTimeout(self
.timeout
)
1184 self
.hoverState
= 'in'
1186 if (!self
.options
.delay
|| !self
.options
.delay
.show
) return self
.show()
1188 self
.timeout
= setTimeout(function () {
1189 if (self
.hoverState
== 'in') self
.show()
1190 }, self
.options
.delay
.show
)
1193 Tooltip
.prototype.leave = function (obj
) {
1194 var self
= obj
instanceof this.constructor ?
1195 obj
: $(obj
.currentTarget
)[this.type
](this.getDelegateOptions()).data('bs.' + this.type
)
1197 clearTimeout(self
.timeout
)
1199 self
.hoverState
= 'out'
1201 if (!self
.options
.delay
|| !self
.options
.delay
.hide
) return self
.hide()
1203 self
.timeout
= setTimeout(function () {
1204 if (self
.hoverState
== 'out') self
.hide()
1205 }, self
.options
.delay
.hide
)
1208 Tooltip
.prototype.show = function () {
1209 var e
= $.Event('show.bs.'+ this.type
)
1211 if (this.hasContent() && this.enabled
) {
1212 this.$element
.trigger(e
)
1214 if (e
.isDefaultPrevented()) return
1216 var $tip
= this.tip()
1220 if (this.options
.animation
) $tip
.addClass('fade')
1222 var placement
= typeof this.options
.placement
== 'function' ?
1223 this.options
.placement
.call(this, $tip
[0], this.$element
[0]) :
1224 this.options
.placement
1226 var autoToken
= /\s?auto?\s?/i
1227 var autoPlace
= autoToken
.test(placement
)
1228 if (autoPlace
) placement
= placement
.replace(autoToken
, '') || 'top'
1232 .css({ top
: 0, left
: 0, display
: 'block' })
1233 .addClass(placement
)
1235 this.options
.container
? $tip
.appendTo(this.options
.container
) : $tip
.insertAfter(this.$element
)
1237 var pos
= this.getPosition()
1238 var actualWidth
= $tip
[0].offsetWidth
1239 var actualHeight
= $tip
[0].offsetHeight
1242 var $parent
= this.$element
.parent()
1244 var orgPlacement
= placement
1245 var docScroll
= document
.documentElement
.scrollTop
|| document
.body
.scrollTop
1246 var parentWidth
= this.options
.container
== 'body' ? window
.innerWidth
: $parent
.outerWidth()
1247 var parentHeight
= this.options
.container
== 'body' ? window
.innerHeight
: $parent
.outerHeight()
1248 var parentLeft
= this.options
.container
== 'body' ? 0 : $parent
.offset().left
1250 placement
= placement
== 'bottom' && pos
.top
+ pos
.height
+ actualHeight
- docScroll
> parentHeight
? 'top' :
1251 placement
== 'top' && pos
.top
- docScroll
- actualHeight
< 0 ? 'bottom' :
1252 placement
== 'right' && pos
.right
+ actualWidth
> parentWidth
? 'left' :
1253 placement
== 'left' && pos
.left
- actualWidth
< parentLeft
? 'right' :
1257 .removeClass(orgPlacement
)
1258 .addClass(placement
)
1261 var calculatedOffset
= this.getCalculatedOffset(placement
, pos
, actualWidth
, actualHeight
)
1263 this.applyPlacement(calculatedOffset
, placement
)
1264 this.$element
.trigger('shown.bs.' + this.type
)
1268 Tooltip
.prototype.applyPlacement = function(offset
, placement
) {
1270 var $tip
= this.tip()
1271 var width
= $tip
[0].offsetWidth
1272 var height
= $tip
[0].offsetHeight
1274 // manually read margins because getBoundingClientRect includes difference
1275 var marginTop
= parseInt($tip
.css('margin-top'), 10)
1276 var marginLeft
= parseInt($tip
.css('margin-left'), 10)
1278 // we must check for NaN for ie 8/9
1279 if (isNaN(marginTop
)) marginTop
= 0
1280 if (isNaN(marginLeft
)) marginLeft
= 0
1282 offset
.top
= offset
.top
+ marginTop
1283 offset
.left
= offset
.left
+ marginLeft
1289 // check to see if placing tip in new offset caused the tip to resize itself
1290 var actualWidth
= $tip
[0].offsetWidth
1291 var actualHeight
= $tip
[0].offsetHeight
1293 if (placement
== 'top' && actualHeight
!= height
) {
1295 offset
.top
= offset
.top
+ height
- actualHeight
1298 if (/bottom|top/.test(placement
)) {
1301 if (offset
.left
< 0) {
1302 delta
= offset
.left
* -2
1307 actualWidth
= $tip
[0].offsetWidth
1308 actualHeight
= $tip
[0].offsetHeight
1311 this.replaceArrow(delta
- width
+ actualWidth
, actualWidth
, 'left')
1313 this.replaceArrow(actualHeight
- height
, actualHeight
, 'top')
1316 if (replace
) $tip
.offset(offset
)
1319 Tooltip
.prototype.replaceArrow = function(delta
, dimension
, position
) {
1320 this.arrow().css(position
, delta
? (50 * (1 - delta
/ dimension
) + "%") : '')
1323 Tooltip
.prototype.setContent = function () {
1324 var $tip
= this.tip()
1325 var title
= this.getTitle()
1327 $tip
.find('.tooltip-inner')[this.options
.html
? 'html' : 'text'](title
)
1328 $tip
.removeClass('fade in top bottom left right')
1331 Tooltip
.prototype.hide = function () {
1333 var $tip
= this.tip()
1334 var e
= $.Event('hide.bs.' + this.type
)
1336 function complete() {
1337 if (that
.hoverState
!= 'in') $tip
.detach()
1340 this.$element
.trigger(e
)
1342 if (e
.isDefaultPrevented()) return
1344 $tip
.removeClass('in')
1346 $.support
.transition
&& this.$tip
.hasClass('fade') ?
1348 .one($.support
.transition
.end
, complete
)
1349 .emulateTransitionEnd(150) :
1352 this.$element
.trigger('hidden.bs.' + this.type
)
1357 Tooltip
.prototype.fixTitle = function () {
1358 var $e
= this.$element
1359 if ($e
.attr('title') || typeof($e
.attr('data-original-title')) != 'string') {
1360 $e
.attr('data-original-title', $e
.attr('title') || '').attr('title', '')
1364 Tooltip
.prototype.hasContent = function () {
1365 return this.getTitle()
1368 Tooltip
.prototype.getPosition = function () {
1369 var el
= this.$element
[0]
1370 return $.extend({}, (typeof el
.getBoundingClientRect
== 'function') ? el
.getBoundingClientRect() : {
1371 width
: el
.offsetWidth
1372 , height
: el
.offsetHeight
1373 }, this.$element
.offset())
1376 Tooltip
.prototype.getCalculatedOffset = function (placement
, pos
, actualWidth
, actualHeight
) {
1377 return placement
== 'bottom' ? { top
: pos
.top
+ pos
.height
, left
: pos
.left
+ pos
.width
/ 2 - actualWidth
/ 2 } :
1378 placement
== 'top' ? { top
: pos
.top
- actualHeight
, left
: pos
.left
+ pos
.width
/ 2 - actualWidth
/ 2 } :
1379 placement
== 'left' ? { top
: pos
.top
+ pos
.height
/ 2 - actualHeight
/ 2, left
: pos
.left
- actualWidth
} :
1380 /* placement == 'right' */ { top
: pos
.top
+ pos
.height
/ 2 - actualHeight
/ 2, left
: pos
.left
+ pos
.width
}
1383 Tooltip
.prototype.getTitle = function () {
1385 var $e
= this.$element
1386 var o
= this.options
1388 title
= $e
.attr('data-original-title')
1389 || (typeof o
.title
== 'function' ? o
.title
.call($e
[0]) : o
.title
)
1394 Tooltip
.prototype.tip = function () {
1395 return this.$tip
= this.$tip
|| $(this.options
.template
)
1398 Tooltip
.prototype.arrow = function () {
1399 return this.$arrow
= this.$arrow
|| this.tip().find('.tooltip-arrow')
1402 Tooltip
.prototype.validate = function () {
1403 if (!this.$element
[0].parentNode
) {
1405 this.$element
= null
1410 Tooltip
.prototype.enable = function () {
1414 Tooltip
.prototype.disable = function () {
1415 this.enabled
= false
1418 Tooltip
.prototype.toggleEnabled = function () {
1419 this.enabled
= !this.enabled
1422 Tooltip
.prototype.toggle = function (e
) {
1423 var self
= e
? $(e
.currentTarget
)[this.type
](this.getDelegateOptions()).data('bs.' + this.type
) : this
1424 self
.tip().hasClass('in') ? self
.leave(self
) : self
.enter(self
)
1427 Tooltip
.prototype.destroy = function () {
1428 this.hide().$element
.off('.' + this.type
).removeData('bs.' + this.type
)
1432 // TOOLTIP PLUGIN DEFINITION
1433 // =========================
1435 var old
= $.fn
.tooltip
1437 $.fn
.tooltip = function (option
) {
1438 return this.each(function () {
1440 var data
= $this.data('bs.tooltip')
1441 var options
= typeof option
== 'object' && option
1443 if (!data
) $this.data('bs.tooltip', (data
= new Tooltip(this, options
)))
1444 if (typeof option
== 'string') data
[option
]()
1448 $.fn
.tooltip
.Constructor
= Tooltip
1451 // TOOLTIP NO CONFLICT
1452 // ===================
1454 $.fn
.tooltip
.noConflict = function () {
1461 /* ========================================================================
1462 * Bootstrap: popover.js v3.0.0
1463 * http://twbs.github.com/bootstrap/javascript.html#popovers
1464 * ========================================================================
1465 * Copyright 2012 Twitter, Inc.
1467 * Licensed under the Apache License, Version 2.0 (the "License");
1468 * you may not use this file except in compliance with the License.
1469 * You may obtain a copy of the License at
1471 * http://www.apache.org/licenses/LICENSE-2.0
1473 * Unless required by applicable law or agreed to in writing, software
1474 * distributed under the License is distributed on an "AS IS" BASIS,
1475 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
1476 * See the License for the specific language governing permissions and
1477 * limitations under the License.
1478 * ======================================================================== */
1481 +function ($) { "use strict";
1483 // POPOVER PUBLIC CLASS DEFINITION
1484 // ===============================
1486 var Popover = function (element
, options
) {
1487 this.init('popover', element
, options
)
1490 if (!$.fn
.tooltip
) throw new Error('Popover requires tooltip.js')
1492 Popover
.DEFAULTS
= $.extend({} , $.fn
.tooltip
.Constructor
.DEFAULTS
, {
1496 , template
: '<div class="popover"><div class="arrow"></div><h3 class="popover-title"></h3><div class="popover-content"></div></div>'
1500 // NOTE: POPOVER EXTENDS tooltip.js
1501 // ================================
1503 Popover
.prototype = $.extend({}, $.fn
.tooltip
.Constructor
.prototype)
1505 Popover
.prototype.constructor = Popover
1507 Popover
.prototype.getDefaults = function () {
1508 return Popover
.DEFAULTS
1511 Popover
.prototype.setContent = function () {
1512 var $tip
= this.tip()
1513 var title
= this.getTitle()
1514 var content
= this.getContent()
1516 $tip
.find('.popover-title')[this.options
.html
? 'html' : 'text'](title
)
1517 $tip
.find('.popover-content')[this.options
.html
? 'html' : 'text'](content
)
1519 $tip
.removeClass('fade top bottom left right in')
1521 // IE8 doesn't accept hiding via the `:empty` pseudo selector, we have to do
1522 // this manually by checking the contents.
1523 if (!$tip
.find('.popover-title').html()) $tip
.find('.popover-title').hide()
1526 Popover
.prototype.hasContent = function () {
1527 return this.getTitle() || this.getContent()
1530 Popover
.prototype.getContent = function () {
1531 var $e
= this.$element
1532 var o
= this.options
1534 return $e
.attr('data-content')
1535 || (typeof o
.content
== 'function' ?
1536 o
.content
.call($e
[0]) :
1540 Popover
.prototype.arrow = function () {
1541 return this.$arrow
= this.$arrow
|| this.tip().find('.arrow')
1544 Popover
.prototype.tip = function () {
1545 if (!this.$tip
) this.$tip
= $(this.options
.template
)
1550 // POPOVER PLUGIN DEFINITION
1551 // =========================
1553 var old
= $.fn
.popover
1555 $.fn
.popover = function (option
) {
1556 return this.each(function () {
1558 var data
= $this.data('bs.popover')
1559 var options
= typeof option
== 'object' && option
1561 if (!data
) $this.data('bs.popover', (data
= new Popover(this, options
)))
1562 if (typeof option
== 'string') data
[option
]()
1566 $.fn
.popover
.Constructor
= Popover
1569 // POPOVER NO CONFLICT
1570 // ===================
1572 $.fn
.popover
.noConflict = function () {
1579 /* ========================================================================
1580 * Bootstrap: scrollspy.js v3.0.0
1581 * http://twbs.github.com/bootstrap/javascript.html#scrollspy
1582 * ========================================================================
1583 * Copyright 2012 Twitter, Inc.
1585 * Licensed under the Apache License, Version 2.0 (the "License");
1586 * you may not use this file except in compliance with the License.
1587 * You may obtain a copy of the License at
1589 * http://www.apache.org/licenses/LICENSE-2.0
1591 * Unless required by applicable law or agreed to in writing, software
1592 * distributed under the License is distributed on an "AS IS" BASIS,
1593 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
1594 * See the License for the specific language governing permissions and
1595 * limitations under the License.
1596 * ======================================================================== */
1599 +function ($) { "use strict";
1601 // SCROLLSPY CLASS DEFINITION
1602 // ==========================
1604 function ScrollSpy(element
, options
) {
1606 var process
= $.proxy(this.process
, this)
1608 this.$element
= $(element
).is('body') ? $(window
) : $(element
)
1609 this.$body
= $('body')
1610 this.$scrollElement
= this.$element
.on('scroll.bs.scroll-spy.data-api', process
)
1611 this.options
= $.extend({}, ScrollSpy
.DEFAULTS
, options
)
1612 this.selector
= (this.options
.target
1613 || ((href
= $(element
).attr('href')) && href
.replace(/.*(?=#[^\s]+$)/, '')) //strip for ie7
1614 || '') + ' .nav li > a'
1615 this.offsets
= $([])
1616 this.targets
= $([])
1617 this.activeTarget
= null
1623 ScrollSpy
.DEFAULTS
= {
1627 ScrollSpy
.prototype.refresh = function () {
1628 var offsetMethod
= this.$element
[0] == window
? 'offset' : 'position'
1630 this.offsets
= $([])
1631 this.targets
= $([])
1634 var $targets
= this.$body
1635 .find(this.selector
)
1638 var href
= $el
.data('target') || $el
.attr('href')
1639 var $href
= /^#\w/.test(href
) && $(href
)
1643 && [[ $href
[offsetMethod
]().top
+ (!$.isWindow(self
.$scrollElement
.get(0)) && self
.$scrollElement
.scrollTop()), href
]]) || null
1645 .sort(function (a
, b
) { return a
[0] - b
[0] })
1647 self
.offsets
.push(this[0])
1648 self
.targets
.push(this[1])
1652 ScrollSpy
.prototype.process = function () {
1653 var scrollTop
= this.$scrollElement
.scrollTop() + this.options
.offset
1654 var scrollHeight
= this.$scrollElement
[0].scrollHeight
|| this.$body
[0].scrollHeight
1655 var maxScroll
= scrollHeight
- this.$scrollElement
.height()
1656 var offsets
= this.offsets
1657 var targets
= this.targets
1658 var activeTarget
= this.activeTarget
1661 if (scrollTop
>= maxScroll
) {
1662 return activeTarget
!= (i
= targets
.last()[0]) && this.activate(i
)
1665 for (i
= offsets
.length
; i
--;) {
1666 activeTarget
!= targets
[i
]
1667 && scrollTop
>= offsets
[i
]
1668 && (!offsets
[i
+ 1] || scrollTop
<= offsets
[i
+ 1])
1669 && this.activate( targets
[i
] )
1673 ScrollSpy
.prototype.activate = function (target
) {
1674 this.activeTarget
= target
1678 .removeClass('active')
1680 var selector
= this.selector
1681 + '[data-target="' + target
+ '"],'
1682 + this.selector
+ '[href="' + target
+ '"]'
1684 var active
= $(selector
)
1688 if (active
.parent('.dropdown-menu').length
) {
1690 .closest('li.dropdown')
1694 active
.trigger('activate')
1698 // SCROLLSPY PLUGIN DEFINITION
1699 // ===========================
1701 var old
= $.fn
.scrollspy
1703 $.fn
.scrollspy = function (option
) {
1704 return this.each(function () {
1706 var data
= $this.data('bs.scrollspy')
1707 var options
= typeof option
== 'object' && option
1709 if (!data
) $this.data('bs.scrollspy', (data
= new ScrollSpy(this, options
)))
1710 if (typeof option
== 'string') data
[option
]()
1714 $.fn
.scrollspy
.Constructor
= ScrollSpy
1717 // SCROLLSPY NO CONFLICT
1718 // =====================
1720 $.fn
.scrollspy
.noConflict = function () {
1721 $.fn
.scrollspy
= old
1726 // SCROLLSPY DATA-API
1727 // ==================
1729 $(window
).on('load', function () {
1730 $('[data-spy="scroll"]').each(function () {
1732 $spy
.scrollspy($spy
.data())
1738 /* ========================================================================
1739 * Bootstrap: tab.js v3.0.0
1740 * http://twbs.github.com/bootstrap/javascript.html#tabs
1741 * ========================================================================
1742 * Copyright 2012 Twitter, Inc.
1744 * Licensed under the Apache License, Version 2.0 (the "License");
1745 * you may not use this file except in compliance with the License.
1746 * You may obtain a copy of the License at
1748 * http://www.apache.org/licenses/LICENSE-2.0
1750 * Unless required by applicable law or agreed to in writing, software
1751 * distributed under the License is distributed on an "AS IS" BASIS,
1752 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
1753 * See the License for the specific language governing permissions and
1754 * limitations under the License.
1755 * ======================================================================== */
1758 +function ($) { "use strict";
1760 // TAB CLASS DEFINITION
1761 // ====================
1763 var Tab = function (element
) {
1764 this.element
= $(element
)
1767 Tab
.prototype.show = function () {
1768 var $this = this.element
1769 var $ul
= $this.closest('ul:not(.dropdown-menu)')
1770 var selector
= $this.attr('data-target')
1773 selector
= $this.attr('href')
1774 selector
= selector
&& selector
.replace(/.*(?=#[^\s]*$)/, '') //strip for ie7
1777 if ($this.parent('li').hasClass('active')) return
1779 var previous
= $ul
.find('.active:last a')[0]
1780 var e
= $.Event('show.bs.tab', {
1781 relatedTarget
: previous
1786 if (e
.isDefaultPrevented()) return
1788 var $target
= $(selector
)
1790 this.activate($this.parent('li'), $ul
)
1791 this.activate($target
, $target
.parent(), function () {
1793 type
: 'shown.bs.tab'
1794 , relatedTarget
: previous
1799 Tab
.prototype.activate = function (element
, container
, callback
) {
1800 var $active
= container
.find('> .active')
1801 var transition
= callback
1802 && $.support
.transition
1803 && $active
.hasClass('fade')
1807 .removeClass('active')
1808 .find('> .dropdown-menu > .active')
1809 .removeClass('active')
1811 element
.addClass('active')
1814 element
[0].offsetWidth
// reflow for transition
1815 element
.addClass('in')
1817 element
.removeClass('fade')
1820 if (element
.parent('.dropdown-menu')) {
1821 element
.closest('li.dropdown').addClass('active')
1824 callback
&& callback()
1829 .one($.support
.transition
.end
, next
)
1830 .emulateTransitionEnd(150) :
1833 $active
.removeClass('in')
1837 // TAB PLUGIN DEFINITION
1838 // =====================
1842 $.fn
.tab = function ( option
) {
1843 return this.each(function () {
1845 var data
= $this.data('bs.tab')
1847 if (!data
) $this.data('bs.tab', (data
= new Tab(this)))
1848 if (typeof option
== 'string') data
[option
]()
1852 $.fn
.tab
.Constructor
= Tab
1858 $.fn
.tab
.noConflict = function () {
1867 $(document
).on('click.bs.tab.data-api', '[data-toggle="tab"], [data-toggle="pill"]', function (e
) {
1874 /* ========================================================================
1875 * Bootstrap: affix.js v3.0.0
1876 * http://twbs.github.com/bootstrap/javascript.html#affix
1877 * ========================================================================
1878 * Copyright 2012 Twitter, Inc.
1880 * Licensed under the Apache License, Version 2.0 (the "License");
1881 * you may not use this file except in compliance with the License.
1882 * You may obtain a copy of the License at
1884 * http://www.apache.org/licenses/LICENSE-2.0
1886 * Unless required by applicable law or agreed to in writing, software
1887 * distributed under the License is distributed on an "AS IS" BASIS,
1888 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
1889 * See the License for the specific language governing permissions and
1890 * limitations under the License.
1891 * ======================================================================== */
1894 +function ($) { "use strict";
1896 // AFFIX CLASS DEFINITION
1897 // ======================
1899 var Affix = function (element
, options
) {
1900 this.options
= $.extend({}, Affix
.DEFAULTS
, options
)
1901 this.$window
= $(window
)
1902 .on('scroll.bs.affix.data-api', $.proxy(this.checkPosition
, this))
1903 .on('click.bs.affix.data-api', $.proxy(this.checkPositionWithEventLoop
, this))
1905 this.$element
= $(element
)
1909 this.checkPosition()
1912 Affix
.RESET
= 'affix affix-top affix-bottom'
1918 Affix
.prototype.checkPositionWithEventLoop = function () {
1919 setTimeout($.proxy(this.checkPosition
, this), 1)
1922 Affix
.prototype.checkPosition = function () {
1923 if (!this.$element
.is(':visible')) return
1925 var scrollHeight
= $(document
).height()
1926 var scrollTop
= this.$window
.scrollTop()
1927 var position
= this.$element
.offset()
1928 var offset
= this.options
.offset
1929 var offsetTop
= offset
.top
1930 var offsetBottom
= offset
.bottom
1932 if (typeof offset
!= 'object') offsetBottom
= offsetTop
= offset
1933 if (typeof offsetTop
== 'function') offsetTop
= offset
.top()
1934 if (typeof offsetBottom
== 'function') offsetBottom
= offset
.bottom()
1936 var affix
= this.unpin
!= null && (scrollTop
+ this.unpin
<= position
.top
) ? false :
1937 offsetBottom
!= null && (position
.top
+ this.$element
.height() >= scrollHeight
- offsetBottom
) ? 'bottom' :
1938 offsetTop
!= null && (scrollTop
<= offsetTop
) ? 'top' : false
1940 if (this.affixed
=== affix
) return
1941 if (this.unpin
) this.$element
.css('top', '')
1943 this.affixed
= affix
1944 this.unpin
= affix
== 'bottom' ? position
.top
- scrollTop
: null
1946 this.$element
.removeClass(Affix
.RESET
).addClass('affix' + (affix
? '-' + affix
: ''))
1948 if (affix
== 'bottom') {
1949 this.$element
.offset({ top
: document
.body
.offsetHeight
- offsetBottom
- this.$element
.height() })
1954 // AFFIX PLUGIN DEFINITION
1955 // =======================
1957 var old
= $.fn
.affix
1959 $.fn
.affix = function (option
) {
1960 return this.each(function () {
1962 var data
= $this.data('bs.affix')
1963 var options
= typeof option
== 'object' && option
1965 if (!data
) $this.data('bs.affix', (data
= new Affix(this, options
)))
1966 if (typeof option
== 'string') data
[option
]()
1970 $.fn
.affix
.Constructor
= Affix
1973 // AFFIX NO CONFLICT
1974 // =================
1976 $.fn
.affix
.noConflict = function () {
1985 $(window
).on('load', function () {
1986 $('[data-spy="affix"]').each(function () {
1988 var data
= $spy
.data()
1990 data
.offset
= data
.offset
|| {}
1992 if (data
.offsetBottom
) data
.offset
.bottom
= data
.offsetBottom
1993 if (data
.offsetTop
) data
.offset
.top
= data
.offsetTop