annotate static/bootstrap/js/bootstrap.js @ 194:3cb5850a537d

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