Dean Troyer | 54b9732 | 2014-06-20 17:53:55 -0500 | [diff] [blame] | 1 | /* =================================================== |
| 2 | * bootstrap-transition.js v2.0.0 |
| 3 | * http://twitter.github.com/bootstrap/javascript.html#transitions |
| 4 | * =================================================== |
| 5 | * Copyright 2012 Twitter, Inc. |
| 6 | * |
| 7 | * Licensed under the Apache License, Version 2.0 (the "License"); |
| 8 | * you may not use this file except in compliance with the License. |
| 9 | * You may obtain a copy of the License at |
| 10 | * |
| 11 | * http://www.apache.org/licenses/LICENSE-2.0 |
| 12 | * |
| 13 | * Unless required by applicable law or agreed to in writing, software |
| 14 | * distributed under the License is distributed on an "AS IS" BASIS, |
| 15 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
| 16 | * See the License for the specific language governing permissions and |
| 17 | * limitations under the License. |
| 18 | * ========================================================== */ |
| 19 | |
| 20 | !function( $ ) { |
| 21 | |
| 22 | $(function () { |
| 23 | |
| 24 | "use strict" |
| 25 | |
| 26 | /* CSS TRANSITION SUPPORT (https://gist.github.com/373874) |
| 27 | * ======================================================= */ |
| 28 | |
| 29 | $.support.transition = (function () { |
| 30 | var thisBody = document.body || document.documentElement |
| 31 | , thisStyle = thisBody.style |
| 32 | , support = thisStyle.transition !== undefined || thisStyle.WebkitTransition !== undefined || thisStyle.MozTransition !== undefined || thisStyle.MsTransition !== undefined || thisStyle.OTransition !== undefined |
| 33 | |
| 34 | return support && { |
| 35 | end: (function () { |
| 36 | var transitionEnd = "TransitionEnd" |
| 37 | if ( $.browser.webkit ) { |
| 38 | transitionEnd = "webkitTransitionEnd" |
| 39 | } else if ( $.browser.mozilla ) { |
| 40 | transitionEnd = "transitionend" |
| 41 | } else if ( $.browser.opera ) { |
| 42 | transitionEnd = "oTransitionEnd" |
| 43 | } |
| 44 | return transitionEnd |
| 45 | }()) |
| 46 | } |
| 47 | })() |
| 48 | |
| 49 | }) |
| 50 | |
| 51 | }( window.jQuery ) |
| 52 | /* ========================================================== |
| 53 | * bootstrap-alert.js v2.0.0 |
| 54 | * http://twitter.github.com/bootstrap/javascript.html#alerts |
| 55 | * ========================================================== |
| 56 | * Copyright 2012 Twitter, Inc. |
| 57 | * |
| 58 | * Licensed under the Apache License, Version 2.0 (the "License"); |
| 59 | * you may not use this file except in compliance with the License. |
| 60 | * You may obtain a copy of the License at |
| 61 | * |
| 62 | * http://www.apache.org/licenses/LICENSE-2.0 |
| 63 | * |
| 64 | * Unless required by applicable law or agreed to in writing, software |
| 65 | * distributed under the License is distributed on an "AS IS" BASIS, |
| 66 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
| 67 | * See the License for the specific language governing permissions and |
| 68 | * limitations under the License. |
| 69 | * ========================================================== */ |
| 70 | |
| 71 | |
| 72 | !function( $ ){ |
| 73 | |
| 74 | "use strict" |
| 75 | |
| 76 | /* ALERT CLASS DEFINITION |
| 77 | * ====================== */ |
| 78 | |
| 79 | var dismiss = '[data-dismiss="alert"]' |
| 80 | , Alert = function ( el ) { |
| 81 | $(el).on('click', dismiss, this.close) |
| 82 | } |
| 83 | |
| 84 | Alert.prototype = { |
| 85 | |
| 86 | constructor: Alert |
| 87 | |
| 88 | , close: function ( e ) { |
| 89 | var $this = $(this) |
| 90 | , selector = $this.attr('data-target') |
| 91 | , $parent |
| 92 | |
| 93 | if (!selector) { |
| 94 | selector = $this.attr('href') |
| 95 | selector = selector && selector.replace(/.*(?=#[^\s]*$)/, '') //strip for ie7 |
| 96 | } |
| 97 | |
| 98 | $parent = $(selector) |
| 99 | $parent.trigger('close') |
| 100 | |
| 101 | e && e.preventDefault() |
| 102 | |
| 103 | $parent.length || ($parent = $this.hasClass('alert') ? $this : $this.parent()) |
| 104 | |
| 105 | $parent.removeClass('in') |
| 106 | |
| 107 | function removeElement() { |
| 108 | $parent.remove() |
| 109 | $parent.trigger('closed') |
| 110 | } |
| 111 | |
| 112 | $.support.transition && $parent.hasClass('fade') ? |
| 113 | $parent.on($.support.transition.end, removeElement) : |
| 114 | removeElement() |
| 115 | } |
| 116 | |
| 117 | } |
| 118 | |
| 119 | |
| 120 | /* ALERT PLUGIN DEFINITION |
| 121 | * ======================= */ |
| 122 | |
| 123 | $.fn.alert = function ( option ) { |
| 124 | return this.each(function () { |
| 125 | var $this = $(this) |
| 126 | , data = $this.data('alert') |
| 127 | if (!data) $this.data('alert', (data = new Alert(this))) |
| 128 | if (typeof option == 'string') data[option].call($this) |
| 129 | }) |
| 130 | } |
| 131 | |
| 132 | $.fn.alert.Constructor = Alert |
| 133 | |
| 134 | |
| 135 | /* ALERT DATA-API |
| 136 | * ============== */ |
| 137 | |
| 138 | $(function () { |
| 139 | $('body').on('click.alert.data-api', dismiss, Alert.prototype.close) |
| 140 | }) |
| 141 | |
| 142 | }( window.jQuery ) |
| 143 | /* ============================================================ |
| 144 | * bootstrap-button.js v2.0.0 |
| 145 | * http://twitter.github.com/bootstrap/javascript.html#buttons |
| 146 | * ============================================================ |
| 147 | * Copyright 2012 Twitter, Inc. |
| 148 | * |
| 149 | * Licensed under the Apache License, Version 2.0 (the "License"); |
| 150 | * you may not use this file except in compliance with the License. |
| 151 | * You may obtain a copy of the License at |
| 152 | * |
| 153 | * http://www.apache.org/licenses/LICENSE-2.0 |
| 154 | * |
| 155 | * Unless required by applicable law or agreed to in writing, software |
| 156 | * distributed under the License is distributed on an "AS IS" BASIS, |
| 157 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
| 158 | * See the License for the specific language governing permissions and |
| 159 | * limitations under the License. |
| 160 | * ============================================================ */ |
| 161 | |
| 162 | !function( $ ){ |
| 163 | |
| 164 | "use strict" |
| 165 | |
| 166 | /* BUTTON PUBLIC CLASS DEFINITION |
| 167 | * ============================== */ |
| 168 | |
| 169 | var Button = function ( element, options ) { |
| 170 | this.$element = $(element) |
| 171 | this.options = $.extend({}, $.fn.button.defaults, options) |
| 172 | } |
| 173 | |
| 174 | Button.prototype = { |
| 175 | |
| 176 | constructor: Button |
| 177 | |
| 178 | , setState: function ( state ) { |
| 179 | var d = 'disabled' |
| 180 | , $el = this.$element |
| 181 | , data = $el.data() |
| 182 | , val = $el.is('input') ? 'val' : 'html' |
| 183 | |
| 184 | state = state + 'Text' |
| 185 | data.resetText || $el.data('resetText', $el[val]()) |
| 186 | |
| 187 | $el[val](data[state] || this.options[state]) |
| 188 | |
| 189 | // push to event loop to allow forms to submit |
| 190 | setTimeout(function () { |
| 191 | state == 'loadingText' ? |
| 192 | $el.addClass(d).attr(d, d) : |
| 193 | $el.removeClass(d).removeAttr(d) |
| 194 | }, 0) |
| 195 | } |
| 196 | |
| 197 | , toggle: function () { |
| 198 | var $parent = this.$element.parent('[data-toggle="buttons-radio"]') |
| 199 | |
| 200 | $parent && $parent |
| 201 | .find('.active') |
| 202 | .removeClass('active') |
| 203 | |
| 204 | this.$element.toggleClass('active') |
| 205 | } |
| 206 | |
| 207 | } |
| 208 | |
| 209 | |
| 210 | /* BUTTON PLUGIN DEFINITION |
| 211 | * ======================== */ |
| 212 | |
| 213 | $.fn.button = function ( option ) { |
| 214 | return this.each(function () { |
| 215 | var $this = $(this) |
| 216 | , data = $this.data('button') |
| 217 | , options = typeof option == 'object' && option |
| 218 | if (!data) $this.data('button', (data = new Button(this, options))) |
| 219 | if (option == 'toggle') data.toggle() |
| 220 | else if (option) data.setState(option) |
| 221 | }) |
| 222 | } |
| 223 | |
| 224 | $.fn.button.defaults = { |
| 225 | loadingText: 'loading...' |
| 226 | } |
| 227 | |
| 228 | $.fn.button.Constructor = Button |
| 229 | |
| 230 | |
| 231 | /* BUTTON DATA-API |
| 232 | * =============== */ |
| 233 | |
| 234 | $(function () { |
| 235 | $('body').on('click.button.data-api', '[data-toggle^=button]', function ( e ) { |
| 236 | $(e.target).button('toggle') |
| 237 | }) |
| 238 | }) |
| 239 | |
| 240 | }( window.jQuery ) |
| 241 | /* ========================================================== |
| 242 | * bootstrap-carousel.js v2.0.0 |
| 243 | * http://twitter.github.com/bootstrap/javascript.html#carousel |
| 244 | * ========================================================== |
| 245 | * Copyright 2012 Twitter, Inc. |
| 246 | * |
| 247 | * Licensed under the Apache License, Version 2.0 (the "License"); |
| 248 | * you may not use this file except in compliance with the License. |
| 249 | * You may obtain a copy of the License at |
| 250 | * |
| 251 | * http://www.apache.org/licenses/LICENSE-2.0 |
| 252 | * |
| 253 | * Unless required by applicable law or agreed to in writing, software |
| 254 | * distributed under the License is distributed on an "AS IS" BASIS, |
| 255 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
| 256 | * See the License for the specific language governing permissions and |
| 257 | * limitations under the License. |
| 258 | * ========================================================== */ |
| 259 | |
| 260 | |
| 261 | !function( $ ){ |
| 262 | |
| 263 | "use strict" |
| 264 | |
| 265 | /* CAROUSEL CLASS DEFINITION |
| 266 | * ========================= */ |
| 267 | |
| 268 | var Carousel = function (element, options) { |
| 269 | this.$element = $(element) |
| 270 | this.options = $.extend({}, $.fn.carousel.defaults, options) |
| 271 | this.options.slide && this.slide(this.options.slide) |
| 272 | } |
| 273 | |
| 274 | Carousel.prototype = { |
| 275 | |
| 276 | cycle: function () { |
| 277 | this.interval = setInterval($.proxy(this.next, this), this.options.interval) |
| 278 | return this |
| 279 | } |
| 280 | |
| 281 | , to: function (pos) { |
| 282 | var $active = this.$element.find('.active') |
| 283 | , children = $active.parent().children() |
| 284 | , activePos = children.index($active) |
| 285 | , that = this |
| 286 | |
| 287 | if (pos > (children.length - 1) || pos < 0) return |
| 288 | |
| 289 | if (this.sliding) { |
| 290 | return this.$element.one('slid', function () { |
| 291 | that.to(pos) |
| 292 | }) |
| 293 | } |
| 294 | |
| 295 | if (activePos == pos) { |
| 296 | return this.pause().cycle() |
| 297 | } |
| 298 | |
| 299 | return this.slide(pos > activePos ? 'next' : 'prev', $(children[pos])) |
| 300 | } |
| 301 | |
| 302 | , pause: function () { |
| 303 | clearInterval(this.interval) |
| 304 | return this |
| 305 | } |
| 306 | |
| 307 | , next: function () { |
| 308 | if (this.sliding) return |
| 309 | return this.slide('next') |
| 310 | } |
| 311 | |
| 312 | , prev: function () { |
| 313 | if (this.sliding) return |
| 314 | return this.slide('prev') |
| 315 | } |
| 316 | |
| 317 | , slide: function (type, next) { |
| 318 | var $active = this.$element.find('.active') |
| 319 | , $next = next || $active[type]() |
| 320 | , isCycling = this.interval |
| 321 | , direction = type == 'next' ? 'left' : 'right' |
| 322 | , fallback = type == 'next' ? 'first' : 'last' |
| 323 | , that = this |
| 324 | |
| 325 | this.sliding = true |
| 326 | |
| 327 | isCycling && this.pause() |
| 328 | |
| 329 | $next = $next.length ? $next : this.$element.find('.item')[fallback]() |
| 330 | |
| 331 | if (!$.support.transition && this.$element.hasClass('slide')) { |
| 332 | this.$element.trigger('slide') |
| 333 | $active.removeClass('active') |
| 334 | $next.addClass('active') |
| 335 | this.sliding = false |
| 336 | this.$element.trigger('slid') |
| 337 | } else { |
| 338 | $next.addClass(type) |
| 339 | $next[0].offsetWidth // force reflow |
| 340 | $active.addClass(direction) |
| 341 | $next.addClass(direction) |
| 342 | this.$element.trigger('slide') |
| 343 | this.$element.one($.support.transition.end, function () { |
| 344 | $next.removeClass([type, direction].join(' ')).addClass('active') |
| 345 | $active.removeClass(['active', direction].join(' ')) |
| 346 | that.sliding = false |
| 347 | setTimeout(function () { that.$element.trigger('slid') }, 0) |
| 348 | }) |
| 349 | } |
| 350 | |
| 351 | isCycling && this.cycle() |
| 352 | |
| 353 | return this |
| 354 | } |
| 355 | |
| 356 | } |
| 357 | |
| 358 | |
| 359 | /* CAROUSEL PLUGIN DEFINITION |
| 360 | * ========================== */ |
| 361 | |
| 362 | $.fn.carousel = function ( option ) { |
| 363 | return this.each(function () { |
| 364 | var $this = $(this) |
| 365 | , data = $this.data('carousel') |
| 366 | , options = typeof option == 'object' && option |
| 367 | if (!data) $this.data('carousel', (data = new Carousel(this, options))) |
| 368 | if (typeof option == 'number') data.to(option) |
| 369 | else if (typeof option == 'string' || (option = options.slide)) data[option]() |
| 370 | else data.cycle() |
| 371 | }) |
| 372 | } |
| 373 | |
| 374 | $.fn.carousel.defaults = { |
| 375 | interval: 5000 |
| 376 | } |
| 377 | |
| 378 | $.fn.carousel.Constructor = Carousel |
| 379 | |
| 380 | |
| 381 | /* CAROUSEL DATA-API |
| 382 | * ================= */ |
| 383 | |
| 384 | $(function () { |
| 385 | $('body').on('click.carousel.data-api', '[data-slide]', function ( e ) { |
| 386 | var $this = $(this), href |
| 387 | , $target = $($this.attr('data-target') || (href = $this.attr('href')) && href.replace(/.*(?=#[^\s]+$)/, '')) //strip for ie7 |
| 388 | , options = !$target.data('modal') && $.extend({}, $target.data(), $this.data()) |
| 389 | $target.carousel(options) |
| 390 | e.preventDefault() |
| 391 | }) |
| 392 | }) |
| 393 | |
| 394 | }( window.jQuery ) |
| 395 | /* ============================================================= |
| 396 | * bootstrap-collapse.js v2.0.0 |
| 397 | * http://twitter.github.com/bootstrap/javascript.html#collapse |
| 398 | * ============================================================= |
| 399 | * Copyright 2012 Twitter, Inc. |
| 400 | * |
| 401 | * Licensed under the Apache License, Version 2.0 (the "License"); |
| 402 | * you may not use this file except in compliance with the License. |
| 403 | * You may obtain a copy of the License at |
| 404 | * |
| 405 | * http://www.apache.org/licenses/LICENSE-2.0 |
| 406 | * |
| 407 | * Unless required by applicable law or agreed to in writing, software |
| 408 | * distributed under the License is distributed on an "AS IS" BASIS, |
| 409 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
| 410 | * See the License for the specific language governing permissions and |
| 411 | * limitations under the License. |
| 412 | * ============================================================ */ |
| 413 | |
| 414 | !function( $ ){ |
| 415 | |
| 416 | "use strict" |
| 417 | |
| 418 | var Collapse = function ( element, options ) { |
| 419 | this.$element = $(element) |
| 420 | this.options = $.extend({}, $.fn.collapse.defaults, options) |
| 421 | |
| 422 | if (this.options["parent"]) { |
| 423 | this.$parent = $(this.options["parent"]) |
| 424 | } |
| 425 | |
| 426 | this.options.toggle && this.toggle() |
| 427 | } |
| 428 | |
| 429 | Collapse.prototype = { |
| 430 | |
| 431 | constructor: Collapse |
| 432 | |
| 433 | , dimension: function () { |
| 434 | var hasWidth = this.$element.hasClass('width') |
| 435 | return hasWidth ? 'width' : 'height' |
| 436 | } |
| 437 | |
| 438 | , show: function () { |
| 439 | var dimension = this.dimension() |
| 440 | , scroll = $.camelCase(['scroll', dimension].join('-')) |
| 441 | , actives = this.$parent && this.$parent.find('.in') |
| 442 | , hasData |
| 443 | |
| 444 | if (actives && actives.length) { |
| 445 | hasData = actives.data('collapse') |
| 446 | actives.collapse('hide') |
| 447 | hasData || actives.data('collapse', null) |
| 448 | } |
| 449 | |
| 450 | this.$element[dimension](0) |
| 451 | this.transition('addClass', 'show', 'shown') |
| 452 | this.$element[dimension](this.$element[0][scroll]) |
| 453 | |
| 454 | } |
| 455 | |
| 456 | , hide: function () { |
| 457 | var dimension = this.dimension() |
| 458 | this.reset(this.$element[dimension]()) |
| 459 | this.transition('removeClass', 'hide', 'hidden') |
| 460 | this.$element[dimension](0) |
| 461 | } |
| 462 | |
| 463 | , reset: function ( size ) { |
| 464 | var dimension = this.dimension() |
| 465 | |
| 466 | this.$element |
| 467 | .removeClass('collapse') |
| 468 | [dimension](size || 'auto') |
| 469 | [0].offsetWidth |
| 470 | |
| 471 | this.$element.addClass('collapse') |
| 472 | } |
| 473 | |
| 474 | , transition: function ( method, startEvent, completeEvent ) { |
| 475 | var that = this |
| 476 | , complete = function () { |
| 477 | if (startEvent == 'show') that.reset() |
| 478 | that.$element.trigger(completeEvent) |
| 479 | } |
| 480 | |
| 481 | this.$element |
| 482 | .trigger(startEvent) |
| 483 | [method]('in') |
| 484 | |
| 485 | $.support.transition && this.$element.hasClass('collapse') ? |
| 486 | this.$element.one($.support.transition.end, complete) : |
| 487 | complete() |
| 488 | } |
| 489 | |
| 490 | , toggle: function () { |
| 491 | this[this.$element.hasClass('in') ? 'hide' : 'show']() |
| 492 | } |
| 493 | |
| 494 | } |
| 495 | |
| 496 | /* COLLAPSIBLE PLUGIN DEFINITION |
| 497 | * ============================== */ |
| 498 | |
| 499 | $.fn.collapse = function ( option ) { |
| 500 | return this.each(function () { |
| 501 | var $this = $(this) |
| 502 | , data = $this.data('collapse') |
| 503 | , options = typeof option == 'object' && option |
| 504 | if (!data) $this.data('collapse', (data = new Collapse(this, options))) |
| 505 | if (typeof option == 'string') data[option]() |
| 506 | }) |
| 507 | } |
| 508 | |
| 509 | $.fn.collapse.defaults = { |
| 510 | toggle: true |
| 511 | } |
| 512 | |
| 513 | $.fn.collapse.Constructor = Collapse |
| 514 | |
| 515 | |
| 516 | /* COLLAPSIBLE DATA-API |
| 517 | * ==================== */ |
| 518 | |
| 519 | $(function () { |
| 520 | $('body').on('click.collapse.data-api', '[data-toggle=collapse]', function ( e ) { |
| 521 | var $this = $(this), href |
| 522 | , target = $this.attr('data-target') |
| 523 | || e.preventDefault() |
| 524 | || (href = $this.attr('href')) && href.replace(/.*(?=#[^\s]+$)/, '') //strip for ie7 |
| 525 | , option = $(target).data('collapse') ? 'toggle' : $this.data() |
| 526 | $(target).collapse(option) |
| 527 | }) |
| 528 | }) |
| 529 | |
| 530 | }( window.jQuery ) |
| 531 | /* ============================================================ |
| 532 | * bootstrap-dropdown.js v2.0.0 |
| 533 | * http://twitter.github.com/bootstrap/javascript.html#dropdowns |
| 534 | * ============================================================ |
| 535 | * Copyright 2012 Twitter, Inc. |
| 536 | * |
| 537 | * Licensed under the Apache License, Version 2.0 (the "License"); |
| 538 | * you may not use this file except in compliance with the License. |
| 539 | * You may obtain a copy of the License at |
| 540 | * |
| 541 | * http://www.apache.org/licenses/LICENSE-2.0 |
| 542 | * |
| 543 | * Unless required by applicable law or agreed to in writing, software |
| 544 | * distributed under the License is distributed on an "AS IS" BASIS, |
| 545 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
| 546 | * See the License for the specific language governing permissions and |
| 547 | * limitations under the License. |
| 548 | * ============================================================ */ |
| 549 | |
| 550 | |
| 551 | !function( $ ){ |
| 552 | |
| 553 | "use strict" |
| 554 | |
| 555 | /* DROPDOWN CLASS DEFINITION |
| 556 | * ========================= */ |
| 557 | |
| 558 | var toggle = '[data-toggle="dropdown"]' |
| 559 | , Dropdown = function ( element ) { |
| 560 | var $el = $(element).on('click.dropdown.data-api', this.toggle) |
| 561 | $('html').on('click.dropdown.data-api', function () { |
| 562 | $el.parent().removeClass('open') |
| 563 | }) |
| 564 | } |
| 565 | |
| 566 | Dropdown.prototype = { |
| 567 | |
| 568 | constructor: Dropdown |
| 569 | |
| 570 | , toggle: function ( e ) { |
| 571 | var $this = $(this) |
| 572 | , selector = $this.attr('data-target') |
| 573 | , $parent |
| 574 | , isActive |
| 575 | |
| 576 | if (!selector) { |
| 577 | selector = $this.attr('href') |
| 578 | selector = selector && selector.replace(/.*(?=#[^\s]*$)/, '') //strip for ie7 |
| 579 | } |
| 580 | |
| 581 | $parent = $(selector) |
| 582 | $parent.length || ($parent = $this.parent()) |
| 583 | |
| 584 | isActive = $parent.hasClass('open') |
| 585 | |
| 586 | clearMenus() |
| 587 | !isActive && $parent.toggleClass('open') |
| 588 | |
| 589 | return false |
| 590 | } |
| 591 | |
| 592 | } |
| 593 | |
| 594 | function clearMenus() { |
| 595 | $(toggle).parent().removeClass('open') |
| 596 | } |
| 597 | |
| 598 | |
| 599 | /* DROPDOWN PLUGIN DEFINITION |
| 600 | * ========================== */ |
| 601 | |
| 602 | $.fn.dropdown = function ( option ) { |
| 603 | return this.each(function () { |
| 604 | var $this = $(this) |
| 605 | , data = $this.data('dropdown') |
| 606 | if (!data) $this.data('dropdown', (data = new Dropdown(this))) |
| 607 | if (typeof option == 'string') data[option].call($this) |
| 608 | }) |
| 609 | } |
| 610 | |
| 611 | $.fn.dropdown.Constructor = Dropdown |
| 612 | |
| 613 | |
| 614 | /* APPLY TO STANDARD DROPDOWN ELEMENTS |
| 615 | * =================================== */ |
| 616 | |
| 617 | $(function () { |
| 618 | $('html').on('click.dropdown.data-api', clearMenus) |
| 619 | $('body').on('click.dropdown.data-api', toggle, Dropdown.prototype.toggle) |
| 620 | }) |
| 621 | |
| 622 | }( window.jQuery ) |
| 623 | /* ========================================================= |
| 624 | * bootstrap-modal.js v2.0.0 |
| 625 | * http://twitter.github.com/bootstrap/javascript.html#modals |
| 626 | * ========================================================= |
| 627 | * Copyright 2012 Twitter, Inc. |
| 628 | * |
| 629 | * Licensed under the Apache License, Version 2.0 (the "License"); |
| 630 | * you may not use this file except in compliance with the License. |
| 631 | * You may obtain a copy of the License at |
| 632 | * |
| 633 | * http://www.apache.org/licenses/LICENSE-2.0 |
| 634 | * |
| 635 | * Unless required by applicable law or agreed to in writing, software |
| 636 | * distributed under the License is distributed on an "AS IS" BASIS, |
| 637 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
| 638 | * See the License for the specific language governing permissions and |
| 639 | * limitations under the License. |
| 640 | * ========================================================= */ |
| 641 | |
| 642 | |
| 643 | !function( $ ){ |
| 644 | |
| 645 | "use strict" |
| 646 | |
| 647 | /* MODAL CLASS DEFINITION |
| 648 | * ====================== */ |
| 649 | |
| 650 | var Modal = function ( content, options ) { |
| 651 | this.options = $.extend({}, $.fn.modal.defaults, options) |
| 652 | this.$element = $(content) |
| 653 | .delegate('[data-dismiss="modal"]', 'click.dismiss.modal', $.proxy(this.hide, this)) |
| 654 | } |
| 655 | |
| 656 | Modal.prototype = { |
| 657 | |
| 658 | constructor: Modal |
| 659 | |
| 660 | , toggle: function () { |
| 661 | return this[!this.isShown ? 'show' : 'hide']() |
| 662 | } |
| 663 | |
| 664 | , show: function () { |
| 665 | var that = this |
| 666 | |
| 667 | if (this.isShown) return |
| 668 | |
| 669 | $('body').addClass('modal-open') |
| 670 | |
| 671 | this.isShown = true |
| 672 | this.$element.trigger('show') |
| 673 | |
| 674 | escape.call(this) |
| 675 | backdrop.call(this, function () { |
| 676 | var transition = $.support.transition && that.$element.hasClass('fade') |
| 677 | |
| 678 | !that.$element.parent().length && that.$element.appendTo(document.body) //don't move modals dom position |
| 679 | |
| 680 | that.$element |
| 681 | .show() |
| 682 | |
| 683 | if (transition) { |
| 684 | that.$element[0].offsetWidth // force reflow |
| 685 | } |
| 686 | |
| 687 | that.$element.addClass('in') |
| 688 | |
| 689 | transition ? |
| 690 | that.$element.one($.support.transition.end, function () { that.$element.trigger('shown') }) : |
| 691 | that.$element.trigger('shown') |
| 692 | |
| 693 | }) |
| 694 | } |
| 695 | |
| 696 | , hide: function ( e ) { |
| 697 | e && e.preventDefault() |
| 698 | |
| 699 | if (!this.isShown) return |
| 700 | |
| 701 | var that = this |
| 702 | this.isShown = false |
| 703 | |
| 704 | $('body').removeClass('modal-open') |
| 705 | |
| 706 | escape.call(this) |
| 707 | |
| 708 | this.$element |
| 709 | .trigger('hide') |
| 710 | .removeClass('in') |
| 711 | |
| 712 | $.support.transition && this.$element.hasClass('fade') ? |
| 713 | hideWithTransition.call(this) : |
| 714 | hideModal.call(this) |
| 715 | } |
| 716 | |
| 717 | } |
| 718 | |
| 719 | |
| 720 | /* MODAL PRIVATE METHODS |
| 721 | * ===================== */ |
| 722 | |
| 723 | function hideWithTransition() { |
| 724 | var that = this |
| 725 | , timeout = setTimeout(function () { |
| 726 | that.$element.off($.support.transition.end) |
| 727 | hideModal.call(that) |
| 728 | }, 500) |
| 729 | |
| 730 | this.$element.one($.support.transition.end, function () { |
| 731 | clearTimeout(timeout) |
| 732 | hideModal.call(that) |
| 733 | }) |
| 734 | } |
| 735 | |
| 736 | function hideModal( that ) { |
| 737 | this.$element |
| 738 | .hide() |
| 739 | .trigger('hidden') |
| 740 | |
| 741 | backdrop.call(this) |
| 742 | } |
| 743 | |
| 744 | function backdrop( callback ) { |
| 745 | var that = this |
| 746 | , animate = this.$element.hasClass('fade') ? 'fade' : '' |
| 747 | |
| 748 | if (this.isShown && this.options.backdrop) { |
| 749 | var doAnimate = $.support.transition && animate |
| 750 | |
| 751 | this.$backdrop = $('<div class="modal-backdrop ' + animate + '" />') |
| 752 | .appendTo(document.body) |
| 753 | |
| 754 | if (this.options.backdrop != 'static') { |
| 755 | this.$backdrop.click($.proxy(this.hide, this)) |
| 756 | } |
| 757 | |
| 758 | if (doAnimate) this.$backdrop[0].offsetWidth // force reflow |
| 759 | |
| 760 | this.$backdrop.addClass('in') |
| 761 | |
| 762 | doAnimate ? |
| 763 | this.$backdrop.one($.support.transition.end, callback) : |
| 764 | callback() |
| 765 | |
| 766 | } else if (!this.isShown && this.$backdrop) { |
| 767 | this.$backdrop.removeClass('in') |
| 768 | |
| 769 | $.support.transition && this.$element.hasClass('fade')? |
| 770 | this.$backdrop.one($.support.transition.end, $.proxy(removeBackdrop, this)) : |
| 771 | removeBackdrop.call(this) |
| 772 | |
| 773 | } else if (callback) { |
| 774 | callback() |
| 775 | } |
| 776 | } |
| 777 | |
| 778 | function removeBackdrop() { |
| 779 | this.$backdrop.remove() |
| 780 | this.$backdrop = null |
| 781 | } |
| 782 | |
| 783 | function escape() { |
| 784 | var that = this |
| 785 | if (this.isShown && this.options.keyboard) { |
| 786 | $(document).on('keyup.dismiss.modal', function ( e ) { |
| 787 | e.which == 27 && that.hide() |
| 788 | }) |
| 789 | } else if (!this.isShown) { |
| 790 | $(document).off('keyup.dismiss.modal') |
| 791 | } |
| 792 | } |
| 793 | |
| 794 | |
| 795 | /* MODAL PLUGIN DEFINITION |
| 796 | * ======================= */ |
| 797 | |
| 798 | $.fn.modal = function ( option ) { |
| 799 | return this.each(function () { |
| 800 | var $this = $(this) |
| 801 | , data = $this.data('modal') |
| 802 | , options = typeof option == 'object' && option |
| 803 | if (!data) $this.data('modal', (data = new Modal(this, options))) |
| 804 | if (typeof option == 'string') data[option]() |
| 805 | else data.show() |
| 806 | }) |
| 807 | } |
| 808 | |
| 809 | $.fn.modal.defaults = { |
| 810 | backdrop: true |
| 811 | , keyboard: true |
| 812 | } |
| 813 | |
| 814 | $.fn.modal.Constructor = Modal |
| 815 | |
| 816 | |
| 817 | /* MODAL DATA-API |
| 818 | * ============== */ |
| 819 | |
| 820 | $(function () { |
| 821 | $('body').on('click.modal.data-api', '[data-toggle="modal"]', function ( e ) { |
| 822 | var $this = $(this), href |
| 823 | , $target = $($this.attr('data-target') || (href = $this.attr('href')) && href.replace(/.*(?=#[^\s]+$)/, '')) //strip for ie7 |
| 824 | , option = $target.data('modal') ? 'toggle' : $.extend({}, $target.data(), $this.data()) |
| 825 | |
| 826 | e.preventDefault() |
| 827 | $target.modal(option) |
| 828 | }) |
| 829 | }) |
| 830 | |
| 831 | }( window.jQuery ) |
| 832 | /* =========================================================== |
| 833 | * bootstrap-tooltip.js v2.0.0 |
| 834 | * http://twitter.github.com/bootstrap/javascript.html#tooltips |
| 835 | * Inspired by the original jQuery.tipsy by Jason Frame |
| 836 | * =========================================================== |
| 837 | * Copyright 2012 Twitter, Inc. |
| 838 | * |
| 839 | * Licensed under the Apache License, Version 2.0 (the "License"); |
| 840 | * you may not use this file except in compliance with the License. |
| 841 | * You may obtain a copy of the License at |
| 842 | * |
| 843 | * http://www.apache.org/licenses/LICENSE-2.0 |
| 844 | * |
| 845 | * Unless required by applicable law or agreed to in writing, software |
| 846 | * distributed under the License is distributed on an "AS IS" BASIS, |
| 847 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
| 848 | * See the License for the specific language governing permissions and |
| 849 | * limitations under the License. |
| 850 | * ========================================================== */ |
| 851 | |
| 852 | !function( $ ) { |
| 853 | |
| 854 | "use strict" |
| 855 | |
| 856 | /* TOOLTIP PUBLIC CLASS DEFINITION |
| 857 | * =============================== */ |
| 858 | |
| 859 | var Tooltip = function ( element, options ) { |
| 860 | this.init('tooltip', element, options) |
| 861 | } |
| 862 | |
| 863 | Tooltip.prototype = { |
| 864 | |
| 865 | constructor: Tooltip |
| 866 | |
| 867 | , init: function ( type, element, options ) { |
| 868 | var eventIn |
| 869 | , eventOut |
| 870 | |
| 871 | this.type = type |
| 872 | this.$element = $(element) |
| 873 | this.options = this.getOptions(options) |
| 874 | this.enabled = true |
| 875 | |
| 876 | if (this.options.trigger != 'manual') { |
| 877 | eventIn = this.options.trigger == 'hover' ? 'mouseenter' : 'focus' |
| 878 | eventOut = this.options.trigger == 'hover' ? 'mouseleave' : 'blur' |
| 879 | this.$element.on(eventIn, this.options.selector, $.proxy(this.enter, this)) |
| 880 | this.$element.on(eventOut, this.options.selector, $.proxy(this.leave, this)) |
| 881 | } |
| 882 | |
| 883 | this.options.selector ? |
| 884 | (this._options = $.extend({}, this.options, { trigger: 'manual', selector: '' })) : |
| 885 | this.fixTitle() |
| 886 | } |
| 887 | |
| 888 | , getOptions: function ( options ) { |
| 889 | options = $.extend({}, $.fn[this.type].defaults, options, this.$element.data()) |
| 890 | |
| 891 | if (options.delay && typeof options.delay == 'number') { |
| 892 | options.delay = { |
| 893 | show: options.delay |
| 894 | , hide: options.delay |
| 895 | } |
| 896 | } |
| 897 | |
| 898 | return options |
| 899 | } |
| 900 | |
| 901 | , enter: function ( e ) { |
| 902 | var self = $(e.currentTarget)[this.type](this._options).data(this.type) |
| 903 | |
| 904 | if (!self.options.delay || !self.options.delay.show) { |
| 905 | self.show() |
| 906 | } else { |
| 907 | self.hoverState = 'in' |
| 908 | setTimeout(function() { |
| 909 | if (self.hoverState == 'in') { |
| 910 | self.show() |
| 911 | } |
| 912 | }, self.options.delay.show) |
| 913 | } |
| 914 | } |
| 915 | |
| 916 | , leave: function ( e ) { |
| 917 | var self = $(e.currentTarget)[this.type](this._options).data(this.type) |
| 918 | |
| 919 | if (!self.options.delay || !self.options.delay.hide) { |
| 920 | self.hide() |
| 921 | } else { |
| 922 | self.hoverState = 'out' |
| 923 | setTimeout(function() { |
| 924 | if (self.hoverState == 'out') { |
| 925 | self.hide() |
| 926 | } |
| 927 | }, self.options.delay.hide) |
| 928 | } |
| 929 | } |
| 930 | |
| 931 | , show: function () { |
| 932 | var $tip |
| 933 | , inside |
| 934 | , pos |
| 935 | , actualWidth |
| 936 | , actualHeight |
| 937 | , placement |
| 938 | , tp |
| 939 | |
| 940 | if (this.hasContent() && this.enabled) { |
| 941 | $tip = this.tip() |
| 942 | this.setContent() |
| 943 | |
| 944 | if (this.options.animation) { |
| 945 | $tip.addClass('fade') |
| 946 | } |
| 947 | |
| 948 | placement = typeof this.options.placement == 'function' ? |
| 949 | this.options.placement.call(this, $tip[0], this.$element[0]) : |
| 950 | this.options.placement |
| 951 | |
| 952 | inside = /in/.test(placement) |
| 953 | |
| 954 | $tip |
| 955 | .remove() |
| 956 | .css({ top: 0, left: 0, display: 'block' }) |
| 957 | .appendTo(inside ? this.$element : document.body) |
| 958 | |
| 959 | pos = this.getPosition(inside) |
| 960 | |
| 961 | actualWidth = $tip[0].offsetWidth |
| 962 | actualHeight = $tip[0].offsetHeight |
| 963 | |
| 964 | switch (inside ? placement.split(' ')[1] : placement) { |
| 965 | case 'bottom': |
| 966 | tp = {top: pos.top + pos.height, left: pos.left + pos.width / 2 - actualWidth / 2} |
| 967 | break |
| 968 | case 'top': |
| 969 | tp = {top: pos.top - actualHeight, left: pos.left + pos.width / 2 - actualWidth / 2} |
| 970 | break |
| 971 | case 'left': |
| 972 | tp = {top: pos.top + pos.height / 2 - actualHeight / 2, left: pos.left - actualWidth} |
| 973 | break |
| 974 | case 'right': |
| 975 | tp = {top: pos.top + pos.height / 2 - actualHeight / 2, left: pos.left + pos.width} |
| 976 | break |
| 977 | } |
| 978 | |
| 979 | $tip |
| 980 | .css(tp) |
| 981 | .addClass(placement) |
| 982 | .addClass('in') |
| 983 | } |
| 984 | } |
| 985 | |
| 986 | , setContent: function () { |
| 987 | var $tip = this.tip() |
| 988 | $tip.find('.tooltip-inner').html(this.getTitle()) |
| 989 | $tip.removeClass('fade in top bottom left right') |
| 990 | } |
| 991 | |
| 992 | , hide: function () { |
| 993 | var that = this |
| 994 | , $tip = this.tip() |
| 995 | |
| 996 | $tip.removeClass('in') |
| 997 | |
| 998 | function removeWithAnimation() { |
| 999 | var timeout = setTimeout(function () { |
| 1000 | $tip.off($.support.transition.end).remove() |
| 1001 | }, 500) |
| 1002 | |
| 1003 | $tip.one($.support.transition.end, function () { |
| 1004 | clearTimeout(timeout) |
| 1005 | $tip.remove() |
| 1006 | }) |
| 1007 | } |
| 1008 | |
| 1009 | $.support.transition && this.$tip.hasClass('fade') ? |
| 1010 | removeWithAnimation() : |
| 1011 | $tip.remove() |
| 1012 | } |
| 1013 | |
| 1014 | , fixTitle: function () { |
| 1015 | var $e = this.$element |
| 1016 | if ($e.attr('title') || typeof($e.attr('data-original-title')) != 'string') { |
| 1017 | $e.attr('data-original-title', $e.attr('title') || '').removeAttr('title') |
| 1018 | } |
| 1019 | } |
| 1020 | |
| 1021 | , hasContent: function () { |
| 1022 | return this.getTitle() |
| 1023 | } |
| 1024 | |
| 1025 | , getPosition: function (inside) { |
| 1026 | return $.extend({}, (inside ? {top: 0, left: 0} : this.$element.offset()), { |
| 1027 | width: this.$element[0].offsetWidth |
| 1028 | , height: this.$element[0].offsetHeight |
| 1029 | }) |
| 1030 | } |
| 1031 | |
| 1032 | , getTitle: function () { |
| 1033 | var title |
| 1034 | , $e = this.$element |
| 1035 | , o = this.options |
| 1036 | |
| 1037 | title = $e.attr('data-original-title') |
| 1038 | || (typeof o.title == 'function' ? o.title.call($e[0]) : o.title) |
| 1039 | |
| 1040 | title = title.toString().replace(/(^\s*|\s*$)/, "") |
| 1041 | |
| 1042 | return title |
| 1043 | } |
| 1044 | |
| 1045 | , tip: function () { |
| 1046 | return this.$tip = this.$tip || $(this.options.template) |
| 1047 | } |
| 1048 | |
| 1049 | , validate: function () { |
| 1050 | if (!this.$element[0].parentNode) { |
| 1051 | this.hide() |
| 1052 | this.$element = null |
| 1053 | this.options = null |
| 1054 | } |
| 1055 | } |
| 1056 | |
| 1057 | , enable: function () { |
| 1058 | this.enabled = true |
| 1059 | } |
| 1060 | |
| 1061 | , disable: function () { |
| 1062 | this.enabled = false |
| 1063 | } |
| 1064 | |
| 1065 | , toggleEnabled: function () { |
| 1066 | this.enabled = !this.enabled |
| 1067 | } |
| 1068 | |
| 1069 | , toggle: function () { |
| 1070 | this[this.tip().hasClass('in') ? 'hide' : 'show']() |
| 1071 | } |
| 1072 | |
| 1073 | } |
| 1074 | |
| 1075 | |
| 1076 | /* TOOLTIP PLUGIN DEFINITION |
| 1077 | * ========================= */ |
| 1078 | |
| 1079 | $.fn.tooltip = function ( option ) { |
| 1080 | return this.each(function () { |
| 1081 | var $this = $(this) |
| 1082 | , data = $this.data('tooltip') |
| 1083 | , options = typeof option == 'object' && option |
| 1084 | if (!data) $this.data('tooltip', (data = new Tooltip(this, options))) |
| 1085 | if (typeof option == 'string') data[option]() |
| 1086 | }) |
| 1087 | } |
| 1088 | |
| 1089 | $.fn.tooltip.Constructor = Tooltip |
| 1090 | |
| 1091 | $.fn.tooltip.defaults = { |
| 1092 | animation: true |
| 1093 | , delay: 0 |
| 1094 | , selector: false |
| 1095 | , placement: 'top' |
| 1096 | , trigger: 'hover' |
| 1097 | , title: '' |
| 1098 | , template: '<div class="tooltip"><div class="tooltip-arrow"></div><div class="tooltip-inner"></div></div>' |
| 1099 | } |
| 1100 | |
| 1101 | }( window.jQuery ) |
| 1102 | /* =========================================================== |
| 1103 | * bootstrap-popover.js v2.0.0 |
| 1104 | * http://twitter.github.com/bootstrap/javascript.html#popovers |
| 1105 | * =========================================================== |
| 1106 | * Copyright 2012 Twitter, Inc. |
| 1107 | * |
| 1108 | * Licensed under the Apache License, Version 2.0 (the "License"); |
| 1109 | * you may not use this file except in compliance with the License. |
| 1110 | * You may obtain a copy of the License at |
| 1111 | * |
| 1112 | * http://www.apache.org/licenses/LICENSE-2.0 |
| 1113 | * |
| 1114 | * Unless required by applicable law or agreed to in writing, software |
| 1115 | * distributed under the License is distributed on an "AS IS" BASIS, |
| 1116 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
| 1117 | * See the License for the specific language governing permissions and |
| 1118 | * limitations under the License. |
| 1119 | * =========================================================== */ |
| 1120 | |
| 1121 | |
| 1122 | !function( $ ) { |
| 1123 | |
| 1124 | "use strict" |
| 1125 | |
| 1126 | var Popover = function ( element, options ) { |
| 1127 | this.init('popover', element, options) |
| 1128 | } |
| 1129 | |
| 1130 | /* NOTE: POPOVER EXTENDS BOOTSTRAP-TOOLTIP.js |
| 1131 | ========================================== */ |
| 1132 | |
| 1133 | Popover.prototype = $.extend({}, $.fn.tooltip.Constructor.prototype, { |
| 1134 | |
| 1135 | constructor: Popover |
| 1136 | |
| 1137 | , setContent: function () { |
| 1138 | var $tip = this.tip() |
| 1139 | , title = this.getTitle() |
| 1140 | , content = this.getContent() |
| 1141 | |
| 1142 | $tip.find('.popover-title')[ $.type(title) == 'object' ? 'append' : 'html' ](title) |
| 1143 | $tip.find('.popover-content > *')[ $.type(content) == 'object' ? 'append' : 'html' ](content) |
| 1144 | |
| 1145 | $tip.removeClass('fade top bottom left right in') |
| 1146 | } |
| 1147 | |
| 1148 | , hasContent: function () { |
| 1149 | return this.getTitle() || this.getContent() |
| 1150 | } |
| 1151 | |
| 1152 | , getContent: function () { |
| 1153 | var content |
| 1154 | , $e = this.$element |
| 1155 | , o = this.options |
| 1156 | |
| 1157 | content = $e.attr('data-content') |
| 1158 | || (typeof o.content == 'function' ? o.content.call($e[0]) : o.content) |
| 1159 | |
| 1160 | content = content.toString().replace(/(^\s*|\s*$)/, "") |
| 1161 | |
| 1162 | return content |
| 1163 | } |
| 1164 | |
| 1165 | , tip: function() { |
| 1166 | if (!this.$tip) { |
| 1167 | this.$tip = $(this.options.template) |
| 1168 | } |
| 1169 | return this.$tip |
| 1170 | } |
| 1171 | |
| 1172 | }) |
| 1173 | |
| 1174 | |
| 1175 | /* POPOVER PLUGIN DEFINITION |
| 1176 | * ======================= */ |
| 1177 | |
| 1178 | $.fn.popover = function ( option ) { |
| 1179 | return this.each(function () { |
| 1180 | var $this = $(this) |
| 1181 | , data = $this.data('popover') |
| 1182 | , options = typeof option == 'object' && option |
| 1183 | if (!data) $this.data('popover', (data = new Popover(this, options))) |
| 1184 | if (typeof option == 'string') data[option]() |
| 1185 | }) |
| 1186 | } |
| 1187 | |
| 1188 | $.fn.popover.Constructor = Popover |
| 1189 | |
| 1190 | $.fn.popover.defaults = $.extend({} , $.fn.tooltip.defaults, { |
| 1191 | placement: 'right' |
| 1192 | , content: '' |
| 1193 | , template: '<div class="popover"><div class="arrow"></div><div class="popover-inner"><h3 class="popover-title"></h3><div class="popover-content"><p></p></div></div></div>' |
| 1194 | }) |
| 1195 | |
| 1196 | }( window.jQuery ) |
| 1197 | /* ============================================================= |
| 1198 | * bootstrap-scrollspy.js v2.0.0 |
| 1199 | * http://twitter.github.com/bootstrap/javascript.html#scrollspy |
| 1200 | * ============================================================= |
| 1201 | * Copyright 2012 Twitter, Inc. |
| 1202 | * |
| 1203 | * Licensed under the Apache License, Version 2.0 (the "License"); |
| 1204 | * you may not use this file except in compliance with the License. |
| 1205 | * You may obtain a copy of the License at |
| 1206 | * |
| 1207 | * http://www.apache.org/licenses/LICENSE-2.0 |
| 1208 | * |
| 1209 | * Unless required by applicable law or agreed to in writing, software |
| 1210 | * distributed under the License is distributed on an "AS IS" BASIS, |
| 1211 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
| 1212 | * See the License for the specific language governing permissions and |
| 1213 | * limitations under the License. |
| 1214 | * ============================================================== */ |
| 1215 | |
| 1216 | !function ( $ ) { |
| 1217 | |
| 1218 | "use strict" |
| 1219 | |
| 1220 | /* SCROLLSPY CLASS DEFINITION |
| 1221 | * ========================== */ |
| 1222 | |
| 1223 | function ScrollSpy( element, options) { |
| 1224 | var process = $.proxy(this.process, this) |
| 1225 | , $element = $(element).is('body') ? $(window) : $(element) |
| 1226 | , href |
| 1227 | this.options = $.extend({}, $.fn.scrollspy.defaults, options) |
| 1228 | this.$scrollElement = $element.on('scroll.scroll.data-api', process) |
| 1229 | this.selector = (this.options.target |
| 1230 | || ((href = $(element).attr('href')) && href.replace(/.*(?=#[^\s]+$)/, '')) //strip for ie7 |
| 1231 | || '') + ' .nav li > a' |
| 1232 | this.$body = $('body').on('click.scroll.data-api', this.selector, process) |
| 1233 | this.refresh() |
| 1234 | this.process() |
| 1235 | } |
| 1236 | |
| 1237 | ScrollSpy.prototype = { |
| 1238 | |
| 1239 | constructor: ScrollSpy |
| 1240 | |
| 1241 | , refresh: function () { |
| 1242 | this.targets = this.$body |
| 1243 | .find(this.selector) |
| 1244 | .map(function () { |
| 1245 | var href = $(this).attr('href') |
| 1246 | return /^#\w/.test(href) && $(href).length ? href : null |
| 1247 | }) |
| 1248 | |
| 1249 | this.offsets = $.map(this.targets, function (id) { |
| 1250 | return $(id).position().top |
| 1251 | }) |
| 1252 | } |
| 1253 | |
| 1254 | , process: function () { |
| 1255 | var scrollTop = this.$scrollElement.scrollTop() + this.options.offset |
| 1256 | , offsets = this.offsets |
| 1257 | , targets = this.targets |
| 1258 | , activeTarget = this.activeTarget |
| 1259 | , i |
| 1260 | |
| 1261 | for (i = offsets.length; i--;) { |
| 1262 | activeTarget != targets[i] |
| 1263 | && scrollTop >= offsets[i] |
| 1264 | && (!offsets[i + 1] || scrollTop <= offsets[i + 1]) |
| 1265 | && this.activate( targets[i] ) |
| 1266 | } |
| 1267 | } |
| 1268 | |
| 1269 | , activate: function (target) { |
| 1270 | var active |
| 1271 | |
| 1272 | this.activeTarget = target |
| 1273 | |
| 1274 | this.$body |
| 1275 | .find(this.selector).parent('.active') |
| 1276 | .removeClass('active') |
| 1277 | |
| 1278 | active = this.$body |
| 1279 | .find(this.selector + '[href="' + target + '"]') |
| 1280 | .parent('li') |
| 1281 | .addClass('active') |
| 1282 | |
| 1283 | if ( active.parent('.dropdown-menu') ) { |
| 1284 | active.closest('li.dropdown').addClass('active') |
| 1285 | } |
| 1286 | } |
| 1287 | |
| 1288 | } |
| 1289 | |
| 1290 | |
| 1291 | /* SCROLLSPY PLUGIN DEFINITION |
| 1292 | * =========================== */ |
| 1293 | |
| 1294 | $.fn.scrollspy = function ( option ) { |
| 1295 | return this.each(function () { |
| 1296 | var $this = $(this) |
| 1297 | , data = $this.data('scrollspy') |
| 1298 | , options = typeof option == 'object' && option |
| 1299 | if (!data) $this.data('scrollspy', (data = new ScrollSpy(this, options))) |
| 1300 | if (typeof option == 'string') data[option]() |
| 1301 | }) |
| 1302 | } |
| 1303 | |
| 1304 | $.fn.scrollspy.Constructor = ScrollSpy |
| 1305 | |
| 1306 | $.fn.scrollspy.defaults = { |
| 1307 | offset: 10 |
| 1308 | } |
| 1309 | |
| 1310 | |
| 1311 | /* SCROLLSPY DATA-API |
| 1312 | * ================== */ |
| 1313 | |
| 1314 | $(function () { |
| 1315 | $('[data-spy="scroll"]').each(function () { |
| 1316 | var $spy = $(this) |
| 1317 | $spy.scrollspy($spy.data()) |
| 1318 | }) |
| 1319 | }) |
| 1320 | |
| 1321 | }( window.jQuery ) |
| 1322 | /* ======================================================== |
| 1323 | * bootstrap-tab.js v2.0.0 |
| 1324 | * http://twitter.github.com/bootstrap/javascript.html#tabs |
| 1325 | * ======================================================== |
| 1326 | * Copyright 2012 Twitter, Inc. |
| 1327 | * |
| 1328 | * Licensed under the Apache License, Version 2.0 (the "License"); |
| 1329 | * you may not use this file except in compliance with the License. |
| 1330 | * You may obtain a copy of the License at |
| 1331 | * |
| 1332 | * http://www.apache.org/licenses/LICENSE-2.0 |
| 1333 | * |
| 1334 | * Unless required by applicable law or agreed to in writing, software |
| 1335 | * distributed under the License is distributed on an "AS IS" BASIS, |
| 1336 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
| 1337 | * See the License for the specific language governing permissions and |
| 1338 | * limitations under the License. |
| 1339 | * ======================================================== */ |
| 1340 | |
| 1341 | |
| 1342 | !function( $ ){ |
| 1343 | |
| 1344 | "use strict" |
| 1345 | |
| 1346 | /* TAB CLASS DEFINITION |
| 1347 | * ==================== */ |
| 1348 | |
| 1349 | var Tab = function ( element ) { |
| 1350 | this.element = $(element) |
| 1351 | } |
| 1352 | |
| 1353 | Tab.prototype = { |
| 1354 | |
| 1355 | constructor: Tab |
| 1356 | |
| 1357 | , show: function () { |
| 1358 | var $this = this.element |
| 1359 | , $ul = $this.closest('ul:not(.dropdown-menu)') |
| 1360 | , selector = $this.attr('data-target') |
| 1361 | , previous |
| 1362 | , $target |
| 1363 | |
| 1364 | if (!selector) { |
| 1365 | selector = $this.attr('href') |
| 1366 | selector = selector && selector.replace(/.*(?=#[^\s]*$)/, '') //strip for ie7 |
| 1367 | } |
| 1368 | |
| 1369 | if ( $this.parent('li').hasClass('active') ) return |
| 1370 | |
| 1371 | previous = $ul.find('.active a').last()[0] |
| 1372 | |
| 1373 | $this.trigger({ |
| 1374 | type: 'show' |
| 1375 | , relatedTarget: previous |
| 1376 | }) |
| 1377 | |
| 1378 | $target = $(selector) |
| 1379 | |
| 1380 | this.activate($this.parent('li'), $ul) |
| 1381 | this.activate($target, $target.parent(), function () { |
| 1382 | $this.trigger({ |
| 1383 | type: 'shown' |
| 1384 | , relatedTarget: previous |
| 1385 | }) |
| 1386 | }) |
| 1387 | } |
| 1388 | |
| 1389 | , activate: function ( element, container, callback) { |
| 1390 | var $active = container.find('> .active') |
| 1391 | , transition = callback |
| 1392 | && $.support.transition |
| 1393 | && $active.hasClass('fade') |
| 1394 | |
| 1395 | function next() { |
| 1396 | $active |
| 1397 | .removeClass('active') |
| 1398 | .find('> .dropdown-menu > .active') |
| 1399 | .removeClass('active') |
| 1400 | |
| 1401 | element.addClass('active') |
| 1402 | |
| 1403 | if (transition) { |
| 1404 | element[0].offsetWidth // reflow for transition |
| 1405 | element.addClass('in') |
| 1406 | } else { |
| 1407 | element.removeClass('fade') |
| 1408 | } |
| 1409 | |
| 1410 | if ( element.parent('.dropdown-menu') ) { |
| 1411 | element.closest('li.dropdown').addClass('active') |
| 1412 | } |
| 1413 | |
| 1414 | callback && callback() |
| 1415 | } |
| 1416 | |
| 1417 | transition ? |
| 1418 | $active.one($.support.transition.end, next) : |
| 1419 | next() |
| 1420 | |
| 1421 | $active.removeClass('in') |
| 1422 | } |
| 1423 | } |
| 1424 | |
| 1425 | |
| 1426 | /* TAB PLUGIN DEFINITION |
| 1427 | * ===================== */ |
| 1428 | |
| 1429 | $.fn.tab = function ( option ) { |
| 1430 | return this.each(function () { |
| 1431 | var $this = $(this) |
| 1432 | , data = $this.data('tab') |
| 1433 | if (!data) $this.data('tab', (data = new Tab(this))) |
| 1434 | if (typeof option == 'string') data[option]() |
| 1435 | }) |
| 1436 | } |
| 1437 | |
| 1438 | $.fn.tab.Constructor = Tab |
| 1439 | |
| 1440 | |
| 1441 | /* TAB DATA-API |
| 1442 | * ============ */ |
| 1443 | |
| 1444 | $(function () { |
| 1445 | $('body').on('click.tab.data-api', '[data-toggle="tab"], [data-toggle="pill"]', function (e) { |
| 1446 | e.preventDefault() |
| 1447 | $(this).tab('show') |
| 1448 | }) |
| 1449 | }) |
| 1450 | |
| 1451 | }( window.jQuery ) |
| 1452 | /* ============================================================= |
| 1453 | * bootstrap-typeahead.js v2.0.0 |
| 1454 | * http://twitter.github.com/bootstrap/javascript.html#typeahead |
| 1455 | * ============================================================= |
| 1456 | * Copyright 2012 Twitter, Inc. |
| 1457 | * |
| 1458 | * Licensed under the Apache License, Version 2.0 (the "License"); |
| 1459 | * you may not use this file except in compliance with the License. |
| 1460 | * You may obtain a copy of the License at |
| 1461 | * |
| 1462 | * http://www.apache.org/licenses/LICENSE-2.0 |
| 1463 | * |
| 1464 | * Unless required by applicable law or agreed to in writing, software |
| 1465 | * distributed under the License is distributed on an "AS IS" BASIS, |
| 1466 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
| 1467 | * See the License for the specific language governing permissions and |
| 1468 | * limitations under the License. |
| 1469 | * ============================================================ */ |
| 1470 | |
| 1471 | !function( $ ){ |
| 1472 | |
| 1473 | "use strict" |
| 1474 | |
| 1475 | var Typeahead = function ( element, options ) { |
| 1476 | this.$element = $(element) |
| 1477 | this.options = $.extend({}, $.fn.typeahead.defaults, options) |
| 1478 | this.matcher = this.options.matcher || this.matcher |
| 1479 | this.sorter = this.options.sorter || this.sorter |
| 1480 | this.highlighter = this.options.highlighter || this.highlighter |
| 1481 | this.$menu = $(this.options.menu).appendTo('body') |
| 1482 | this.source = this.options.source |
| 1483 | this.shown = false |
| 1484 | this.listen() |
| 1485 | } |
| 1486 | |
| 1487 | Typeahead.prototype = { |
| 1488 | |
| 1489 | constructor: Typeahead |
| 1490 | |
| 1491 | , select: function () { |
| 1492 | var val = this.$menu.find('.active').attr('data-value') |
| 1493 | this.$element.val(val) |
| 1494 | return this.hide() |
| 1495 | } |
| 1496 | |
| 1497 | , show: function () { |
| 1498 | var pos = $.extend({}, this.$element.offset(), { |
| 1499 | height: this.$element[0].offsetHeight |
| 1500 | }) |
| 1501 | |
| 1502 | this.$menu.css({ |
| 1503 | top: pos.top + pos.height |
| 1504 | , left: pos.left |
| 1505 | }) |
| 1506 | |
| 1507 | this.$menu.show() |
| 1508 | this.shown = true |
| 1509 | return this |
| 1510 | } |
| 1511 | |
| 1512 | , hide: function () { |
| 1513 | this.$menu.hide() |
| 1514 | this.shown = false |
| 1515 | return this |
| 1516 | } |
| 1517 | |
| 1518 | , lookup: function (event) { |
| 1519 | var that = this |
| 1520 | , items |
| 1521 | , q |
| 1522 | |
| 1523 | this.query = this.$element.val() |
| 1524 | |
| 1525 | if (!this.query) { |
| 1526 | return this.shown ? this.hide() : this |
| 1527 | } |
| 1528 | |
| 1529 | items = $.grep(this.source, function (item) { |
| 1530 | if (that.matcher(item)) return item |
| 1531 | }) |
| 1532 | |
| 1533 | items = this.sorter(items) |
| 1534 | |
| 1535 | if (!items.length) { |
| 1536 | return this.shown ? this.hide() : this |
| 1537 | } |
| 1538 | |
| 1539 | return this.render(items.slice(0, this.options.items)).show() |
| 1540 | } |
| 1541 | |
| 1542 | , matcher: function (item) { |
| 1543 | return ~item.toLowerCase().indexOf(this.query.toLowerCase()) |
| 1544 | } |
| 1545 | |
| 1546 | , sorter: function (items) { |
| 1547 | var beginswith = [] |
| 1548 | , caseSensitive = [] |
| 1549 | , caseInsensitive = [] |
| 1550 | , item |
| 1551 | |
| 1552 | while (item = items.shift()) { |
| 1553 | if (!item.toLowerCase().indexOf(this.query.toLowerCase())) beginswith.push(item) |
| 1554 | else if (~item.indexOf(this.query)) caseSensitive.push(item) |
| 1555 | else caseInsensitive.push(item) |
| 1556 | } |
| 1557 | |
| 1558 | return beginswith.concat(caseSensitive, caseInsensitive) |
| 1559 | } |
| 1560 | |
| 1561 | , highlighter: function (item) { |
| 1562 | return item.replace(new RegExp('(' + this.query + ')', 'ig'), function ($1, match) { |
| 1563 | return '<strong>' + match + '</strong>' |
| 1564 | }) |
| 1565 | } |
| 1566 | |
| 1567 | , render: function (items) { |
| 1568 | var that = this |
| 1569 | |
| 1570 | items = $(items).map(function (i, item) { |
| 1571 | i = $(that.options.item).attr('data-value', item) |
| 1572 | i.find('a').html(that.highlighter(item)) |
| 1573 | return i[0] |
| 1574 | }) |
| 1575 | |
| 1576 | items.first().addClass('active') |
| 1577 | this.$menu.html(items) |
| 1578 | return this |
| 1579 | } |
| 1580 | |
| 1581 | , next: function (event) { |
| 1582 | var active = this.$menu.find('.active').removeClass('active') |
| 1583 | , next = active.next() |
| 1584 | |
| 1585 | if (!next.length) { |
| 1586 | next = $(this.$menu.find('li')[0]) |
| 1587 | } |
| 1588 | |
| 1589 | next.addClass('active') |
| 1590 | } |
| 1591 | |
| 1592 | , prev: function (event) { |
| 1593 | var active = this.$menu.find('.active').removeClass('active') |
| 1594 | , prev = active.prev() |
| 1595 | |
| 1596 | if (!prev.length) { |
| 1597 | prev = this.$menu.find('li').last() |
| 1598 | } |
| 1599 | |
| 1600 | prev.addClass('active') |
| 1601 | } |
| 1602 | |
| 1603 | , listen: function () { |
| 1604 | this.$element |
| 1605 | .on('blur', $.proxy(this.blur, this)) |
| 1606 | .on('keypress', $.proxy(this.keypress, this)) |
| 1607 | .on('keyup', $.proxy(this.keyup, this)) |
| 1608 | |
| 1609 | if ($.browser.webkit || $.browser.msie) { |
| 1610 | this.$element.on('keydown', $.proxy(this.keypress, this)) |
| 1611 | } |
| 1612 | |
| 1613 | this.$menu |
| 1614 | .on('click', $.proxy(this.click, this)) |
| 1615 | .on('mouseenter', 'li', $.proxy(this.mouseenter, this)) |
| 1616 | } |
| 1617 | |
| 1618 | , keyup: function (e) { |
| 1619 | e.stopPropagation() |
| 1620 | e.preventDefault() |
| 1621 | |
| 1622 | switch(e.keyCode) { |
| 1623 | case 40: // down arrow |
| 1624 | case 38: // up arrow |
| 1625 | break |
| 1626 | |
| 1627 | case 9: // tab |
| 1628 | case 13: // enter |
| 1629 | if (!this.shown) return |
| 1630 | this.select() |
| 1631 | break |
| 1632 | |
| 1633 | case 27: // escape |
| 1634 | this.hide() |
| 1635 | break |
| 1636 | |
| 1637 | default: |
| 1638 | this.lookup() |
| 1639 | } |
| 1640 | |
| 1641 | } |
| 1642 | |
| 1643 | , keypress: function (e) { |
| 1644 | e.stopPropagation() |
| 1645 | if (!this.shown) return |
| 1646 | |
| 1647 | switch(e.keyCode) { |
| 1648 | case 9: // tab |
| 1649 | case 13: // enter |
| 1650 | case 27: // escape |
| 1651 | e.preventDefault() |
| 1652 | break |
| 1653 | |
| 1654 | case 38: // up arrow |
| 1655 | e.preventDefault() |
| 1656 | this.prev() |
| 1657 | break |
| 1658 | |
| 1659 | case 40: // down arrow |
| 1660 | e.preventDefault() |
| 1661 | this.next() |
| 1662 | break |
| 1663 | } |
| 1664 | } |
| 1665 | |
| 1666 | , blur: function (e) { |
| 1667 | var that = this |
| 1668 | e.stopPropagation() |
| 1669 | e.preventDefault() |
| 1670 | setTimeout(function () { that.hide() }, 150) |
| 1671 | } |
| 1672 | |
| 1673 | , click: function (e) { |
| 1674 | e.stopPropagation() |
| 1675 | e.preventDefault() |
| 1676 | this.select() |
| 1677 | } |
| 1678 | |
| 1679 | , mouseenter: function (e) { |
| 1680 | this.$menu.find('.active').removeClass('active') |
| 1681 | $(e.currentTarget).addClass('active') |
| 1682 | } |
| 1683 | |
| 1684 | } |
| 1685 | |
| 1686 | |
| 1687 | /* TYPEAHEAD PLUGIN DEFINITION |
| 1688 | * =========================== */ |
| 1689 | |
| 1690 | $.fn.typeahead = function ( option ) { |
| 1691 | return this.each(function () { |
| 1692 | var $this = $(this) |
| 1693 | , data = $this.data('typeahead') |
| 1694 | , options = typeof option == 'object' && option |
| 1695 | if (!data) $this.data('typeahead', (data = new Typeahead(this, options))) |
| 1696 | if (typeof option == 'string') data[option]() |
| 1697 | }) |
| 1698 | } |
| 1699 | |
| 1700 | $.fn.typeahead.defaults = { |
| 1701 | source: [] |
| 1702 | , items: 8 |
| 1703 | , menu: '<ul class="typeahead dropdown-menu"></ul>' |
| 1704 | , item: '<li><a href="#"></a></li>' |
| 1705 | } |
| 1706 | |
| 1707 | $.fn.typeahead.Constructor = Typeahead |
| 1708 | |
| 1709 | |
| 1710 | /* TYPEAHEAD DATA-API |
| 1711 | * ================== */ |
| 1712 | |
| 1713 | $(function () { |
| 1714 | $('body').on('focus.typeahead.data-api', '[data-provide="typeahead"]', function (e) { |
| 1715 | var $this = $(this) |
| 1716 | if ($this.data('typeahead')) return |
| 1717 | e.preventDefault() |
| 1718 | $this.typeahead($this.data()) |
| 1719 | }) |
| 1720 | }) |
| 1721 | |
| 1722 | }( window.jQuery ) |