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