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