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