aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
Diffstat (limited to 'Code/jinwei.me/mobile/js/bootstrap.js')
-rw-r--r--Code/jinwei.me/mobile/js/bootstrap.js1988
1 files changed, 1988 insertions, 0 deletions
diff --git a/Code/jinwei.me/mobile/js/bootstrap.js b/Code/jinwei.me/mobile/js/bootstrap.js
new file mode 100644
index 0000000..1019e52
--- /dev/null
+++ b/Code/jinwei.me/mobile/js/bootstrap.js
@@ -0,0 +1,1988 @@
1/*!
2 * Bootstrap v3.1.1 (http://getbootstrap.com)
3 * Copyright 2011-2014 Twitter, Inc.
4 * Licensed under MIT (https://github.com/twbs/bootstrap/blob/master/LICENSE)
5 */
6
7if (typeof jQuery === 'undefined') {
8 throw new Error('Bootstrap\'s JavaScript requires jQuery')
9}
10
11/* ========================================================================
12 * Bootstrap: transition.js v3.1.1
13 * http://getbootstrap.com/javascript/#transitions
14 * ========================================================================
15 * Copyright 2011-2014 Twitter, Inc.
16 * Licensed under MIT (https://github.com/twbs/bootstrap/blob/master/LICENSE)
17 * ======================================================================== */
18
19
20+ function($) {
21 'use strict';
22
23 // CSS TRANSITION SUPPORT (Shoutout: http://www.modernizr.com/)
24 // ============================================================
25
26 function transitionEnd() {
27 var el = document.createElement('bootstrap')
28
29 var transEndEventNames = {
30 'WebkitTransition': 'webkitTransitionEnd',
31 'MozTransition': 'transitionend',
32 'OTransition': 'oTransitionEnd otransitionend',
33 'transition': 'transitionend'
34 }
35
36 for (var name in transEndEventNames) {
37 if (el.style[name] !== undefined) {
38 return {
39 end: transEndEventNames[name]
40 }
41 }
42 }
43
44 return false // explicit for ie8 ( ._.)
45 }
46
47 // http://blog.alexmaccaw.com/css-transitions
48 $.fn.emulateTransitionEnd = function(duration) {
49 var called = false,
50 $el = this
51 $(this).one($.support.transition.end, function() {
52 called = true
53 })
54 var callback = function() {
55 if (!called) $($el).trigger($.support.transition.end)
56 }
57 setTimeout(callback, duration)
58 return this
59 }
60
61 $(function() {
62 $.support.transition = transitionEnd()
63 })
64
65}(jQuery);
66
67/* ========================================================================
68 * Bootstrap: alert.js v3.1.1
69 * http://getbootstrap.com/javascript/#alerts
70 * ========================================================================
71 * Copyright 2011-2014 Twitter, Inc.
72 * Licensed under MIT (https://github.com/twbs/bootstrap/blob/master/LICENSE)
73 * ======================================================================== */
74
75
76+ function($) {
77 'use strict';
78
79 // ALERT CLASS DEFINITION
80 // ======================
81
82 var dismiss = '[data-dismiss="alert"]'
83 var Alert = function(el) {
84 $(el).on('click', dismiss, this.close)
85 }
86
87 Alert.prototype.close = function(e) {
88 var $this = $(this)
89 var selector = $this.attr('data-target')
90
91 if (!selector) {
92 selector = $this.attr('href')
93 selector = selector && selector.replace(/.*(?=#[^\s]*$)/, '') // strip for ie7
94 }
95
96 var $parent = $(selector)
97
98 if (e) e.preventDefault()
99
100 if (!$parent.length) {
101 $parent = $this.hasClass('alert') ? $this : $this.parent()
102 }
103
104 $parent.trigger(e = $.Event('close.bs.alert'))
105
106 if (e.isDefaultPrevented()) return
107
108 $parent.removeClass('in')
109
110 function removeElement() {
111 $parent.trigger('closed.bs.alert').remove()
112 }
113
114 $.support.transition && $parent.hasClass('fade') ?
115 $parent
116 .one($.support.transition.end, removeElement)
117 .emulateTransitionEnd(150) :
118 removeElement()
119 }
120
121
122 // ALERT PLUGIN DEFINITION
123 // =======================
124
125 var old = $.fn.alert
126
127 $.fn.alert = function(option) {
128 return this.each(function() {
129 var $this = $(this)
130 var data = $this.data('bs.alert')
131
132 if (!data) $this.data('bs.alert', (data = new Alert(this)))
133 if (typeof option == 'string') data[option].call($this)
134 })
135 }
136
137 $.fn.alert.Constructor = Alert
138
139
140 // ALERT NO CONFLICT
141 // =================
142
143 $.fn.alert.noConflict = function() {
144 $.fn.alert = old
145 return this
146 }
147
148
149 // ALERT DATA-API
150 // ==============
151
152 $(document).on('click.bs.alert.data-api', dismiss, Alert.prototype.close)
153
154}(jQuery);
155
156/* ========================================================================
157 * Bootstrap: button.js v3.1.1
158 * http://getbootstrap.com/javascript/#buttons
159 * ========================================================================
160 * Copyright 2011-2014 Twitter, Inc.
161 * Licensed under MIT (https://github.com/twbs/bootstrap/blob/master/LICENSE)
162 * ======================================================================== */
163
164
165+ function($) {
166 'use strict';
167
168 // BUTTON PUBLIC CLASS DEFINITION
169 // ==============================
170
171 var Button = function(element, options) {
172 this.$element = $(element)
173 this.options = $.extend({}, Button.DEFAULTS, options)
174 this.isLoading = false
175 }
176
177 Button.DEFAULTS = {
178 loadingText: 'loading...'
179 }
180
181 Button.prototype.setState = function(state) {
182 var d = 'disabled'
183 var $el = this.$element
184 var val = $el.is('input') ? 'val' : 'html'
185 var data = $el.data()
186
187 state = state + 'Text'
188
189 if (!data.resetText) $el.data('resetText', $el[val]())
190
191 $el[val](data[state] || this.options[state])
192
193 // push to event loop to allow forms to submit
194 setTimeout($.proxy(function() {
195 if (state == 'loadingText') {
196 this.isLoading = true
197 $el.addClass(d).attr(d, d)
198 } else if (this.isLoading) {
199 this.isLoading = false
200 $el.removeClass(d).removeAttr(d)
201 }
202 }, this), 0)
203 }
204
205 Button.prototype.toggle = function() {
206 var changed = true
207 var $parent = this.$element.closest('[data-toggle="buttons"]')
208
209 if ($parent.length) {
210 var $input = this.$element.find('input')
211 if ($input.prop('type') == 'radio') {
212 if ($input.prop('checked') && this.$element.hasClass('active')) changed = false
213 else $parent.find('.active').removeClass('active')
214 }
215 if (changed) $input.prop('checked', !this.$element.hasClass('active')).trigger('change')
216 }
217
218 if (changed) this.$element.toggleClass('active')
219 }
220
221
222 // BUTTON PLUGIN DEFINITION
223 // ========================
224
225 var old = $.fn.button
226
227 $.fn.button = function(option) {
228 return this.each(function() {
229 var $this = $(this)
230 var data = $this.data('bs.button')
231 var options = typeof option == 'object' && option
232
233 if (!data) $this.data('bs.button', (data = new Button(this, options)))
234
235 if (option == 'toggle') data.toggle()
236 else if (option) data.setState(option)
237 })
238 }
239
240 $.fn.button.Constructor = Button
241
242
243 // BUTTON NO CONFLICT
244 // ==================
245
246 $.fn.button.noConflict = function() {
247 $.fn.button = old
248 return this
249 }
250
251
252 // BUTTON DATA-API
253 // ===============
254
255 $(document).on('click.bs.button.data-api', '[data-toggle^=button]', function(e) {
256 var $btn = $(e.target)
257 if (!$btn.hasClass('btn')) $btn = $btn.closest('.btn')
258 $btn.button('toggle')
259 e.preventDefault()
260 })
261
262}(jQuery);
263
264/* ========================================================================
265 * Bootstrap: carousel.js v3.1.1
266 * http://getbootstrap.com/javascript/#carousel
267 * ========================================================================
268 * Copyright 2011-2014 Twitter, Inc.
269 * Licensed under MIT (https://github.com/twbs/bootstrap/blob/master/LICENSE)
270 * ======================================================================== */
271
272
273+ function($) {
274 'use strict';
275
276 // CAROUSEL CLASS DEFINITION
277 // =========================
278
279 var Carousel = function(element, options) {
280 this.$element = $(element)
281 this.$indicators = this.$element.find('.carousel-indicators')
282 this.options = options
283 this.paused =
284 this.sliding =
285 this.interval =
286 this.$active =
287 this.$items = null
288
289 this.options.pause == 'hover' && this.$element
290 .on('mouseenter', $.proxy(this.pause, this))
291 .on('mouseleave', $.proxy(this.cycle, this))
292 }
293
294 Carousel.DEFAULTS = {
295 interval: 5000,
296 pause: 'hover',
297 wrap: true
298 }
299
300 Carousel.prototype.cycle = function(e) {
301 e || (this.paused = false)
302
303 this.interval && clearInterval(this.interval)
304
305 this.options.interval && !this.paused && (this.interval = setInterval($.proxy(this.next, this), this.options.interval))
306
307 return this
308 }
309
310 Carousel.prototype.getActiveIndex = function() {
311 this.$active = this.$element.find('.item.active')
312 this.$items = this.$active.parent().children()
313
314 return this.$items.index(this.$active)
315 }
316
317 Carousel.prototype.to = function(pos) {
318 var that = this
319 var activeIndex = this.getActiveIndex()
320
321 if (pos > (this.$items.length - 1) || pos < 0) return
322
323 if (this.sliding) return this.$element.one('slid.bs.carousel', function() {
324 that.to(pos)
325 })
326 if (activeIndex == pos) return this.pause().cycle()
327
328 return this.slide(pos > activeIndex ? 'next' : 'prev', $(this.$items[pos]))
329 }
330
331 Carousel.prototype.pause = function(e) {
332 e || (this.paused = true)
333
334 if (this.$element.find('.next, .prev').length && $.support.transition) {
335 this.$element.trigger($.support.transition.end)
336 this.cycle(true)
337 }
338
339 this.interval = clearInterval(this.interval)
340
341 return this
342 }
343
344 Carousel.prototype.next = function() {
345 if (this.sliding) return
346 return this.slide('next')
347 }
348
349 Carousel.prototype.prev = function() {
350 if (this.sliding) return
351 return this.slide('prev')
352 }
353
354 Carousel.prototype.slide = function(type, next) {
355 var $active = this.$element.find('.item.active')
356 var $next = next || $active[type]()
357 var isCycling = this.interval
358 var direction = type == 'next' ? 'left' : 'right'
359 var fallback = type == 'next' ? 'first' : 'last'
360 var that = this
361
362 if (!$next.length) {
363 if (!this.options.wrap) return
364 $next = this.$element.find('.item')[fallback]()
365 }
366
367 if ($next.hasClass('active')) return this.sliding = false
368
369 var e = $.Event('slide.bs.carousel', {
370 relatedTarget: $next[0],
371 direction: direction
372 })
373 this.$element.trigger(e)
374 if (e.isDefaultPrevented()) return
375
376 this.sliding = true
377
378 isCycling && this.pause()
379
380 if (this.$indicators.length) {
381 this.$indicators.find('.active').removeClass('active')
382 this.$element.one('slid.bs.carousel', function() {
383 var $nextIndicator = $(that.$indicators.children()[that.getActiveIndex()])
384 $nextIndicator && $nextIndicator.addClass('active')
385 })
386 }
387
388 if ($.support.transition && this.$element.hasClass('slide')) {
389 $next.addClass(type)
390 $next[0].offsetWidth // force reflow
391 $active.addClass(direction)
392 $next.addClass(direction)
393 $active
394 .one($.support.transition.end, function() {
395 $next.removeClass([type, direction].join(' ')).addClass('active')
396 $active.removeClass(['active', direction].join(' '))
397 that.sliding = false
398 setTimeout(function() {
399 that.$element.trigger('slid.bs.carousel')
400 }, 0)
401 })
402 .emulateTransitionEnd($active.css('transition-duration').slice(0, -1) * 1000)
403 } else {
404 $active.removeClass('active')
405 $next.addClass('active')
406 this.sliding = false
407 this.$element.trigger('slid.bs.carousel')
408 }
409
410 isCycling && this.cycle()
411
412 return this
413 }
414
415
416 // CAROUSEL PLUGIN DEFINITION
417 // ==========================
418
419 var old = $.fn.carousel
420
421 $.fn.carousel = function(option) {
422 return this.each(function() {
423 var $this = $(this)
424 var data = $this.data('bs.carousel')
425 var options = $.extend({}, Carousel.DEFAULTS, $this.data(), typeof option == 'object' && option)
426 var action = typeof option == 'string' ? option : options.slide
427
428 if (!data) $this.data('bs.carousel', (data = new Carousel(this, options)))
429 if (typeof option == 'number') data.to(option)
430 else if (action) data[action]()
431 else if (options.interval) data.pause().cycle()
432 })
433 }
434
435 $.fn.carousel.Constructor = Carousel
436
437
438 // CAROUSEL NO CONFLICT
439 // ====================
440
441 $.fn.carousel.noConflict = function() {
442 $.fn.carousel = old
443 return this
444 }
445
446
447 // CAROUSEL DATA-API
448 // =================
449
450 $(document).on('click.bs.carousel.data-api', '[data-slide], [data-slide-to]', function(e) {
451 var $this = $(this),
452 href
453 var $target = $($this.attr('data-target') || (href = $this.attr('href')) && href.replace(/.*(?=#[^\s]+$)/, '')) //strip for ie7
454 var options = $.extend({}, $target.data(), $this.data())
455 var slideIndex = $this.attr('data-slide-to')
456 if (slideIndex) options.interval = false
457
458 $target.carousel(options)
459
460 if (slideIndex = $this.attr('data-slide-to')) {
461 $target.data('bs.carousel').to(slideIndex)
462 }
463
464 e.preventDefault()
465 })
466
467 $(window).on('load', function() {
468 $('[data-ride="carousel"]').each(function() {
469 var $carousel = $(this)
470 $carousel.carousel($carousel.data())
471 })
472 })
473
474}(jQuery);
475
476/* ========================================================================
477 * Bootstrap: collapse.js v3.1.1
478 * http://getbootstrap.com/javascript/#collapse
479 * ========================================================================
480 * Copyright 2011-2014 Twitter, Inc.
481 * Licensed under MIT (https://github.com/twbs/bootstrap/blob/master/LICENSE)
482 * ======================================================================== */
483
484
485+ function($) {
486 'use strict';
487
488 // COLLAPSE PUBLIC CLASS DEFINITION
489 // ================================
490
491 var Collapse = function(element, options) {
492 this.$element = $(element)
493 this.options = $.extend({}, Collapse.DEFAULTS, options)
494 this.transitioning = null
495
496 if (this.options.parent) this.$parent = $(this.options.parent)
497 if (this.options.toggle) this.toggle()
498 }
499
500 Collapse.DEFAULTS = {
501 toggle: true
502 }
503
504 Collapse.prototype.dimension = function() {
505 var hasWidth = this.$element.hasClass('width')
506 return hasWidth ? 'width' : 'height'
507 }
508
509 Collapse.prototype.show = function() {
510 if (this.transitioning || this.$element.hasClass('in')) return
511
512 var startEvent = $.Event('show.bs.collapse')
513 this.$element.trigger(startEvent)
514 if (startEvent.isDefaultPrevented()) return
515
516 var actives = this.$parent && this.$parent.find('> .panel > .in')
517
518 if (actives && actives.length) {
519 var hasData = actives.data('bs.collapse')
520 if (hasData && hasData.transitioning) return
521 actives.collapse('hide')
522 hasData || actives.data('bs.collapse', null)
523 }
524
525 var dimension = this.dimension()
526
527 this.$element
528 .removeClass('collapse')
529 .addClass('collapsing')[dimension](0)
530
531 this.transitioning = 1
532
533 var complete = function() {
534 this.$element
535 .removeClass('collapsing')
536 .addClass('collapse in')[dimension]('auto')
537 this.transitioning = 0
538 this.$element.trigger('shown.bs.collapse')
539 }
540
541 if (!$.support.transition) return complete.call(this)
542
543 var scrollSize = $.camelCase(['scroll', dimension].join('-'))
544
545 this.$element
546 .one($.support.transition.end, $.proxy(complete, this))
547 .emulateTransitionEnd(350)[dimension](this.$element[0][scrollSize])
548 }
549
550 Collapse.prototype.hide = function() {
551 if (this.transitioning || !this.$element.hasClass('in')) return
552
553 var startEvent = $.Event('hide.bs.collapse')
554 this.$element.trigger(startEvent)
555 if (startEvent.isDefaultPrevented()) return
556
557 var dimension = this.dimension()
558
559 this.$element[dimension](this.$element[dimension]())[0].offsetHeight
560
561 this.$element
562 .addClass('collapsing')
563 .removeClass('collapse')
564 .removeClass('in')
565
566 this.transitioning = 1
567
568 var complete = function() {
569 this.transitioning = 0
570 this.$element
571 .trigger('hidden.bs.collapse')
572 .removeClass('collapsing')
573 .addClass('collapse')
574 }
575
576 if (!$.support.transition) return complete.call(this)
577
578 this.$element[dimension](0)
579 .one($.support.transition.end, $.proxy(complete, this))
580 .emulateTransitionEnd(350)
581 }
582
583 Collapse.prototype.toggle = function() {
584 this[this.$element.hasClass('in') ? 'hide' : 'show']()
585 }
586
587
588 // COLLAPSE PLUGIN DEFINITION
589 // ==========================
590
591 var old = $.fn.collapse
592
593 $.fn.collapse = function(option) {
594 return this.each(function() {
595 var $this = $(this)
596 var data = $this.data('bs.collapse')
597 var options = $.extend({}, Collapse.DEFAULTS, $this.data(), typeof option == 'object' && option)
598
599 if (!data && options.toggle && option == 'show') option = !option
600 if (!data) $this.data('bs.collapse', (data = new Collapse(this, options)))
601 if (typeof option == 'string') data[option]()
602 })
603 }
604
605 $.fn.collapse.Constructor = Collapse
606
607
608 // COLLAPSE NO CONFLICT
609 // ====================
610
611 $.fn.collapse.noConflict = function() {
612 $.fn.collapse = old
613 return this
614 }
615
616
617 // COLLAPSE DATA-API
618 // =================
619
620 $(document).on('click.bs.collapse.data-api', '[data-toggle=collapse]', function(e) {
621 var $this = $(this),
622 href
623 var target = $this.attr('data-target') || e.preventDefault() || (href = $this.attr('href')) && href.replace(/.*(?=#[^\s]+$)/, '') //strip for ie7
624 var $target = $(target)
625 var data = $target.data('bs.collapse')
626 var option = data ? 'toggle' : $this.data()
627 var parent = $this.attr('data-parent')
628 var $parent = parent && $(parent)
629
630 if (!data || !data.transitioning) {
631 if ($parent) $parent.find('[data-toggle=collapse][data-parent="' + parent + '"]').not($this).addClass('collapsed')
632 $this[$target.hasClass('in') ? 'addClass' : 'removeClass']('collapsed')
633 }
634
635 $target.collapse(option)
636 })
637
638}(jQuery);
639
640/* ========================================================================
641 * Bootstrap: dropdown.js v3.1.1
642 * http://getbootstrap.com/javascript/#dropdowns
643 * ========================================================================
644 * Copyright 2011-2014 Twitter, Inc.
645 * Licensed under MIT (https://github.com/twbs/bootstrap/blob/master/LICENSE)
646 * ======================================================================== */
647
648
649+ function($) {
650 'use strict';
651
652 // DROPDOWN CLASS DEFINITION
653 // =========================
654
655 var backdrop = '.dropdown-backdrop'
656 var toggle = '[data-toggle=dropdown]'
657 var Dropdown = function(element) {
658 $(element).on('click.bs.dropdown', this.toggle)
659 }
660
661 Dropdown.prototype.toggle = function(e) {
662 var $this = $(this)
663
664 if ($this.is('.disabled, :disabled')) return
665
666 var $parent = getParent($this)
667 var isActive = $parent.hasClass('open')
668
669 clearMenus()
670
671 if (!isActive) {
672 if ('ontouchstart' in document.documentElement && !$parent.closest('.navbar-nav').length) {
673 // if mobile we use a backdrop because click events don't delegate
674 $('<div class="dropdown-backdrop"/>').insertAfter($(this)).on('click', clearMenus)
675 }
676
677 var relatedTarget = {
678 relatedTarget: this
679 }
680 $parent.trigger(e = $.Event('show.bs.dropdown', relatedTarget))
681
682 if (e.isDefaultPrevented()) return
683
684 $parent
685 .toggleClass('open')
686 .trigger('shown.bs.dropdown', relatedTarget)
687
688 $this.focus()
689 }
690
691 return false
692 }
693
694 Dropdown.prototype.keydown = function(e) {
695 if (!/(38|40|27)/.test(e.keyCode)) return
696
697 var $this = $(this)
698
699 e.preventDefault()
700 e.stopPropagation()
701
702 if ($this.is('.disabled, :disabled')) return
703
704 var $parent = getParent($this)
705 var isActive = $parent.hasClass('open')
706
707 if (!isActive || (isActive && e.keyCode == 27)) {
708 if (e.which == 27) $parent.find(toggle).focus()
709 return $this.click()
710 }
711
712 var desc = ' li:not(.divider):visible a'
713 var $items = $parent.find('[role=menu]' + desc + ', [role=listbox]' + desc)
714
715 if (!$items.length) return
716
717 var index = $items.index($items.filter(':focus'))
718
719 if (e.keyCode == 38 && index > 0) index-- // up
720 if (e.keyCode == 40 && index < $items.length - 1) index++ // down
721 if (!~index) index = 0
722
723 $items.eq(index).focus()
724 }
725
726 function clearMenus(e) {
727 $(backdrop).remove()
728 $(toggle).each(function() {
729 var $parent = getParent($(this))
730 var relatedTarget = {
731 relatedTarget: this
732 }
733 if (!$parent.hasClass('open')) return
734 $parent.trigger(e = $.Event('hide.bs.dropdown', relatedTarget))
735 if (e.isDefaultPrevented()) return
736 $parent.removeClass('open').trigger('hidden.bs.dropdown', relatedTarget)
737 })
738 }
739
740 function getParent($this) {
741 var selector = $this.attr('data-target')
742
743 if (!selector) {
744 selector = $this.attr('href')
745 selector = selector && /#[A-Za-z]/.test(selector) && selector.replace(/.*(?=#[^\s]*$)/, '') //strip for ie7
746 }
747
748 var $parent = selector && $(selector)
749
750 return $parent && $parent.length ? $parent : $this.parent()
751 }
752
753
754 // DROPDOWN PLUGIN DEFINITION
755 // ==========================
756
757 var old = $.fn.dropdown
758
759 $.fn.dropdown = function(option) {
760 return this.each(function() {
761 var $this = $(this)
762 var data = $this.data('bs.dropdown')
763
764 if (!data) $this.data('bs.dropdown', (data = new Dropdown(this)))
765 if (typeof option == 'string') data[option].call($this)
766 })
767 }
768
769 $.fn.dropdown.Constructor = Dropdown
770
771
772 // DROPDOWN NO CONFLICT
773 // ====================
774
775 $.fn.dropdown.noConflict = function() {
776 $.fn.dropdown = old
777 return this
778 }
779
780
781 // APPLY TO STANDARD DROPDOWN ELEMENTS
782 // ===================================
783
784 $(document)
785 .on('click.bs.dropdown.data-api', clearMenus)
786 .on('click.bs.dropdown.data-api', '.dropdown form', function(e) {
787 e.stopPropagation()
788 })
789 .on('click.bs.dropdown.data-api', toggle, Dropdown.prototype.toggle)
790 .on('keydown.bs.dropdown.data-api', toggle + ', [role=menu], [role=listbox]', Dropdown.prototype.keydown)
791
792}(jQuery);
793
794/* ========================================================================
795 * Bootstrap: modal.js v3.1.1
796 * http://getbootstrap.com/javascript/#modals
797 * ========================================================================
798 * Copyright 2011-2014 Twitter, Inc.
799 * Licensed under MIT (https://github.com/twbs/bootstrap/blob/master/LICENSE)
800 * ======================================================================== */
801
802
803+ function($) {
804 'use strict';
805
806 // MODAL CLASS DEFINITION
807 // ======================
808
809 var Modal = function(element, options) {
810 this.options = options
811 this.$element = $(element)
812 this.$backdrop =
813 this.isShown = null
814
815 if (this.options.remote) {
816 this.$element
817 .find('.modal-content')
818 .load(this.options.remote, $.proxy(function() {
819 this.$element.trigger('loaded.bs.modal')
820 }, this))
821 }
822 }
823
824 Modal.DEFAULTS = {
825 backdrop: true,
826 keyboard: true,
827 show: true
828 }
829
830 Modal.prototype.toggle = function(_relatedTarget) {
831 return this[!this.isShown ? 'show' : 'hide'](_relatedTarget)
832 }
833
834 Modal.prototype.show = function(_relatedTarget) {
835 var that = this
836 var e = $.Event('show.bs.modal', {
837 relatedTarget: _relatedTarget
838 })
839
840 this.$element.trigger(e)
841
842 if (this.isShown || e.isDefaultPrevented()) return
843
844 this.isShown = true
845
846 this.escape()
847
848 this.$element.on('click.dismiss.bs.modal', '[data-dismiss="modal"]', $.proxy(this.hide, this))
849
850 this.backdrop(function() {
851 var transition = $.support.transition && that.$element.hasClass('fade')
852
853 if (!that.$element.parent().length) {
854 that.$element.appendTo(document.body) // don't move modals dom position
855 }
856
857 that.$element
858 .show()
859 .scrollTop(0)
860
861 if (transition) {
862 that.$element[0].offsetWidth // force reflow
863 }
864
865 that.$element
866 .addClass('in')
867 .attr('aria-hidden', false)
868
869 that.enforceFocus()
870
871 var e = $.Event('shown.bs.modal', {
872 relatedTarget: _relatedTarget
873 })
874
875 transition ?
876 that.$element.find('.modal-dialog') // wait for modal to slide in
877 .one($.support.transition.end, function() {
878 that.$element.focus().trigger(e)
879 })
880 .emulateTransitionEnd(300) :
881 that.$element.focus().trigger(e)
882 })
883 }
884
885 Modal.prototype.hide = function(e) {
886 if (e) e.preventDefault()
887
888 e = $.Event('hide.bs.modal')
889
890 this.$element.trigger(e)
891
892 if (!this.isShown || e.isDefaultPrevented()) return
893
894 this.isShown = false
895
896 this.escape()
897
898 $(document).off('focusin.bs.modal')
899
900 this.$element
901 .removeClass('in')
902 .attr('aria-hidden', true)
903 .off('click.dismiss.bs.modal')
904
905 $.support.transition && this.$element.hasClass('fade') ?
906 this.$element
907 .one($.support.transition.end, $.proxy(this.hideModal, this))
908 .emulateTransitionEnd(300) :
909 this.hideModal()
910 }
911
912 Modal.prototype.enforceFocus = function() {
913 $(document)
914 .off('focusin.bs.modal') // guard against infinite focus loop
915 .on('focusin.bs.modal', $.proxy(function(e) {
916 if (this.$element[0] !== e.target && !this.$element.has(e.target).length) {
917 this.$element.focus()
918 }
919 }, this))
920 }
921
922 Modal.prototype.escape = function() {
923 if (this.isShown && this.options.keyboard) {
924 this.$element.on('keyup.dismiss.bs.modal', $.proxy(function(e) {
925 e.which == 27 && this.hide()
926 }, this))
927 } else if (!this.isShown) {
928 this.$element.off('keyup.dismiss.bs.modal')
929 }
930 }
931
932 Modal.prototype.hideModal = function() {
933 var that = this
934 this.$element.hide()
935 this.backdrop(function() {
936 that.removeBackdrop()
937 that.$element.trigger('hidden.bs.modal')
938 })
939 }
940
941 Modal.prototype.removeBackdrop = function() {
942 this.$backdrop && this.$backdrop.remove()
943 this.$backdrop = null
944 }
945
946 Modal.prototype.backdrop = function(callback) {
947 var animate = this.$element.hasClass('fade') ? 'fade' : ''
948
949 if (this.isShown && this.options.backdrop) {
950 var doAnimate = $.support.transition && animate
951
952 this.$backdrop = $('<div class="modal-backdrop ' + animate + '" />')
953 .appendTo(document.body)
954
955 this.$element.on('click.dismiss.bs.modal', $.proxy(function(e) {
956 if (e.target !== e.currentTarget) return
957 this.options.backdrop == 'static' ? this.$element[0].focus.call(this.$element[0]) : this.hide.call(this)
958 }, this))
959
960 if (doAnimate) this.$backdrop[0].offsetWidth // force reflow
961
962 this.$backdrop.addClass('in')
963
964 if (!callback) return
965
966 doAnimate ?
967 this.$backdrop
968 .one($.support.transition.end, callback)
969 .emulateTransitionEnd(150) :
970 callback()
971
972 } else if (!this.isShown && this.$backdrop) {
973 this.$backdrop.removeClass('in')
974
975 $.support.transition && this.$element.hasClass('fade') ?
976 this.$backdrop
977 .one($.support.transition.end, callback)
978 .emulateTransitionEnd(150) :
979 callback()
980
981 } else if (callback) {
982 callback()
983 }
984 }
985
986
987 // MODAL PLUGIN DEFINITION
988 // =======================
989
990 var old = $.fn.modal
991
992 $.fn.modal = function(option, _relatedTarget) {
993 return this.each(function() {
994 var $this = $(this)
995 var data = $this.data('bs.modal')
996 var options = $.extend({}, Modal.DEFAULTS, $this.data(), typeof option == 'object' && option)
997
998 if (!data) $this.data('bs.modal', (data = new Modal(this, options)))
999 if (typeof option == 'string') data[option](_relatedTarget)
1000 else if (options.show) data.show(_relatedTarget)
1001 })
1002 }
1003
1004 $.fn.modal.Constructor = Modal
1005
1006
1007 // MODAL NO CONFLICT
1008 // =================
1009
1010 $.fn.modal.noConflict = function() {
1011 $.fn.modal = old
1012 return this
1013 }
1014
1015
1016 // MODAL DATA-API
1017 // ==============
1018
1019 $(document).on('click.bs.modal.data-api', '[data-toggle="modal"]', function(e) {
1020 var $this = $(this)
1021 var href = $this.attr('href')
1022 var $target = $($this.attr('data-target') || (href && href.replace(/.*(?=#[^\s]+$)/, ''))) //strip for ie7
1023 var option = $target.data('bs.modal') ? 'toggle' : $.extend({
1024 remote: !/#/.test(href) && href
1025 }, $target.data(), $this.data())
1026
1027 if ($this.is('a')) e.preventDefault()
1028
1029 $target
1030 .modal(option, this)
1031 .one('hide', function() {
1032 $this.is(':visible') && $this.focus()
1033 })
1034 })
1035
1036 $(document)
1037 .on('show.bs.modal', '.modal', function() {
1038 $(document.body).addClass('modal-open')
1039 })
1040 .on('hidden.bs.modal', '.modal', function() {
1041 $(document.body).removeClass('modal-open')
1042 })
1043
1044}(jQuery);
1045
1046/* ========================================================================
1047 * Bootstrap: tooltip.js v3.1.1
1048 * http://getbootstrap.com/javascript/#tooltip
1049 * Inspired by the original jQuery.tipsy by Jason Frame
1050 * ========================================================================
1051 * Copyright 2011-2014 Twitter, Inc.
1052 * Licensed under MIT (https://github.com/twbs/bootstrap/blob/master/LICENSE)
1053 * ======================================================================== */
1054
1055
1056+ function($) {
1057 'use strict';
1058
1059 // TOOLTIP PUBLIC CLASS DEFINITION
1060 // ===============================
1061
1062 var Tooltip = function(element, options) {
1063 this.type =
1064 this.options =
1065 this.enabled =
1066 this.timeout =
1067 this.hoverState =
1068 this.$element = null
1069
1070 this.init('tooltip', element, options)
1071 }
1072
1073 Tooltip.DEFAULTS = {
1074 animation: true,
1075 placement: 'top',
1076 selector: false,
1077 template: '<div class="tooltip"><div class="tooltip-arrow"></div><div class="tooltip-inner"></div></div>',
1078 trigger: 'hover focus',
1079 title: '',
1080 delay: 0,
1081 html: false,
1082 container: false
1083 }
1084
1085 Tooltip.prototype.init = function(type, element, options) {
1086 this.enabled = true
1087 this.type = type
1088 this.$element = $(element)
1089 this.options = this.getOptions(options)
1090
1091 var triggers = this.options.trigger.split(' ')
1092
1093 for (var i = triggers.length; i--;) {
1094 var trigger = triggers[i]
1095
1096 if (trigger == 'click') {
1097 this.$element.on('click.' + this.type, this.options.selector, $.proxy(this.toggle, this))
1098 } else if (trigger != 'manual') {
1099 var eventIn = trigger == 'hover' ? 'mouseenter' : 'focusin'
1100 var eventOut = trigger == 'hover' ? 'mouseleave' : 'focusout'
1101
1102 this.$element.on(eventIn + '.' + this.type, this.options.selector, $.proxy(this.enter, this))
1103 this.$element.on(eventOut + '.' + this.type, this.options.selector, $.proxy(this.leave, this))
1104 }
1105 }
1106
1107 this.options.selector ?
1108 (this._options = $.extend({}, this.options, {
1109 trigger: 'manual',
1110 selector: ''
1111 })) :
1112 this.fixTitle()
1113 }
1114
1115 Tooltip.prototype.getDefaults = function() {
1116 return Tooltip.DEFAULTS
1117 }
1118
1119 Tooltip.prototype.getOptions = function(options) {
1120 options = $.extend({}, this.getDefaults(), this.$element.data(), options)
1121
1122 if (options.delay && typeof options.delay == 'number') {
1123 options.delay = {
1124 show: options.delay,
1125 hide: options.delay
1126 }
1127 }
1128
1129 return options
1130 }
1131
1132 Tooltip.prototype.getDelegateOptions = function() {
1133 var options = {}
1134 var defaults = this.getDefaults()
1135
1136 this._options && $.each(this._options, function(key, value) {
1137 if (defaults[key] != value) options[key] = value
1138 })
1139
1140 return options
1141 }
1142
1143 Tooltip.prototype.enter = function(obj) {
1144 var self = obj instanceof this.constructor ?
1145 obj : $(obj.currentTarget)[this.type](this.getDelegateOptions()).data('bs.' + this.type)
1146
1147 clearTimeout(self.timeout)
1148
1149 self.hoverState = 'in'
1150
1151 if (!self.options.delay || !self.options.delay.show) return self.show()
1152
1153 self.timeout = setTimeout(function() {
1154 if (self.hoverState == 'in') self.show()
1155 }, self.options.delay.show)
1156 }
1157
1158 Tooltip.prototype.leave = function(obj) {
1159 var self = obj instanceof this.constructor ?
1160 obj : $(obj.currentTarget)[this.type](this.getDelegateOptions()).data('bs.' + this.type)
1161
1162 clearTimeout(self.timeout)
1163
1164 self.hoverState = 'out'
1165
1166 if (!self.options.delay || !self.options.delay.hide) return self.hide()
1167
1168 self.timeout = setTimeout(function() {
1169 if (self.hoverState == 'out') self.hide()
1170 }, self.options.delay.hide)
1171 }
1172
1173 Tooltip.prototype.show = function() {
1174 var e = $.Event('show.bs.' + this.type)
1175
1176 if (this.hasContent() && this.enabled) {
1177 this.$element.trigger(e)
1178
1179 if (e.isDefaultPrevented()) return
1180 var that = this;
1181
1182 var $tip = this.tip()
1183
1184 this.setContent()
1185
1186 if (this.options.animation) $tip.addClass('fade')
1187
1188 var placement = typeof this.options.placement == 'function' ?
1189 this.options.placement.call(this, $tip[0], this.$element[0]) :
1190 this.options.placement
1191
1192 var autoToken = /\s?auto?\s?/i
1193 var autoPlace = autoToken.test(placement)
1194 if (autoPlace) placement = placement.replace(autoToken, '') || 'top'
1195
1196 $tip
1197 .detach()
1198 .css({
1199 top: 0,
1200 left: 0,
1201 display: 'block'
1202 })
1203 .addClass(placement)
1204
1205 this.options.container ? $tip.appendTo(this.options.container) : $tip.insertAfter(this.$element)
1206
1207 var pos = this.getPosition()
1208 var actualWidth = $tip[0].offsetWidth
1209 var actualHeight = $tip[0].offsetHeight
1210
1211 if (autoPlace) {
1212 var $parent = this.$element.parent()
1213
1214 var orgPlacement = placement
1215 var docScroll = document.documentElement.scrollTop || document.body.scrollTop
1216 var parentWidth = this.options.container == 'body' ? window.innerWidth : $parent.outerWidth()
1217 var parentHeight = this.options.container == 'body' ? window.innerHeight : $parent.outerHeight()
1218 var parentLeft = this.options.container == 'body' ? 0 : $parent.offset().left
1219
1220 placement = placement == 'bottom' && pos.top + pos.height + actualHeight - docScroll > parentHeight ? 'top' :
1221 placement == 'top' && pos.top - docScroll - actualHeight < 0 ? 'bottom' :
1222 placement == 'right' && pos.right + actualWidth > parentWidth ? 'left' :
1223 placement == 'left' && pos.left - actualWidth < parentLeft ? 'right' :
1224 placement
1225
1226 $tip
1227 .removeClass(orgPlacement)
1228 .addClass(placement)
1229 }
1230
1231 var calculatedOffset = this.getCalculatedOffset(placement, pos, actualWidth, actualHeight)
1232
1233 this.applyPlacement(calculatedOffset, placement)
1234 this.hoverState = null
1235
1236 var complete = function() {
1237 that.$element.trigger('shown.bs.' + that.type)
1238 }
1239
1240 $.support.transition && this.$tip.hasClass('fade') ?
1241 $tip
1242 .one($.support.transition.end, complete)
1243 .emulateTransitionEnd(150) :
1244 complete()
1245 }
1246 }
1247
1248 Tooltip.prototype.applyPlacement = function(offset, placement) {
1249 var replace
1250 var $tip = this.tip()
1251 var width = $tip[0].offsetWidth
1252 var height = $tip[0].offsetHeight
1253
1254 // manually read margins because getBoundingClientRect includes difference
1255 var marginTop = parseInt($tip.css('margin-top'), 10)
1256 var marginLeft = parseInt($tip.css('margin-left'), 10)
1257
1258 // we must check for NaN for ie 8/9
1259 if (isNaN(marginTop)) marginTop = 0
1260 if (isNaN(marginLeft)) marginLeft = 0
1261
1262 offset.top = offset.top + marginTop
1263 offset.left = offset.left + marginLeft
1264
1265 // $.fn.offset doesn't round pixel values
1266 // so we use setOffset directly with our own function B-0
1267 $.offset.setOffset($tip[0], $.extend({
1268 using: function(props) {
1269 $tip.css({
1270 top: Math.round(props.top),
1271 left: Math.round(props.left)
1272 })
1273 }
1274 }, offset), 0)
1275
1276 $tip.addClass('in')
1277
1278 // check to see if placing tip in new offset caused the tip to resize itself
1279 var actualWidth = $tip[0].offsetWidth
1280 var actualHeight = $tip[0].offsetHeight
1281
1282 if (placement == 'top' && actualHeight != height) {
1283 replace = true
1284 offset.top = offset.top + height - actualHeight
1285 }
1286
1287 if (/bottom|top/.test(placement)) {
1288 var delta = 0
1289
1290 if (offset.left < 0) {
1291 delta = offset.left * -2
1292 offset.left = 0
1293
1294 $tip.offset(offset)
1295
1296 actualWidth = $tip[0].offsetWidth
1297 actualHeight = $tip[0].offsetHeight
1298 }
1299
1300 this.replaceArrow(delta - width + actualWidth, actualWidth, 'left')
1301 } else {
1302 this.replaceArrow(actualHeight - height, actualHeight, 'top')
1303 }
1304
1305 if (replace) $tip.offset(offset)
1306 }
1307
1308 Tooltip.prototype.replaceArrow = function(delta, dimension, position) {
1309 this.arrow().css(position, delta ? (50 * (1 - delta / dimension) + '%') : '')
1310 }
1311
1312 Tooltip.prototype.setContent = function() {
1313 var $tip = this.tip()
1314 var title = this.getTitle()
1315
1316 $tip.find('.tooltip-inner')[this.options.html ? 'html' : 'text'](title)
1317 $tip.removeClass('fade in top bottom left right')
1318 }
1319
1320 Tooltip.prototype.hide = function() {
1321 var that = this
1322 var $tip = this.tip()
1323 var e = $.Event('hide.bs.' + this.type)
1324
1325 function complete() {
1326 if (that.hoverState != 'in') $tip.detach()
1327 that.$element.trigger('hidden.bs.' + that.type)
1328 }
1329
1330 this.$element.trigger(e)
1331
1332 if (e.isDefaultPrevented()) return
1333
1334 $tip.removeClass('in')
1335
1336 $.support.transition && this.$tip.hasClass('fade') ?
1337 $tip
1338 .one($.support.transition.end, complete)
1339 .emulateTransitionEnd(150) :
1340 complete()
1341
1342 this.hoverState = null
1343
1344 return this
1345 }
1346
1347 Tooltip.prototype.fixTitle = function() {
1348 var $e = this.$element
1349 if ($e.attr('title') || typeof($e.attr('data-original-title')) != 'string') {
1350 $e.attr('data-original-title', $e.attr('title') || '').attr('title', '')
1351 }
1352 }
1353
1354 Tooltip.prototype.hasContent = function() {
1355 return this.getTitle()
1356 }
1357
1358 Tooltip.prototype.getPosition = function() {
1359 var el = this.$element[0]
1360 return $.extend({}, (typeof el.getBoundingClientRect == 'function') ? el.getBoundingClientRect() : {
1361 width: el.offsetWidth,
1362 height: el.offsetHeight
1363 }, this.$element.offset())
1364 }
1365
1366 Tooltip.prototype.getCalculatedOffset = function(placement, pos, actualWidth, actualHeight) {
1367 return placement == 'bottom' ? {
1368 top: pos.top + pos.height,
1369 left: pos.left + pos.width / 2 - actualWidth / 2
1370 } :
1371 placement == 'top' ? {
1372 top: pos.top - actualHeight,
1373 left: pos.left + pos.width / 2 - actualWidth / 2
1374 } :
1375 placement == 'left' ? {
1376 top: pos.top + pos.height / 2 - actualHeight / 2,
1377 left: pos.left - actualWidth
1378 } :
1379 /* placement == 'right' */
1380 {
1381 top: pos.top + pos.height / 2 - actualHeight / 2,
1382 left: pos.left + pos.width
1383 }
1384 }
1385
1386 Tooltip.prototype.getTitle = function() {
1387 var title
1388 var $e = this.$element
1389 var o = this.options
1390
1391 title = $e.attr('data-original-title') || (typeof o.title == 'function' ? o.title.call($e[0]) : o.title)
1392
1393 return title
1394 }
1395
1396 Tooltip.prototype.tip = function() {
1397 return this.$tip = this.$tip || $(this.options.template)
1398 }
1399
1400 Tooltip.prototype.arrow = function() {
1401 return this.$arrow = this.$arrow || this.tip().find('.tooltip-arrow')
1402 }
1403
1404 Tooltip.prototype.validate = function() {
1405 if (!this.$element[0].parentNode) {
1406 this.hide()
1407 this.$element = null
1408 this.options = null
1409 }
1410 }
1411
1412 Tooltip.prototype.enable = function() {
1413 this.enabled = true
1414 }
1415
1416 Tooltip.prototype.disable = function() {
1417 this.enabled = false
1418 }
1419
1420 Tooltip.prototype.toggleEnabled = function() {
1421 this.enabled = !this.enabled
1422 }
1423
1424 Tooltip.prototype.toggle = function(e) {
1425 var self = e ? $(e.currentTarget)[this.type](this.getDelegateOptions()).data('bs.' + this.type) : this
1426 self.tip().hasClass('in') ? self.leave(self) : self.enter(self)
1427 }
1428
1429 Tooltip.prototype.destroy = function() {
1430 clearTimeout(this.timeout)
1431 this.hide().$element.off('.' + this.type).removeData('bs.' + this.type)
1432 }
1433
1434
1435 // TOOLTIP PLUGIN DEFINITION
1436 // =========================
1437
1438 var old = $.fn.tooltip
1439
1440 $.fn.tooltip = function(option) {
1441 return this.each(function() {
1442 var $this = $(this)
1443 var data = $this.data('bs.tooltip')
1444 var options = typeof option == 'object' && option
1445
1446 if (!data && option == 'destroy') return
1447 if (!data) $this.data('bs.tooltip', (data = new Tooltip(this, options)))
1448 if (typeof option == 'string') data[option]()
1449 })
1450 }
1451
1452 $.fn.tooltip.Constructor = Tooltip
1453
1454
1455 // TOOLTIP NO CONFLICT
1456 // ===================
1457
1458 $.fn.tooltip.noConflict = function() {
1459 $.fn.tooltip = old
1460 return this
1461 }
1462
1463}(jQuery);
1464
1465/* ========================================================================
1466 * Bootstrap: popover.js v3.1.1
1467 * http://getbootstrap.com/javascript/#popovers
1468 * ========================================================================
1469 * Copyright 2011-2014 Twitter, Inc.
1470 * Licensed under MIT (https://github.com/twbs/bootstrap/blob/master/LICENSE)
1471 * ======================================================================== */
1472
1473
1474+ function($) {
1475 'use strict';
1476
1477 // POPOVER PUBLIC CLASS DEFINITION
1478 // ===============================
1479
1480 var Popover = function(element, options) {
1481 this.init('popover', element, options)
1482 }
1483
1484 if (!$.fn.tooltip) throw new Error('Popover requires tooltip.js')
1485
1486 Popover.DEFAULTS = $.extend({}, $.fn.tooltip.Constructor.DEFAULTS, {
1487 placement: 'right',
1488 trigger: 'click',
1489 content: '',
1490 template: '<div class="popover"><div class="arrow"></div><h3 class="popover-title"></h3><div class="popover-content"></div></div>'
1491 })
1492
1493
1494 // NOTE: POPOVER EXTENDS tooltip.js
1495 // ================================
1496
1497 Popover.prototype = $.extend({}, $.fn.tooltip.Constructor.prototype)
1498
1499 Popover.prototype.constructor = Popover
1500
1501 Popover.prototype.getDefaults = function() {
1502 return Popover.DEFAULTS
1503 }
1504
1505 Popover.prototype.setContent = function() {
1506 var $tip = this.tip()
1507 var title = this.getTitle()
1508 var content = this.getContent()
1509
1510 $tip.find('.popover-title')[this.options.html ? 'html' : 'text'](title)
1511 $tip.find('.popover-content')[ // we use append for html objects to maintain js events
1512 this.options.html ? (typeof content == 'string' ? 'html' : 'append') : 'text'
1513 ](content)
1514
1515 $tip.removeClass('fade top bottom left right in')
1516
1517 // IE8 doesn't accept hiding via the `:empty` pseudo selector, we have to do
1518 // this manually by checking the contents.
1519 if (!$tip.find('.popover-title').html()) $tip.find('.popover-title').hide()
1520 }
1521
1522 Popover.prototype.hasContent = function() {
1523 return this.getTitle() || this.getContent()
1524 }
1525
1526 Popover.prototype.getContent = function() {
1527 var $e = this.$element
1528 var o = this.options
1529
1530 return $e.attr('data-content') || (typeof o.content == 'function' ?
1531 o.content.call($e[0]) :
1532 o.content)
1533 }
1534
1535 Popover.prototype.arrow = function() {
1536 return this.$arrow = this.$arrow || this.tip().find('.arrow')
1537 }
1538
1539 Popover.prototype.tip = function() {
1540 if (!this.$tip) this.$tip = $(this.options.template)
1541 return this.$tip
1542 }
1543
1544
1545 // POPOVER PLUGIN DEFINITION
1546 // =========================
1547
1548 var old = $.fn.popover
1549
1550 $.fn.popover = function(option) {
1551 return this.each(function() {
1552 var $this = $(this)
1553 var data = $this.data('bs.popover')
1554 var options = typeof option == 'object' && option
1555
1556 if (!data && option == 'destroy') return
1557 if (!data) $this.data('bs.popover', (data = new Popover(this, options)))
1558 if (typeof option == 'string') data[option]()
1559 })
1560 }
1561
1562 $.fn.popover.Constructor = Popover
1563
1564
1565 // POPOVER NO CONFLICT
1566 // ===================
1567
1568 $.fn.popover.noConflict = function() {
1569 $.fn.popover = old
1570 return this
1571 }
1572
1573}(jQuery);
1574
1575/* ========================================================================
1576 * Bootstrap: scrollspy.js v3.1.1
1577 * http://getbootstrap.com/javascript/#scrollspy
1578 * ========================================================================
1579 * Copyright 2011-2014 Twitter, Inc.
1580 * Licensed under MIT (https://github.com/twbs/bootstrap/blob/master/LICENSE)
1581 * ======================================================================== */
1582
1583
1584+ function($) {
1585 'use strict';
1586
1587 // SCROLLSPY CLASS DEFINITION
1588 // ==========================
1589
1590 function ScrollSpy(element, options) {
1591 var href
1592 var process = $.proxy(this.process, this)
1593
1594 this.$element = $(element).is('body') ? $(window) : $(element)
1595 this.$body = $('body')
1596 this.$scrollElement = this.$element.on('scroll.bs.scroll-spy.data-api', process)
1597 this.options = $.extend({}, ScrollSpy.DEFAULTS, options)
1598 this.selector = (this.options.target || ((href = $(element).attr('href')) && href.replace(/.*(?=#[^\s]+$)/, '')) //strip for ie7
1599 || '') + ' .nav li > a'
1600 this.offsets = $([])
1601 this.targets = $([])
1602 this.activeTarget = null
1603
1604 this.refresh()
1605 this.process()
1606 }
1607
1608 ScrollSpy.DEFAULTS = {
1609 offset: 10
1610 }
1611
1612 ScrollSpy.prototype.refresh = function() {
1613 var offsetMethod = this.$element[0] == window ? 'offset' : 'position'
1614
1615 this.offsets = $([])
1616 this.targets = $([])
1617
1618 var self = this
1619 var $targets = this.$body
1620 .find(this.selector)
1621 .map(function() {
1622 var $el = $(this)
1623 var href = $el.data('target') || $el.attr('href')
1624 var $href = /^#./.test(href) && $(href)
1625
1626 return ($href && $href.length && $href.is(':visible') && [
1627 [$href[offsetMethod]().top + (!$.isWindow(self.$scrollElement.get(0)) && self.$scrollElement.scrollTop()), href]
1628 ]) || null
1629 })
1630 .sort(function(a, b) {
1631 return a[0] - b[0]
1632 })
1633 .each(function() {
1634 self.offsets.push(this[0])
1635 self.targets.push(this[1])
1636 })
1637 }
1638
1639 ScrollSpy.prototype.process = function() {
1640 var scrollTop = this.$scrollElement.scrollTop() + this.options.offset
1641 var scrollHeight = this.$scrollElement[0].scrollHeight || this.$body[0].scrollHeight
1642 var maxScroll = scrollHeight - this.$scrollElement.height()
1643 var offsets = this.offsets
1644 var targets = this.targets
1645 var activeTarget = this.activeTarget
1646 var i
1647
1648 if (scrollTop >= maxScroll) {
1649 return activeTarget != (i = targets.last()[0]) && this.activate(i)
1650 }
1651
1652 if (activeTarget && scrollTop <= offsets[0]) {
1653 return activeTarget != (i = targets[0]) && this.activate(i)
1654 }
1655
1656 for (i = offsets.length; i--;) {
1657 activeTarget != targets[i] && scrollTop >= offsets[i] && (!offsets[i + 1] || scrollTop <= offsets[i + 1]) && this.activate(targets[i])
1658 }
1659 }
1660
1661 ScrollSpy.prototype.activate = function(target) {
1662 this.activeTarget = target
1663
1664 $(this.selector)
1665 .parentsUntil(this.options.target, '.active')
1666 .removeClass('active')
1667
1668 var selector = this.selector +
1669 '[data-target="' + target + '"],' +
1670 this.selector + '[href="' + target + '"]'
1671
1672 var active = $(selector)
1673 .parents('li')
1674 .addClass('active')
1675
1676 if (active.parent('.dropdown-menu').length) {
1677 active = active
1678 .closest('li.dropdown')
1679 .addClass('active')
1680 }
1681
1682 active.trigger('activate.bs.scrollspy')
1683 }
1684
1685
1686 // SCROLLSPY PLUGIN DEFINITION
1687 // ===========================
1688
1689 var old = $.fn.scrollspy
1690
1691 $.fn.scrollspy = function(option) {
1692 return this.each(function() {
1693 var $this = $(this)
1694 var data = $this.data('bs.scrollspy')
1695 var options = typeof option == 'object' && option
1696
1697 if (!data) $this.data('bs.scrollspy', (data = new ScrollSpy(this, options)))
1698 if (typeof option == 'string') data[option]()
1699 })
1700 }
1701
1702 $.fn.scrollspy.Constructor = ScrollSpy
1703
1704
1705 // SCROLLSPY NO CONFLICT
1706 // =====================
1707
1708 $.fn.scrollspy.noConflict = function() {
1709 $.fn.scrollspy = old
1710 return this
1711 }
1712
1713
1714 // SCROLLSPY DATA-API
1715 // ==================
1716
1717 $(window).on('load', function() {
1718 $('[data-spy="scroll"]').each(function() {
1719 var $spy = $(this)
1720 $spy.scrollspy($spy.data())
1721 })
1722 })
1723
1724}(jQuery);
1725
1726/* ========================================================================
1727 * Bootstrap: tab.js v3.1.1
1728 * http://getbootstrap.com/javascript/#tabs
1729 * ========================================================================
1730 * Copyright 2011-2014 Twitter, Inc.
1731 * Licensed under MIT (https://github.com/twbs/bootstrap/blob/master/LICENSE)
1732 * ======================================================================== */
1733
1734
1735+ function($) {
1736 'use strict';
1737
1738 // TAB CLASS DEFINITION
1739 // ====================
1740
1741 var Tab = function(element) {
1742 this.element = $(element)
1743 }
1744
1745 Tab.prototype.show = function() {
1746 var $this = this.element
1747 var $ul = $this.closest('ul:not(.dropdown-menu)')
1748 var selector = $this.data('target')
1749
1750 if (!selector) {
1751 selector = $this.attr('href')
1752 selector = selector && selector.replace(/.*(?=#[^\s]*$)/, '') //strip for ie7
1753 }
1754
1755 if ($this.parent('li').hasClass('active')) return
1756
1757 var previous = $ul.find('.active:last a')[0]
1758 var e = $.Event('show.bs.tab', {
1759 relatedTarget: previous
1760 })
1761
1762 $this.trigger(e)
1763
1764 if (e.isDefaultPrevented()) return
1765
1766 var $target = $(selector)
1767
1768 this.activate($this.parent('li'), $ul)
1769 this.activate($target, $target.parent(), function() {
1770 $this.trigger({
1771 type: 'shown.bs.tab',
1772 relatedTarget: previous
1773 })
1774 })
1775 }
1776
1777 Tab.prototype.activate = function(element, container, callback) {
1778 var $active = container.find('> .active')
1779 var transition = callback && $.support.transition && $active.hasClass('fade')
1780
1781 function next() {
1782 $active
1783 .removeClass('active')
1784 .find('> .dropdown-menu > .active')
1785 .removeClass('active')
1786
1787 element.addClass('active')
1788
1789 if (transition) {
1790 element[0].offsetWidth // reflow for transition
1791 element.addClass('in')
1792 } else {
1793 element.removeClass('fade')
1794 }
1795
1796 if (element.parent('.dropdown-menu')) {
1797 element.closest('li.dropdown').addClass('active')
1798 }
1799
1800 callback && callback()
1801 }
1802
1803 transition ?
1804 $active
1805 .one($.support.transition.end, next)
1806 .emulateTransitionEnd(150) :
1807 next()
1808
1809 $active.removeClass('in')
1810 }
1811
1812
1813 // TAB PLUGIN DEFINITION
1814 // =====================
1815
1816 var old = $.fn.tab
1817
1818 $.fn.tab = function(option) {
1819 return this.each(function() {
1820 var $this = $(this)
1821 var data = $this.data('bs.tab')
1822
1823 if (!data) $this.data('bs.tab', (data = new Tab(this)))
1824 if (typeof option == 'string') data[option]()
1825 })
1826 }
1827
1828 $.fn.tab.Constructor = Tab
1829
1830
1831 // TAB NO CONFLICT
1832 // ===============
1833
1834 $.fn.tab.noConflict = function() {
1835 $.fn.tab = old
1836 return this
1837 }
1838
1839
1840 // TAB DATA-API
1841 // ============
1842
1843 $(document).on('click.bs.tab.data-api', '[data-toggle="tab"], [data-toggle="pill"]', function(e) {
1844 e.preventDefault()
1845 $(this).tab('show')
1846 })
1847
1848}(jQuery);
1849
1850/* ========================================================================
1851 * Bootstrap: affix.js v3.1.1
1852 * http://getbootstrap.com/javascript/#affix
1853 * ========================================================================
1854 * Copyright 2011-2014 Twitter, Inc.
1855 * Licensed under MIT (https://github.com/twbs/bootstrap/blob/master/LICENSE)
1856 * ======================================================================== */
1857
1858
1859+ function($) {
1860 'use strict';
1861
1862 // AFFIX CLASS DEFINITION
1863 // ======================
1864
1865 var Affix = function(element, options) {
1866 this.options = $.extend({}, Affix.DEFAULTS, options)
1867 this.$window = $(window)
1868 .on('scroll.bs.affix.data-api', $.proxy(this.checkPosition, this))
1869 .on('click.bs.affix.data-api', $.proxy(this.checkPositionWithEventLoop, this))
1870
1871 this.$element = $(element)
1872 this.affixed =
1873 this.unpin =
1874 this.pinnedOffset = null
1875
1876 this.checkPosition()
1877 }
1878
1879 Affix.RESET = 'affix affix-top affix-bottom'
1880
1881 Affix.DEFAULTS = {
1882 offset: 0
1883 }
1884
1885 Affix.prototype.getPinnedOffset = function() {
1886 if (this.pinnedOffset) return this.pinnedOffset
1887 this.$element.removeClass(Affix.RESET).addClass('affix')
1888 var scrollTop = this.$window.scrollTop()
1889 var position = this.$element.offset()
1890 return (this.pinnedOffset = position.top - scrollTop)
1891 }
1892
1893 Affix.prototype.checkPositionWithEventLoop = function() {
1894 setTimeout($.proxy(this.checkPosition, this), 1)
1895 }
1896
1897 Affix.prototype.checkPosition = function() {
1898 if (!this.$element.is(':visible')) return
1899
1900 var scrollHeight = $(document).height()
1901 var scrollTop = this.$window.scrollTop()
1902 var position = this.$element.offset()
1903 var offset = this.options.offset
1904 var offsetTop = offset.top
1905 var offsetBottom = offset.bottom
1906
1907 if (this.affixed == 'top') position.top += scrollTop
1908
1909 if (typeof offset != 'object') offsetBottom = offsetTop = offset
1910 if (typeof offsetTop == 'function') offsetTop = offset.top(this.$element)
1911 if (typeof offsetBottom == 'function') offsetBottom = offset.bottom(this.$element)
1912
1913 var affix = this.unpin != null && (scrollTop + this.unpin <= position.top) ? false :
1914 offsetBottom != null && (position.top + this.$element.height() >= scrollHeight - offsetBottom) ? 'bottom' :
1915 offsetTop != null && (scrollTop <= offsetTop) ? 'top' : false
1916
1917 if (this.affixed === affix) return
1918 if (this.unpin) this.$element.css('top', '')
1919
1920 var affixType = 'affix' + (affix ? '-' + affix : '')
1921 var e = $.Event(affixType + '.bs.affix')
1922
1923 this.$element.trigger(e)
1924
1925 if (e.isDefaultPrevented()) return
1926
1927 this.affixed = affix
1928 this.unpin = affix == 'bottom' ? this.getPinnedOffset() : null
1929
1930 this.$element
1931 .removeClass(Affix.RESET)
1932 .addClass(affixType)
1933 .trigger($.Event(affixType.replace('affix', 'affixed')))
1934
1935 if (affix == 'bottom') {
1936 this.$element.offset({
1937 top: scrollHeight - offsetBottom - this.$element.height()
1938 })
1939 }
1940 }
1941
1942
1943 // AFFIX PLUGIN DEFINITION
1944 // =======================
1945
1946 var old = $.fn.affix
1947
1948 $.fn.affix = function(option) {
1949 return this.each(function() {
1950 var $this = $(this)
1951 var data = $this.data('bs.affix')
1952 var options = typeof option == 'object' && option
1953
1954 if (!data) $this.data('bs.affix', (data = new Affix(this, options)))
1955 if (typeof option == 'string') data[option]()
1956 })
1957 }
1958
1959 $.fn.affix.Constructor = Affix
1960
1961
1962 // AFFIX NO CONFLICT
1963 // =================
1964
1965 $.fn.affix.noConflict = function() {
1966 $.fn.affix = old
1967 return this
1968 }
1969
1970
1971 // AFFIX DATA-API
1972 // ==============
1973
1974 $(window).on('load', function() {
1975 $('[data-spy="affix"]').each(function() {
1976 var $spy = $(this)
1977 var data = $spy.data()
1978
1979 data.offset = data.offset || {}
1980
1981 if (data.offsetBottom) data.offset.bottom = data.offsetBottom
1982 if (data.offsetTop) data.offset.top = data.offsetTop
1983
1984 $spy.affix(data)
1985 })
1986 })
1987
1988}(jQuery); \ No newline at end of file
Powered by cgit v1.2.3 (git 2.41.0)