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