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