bootstrap3-rails 3.0.0

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