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