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