rsyntaxtree 0.5.0

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