comparison static/bootstrap/js/bootstrap.js @ 137:964d5e9130c2

Update to Bootstrap 3.1.1.
author Brian Neal <bgneal@gmail.com>
date Fri, 14 Feb 2014 19:42:07 -0600
parents ddf49209cfc1
children
comparison
equal deleted inserted replaced
136:44859442efe6 137:964d5e9130c2
1 /** 1 /*!
2 * bootstrap.js v3.0.0 by @fat and @mdo 2 * Bootstrap v3.1.1 (http://getbootstrap.com)
3 * Copyright 2013 Twitter Inc. 3 * Copyright 2011-2014 Twitter, Inc.
4 * http://www.apache.org/licenses/LICENSE-2.0 4 * Licensed under MIT (https://github.com/twbs/bootstrap/blob/master/LICENSE)
5 */ 5 */
6 if (!jQuery) { throw new Error("Bootstrap requires jQuery") } 6
7 if (typeof jQuery === 'undefined') { throw new Error('Bootstrap\'s JavaScript requires jQuery') }
7 8
8 /* ======================================================================== 9 /* ========================================================================
9 * Bootstrap: transition.js v3.0.0 10 * Bootstrap: transition.js v3.1.1
10 * http://twbs.github.com/bootstrap/javascript.html#transitions 11 * http://getbootstrap.com/javascript/#transitions
11 * ======================================================================== 12 * ========================================================================
12 * Copyright 2013 Twitter, Inc. 13 * Copyright 2011-2014 Twitter, Inc.
13 * 14 * Licensed under MIT (https://github.com/twbs/bootstrap/blob/master/LICENSE)
14 * Licensed under the Apache License, Version 2.0 (the "License");
15 * you may not use this file except in compliance with the License.
16 * You may obtain a copy of the License at
17 *
18 * http://www.apache.org/licenses/LICENSE-2.0
19 *
20 * Unless required by applicable law or agreed to in writing, software
21 * distributed under the License is distributed on an "AS IS" BASIS,
22 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
23 * See the License for the specific language governing permissions and
24 * limitations under the License.
25 * ======================================================================== */ 15 * ======================================================================== */
26 16
27 17
28 +function ($) { "use strict"; 18 +function ($) {
19 'use strict';
29 20
30 // CSS TRANSITION SUPPORT (Shoutout: http://www.modernizr.com/) 21 // CSS TRANSITION SUPPORT (Shoutout: http://www.modernizr.com/)
31 // ============================================================ 22 // ============================================================
32 23
33 function transitionEnd() { 24 function transitionEnd() {
34 var el = document.createElement('bootstrap') 25 var el = document.createElement('bootstrap')
35 26
36 var transEndEventNames = { 27 var transEndEventNames = {
37 'WebkitTransition' : 'webkitTransitionEnd' 28 'WebkitTransition' : 'webkitTransitionEnd',
38 , 'MozTransition' : 'transitionend' 29 'MozTransition' : 'transitionend',
39 , 'OTransition' : 'oTransitionEnd otransitionend' 30 'OTransition' : 'oTransitionEnd otransitionend',
40 , 'transition' : 'transitionend' 31 'transition' : 'transitionend'
41 } 32 }
42 33
43 for (var name in transEndEventNames) { 34 for (var name in transEndEventNames) {
44 if (el.style[name] !== undefined) { 35 if (el.style[name] !== undefined) {
45 return { end: transEndEventNames[name] } 36 return { end: transEndEventNames[name] }
46 } 37 }
47 } 38 }
39
40 return false // explicit for ie8 ( ._.)
48 } 41 }
49 42
50 // http://blog.alexmaccaw.com/css-transitions 43 // http://blog.alexmaccaw.com/css-transitions
51 $.fn.emulateTransitionEnd = function (duration) { 44 $.fn.emulateTransitionEnd = function (duration) {
52 var called = false, $el = this 45 var called = false, $el = this
58 51
59 $(function () { 52 $(function () {
60 $.support.transition = transitionEnd() 53 $.support.transition = transitionEnd()
61 }) 54 })
62 55
63 }(window.jQuery); 56 }(jQuery);
64 57
65 /* ======================================================================== 58 /* ========================================================================
66 * Bootstrap: alert.js v3.0.0 59 * Bootstrap: alert.js v3.1.1
67 * http://twbs.github.com/bootstrap/javascript.html#alerts 60 * http://getbootstrap.com/javascript/#alerts
68 * ======================================================================== 61 * ========================================================================
69 * Copyright 2013 Twitter, Inc. 62 * Copyright 2011-2014 Twitter, Inc.
70 * 63 * Licensed under MIT (https://github.com/twbs/bootstrap/blob/master/LICENSE)
71 * Licensed under the Apache License, Version 2.0 (the "License");
72 * you may not use this file except in compliance with the License.
73 * You may obtain a copy of the License at
74 *
75 * http://www.apache.org/licenses/LICENSE-2.0
76 *
77 * Unless required by applicable law or agreed to in writing, software
78 * distributed under the License is distributed on an "AS IS" BASIS,
79 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
80 * See the License for the specific language governing permissions and
81 * limitations under the License.
82 * ======================================================================== */ 64 * ======================================================================== */
83 65
84 66
85 +function ($) { "use strict"; 67 +function ($) {
68 'use strict';
86 69
87 // ALERT CLASS DEFINITION 70 // ALERT CLASS DEFINITION
88 // ====================== 71 // ======================
89 72
90 var dismiss = '[data-dismiss="alert"]' 73 var dismiss = '[data-dismiss="alert"]'
157 // ALERT DATA-API 140 // ALERT DATA-API
158 // ============== 141 // ==============
159 142
160 $(document).on('click.bs.alert.data-api', dismiss, Alert.prototype.close) 143 $(document).on('click.bs.alert.data-api', dismiss, Alert.prototype.close)
161 144
162 }(window.jQuery); 145 }(jQuery);
163 146
164 /* ======================================================================== 147 /* ========================================================================
165 * Bootstrap: button.js v3.0.0 148 * Bootstrap: button.js v3.1.1
166 * http://twbs.github.com/bootstrap/javascript.html#buttons 149 * http://getbootstrap.com/javascript/#buttons
167 * ======================================================================== 150 * ========================================================================
168 * Copyright 2013 Twitter, Inc. 151 * Copyright 2011-2014 Twitter, Inc.
169 * 152 * Licensed under MIT (https://github.com/twbs/bootstrap/blob/master/LICENSE)
170 * Licensed under the Apache License, Version 2.0 (the "License");
171 * you may not use this file except in compliance with the License.
172 * You may obtain a copy of the License at
173 *
174 * http://www.apache.org/licenses/LICENSE-2.0
175 *
176 * Unless required by applicable law or agreed to in writing, software
177 * distributed under the License is distributed on an "AS IS" BASIS,
178 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
179 * See the License for the specific language governing permissions and
180 * limitations under the License.
181 * ======================================================================== */ 153 * ======================================================================== */
182 154
183 155
184 +function ($) { "use strict"; 156 +function ($) {
157 'use strict';
185 158
186 // BUTTON PUBLIC CLASS DEFINITION 159 // BUTTON PUBLIC CLASS DEFINITION
187 // ============================== 160 // ==============================
188 161
189 var Button = function (element, options) { 162 var Button = function (element, options) {
190 this.$element = $(element) 163 this.$element = $(element)
191 this.options = $.extend({}, Button.DEFAULTS, options) 164 this.options = $.extend({}, Button.DEFAULTS, options)
165 this.isLoading = false
192 } 166 }
193 167
194 Button.DEFAULTS = { 168 Button.DEFAULTS = {
195 loadingText: 'loading...' 169 loadingText: 'loading...'
196 } 170 }
206 if (!data.resetText) $el.data('resetText', $el[val]()) 180 if (!data.resetText) $el.data('resetText', $el[val]())
207 181
208 $el[val](data[state] || this.options[state]) 182 $el[val](data[state] || this.options[state])
209 183
210 // push to event loop to allow forms to submit 184 // push to event loop to allow forms to submit
211 setTimeout(function () { 185 setTimeout($.proxy(function () {
212 state == 'loadingText' ? 186 if (state == 'loadingText') {
213 $el.addClass(d).attr(d, d) : 187 this.isLoading = true
214 $el.removeClass(d).removeAttr(d); 188 $el.addClass(d).attr(d, d)
215 }, 0) 189 } else if (this.isLoading) {
190 this.isLoading = false
191 $el.removeClass(d).removeAttr(d)
192 }
193 }, this), 0)
216 } 194 }
217 195
218 Button.prototype.toggle = function () { 196 Button.prototype.toggle = function () {
197 var changed = true
219 var $parent = this.$element.closest('[data-toggle="buttons"]') 198 var $parent = this.$element.closest('[data-toggle="buttons"]')
220 199
221 if ($parent.length) { 200 if ($parent.length) {
222 var $input = this.$element.find('input') 201 var $input = this.$element.find('input')
223 .prop('checked', !this.$element.hasClass('active')) 202 if ($input.prop('type') == 'radio') {
224 .trigger('change') 203 if ($input.prop('checked') && this.$element.hasClass('active')) changed = false
225 if ($input.prop('type') === 'radio') $parent.find('.active').removeClass('active') 204 else $parent.find('.active').removeClass('active')
226 } 205 }
227 206 if (changed) $input.prop('checked', !this.$element.hasClass('active')).trigger('change')
228 this.$element.toggleClass('active') 207 }
208
209 if (changed) this.$element.toggleClass('active')
229 } 210 }
230 211
231 212
232 // BUTTON PLUGIN DEFINITION 213 // BUTTON PLUGIN DEFINITION
233 // ======================== 214 // ========================
267 if (!$btn.hasClass('btn')) $btn = $btn.closest('.btn') 248 if (!$btn.hasClass('btn')) $btn = $btn.closest('.btn')
268 $btn.button('toggle') 249 $btn.button('toggle')
269 e.preventDefault() 250 e.preventDefault()
270 }) 251 })
271 252
272 }(window.jQuery); 253 }(jQuery);
273 254
274 /* ======================================================================== 255 /* ========================================================================
275 * Bootstrap: carousel.js v3.0.0 256 * Bootstrap: carousel.js v3.1.1
276 * http://twbs.github.com/bootstrap/javascript.html#carousel 257 * http://getbootstrap.com/javascript/#carousel
277 * ======================================================================== 258 * ========================================================================
278 * Copyright 2012 Twitter, Inc. 259 * Copyright 2011-2014 Twitter, Inc.
279 * 260 * Licensed under MIT (https://github.com/twbs/bootstrap/blob/master/LICENSE)
280 * Licensed under the Apache License, Version 2.0 (the "License");
281 * you may not use this file except in compliance with the License.
282 * You may obtain a copy of the License at
283 *
284 * http://www.apache.org/licenses/LICENSE-2.0
285 *
286 * Unless required by applicable law or agreed to in writing, software
287 * distributed under the License is distributed on an "AS IS" BASIS,
288 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
289 * See the License for the specific language governing permissions and
290 * limitations under the License.
291 * ======================================================================== */ 261 * ======================================================================== */
292 262
293 263
294 +function ($) { "use strict"; 264 +function ($) {
265 'use strict';
295 266
296 // CAROUSEL CLASS DEFINITION 267 // CAROUSEL CLASS DEFINITION
297 // ========================= 268 // =========================
298 269
299 var Carousel = function (element, options) { 270 var Carousel = function (element, options) {
310 .on('mouseenter', $.proxy(this.pause, this)) 281 .on('mouseenter', $.proxy(this.pause, this))
311 .on('mouseleave', $.proxy(this.cycle, this)) 282 .on('mouseleave', $.proxy(this.cycle, this))
312 } 283 }
313 284
314 Carousel.DEFAULTS = { 285 Carousel.DEFAULTS = {
315 interval: 5000 286 interval: 5000,
316 , pause: 'hover' 287 pause: 'hover',
317 , wrap: true 288 wrap: true
318 } 289 }
319 290
320 Carousel.prototype.cycle = function (e) { 291 Carousel.prototype.cycle = function (e) {
321 e || (this.paused = false) 292 e || (this.paused = false)
322 293
340 var that = this 311 var that = this
341 var activeIndex = this.getActiveIndex() 312 var activeIndex = this.getActiveIndex()
342 313
343 if (pos > (this.$items.length - 1) || pos < 0) return 314 if (pos > (this.$items.length - 1) || pos < 0) return
344 315
345 if (this.sliding) return this.$element.one('slid', function () { that.to(pos) }) 316 if (this.sliding) return this.$element.one('slid.bs.carousel', function () { that.to(pos) })
346 if (activeIndex == pos) return this.pause().cycle() 317 if (activeIndex == pos) return this.pause().cycle()
347 318
348 return this.slide(pos > activeIndex ? 'next' : 'prev', $(this.$items[pos])) 319 return this.slide(pos > activeIndex ? 'next' : 'prev', $(this.$items[pos]))
349 } 320 }
350 321
351 Carousel.prototype.pause = function (e) { 322 Carousel.prototype.pause = function (e) {
352 e || (this.paused = true) 323 e || (this.paused = true)
353 324
354 if (this.$element.find('.next, .prev').length && $.support.transition.end) { 325 if (this.$element.find('.next, .prev').length && $.support.transition) {
355 this.$element.trigger($.support.transition.end) 326 this.$element.trigger($.support.transition.end)
356 this.cycle(true) 327 this.cycle(true)
357 } 328 }
358 329
359 this.interval = clearInterval(this.interval) 330 this.interval = clearInterval(this.interval)
382 if (!$next.length) { 353 if (!$next.length) {
383 if (!this.options.wrap) return 354 if (!this.options.wrap) return
384 $next = this.$element.find('.item')[fallback]() 355 $next = this.$element.find('.item')[fallback]()
385 } 356 }
386 357
358 if ($next.hasClass('active')) return this.sliding = false
359
360 var e = $.Event('slide.bs.carousel', { relatedTarget: $next[0], direction: direction })
361 this.$element.trigger(e)
362 if (e.isDefaultPrevented()) return
363
387 this.sliding = true 364 this.sliding = true
388 365
389 isCycling && this.pause() 366 isCycling && this.pause()
390
391 var e = $.Event('slide.bs.carousel', { relatedTarget: $next[0], direction: direction })
392
393 if ($next.hasClass('active')) return
394 367
395 if (this.$indicators.length) { 368 if (this.$indicators.length) {
396 this.$indicators.find('.active').removeClass('active') 369 this.$indicators.find('.active').removeClass('active')
397 this.$element.one('slid', function () { 370 this.$element.one('slid.bs.carousel', function () {
398 var $nextIndicator = $(that.$indicators.children()[that.getActiveIndex()]) 371 var $nextIndicator = $(that.$indicators.children()[that.getActiveIndex()])
399 $nextIndicator && $nextIndicator.addClass('active') 372 $nextIndicator && $nextIndicator.addClass('active')
400 }) 373 })
401 } 374 }
402 375
403 if ($.support.transition && this.$element.hasClass('slide')) { 376 if ($.support.transition && this.$element.hasClass('slide')) {
404 this.$element.trigger(e)
405 if (e.isDefaultPrevented()) return
406 $next.addClass(type) 377 $next.addClass(type)
407 $next[0].offsetWidth // force reflow 378 $next[0].offsetWidth // force reflow
408 $active.addClass(direction) 379 $active.addClass(direction)
409 $next.addClass(direction) 380 $next.addClass(direction)
410 $active 381 $active
411 .one($.support.transition.end, function () { 382 .one($.support.transition.end, function () {
412 $next.removeClass([type, direction].join(' ')).addClass('active') 383 $next.removeClass([type, direction].join(' ')).addClass('active')
413 $active.removeClass(['active', direction].join(' ')) 384 $active.removeClass(['active', direction].join(' '))
414 that.sliding = false 385 that.sliding = false
415 setTimeout(function () { that.$element.trigger('slid') }, 0) 386 setTimeout(function () { that.$element.trigger('slid.bs.carousel') }, 0)
416 }) 387 })
417 .emulateTransitionEnd(600) 388 .emulateTransitionEnd($active.css('transition-duration').slice(0, -1) * 1000)
418 } else { 389 } else {
419 this.$element.trigger(e)
420 if (e.isDefaultPrevented()) return
421 $active.removeClass('active') 390 $active.removeClass('active')
422 $next.addClass('active') 391 $next.addClass('active')
423 this.sliding = false 392 this.sliding = false
424 this.$element.trigger('slid') 393 this.$element.trigger('slid.bs.carousel')
425 } 394 }
426 395
427 isCycling && this.cycle() 396 isCycling && this.cycle()
428 397
429 return this 398 return this
485 var $carousel = $(this) 454 var $carousel = $(this)
486 $carousel.carousel($carousel.data()) 455 $carousel.carousel($carousel.data())
487 }) 456 })
488 }) 457 })
489 458
490 }(window.jQuery); 459 }(jQuery);
491 460
492 /* ======================================================================== 461 /* ========================================================================
493 * Bootstrap: collapse.js v3.0.0 462 * Bootstrap: collapse.js v3.1.1
494 * http://twbs.github.com/bootstrap/javascript.html#collapse 463 * http://getbootstrap.com/javascript/#collapse
495 * ======================================================================== 464 * ========================================================================
496 * Copyright 2012 Twitter, Inc. 465 * Copyright 2011-2014 Twitter, Inc.
497 * 466 * Licensed under MIT (https://github.com/twbs/bootstrap/blob/master/LICENSE)
498 * Licensed under the Apache License, Version 2.0 (the "License");
499 * you may not use this file except in compliance with the License.
500 * You may obtain a copy of the License at
501 *
502 * http://www.apache.org/licenses/LICENSE-2.0
503 *
504 * Unless required by applicable law or agreed to in writing, software
505 * distributed under the License is distributed on an "AS IS" BASIS,
506 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
507 * See the License for the specific language governing permissions and
508 * limitations under the License.
509 * ======================================================================== */ 467 * ======================================================================== */
510 468
511 469
512 +function ($) { "use strict"; 470 +function ($) {
471 'use strict';
513 472
514 // COLLAPSE PUBLIC CLASS DEFINITION 473 // COLLAPSE PUBLIC CLASS DEFINITION
515 // ================================ 474 // ================================
516 475
517 var Collapse = function (element, options) { 476 var Collapse = function (element, options) {
558 this.transitioning = 1 517 this.transitioning = 1
559 518
560 var complete = function () { 519 var complete = function () {
561 this.$element 520 this.$element
562 .removeClass('collapsing') 521 .removeClass('collapsing')
563 .addClass('in') 522 .addClass('collapse in')
564 [dimension]('auto') 523 [dimension]('auto')
565 this.transitioning = 0 524 this.transitioning = 0
566 this.$element.trigger('shown.bs.collapse') 525 this.$element.trigger('shown.bs.collapse')
567 } 526 }
568 527
626 return this.each(function () { 585 return this.each(function () {
627 var $this = $(this) 586 var $this = $(this)
628 var data = $this.data('bs.collapse') 587 var data = $this.data('bs.collapse')
629 var options = $.extend({}, Collapse.DEFAULTS, $this.data(), typeof option == 'object' && option) 588 var options = $.extend({}, Collapse.DEFAULTS, $this.data(), typeof option == 'object' && option)
630 589
590 if (!data && options.toggle && option == 'show') option = !option
631 if (!data) $this.data('bs.collapse', (data = new Collapse(this, options))) 591 if (!data) $this.data('bs.collapse', (data = new Collapse(this, options)))
632 if (typeof option == 'string') data[option]() 592 if (typeof option == 'string') data[option]()
633 }) 593 })
634 } 594 }
635 595
665 } 625 }
666 626
667 $target.collapse(option) 627 $target.collapse(option)
668 }) 628 })
669 629
670 }(window.jQuery); 630 }(jQuery);
671 631
672 /* ======================================================================== 632 /* ========================================================================
673 * Bootstrap: dropdown.js v3.0.0 633 * Bootstrap: dropdown.js v3.1.1
674 * http://twbs.github.com/bootstrap/javascript.html#dropdowns 634 * http://getbootstrap.com/javascript/#dropdowns
675 * ======================================================================== 635 * ========================================================================
676 * Copyright 2012 Twitter, Inc. 636 * Copyright 2011-2014 Twitter, Inc.
677 * 637 * Licensed under MIT (https://github.com/twbs/bootstrap/blob/master/LICENSE)
678 * Licensed under the Apache License, Version 2.0 (the "License");
679 * you may not use this file except in compliance with the License.
680 * You may obtain a copy of the License at
681 *
682 * http://www.apache.org/licenses/LICENSE-2.0
683 *
684 * Unless required by applicable law or agreed to in writing, software
685 * distributed under the License is distributed on an "AS IS" BASIS,
686 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
687 * See the License for the specific language governing permissions and
688 * limitations under the License.
689 * ======================================================================== */ 638 * ======================================================================== */
690 639
691 640
692 +function ($) { "use strict"; 641 +function ($) {
642 'use strict';
693 643
694 // DROPDOWN CLASS DEFINITION 644 // DROPDOWN CLASS DEFINITION
695 // ========================= 645 // =========================
696 646
697 var backdrop = '.dropdown-backdrop' 647 var backdrop = '.dropdown-backdrop'
698 var toggle = '[data-toggle=dropdown]' 648 var toggle = '[data-toggle=dropdown]'
699 var Dropdown = function (element) { 649 var Dropdown = function (element) {
700 var $el = $(element).on('click.bs.dropdown', this.toggle) 650 $(element).on('click.bs.dropdown', this.toggle)
701 } 651 }
702 652
703 Dropdown.prototype.toggle = function (e) { 653 Dropdown.prototype.toggle = function (e) {
704 var $this = $(this) 654 var $this = $(this)
705 655
710 660
711 clearMenus() 661 clearMenus()
712 662
713 if (!isActive) { 663 if (!isActive) {
714 if ('ontouchstart' in document.documentElement && !$parent.closest('.navbar-nav').length) { 664 if ('ontouchstart' in document.documentElement && !$parent.closest('.navbar-nav').length) {
715 // if mobile we we use a backdrop because click events don't delegate 665 // if mobile we use a backdrop because click events don't delegate
716 $('<div class="dropdown-backdrop"/>').insertAfter($(this)).on('click', clearMenus) 666 $('<div class="dropdown-backdrop"/>').insertAfter($(this)).on('click', clearMenus)
717 } 667 }
718 668
719 $parent.trigger(e = $.Event('show.bs.dropdown')) 669 var relatedTarget = { relatedTarget: this }
670 $parent.trigger(e = $.Event('show.bs.dropdown', relatedTarget))
720 671
721 if (e.isDefaultPrevented()) return 672 if (e.isDefaultPrevented()) return
722 673
723 $parent 674 $parent
724 .toggleClass('open') 675 .toggleClass('open')
725 .trigger('shown.bs.dropdown') 676 .trigger('shown.bs.dropdown', relatedTarget)
726 677
727 $this.focus() 678 $this.focus()
728 } 679 }
729 680
730 return false 681 return false
746 if (!isActive || (isActive && e.keyCode == 27)) { 697 if (!isActive || (isActive && e.keyCode == 27)) {
747 if (e.which == 27) $parent.find(toggle).focus() 698 if (e.which == 27) $parent.find(toggle).focus()
748 return $this.click() 699 return $this.click()
749 } 700 }
750 701
751 var $items = $('[role=menu] li:not(.divider):visible a', $parent) 702 var desc = ' li:not(.divider):visible a'
703 var $items = $parent.find('[role=menu]' + desc + ', [role=listbox]' + desc)
752 704
753 if (!$items.length) return 705 if (!$items.length) return
754 706
755 var index = $items.index($items.filter(':focus')) 707 var index = $items.index($items.filter(':focus'))
756 708
757 if (e.keyCode == 38 && index > 0) index-- // up 709 if (e.keyCode == 38 && index > 0) index-- // up
758 if (e.keyCode == 40 && index < $items.length - 1) index++ // down 710 if (e.keyCode == 40 && index < $items.length - 1) index++ // down
759 if (!~index) index=0 711 if (!~index) index = 0
760 712
761 $items.eq(index).focus() 713 $items.eq(index).focus()
762 } 714 }
763 715
764 function clearMenus() { 716 function clearMenus(e) {
765 $(backdrop).remove() 717 $(backdrop).remove()
766 $(toggle).each(function (e) { 718 $(toggle).each(function () {
767 var $parent = getParent($(this)) 719 var $parent = getParent($(this))
720 var relatedTarget = { relatedTarget: this }
768 if (!$parent.hasClass('open')) return 721 if (!$parent.hasClass('open')) return
769 $parent.trigger(e = $.Event('hide.bs.dropdown')) 722 $parent.trigger(e = $.Event('hide.bs.dropdown', relatedTarget))
770 if (e.isDefaultPrevented()) return 723 if (e.isDefaultPrevented()) return
771 $parent.removeClass('open').trigger('hidden.bs.dropdown') 724 $parent.removeClass('open').trigger('hidden.bs.dropdown', relatedTarget)
772 }) 725 })
773 } 726 }
774 727
775 function getParent($this) { 728 function getParent($this) {
776 var selector = $this.attr('data-target') 729 var selector = $this.attr('data-target')
777 730
778 if (!selector) { 731 if (!selector) {
779 selector = $this.attr('href') 732 selector = $this.attr('href')
780 selector = selector && /#/.test(selector) && selector.replace(/.*(?=#[^\s]*$)/, '') //strip for ie7 733 selector = selector && /#[A-Za-z]/.test(selector) && selector.replace(/.*(?=#[^\s]*$)/, '') //strip for ie7
781 } 734 }
782 735
783 var $parent = selector && $(selector) 736 var $parent = selector && $(selector)
784 737
785 return $parent && $parent.length ? $parent : $this.parent() 738 return $parent && $parent.length ? $parent : $this.parent()
792 var old = $.fn.dropdown 745 var old = $.fn.dropdown
793 746
794 $.fn.dropdown = function (option) { 747 $.fn.dropdown = function (option) {
795 return this.each(function () { 748 return this.each(function () {
796 var $this = $(this) 749 var $this = $(this)
797 var data = $this.data('dropdown') 750 var data = $this.data('bs.dropdown')
798 751
799 if (!data) $this.data('dropdown', (data = new Dropdown(this))) 752 if (!data) $this.data('bs.dropdown', (data = new Dropdown(this)))
800 if (typeof option == 'string') data[option].call($this) 753 if (typeof option == 'string') data[option].call($this)
801 }) 754 })
802 } 755 }
803 756
804 $.fn.dropdown.Constructor = Dropdown 757 $.fn.dropdown.Constructor = Dropdown
817 // =================================== 770 // ===================================
818 771
819 $(document) 772 $(document)
820 .on('click.bs.dropdown.data-api', clearMenus) 773 .on('click.bs.dropdown.data-api', clearMenus)
821 .on('click.bs.dropdown.data-api', '.dropdown form', function (e) { e.stopPropagation() }) 774 .on('click.bs.dropdown.data-api', '.dropdown form', function (e) { e.stopPropagation() })
822 .on('click.bs.dropdown.data-api' , toggle, Dropdown.prototype.toggle) 775 .on('click.bs.dropdown.data-api', toggle, Dropdown.prototype.toggle)
823 .on('keydown.bs.dropdown.data-api', toggle + ', [role=menu]' , Dropdown.prototype.keydown) 776 .on('keydown.bs.dropdown.data-api', toggle + ', [role=menu], [role=listbox]', Dropdown.prototype.keydown)
824 777
825 }(window.jQuery); 778 }(jQuery);
826 779
827 /* ======================================================================== 780 /* ========================================================================
828 * Bootstrap: modal.js v3.0.0 781 * Bootstrap: modal.js v3.1.1
829 * http://twbs.github.com/bootstrap/javascript.html#modals 782 * http://getbootstrap.com/javascript/#modals
830 * ======================================================================== 783 * ========================================================================
831 * Copyright 2012 Twitter, Inc. 784 * Copyright 2011-2014 Twitter, Inc.
832 * 785 * Licensed under MIT (https://github.com/twbs/bootstrap/blob/master/LICENSE)
833 * Licensed under the Apache License, Version 2.0 (the "License");
834 * you may not use this file except in compliance with the License.
835 * You may obtain a copy of the License at
836 *
837 * http://www.apache.org/licenses/LICENSE-2.0
838 *
839 * Unless required by applicable law or agreed to in writing, software
840 * distributed under the License is distributed on an "AS IS" BASIS,
841 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
842 * See the License for the specific language governing permissions and
843 * limitations under the License.
844 * ======================================================================== */ 786 * ======================================================================== */
845 787
846 788
847 +function ($) { "use strict"; 789 +function ($) {
790 'use strict';
848 791
849 // MODAL CLASS DEFINITION 792 // MODAL CLASS DEFINITION
850 // ====================== 793 // ======================
851 794
852 var Modal = function (element, options) { 795 var Modal = function (element, options) {
853 this.options = options 796 this.options = options
854 this.$element = $(element) 797 this.$element = $(element)
855 this.$backdrop = 798 this.$backdrop =
856 this.isShown = null 799 this.isShown = null
857 800
858 if (this.options.remote) this.$element.load(this.options.remote) 801 if (this.options.remote) {
802 this.$element
803 .find('.modal-content')
804 .load(this.options.remote, $.proxy(function () {
805 this.$element.trigger('loaded.bs.modal')
806 }, this))
807 }
859 } 808 }
860 809
861 Modal.DEFAULTS = { 810 Modal.DEFAULTS = {
862 backdrop: true 811 backdrop: true,
863 , keyboard: true 812 keyboard: true,
864 , show: true 813 show: true
865 } 814 }
866 815
867 Modal.prototype.toggle = function (_relatedTarget) { 816 Modal.prototype.toggle = function (_relatedTarget) {
868 return this[!this.isShown ? 'show' : 'hide'](_relatedTarget) 817 return this[!this.isShown ? 'show' : 'hide'](_relatedTarget)
869 } 818 }
878 827
879 this.isShown = true 828 this.isShown = true
880 829
881 this.escape() 830 this.escape()
882 831
883 this.$element.on('click.dismiss.modal', '[data-dismiss="modal"]', $.proxy(this.hide, this)) 832 this.$element.on('click.dismiss.bs.modal', '[data-dismiss="modal"]', $.proxy(this.hide, this))
884 833
885 this.backdrop(function () { 834 this.backdrop(function () {
886 var transition = $.support.transition && that.$element.hasClass('fade') 835 var transition = $.support.transition && that.$element.hasClass('fade')
887 836
888 if (!that.$element.parent().length) { 837 if (!that.$element.parent().length) {
889 that.$element.appendTo(document.body) // don't move modals dom position 838 that.$element.appendTo(document.body) // don't move modals dom position
890 } 839 }
891 840
892 that.$element.show() 841 that.$element
842 .show()
843 .scrollTop(0)
893 844
894 if (transition) { 845 if (transition) {
895 that.$element[0].offsetWidth // force reflow 846 that.$element[0].offsetWidth // force reflow
896 } 847 }
897 848
929 $(document).off('focusin.bs.modal') 880 $(document).off('focusin.bs.modal')
930 881
931 this.$element 882 this.$element
932 .removeClass('in') 883 .removeClass('in')
933 .attr('aria-hidden', true) 884 .attr('aria-hidden', true)
934 .off('click.dismiss.modal') 885 .off('click.dismiss.bs.modal')
935 886
936 $.support.transition && this.$element.hasClass('fade') ? 887 $.support.transition && this.$element.hasClass('fade') ?
937 this.$element 888 this.$element
938 .one($.support.transition.end, $.proxy(this.hideModal, this)) 889 .one($.support.transition.end, $.proxy(this.hideModal, this))
939 .emulateTransitionEnd(300) : 890 .emulateTransitionEnd(300) :
973 this.$backdrop && this.$backdrop.remove() 924 this.$backdrop && this.$backdrop.remove()
974 this.$backdrop = null 925 this.$backdrop = null
975 } 926 }
976 927
977 Modal.prototype.backdrop = function (callback) { 928 Modal.prototype.backdrop = function (callback) {
978 var that = this
979 var animate = this.$element.hasClass('fade') ? 'fade' : '' 929 var animate = this.$element.hasClass('fade') ? 'fade' : ''
980 930
981 if (this.isShown && this.options.backdrop) { 931 if (this.isShown && this.options.backdrop) {
982 var doAnimate = $.support.transition && animate 932 var doAnimate = $.support.transition && animate
983 933
984 this.$backdrop = $('<div class="modal-backdrop ' + animate + '" />') 934 this.$backdrop = $('<div class="modal-backdrop ' + animate + '" />')
985 .appendTo(document.body) 935 .appendTo(document.body)
986 936
987 this.$element.on('click.dismiss.modal', $.proxy(function (e) { 937 this.$element.on('click.dismiss.bs.modal', $.proxy(function (e) {
988 if (e.target !== e.currentTarget) return 938 if (e.target !== e.currentTarget) return
989 this.options.backdrop == 'static' 939 this.options.backdrop == 'static'
990 ? this.$element[0].focus.call(this.$element[0]) 940 ? this.$element[0].focus.call(this.$element[0])
991 : this.hide.call(this) 941 : this.hide.call(this)
992 }, this)) 942 }, this))
1004 callback() 954 callback()
1005 955
1006 } else if (!this.isShown && this.$backdrop) { 956 } else if (!this.isShown && this.$backdrop) {
1007 this.$backdrop.removeClass('in') 957 this.$backdrop.removeClass('in')
1008 958
1009 $.support.transition && this.$element.hasClass('fade')? 959 $.support.transition && this.$element.hasClass('fade') ?
1010 this.$backdrop 960 this.$backdrop
1011 .one($.support.transition.end, callback) 961 .one($.support.transition.end, callback)
1012 .emulateTransitionEnd(150) : 962 .emulateTransitionEnd(150) :
1013 callback() 963 callback()
1014 964
1052 1002
1053 $(document).on('click.bs.modal.data-api', '[data-toggle="modal"]', function (e) { 1003 $(document).on('click.bs.modal.data-api', '[data-toggle="modal"]', function (e) {
1054 var $this = $(this) 1004 var $this = $(this)
1055 var href = $this.attr('href') 1005 var href = $this.attr('href')
1056 var $target = $($this.attr('data-target') || (href && href.replace(/.*(?=#[^\s]+$)/, ''))) //strip for ie7 1006 var $target = $($this.attr('data-target') || (href && href.replace(/.*(?=#[^\s]+$)/, ''))) //strip for ie7
1057 var option = $target.data('modal') ? 'toggle' : $.extend({ remote: !/#/.test(href) && href }, $target.data(), $this.data()) 1007 var option = $target.data('bs.modal') ? 'toggle' : $.extend({ remote: !/#/.test(href) && href }, $target.data(), $this.data())
1058 1008
1059 e.preventDefault() 1009 if ($this.is('a')) e.preventDefault()
1060 1010
1061 $target 1011 $target
1062 .modal(option, this) 1012 .modal(option, this)
1063 .one('hide', function () { 1013 .one('hide', function () {
1064 $this.is(':visible') && $this.focus() 1014 $this.is(':visible') && $this.focus()
1065 }) 1015 })
1066 }) 1016 })
1067 1017
1068 $(document) 1018 $(document)
1069 .on('show.bs.modal', '.modal', function () { $(document.body).addClass('modal-open') }) 1019 .on('show.bs.modal', '.modal', function () { $(document.body).addClass('modal-open') })
1070 .on('hidden.bs.modal', '.modal', function () { $(document.body).removeClass('modal-open') }) 1020 .on('hidden.bs.modal', '.modal', function () { $(document.body).removeClass('modal-open') })
1071 1021
1072 }(window.jQuery); 1022 }(jQuery);
1073 1023
1074 /* ======================================================================== 1024 /* ========================================================================
1075 * Bootstrap: tooltip.js v3.0.0 1025 * Bootstrap: tooltip.js v3.1.1
1076 * http://twbs.github.com/bootstrap/javascript.html#tooltip 1026 * http://getbootstrap.com/javascript/#tooltip
1077 * Inspired by the original jQuery.tipsy by Jason Frame 1027 * Inspired by the original jQuery.tipsy by Jason Frame
1078 * ======================================================================== 1028 * ========================================================================
1079 * Copyright 2012 Twitter, Inc. 1029 * Copyright 2011-2014 Twitter, Inc.
1080 * 1030 * Licensed under MIT (https://github.com/twbs/bootstrap/blob/master/LICENSE)
1081 * Licensed under the Apache License, Version 2.0 (the "License");
1082 * you may not use this file except in compliance with the License.
1083 * You may obtain a copy of the License at
1084 *
1085 * http://www.apache.org/licenses/LICENSE-2.0
1086 *
1087 * Unless required by applicable law or agreed to in writing, software
1088 * distributed under the License is distributed on an "AS IS" BASIS,
1089 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
1090 * See the License for the specific language governing permissions and
1091 * limitations under the License.
1092 * ======================================================================== */ 1031 * ======================================================================== */
1093 1032
1094 1033
1095 +function ($) { "use strict"; 1034 +function ($) {
1035 'use strict';
1096 1036
1097 // TOOLTIP PUBLIC CLASS DEFINITION 1037 // TOOLTIP PUBLIC CLASS DEFINITION
1098 // =============================== 1038 // ===============================
1099 1039
1100 var Tooltip = function (element, options) { 1040 var Tooltip = function (element, options) {
1107 1047
1108 this.init('tooltip', element, options) 1048 this.init('tooltip', element, options)
1109 } 1049 }
1110 1050
1111 Tooltip.DEFAULTS = { 1051 Tooltip.DEFAULTS = {
1112 animation: true 1052 animation: true,
1113 , placement: 'top' 1053 placement: 'top',
1114 , selector: false 1054 selector: false,
1115 , template: '<div class="tooltip"><div class="tooltip-arrow"></div><div class="tooltip-inner"></div></div>' 1055 template: '<div class="tooltip"><div class="tooltip-arrow"></div><div class="tooltip-inner"></div></div>',
1116 , trigger: 'hover focus' 1056 trigger: 'hover focus',
1117 , title: '' 1057 title: '',
1118 , delay: 0 1058 delay: 0,
1119 , html: false 1059 html: false,
1120 , container: false 1060 container: false
1121 } 1061 }
1122 1062
1123 Tooltip.prototype.init = function (type, element, options) { 1063 Tooltip.prototype.init = function (type, element, options) {
1124 this.enabled = true 1064 this.enabled = true
1125 this.type = type 1065 this.type = type
1132 var trigger = triggers[i] 1072 var trigger = triggers[i]
1133 1073
1134 if (trigger == 'click') { 1074 if (trigger == 'click') {
1135 this.$element.on('click.' + this.type, this.options.selector, $.proxy(this.toggle, this)) 1075 this.$element.on('click.' + this.type, this.options.selector, $.proxy(this.toggle, this))
1136 } else if (trigger != 'manual') { 1076 } else if (trigger != 'manual') {
1137 var eventIn = trigger == 'hover' ? 'mouseenter' : 'focus' 1077 var eventIn = trigger == 'hover' ? 'mouseenter' : 'focusin'
1138 var eventOut = trigger == 'hover' ? 'mouseleave' : 'blur' 1078 var eventOut = trigger == 'hover' ? 'mouseleave' : 'focusout'
1139 1079
1140 this.$element.on(eventIn + '.' + this.type, this.options.selector, $.proxy(this.enter, this)) 1080 this.$element.on(eventIn + '.' + this.type, this.options.selector, $.proxy(this.enter, this))
1141 this.$element.on(eventOut + '.' + this.type, this.options.selector, $.proxy(this.leave, this)) 1081 this.$element.on(eventOut + '.' + this.type, this.options.selector, $.proxy(this.leave, this))
1142 } 1082 }
1143 } 1083 }
1154 Tooltip.prototype.getOptions = function (options) { 1094 Tooltip.prototype.getOptions = function (options) {
1155 options = $.extend({}, this.getDefaults(), this.$element.data(), options) 1095 options = $.extend({}, this.getDefaults(), this.$element.data(), options)
1156 1096
1157 if (options.delay && typeof options.delay == 'number') { 1097 if (options.delay && typeof options.delay == 'number') {
1158 options.delay = { 1098 options.delay = {
1159 show: options.delay 1099 show: options.delay,
1160 , hide: options.delay 1100 hide: options.delay
1161 } 1101 }
1162 } 1102 }
1163 1103
1164 return options 1104 return options
1165 } 1105 }
1204 if (self.hoverState == 'out') self.hide() 1144 if (self.hoverState == 'out') self.hide()
1205 }, self.options.delay.hide) 1145 }, self.options.delay.hide)
1206 } 1146 }
1207 1147
1208 Tooltip.prototype.show = function () { 1148 Tooltip.prototype.show = function () {
1209 var e = $.Event('show.bs.'+ this.type) 1149 var e = $.Event('show.bs.' + this.type)
1210 1150
1211 if (this.hasContent() && this.enabled) { 1151 if (this.hasContent() && this.enabled) {
1212 this.$element.trigger(e) 1152 this.$element.trigger(e)
1213 1153
1214 if (e.isDefaultPrevented()) return 1154 if (e.isDefaultPrevented()) return
1155 var that = this;
1215 1156
1216 var $tip = this.tip() 1157 var $tip = this.tip()
1217 1158
1218 this.setContent() 1159 this.setContent()
1219 1160
1259 } 1200 }
1260 1201
1261 var calculatedOffset = this.getCalculatedOffset(placement, pos, actualWidth, actualHeight) 1202 var calculatedOffset = this.getCalculatedOffset(placement, pos, actualWidth, actualHeight)
1262 1203
1263 this.applyPlacement(calculatedOffset, placement) 1204 this.applyPlacement(calculatedOffset, placement)
1264 this.$element.trigger('shown.bs.' + this.type) 1205 this.hoverState = null
1265 } 1206
1266 } 1207 var complete = function() {
1267 1208 that.$element.trigger('shown.bs.' + that.type)
1268 Tooltip.prototype.applyPlacement = function(offset, placement) { 1209 }
1210
1211 $.support.transition && this.$tip.hasClass('fade') ?
1212 $tip
1213 .one($.support.transition.end, complete)
1214 .emulateTransitionEnd(150) :
1215 complete()
1216 }
1217 }
1218
1219 Tooltip.prototype.applyPlacement = function (offset, placement) {
1269 var replace 1220 var replace
1270 var $tip = this.tip() 1221 var $tip = this.tip()
1271 var width = $tip[0].offsetWidth 1222 var width = $tip[0].offsetWidth
1272 var height = $tip[0].offsetHeight 1223 var height = $tip[0].offsetHeight
1273 1224
1280 if (isNaN(marginLeft)) marginLeft = 0 1231 if (isNaN(marginLeft)) marginLeft = 0
1281 1232
1282 offset.top = offset.top + marginTop 1233 offset.top = offset.top + marginTop
1283 offset.left = offset.left + marginLeft 1234 offset.left = offset.left + marginLeft
1284 1235
1285 $tip 1236 // $.fn.offset doesn't round pixel values
1286 .offset(offset) 1237 // so we use setOffset directly with our own function B-0
1287 .addClass('in') 1238 $.offset.setOffset($tip[0], $.extend({
1239 using: function (props) {
1240 $tip.css({
1241 top: Math.round(props.top),
1242 left: Math.round(props.left)
1243 })
1244 }
1245 }, offset), 0)
1246
1247 $tip.addClass('in')
1288 1248
1289 // check to see if placing tip in new offset caused the tip to resize itself 1249 // check to see if placing tip in new offset caused the tip to resize itself
1290 var actualWidth = $tip[0].offsetWidth 1250 var actualWidth = $tip[0].offsetWidth
1291 var actualHeight = $tip[0].offsetHeight 1251 var actualHeight = $tip[0].offsetHeight
1292 1252
1314 } 1274 }
1315 1275
1316 if (replace) $tip.offset(offset) 1276 if (replace) $tip.offset(offset)
1317 } 1277 }
1318 1278
1319 Tooltip.prototype.replaceArrow = function(delta, dimension, position) { 1279 Tooltip.prototype.replaceArrow = function (delta, dimension, position) {
1320 this.arrow().css(position, delta ? (50 * (1 - delta / dimension) + "%") : '') 1280 this.arrow().css(position, delta ? (50 * (1 - delta / dimension) + '%') : '')
1321 } 1281 }
1322 1282
1323 Tooltip.prototype.setContent = function () { 1283 Tooltip.prototype.setContent = function () {
1324 var $tip = this.tip() 1284 var $tip = this.tip()
1325 var title = this.getTitle() 1285 var title = this.getTitle()
1333 var $tip = this.tip() 1293 var $tip = this.tip()
1334 var e = $.Event('hide.bs.' + this.type) 1294 var e = $.Event('hide.bs.' + this.type)
1335 1295
1336 function complete() { 1296 function complete() {
1337 if (that.hoverState != 'in') $tip.detach() 1297 if (that.hoverState != 'in') $tip.detach()
1298 that.$element.trigger('hidden.bs.' + that.type)
1338 } 1299 }
1339 1300
1340 this.$element.trigger(e) 1301 this.$element.trigger(e)
1341 1302
1342 if (e.isDefaultPrevented()) return 1303 if (e.isDefaultPrevented()) return
1347 $tip 1308 $tip
1348 .one($.support.transition.end, complete) 1309 .one($.support.transition.end, complete)
1349 .emulateTransitionEnd(150) : 1310 .emulateTransitionEnd(150) :
1350 complete() 1311 complete()
1351 1312
1352 this.$element.trigger('hidden.bs.' + this.type) 1313 this.hoverState = null
1353 1314
1354 return this 1315 return this
1355 } 1316 }
1356 1317
1357 Tooltip.prototype.fixTitle = function () { 1318 Tooltip.prototype.fixTitle = function () {
1366 } 1327 }
1367 1328
1368 Tooltip.prototype.getPosition = function () { 1329 Tooltip.prototype.getPosition = function () {
1369 var el = this.$element[0] 1330 var el = this.$element[0]
1370 return $.extend({}, (typeof el.getBoundingClientRect == 'function') ? el.getBoundingClientRect() : { 1331 return $.extend({}, (typeof el.getBoundingClientRect == 'function') ? el.getBoundingClientRect() : {
1371 width: el.offsetWidth 1332 width: el.offsetWidth,
1372 , height: el.offsetHeight 1333 height: el.offsetHeight
1373 }, this.$element.offset()) 1334 }, this.$element.offset())
1374 } 1335 }
1375 1336
1376 Tooltip.prototype.getCalculatedOffset = function (placement, pos, actualWidth, actualHeight) { 1337 Tooltip.prototype.getCalculatedOffset = function (placement, pos, actualWidth, actualHeight) {
1377 return placement == 'bottom' ? { top: pos.top + pos.height, left: pos.left + pos.width / 2 - actualWidth / 2 } : 1338 return placement == 'bottom' ? { top: pos.top + pos.height, left: pos.left + pos.width / 2 - actualWidth / 2 } :
1423 var self = e ? $(e.currentTarget)[this.type](this.getDelegateOptions()).data('bs.' + this.type) : this 1384 var self = e ? $(e.currentTarget)[this.type](this.getDelegateOptions()).data('bs.' + this.type) : this
1424 self.tip().hasClass('in') ? self.leave(self) : self.enter(self) 1385 self.tip().hasClass('in') ? self.leave(self) : self.enter(self)
1425 } 1386 }
1426 1387
1427 Tooltip.prototype.destroy = function () { 1388 Tooltip.prototype.destroy = function () {
1389 clearTimeout(this.timeout)
1428 this.hide().$element.off('.' + this.type).removeData('bs.' + this.type) 1390 this.hide().$element.off('.' + this.type).removeData('bs.' + this.type)
1429 } 1391 }
1430 1392
1431 1393
1432 // TOOLTIP PLUGIN DEFINITION 1394 // TOOLTIP PLUGIN DEFINITION
1438 return this.each(function () { 1400 return this.each(function () {
1439 var $this = $(this) 1401 var $this = $(this)
1440 var data = $this.data('bs.tooltip') 1402 var data = $this.data('bs.tooltip')
1441 var options = typeof option == 'object' && option 1403 var options = typeof option == 'object' && option
1442 1404
1405 if (!data && option == 'destroy') return
1443 if (!data) $this.data('bs.tooltip', (data = new Tooltip(this, options))) 1406 if (!data) $this.data('bs.tooltip', (data = new Tooltip(this, options)))
1444 if (typeof option == 'string') data[option]() 1407 if (typeof option == 'string') data[option]()
1445 }) 1408 })
1446 } 1409 }
1447 1410
1454 $.fn.tooltip.noConflict = function () { 1417 $.fn.tooltip.noConflict = function () {
1455 $.fn.tooltip = old 1418 $.fn.tooltip = old
1456 return this 1419 return this
1457 } 1420 }
1458 1421
1459 }(window.jQuery); 1422 }(jQuery);
1460 1423
1461 /* ======================================================================== 1424 /* ========================================================================
1462 * Bootstrap: popover.js v3.0.0 1425 * Bootstrap: popover.js v3.1.1
1463 * http://twbs.github.com/bootstrap/javascript.html#popovers 1426 * http://getbootstrap.com/javascript/#popovers
1464 * ======================================================================== 1427 * ========================================================================
1465 * Copyright 2012 Twitter, Inc. 1428 * Copyright 2011-2014 Twitter, Inc.
1466 * 1429 * Licensed under MIT (https://github.com/twbs/bootstrap/blob/master/LICENSE)
1467 * Licensed under the Apache License, Version 2.0 (the "License");
1468 * you may not use this file except in compliance with the License.
1469 * You may obtain a copy of the License at
1470 *
1471 * http://www.apache.org/licenses/LICENSE-2.0
1472 *
1473 * Unless required by applicable law or agreed to in writing, software
1474 * distributed under the License is distributed on an "AS IS" BASIS,
1475 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
1476 * See the License for the specific language governing permissions and
1477 * limitations under the License.
1478 * ======================================================================== */ 1430 * ======================================================================== */
1479 1431
1480 1432
1481 +function ($) { "use strict"; 1433 +function ($) {
1434 'use strict';
1482 1435
1483 // POPOVER PUBLIC CLASS DEFINITION 1436 // POPOVER PUBLIC CLASS DEFINITION
1484 // =============================== 1437 // ===============================
1485 1438
1486 var Popover = function (element, options) { 1439 var Popover = function (element, options) {
1487 this.init('popover', element, options) 1440 this.init('popover', element, options)
1488 } 1441 }
1489 1442
1490 if (!$.fn.tooltip) throw new Error('Popover requires tooltip.js') 1443 if (!$.fn.tooltip) throw new Error('Popover requires tooltip.js')
1491 1444
1492 Popover.DEFAULTS = $.extend({} , $.fn.tooltip.Constructor.DEFAULTS, { 1445 Popover.DEFAULTS = $.extend({}, $.fn.tooltip.Constructor.DEFAULTS, {
1493 placement: 'right' 1446 placement: 'right',
1494 , trigger: 'click' 1447 trigger: 'click',
1495 , content: '' 1448 content: '',
1496 , template: '<div class="popover"><div class="arrow"></div><h3 class="popover-title"></h3><div class="popover-content"></div></div>' 1449 template: '<div class="popover"><div class="arrow"></div><h3 class="popover-title"></h3><div class="popover-content"></div></div>'
1497 }) 1450 })
1498 1451
1499 1452
1500 // NOTE: POPOVER EXTENDS tooltip.js 1453 // NOTE: POPOVER EXTENDS tooltip.js
1501 // ================================ 1454 // ================================
1512 var $tip = this.tip() 1465 var $tip = this.tip()
1513 var title = this.getTitle() 1466 var title = this.getTitle()
1514 var content = this.getContent() 1467 var content = this.getContent()
1515 1468
1516 $tip.find('.popover-title')[this.options.html ? 'html' : 'text'](title) 1469 $tip.find('.popover-title')[this.options.html ? 'html' : 'text'](title)
1517 $tip.find('.popover-content')[this.options.html ? 'html' : 'text'](content) 1470 $tip.find('.popover-content')[ // we use append for html objects to maintain js events
1471 this.options.html ? (typeof content == 'string' ? 'html' : 'append') : 'text'
1472 ](content)
1518 1473
1519 $tip.removeClass('fade top bottom left right in') 1474 $tip.removeClass('fade top bottom left right in')
1520 1475
1521 // IE8 doesn't accept hiding via the `:empty` pseudo selector, we have to do 1476 // IE8 doesn't accept hiding via the `:empty` pseudo selector, we have to do
1522 // this manually by checking the contents. 1477 // this manually by checking the contents.
1556 return this.each(function () { 1511 return this.each(function () {
1557 var $this = $(this) 1512 var $this = $(this)
1558 var data = $this.data('bs.popover') 1513 var data = $this.data('bs.popover')
1559 var options = typeof option == 'object' && option 1514 var options = typeof option == 'object' && option
1560 1515
1516 if (!data && option == 'destroy') return
1561 if (!data) $this.data('bs.popover', (data = new Popover(this, options))) 1517 if (!data) $this.data('bs.popover', (data = new Popover(this, options)))
1562 if (typeof option == 'string') data[option]() 1518 if (typeof option == 'string') data[option]()
1563 }) 1519 })
1564 } 1520 }
1565 1521
1572 $.fn.popover.noConflict = function () { 1528 $.fn.popover.noConflict = function () {
1573 $.fn.popover = old 1529 $.fn.popover = old
1574 return this 1530 return this
1575 } 1531 }
1576 1532
1577 }(window.jQuery); 1533 }(jQuery);
1578 1534
1579 /* ======================================================================== 1535 /* ========================================================================
1580 * Bootstrap: scrollspy.js v3.0.0 1536 * Bootstrap: scrollspy.js v3.1.1
1581 * http://twbs.github.com/bootstrap/javascript.html#scrollspy 1537 * http://getbootstrap.com/javascript/#scrollspy
1582 * ======================================================================== 1538 * ========================================================================
1583 * Copyright 2012 Twitter, Inc. 1539 * Copyright 2011-2014 Twitter, Inc.
1584 * 1540 * Licensed under MIT (https://github.com/twbs/bootstrap/blob/master/LICENSE)
1585 * Licensed under the Apache License, Version 2.0 (the "License");
1586 * you may not use this file except in compliance with the License.
1587 * You may obtain a copy of the License at
1588 *
1589 * http://www.apache.org/licenses/LICENSE-2.0
1590 *
1591 * Unless required by applicable law or agreed to in writing, software
1592 * distributed under the License is distributed on an "AS IS" BASIS,
1593 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
1594 * See the License for the specific language governing permissions and
1595 * limitations under the License.
1596 * ======================================================================== */ 1541 * ======================================================================== */
1597 1542
1598 1543
1599 +function ($) { "use strict"; 1544 +function ($) {
1545 'use strict';
1600 1546
1601 // SCROLLSPY CLASS DEFINITION 1547 // SCROLLSPY CLASS DEFINITION
1602 // ========================== 1548 // ==========================
1603 1549
1604 function ScrollSpy(element, options) { 1550 function ScrollSpy(element, options) {
1634 var $targets = this.$body 1580 var $targets = this.$body
1635 .find(this.selector) 1581 .find(this.selector)
1636 .map(function () { 1582 .map(function () {
1637 var $el = $(this) 1583 var $el = $(this)
1638 var href = $el.data('target') || $el.attr('href') 1584 var href = $el.data('target') || $el.attr('href')
1639 var $href = /^#\w/.test(href) && $(href) 1585 var $href = /^#./.test(href) && $(href)
1640 1586
1641 return ($href 1587 return ($href
1642 && $href.length 1588 && $href.length
1589 && $href.is(':visible')
1643 && [[ $href[offsetMethod]().top + (!$.isWindow(self.$scrollElement.get(0)) && self.$scrollElement.scrollTop()), href ]]) || null 1590 && [[ $href[offsetMethod]().top + (!$.isWindow(self.$scrollElement.get(0)) && self.$scrollElement.scrollTop()), href ]]) || null
1644 }) 1591 })
1645 .sort(function (a, b) { return a[0] - b[0] }) 1592 .sort(function (a, b) { return a[0] - b[0] })
1646 .each(function () { 1593 .each(function () {
1647 self.offsets.push(this[0]) 1594 self.offsets.push(this[0])
1660 1607
1661 if (scrollTop >= maxScroll) { 1608 if (scrollTop >= maxScroll) {
1662 return activeTarget != (i = targets.last()[0]) && this.activate(i) 1609 return activeTarget != (i = targets.last()[0]) && this.activate(i)
1663 } 1610 }
1664 1611
1612 if (activeTarget && scrollTop <= offsets[0]) {
1613 return activeTarget != (i = targets[0]) && this.activate(i)
1614 }
1615
1665 for (i = offsets.length; i--;) { 1616 for (i = offsets.length; i--;) {
1666 activeTarget != targets[i] 1617 activeTarget != targets[i]
1667 && scrollTop >= offsets[i] 1618 && scrollTop >= offsets[i]
1668 && (!offsets[i + 1] || scrollTop <= offsets[i + 1]) 1619 && (!offsets[i + 1] || scrollTop <= offsets[i + 1])
1669 && this.activate( targets[i] ) 1620 && this.activate( targets[i] )
1672 1623
1673 ScrollSpy.prototype.activate = function (target) { 1624 ScrollSpy.prototype.activate = function (target) {
1674 this.activeTarget = target 1625 this.activeTarget = target
1675 1626
1676 $(this.selector) 1627 $(this.selector)
1677 .parents('.active') 1628 .parentsUntil(this.options.target, '.active')
1678 .removeClass('active') 1629 .removeClass('active')
1679 1630
1680 var selector = this.selector 1631 var selector = this.selector +
1681 + '[data-target="' + target + '"],' 1632 '[data-target="' + target + '"],' +
1682 + this.selector + '[href="' + target + '"]' 1633 this.selector + '[href="' + target + '"]'
1683 1634
1684 var active = $(selector) 1635 var active = $(selector)
1685 .parents('li') 1636 .parents('li')
1686 .addClass('active') 1637 .addClass('active')
1687 1638
1688 if (active.parent('.dropdown-menu').length) { 1639 if (active.parent('.dropdown-menu').length) {
1689 active = active 1640 active = active
1690 .closest('li.dropdown') 1641 .closest('li.dropdown')
1691 .addClass('active') 1642 .addClass('active')
1692 } 1643 }
1693 1644
1694 active.trigger('activate') 1645 active.trigger('activate.bs.scrollspy')
1695 } 1646 }
1696 1647
1697 1648
1698 // SCROLLSPY PLUGIN DEFINITION 1649 // SCROLLSPY PLUGIN DEFINITION
1699 // =========================== 1650 // ===========================
1731 var $spy = $(this) 1682 var $spy = $(this)
1732 $spy.scrollspy($spy.data()) 1683 $spy.scrollspy($spy.data())
1733 }) 1684 })
1734 }) 1685 })
1735 1686
1736 }(window.jQuery); 1687 }(jQuery);
1737 1688
1738 /* ======================================================================== 1689 /* ========================================================================
1739 * Bootstrap: tab.js v3.0.0 1690 * Bootstrap: tab.js v3.1.1
1740 * http://twbs.github.com/bootstrap/javascript.html#tabs 1691 * http://getbootstrap.com/javascript/#tabs
1741 * ======================================================================== 1692 * ========================================================================
1742 * Copyright 2012 Twitter, Inc. 1693 * Copyright 2011-2014 Twitter, Inc.
1743 * 1694 * Licensed under MIT (https://github.com/twbs/bootstrap/blob/master/LICENSE)
1744 * Licensed under the Apache License, Version 2.0 (the "License");
1745 * you may not use this file except in compliance with the License.
1746 * You may obtain a copy of the License at
1747 *
1748 * http://www.apache.org/licenses/LICENSE-2.0
1749 *
1750 * Unless required by applicable law or agreed to in writing, software
1751 * distributed under the License is distributed on an "AS IS" BASIS,
1752 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
1753 * See the License for the specific language governing permissions and
1754 * limitations under the License.
1755 * ======================================================================== */ 1695 * ======================================================================== */
1756 1696
1757 1697
1758 +function ($) { "use strict"; 1698 +function ($) {
1699 'use strict';
1759 1700
1760 // TAB CLASS DEFINITION 1701 // TAB CLASS DEFINITION
1761 // ==================== 1702 // ====================
1762 1703
1763 var Tab = function (element) { 1704 var Tab = function (element) {
1765 } 1706 }
1766 1707
1767 Tab.prototype.show = function () { 1708 Tab.prototype.show = function () {
1768 var $this = this.element 1709 var $this = this.element
1769 var $ul = $this.closest('ul:not(.dropdown-menu)') 1710 var $ul = $this.closest('ul:not(.dropdown-menu)')
1770 var selector = $this.attr('data-target') 1711 var selector = $this.data('target')
1771 1712
1772 if (!selector) { 1713 if (!selector) {
1773 selector = $this.attr('href') 1714 selector = $this.attr('href')
1774 selector = selector && selector.replace(/.*(?=#[^\s]*$)/, '') //strip for ie7 1715 selector = selector && selector.replace(/.*(?=#[^\s]*$)/, '') //strip for ie7
1775 } 1716 }
1788 var $target = $(selector) 1729 var $target = $(selector)
1789 1730
1790 this.activate($this.parent('li'), $ul) 1731 this.activate($this.parent('li'), $ul)
1791 this.activate($target, $target.parent(), function () { 1732 this.activate($target, $target.parent(), function () {
1792 $this.trigger({ 1733 $this.trigger({
1793 type: 'shown.bs.tab' 1734 type: 'shown.bs.tab',
1794 , relatedTarget: previous 1735 relatedTarget: previous
1795 }) 1736 })
1796 }) 1737 })
1797 } 1738 }
1798 1739
1799 Tab.prototype.activate = function (element, container, callback) { 1740 Tab.prototype.activate = function (element, container, callback) {
1867 $(document).on('click.bs.tab.data-api', '[data-toggle="tab"], [data-toggle="pill"]', function (e) { 1808 $(document).on('click.bs.tab.data-api', '[data-toggle="tab"], [data-toggle="pill"]', function (e) {
1868 e.preventDefault() 1809 e.preventDefault()
1869 $(this).tab('show') 1810 $(this).tab('show')
1870 }) 1811 })
1871 1812
1872 }(window.jQuery); 1813 }(jQuery);
1873 1814
1874 /* ======================================================================== 1815 /* ========================================================================
1875 * Bootstrap: affix.js v3.0.0 1816 * Bootstrap: affix.js v3.1.1
1876 * http://twbs.github.com/bootstrap/javascript.html#affix 1817 * http://getbootstrap.com/javascript/#affix
1877 * ======================================================================== 1818 * ========================================================================
1878 * Copyright 2012 Twitter, Inc. 1819 * Copyright 2011-2014 Twitter, Inc.
1879 * 1820 * Licensed under MIT (https://github.com/twbs/bootstrap/blob/master/LICENSE)
1880 * Licensed under the Apache License, Version 2.0 (the "License");
1881 * you may not use this file except in compliance with the License.
1882 * You may obtain a copy of the License at
1883 *
1884 * http://www.apache.org/licenses/LICENSE-2.0
1885 *
1886 * Unless required by applicable law or agreed to in writing, software
1887 * distributed under the License is distributed on an "AS IS" BASIS,
1888 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
1889 * See the License for the specific language governing permissions and
1890 * limitations under the License.
1891 * ======================================================================== */ 1821 * ======================================================================== */
1892 1822
1893 1823
1894 +function ($) { "use strict"; 1824 +function ($) {
1825 'use strict';
1895 1826
1896 // AFFIX CLASS DEFINITION 1827 // AFFIX CLASS DEFINITION
1897 // ====================== 1828 // ======================
1898 1829
1899 var Affix = function (element, options) { 1830 var Affix = function (element, options) {
1900 this.options = $.extend({}, Affix.DEFAULTS, options) 1831 this.options = $.extend({}, Affix.DEFAULTS, options)
1901 this.$window = $(window) 1832 this.$window = $(window)
1902 .on('scroll.bs.affix.data-api', $.proxy(this.checkPosition, this)) 1833 .on('scroll.bs.affix.data-api', $.proxy(this.checkPosition, this))
1903 .on('click.bs.affix.data-api', $.proxy(this.checkPositionWithEventLoop, this)) 1834 .on('click.bs.affix.data-api', $.proxy(this.checkPositionWithEventLoop, this))
1904 1835
1905 this.$element = $(element) 1836 this.$element = $(element)
1906 this.affixed = 1837 this.affixed =
1907 this.unpin = null 1838 this.unpin =
1839 this.pinnedOffset = null
1908 1840
1909 this.checkPosition() 1841 this.checkPosition()
1910 } 1842 }
1911 1843
1912 Affix.RESET = 'affix affix-top affix-bottom' 1844 Affix.RESET = 'affix affix-top affix-bottom'
1913 1845
1914 Affix.DEFAULTS = { 1846 Affix.DEFAULTS = {
1915 offset: 0 1847 offset: 0
1848 }
1849
1850 Affix.prototype.getPinnedOffset = function () {
1851 if (this.pinnedOffset) return this.pinnedOffset
1852 this.$element.removeClass(Affix.RESET).addClass('affix')
1853 var scrollTop = this.$window.scrollTop()
1854 var position = this.$element.offset()
1855 return (this.pinnedOffset = position.top - scrollTop)
1916 } 1856 }
1917 1857
1918 Affix.prototype.checkPositionWithEventLoop = function () { 1858 Affix.prototype.checkPositionWithEventLoop = function () {
1919 setTimeout($.proxy(this.checkPosition, this), 1) 1859 setTimeout($.proxy(this.checkPosition, this), 1)
1920 } 1860 }
1927 var position = this.$element.offset() 1867 var position = this.$element.offset()
1928 var offset = this.options.offset 1868 var offset = this.options.offset
1929 var offsetTop = offset.top 1869 var offsetTop = offset.top
1930 var offsetBottom = offset.bottom 1870 var offsetBottom = offset.bottom
1931 1871
1872 if (this.affixed == 'top') position.top += scrollTop
1873
1932 if (typeof offset != 'object') offsetBottom = offsetTop = offset 1874 if (typeof offset != 'object') offsetBottom = offsetTop = offset
1933 if (typeof offsetTop == 'function') offsetTop = offset.top() 1875 if (typeof offsetTop == 'function') offsetTop = offset.top(this.$element)
1934 if (typeof offsetBottom == 'function') offsetBottom = offset.bottom() 1876 if (typeof offsetBottom == 'function') offsetBottom = offset.bottom(this.$element)
1935 1877
1936 var affix = this.unpin != null && (scrollTop + this.unpin <= position.top) ? false : 1878 var affix = this.unpin != null && (scrollTop + this.unpin <= position.top) ? false :
1937 offsetBottom != null && (position.top + this.$element.height() >= scrollHeight - offsetBottom) ? 'bottom' : 1879 offsetBottom != null && (position.top + this.$element.height() >= scrollHeight - offsetBottom) ? 'bottom' :
1938 offsetTop != null && (scrollTop <= offsetTop) ? 'top' : false 1880 offsetTop != null && (scrollTop <= offsetTop) ? 'top' : false
1939 1881
1940 if (this.affixed === affix) return 1882 if (this.affixed === affix) return
1941 if (this.unpin) this.$element.css('top', '') 1883 if (this.unpin) this.$element.css('top', '')
1942 1884
1885 var affixType = 'affix' + (affix ? '-' + affix : '')
1886 var e = $.Event(affixType + '.bs.affix')
1887
1888 this.$element.trigger(e)
1889
1890 if (e.isDefaultPrevented()) return
1891
1943 this.affixed = affix 1892 this.affixed = affix
1944 this.unpin = affix == 'bottom' ? position.top - scrollTop : null 1893 this.unpin = affix == 'bottom' ? this.getPinnedOffset() : null
1945 1894
1946 this.$element.removeClass(Affix.RESET).addClass('affix' + (affix ? '-' + affix : '')) 1895 this.$element
1896 .removeClass(Affix.RESET)
1897 .addClass(affixType)
1898 .trigger($.Event(affixType.replace('affix', 'affixed')))
1947 1899
1948 if (affix == 'bottom') { 1900 if (affix == 'bottom') {
1949 this.$element.offset({ top: document.body.offsetHeight - offsetBottom - this.$element.height() }) 1901 this.$element.offset({ top: scrollHeight - offsetBottom - this.$element.height() })
1950 } 1902 }
1951 } 1903 }
1952 1904
1953 1905
1954 // AFFIX PLUGIN DEFINITION 1906 // AFFIX PLUGIN DEFINITION
1994 1946
1995 $spy.affix(data) 1947 $spy.affix(data)
1996 }) 1948 })
1997 }) 1949 })
1998 1950
1999 }(window.jQuery); 1951 }(jQuery);