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