kitchen_hooks 1.3.0

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