fanforce-plugin-factory 0.34.2 → 0.35.0

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