sequel-reporter 0.0.1

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