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