| 
									
										
										
										
											2013-05-22 10:30:33 +08:00
										 |  |  | /* ======================================================================== | 
					
						
							| 
									
										
										
										
											2013-12-25 04:16:17 +08:00
										 |  |  |  * Bootstrap: carousel.js v3.0.3 | 
					
						
							| 
									
										
										
										
											2013-10-30 01:10:47 +08:00
										 |  |  |  * http://getbootstrap.com/javascript/#carousel
 | 
					
						
							| 
									
										
										
										
											2013-05-22 10:30:33 +08:00
										 |  |  |  * ======================================================================== | 
					
						
							| 
									
										
										
										
											2013-10-23 00:41:33 +08:00
										 |  |  |  * Copyright 2013 Twitter, Inc. | 
					
						
							| 
									
										
										
										
											2013-12-19 07:28:08 +08:00
										 |  |  |  * Licensed under MIT (https://github.com/twbs/bootstrap/blob/master/LICENSE)
 | 
					
						
							| 
									
										
										
										
											2013-05-22 10:30:33 +08:00
										 |  |  |  * ======================================================================== */ | 
					
						
							| 
									
										
										
										
											2013-05-17 02:06:30 +08:00
										 |  |  | 
 | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2013-09-19 00:50:02 +08:00
										 |  |  | +function ($) { 'use strict'; | 
					
						
							| 
									
										
										
										
											2013-05-17 02:06:30 +08:00
										 |  |  | 
 | 
					
						
							|  |  |  |   // CAROUSEL CLASS DEFINITION
 | 
					
						
							|  |  |  |   // =========================
 | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |   var Carousel = function (element, options) { | 
					
						
							|  |  |  |     this.$element    = $(element) | 
					
						
							|  |  |  |     this.$indicators = this.$element.find('.carousel-indicators') | 
					
						
							|  |  |  |     this.options     = options | 
					
						
							|  |  |  |     this.paused      = | 
					
						
							|  |  |  |     this.sliding     = | 
					
						
							|  |  |  |     this.interval    = | 
					
						
							|  |  |  |     this.$active     = | 
					
						
							|  |  |  |     this.$items      = null | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |     this.options.pause == 'hover' && this.$element | 
					
						
							|  |  |  |       .on('mouseenter', $.proxy(this.pause, this)) | 
					
						
							|  |  |  |       .on('mouseleave', $.proxy(this.cycle, this)) | 
					
						
							|  |  |  |   } | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |   Carousel.DEFAULTS = { | 
					
						
							| 
									
										
										
										
											2013-12-16 03:04:32 +08:00
										 |  |  |     interval: 5000, | 
					
						
							|  |  |  |     pause: 'hover', | 
					
						
							|  |  |  |     wrap: true | 
					
						
							| 
									
										
										
										
											2013-05-17 02:06:30 +08:00
										 |  |  |   } | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |   Carousel.prototype.cycle =  function (e) { | 
					
						
							|  |  |  |     e || (this.paused = false) | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |     this.interval && clearInterval(this.interval) | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |     this.options.interval | 
					
						
							|  |  |  |       && !this.paused | 
					
						
							|  |  |  |       && (this.interval = setInterval($.proxy(this.next, this), this.options.interval)) | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |     return this | 
					
						
							|  |  |  |   } | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |   Carousel.prototype.getActiveIndex = function () { | 
					
						
							|  |  |  |     this.$active = this.$element.find('.item.active') | 
					
						
							|  |  |  |     this.$items  = this.$active.parent().children() | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |     return this.$items.index(this.$active) | 
					
						
							|  |  |  |   } | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |   Carousel.prototype.to = function (pos) { | 
					
						
							|  |  |  |     var that        = this | 
					
						
							|  |  |  |     var activeIndex = this.getActiveIndex() | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |     if (pos > (this.$items.length - 1) || pos < 0) return | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2013-11-15 15:58:29 +08:00
										 |  |  |     if (this.sliding)       return this.$element.one('slid.bs.carousel', function () { that.to(pos) }) | 
					
						
							| 
									
										
										
										
											2013-05-17 02:06:30 +08:00
										 |  |  |     if (activeIndex == pos) return this.pause().cycle() | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |     return this.slide(pos > activeIndex ? 'next' : 'prev', $(this.$items[pos])) | 
					
						
							|  |  |  |   } | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |   Carousel.prototype.pause = function (e) { | 
					
						
							|  |  |  |     e || (this.paused = true) | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |     if (this.$element.find('.next, .prev').length && $.support.transition.end) { | 
					
						
							|  |  |  |       this.$element.trigger($.support.transition.end) | 
					
						
							|  |  |  |       this.cycle(true) | 
					
						
							|  |  |  |     } | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |     this.interval = clearInterval(this.interval) | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |     return this | 
					
						
							|  |  |  |   } | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |   Carousel.prototype.next = function () { | 
					
						
							|  |  |  |     if (this.sliding) return | 
					
						
							|  |  |  |     return this.slide('next') | 
					
						
							|  |  |  |   } | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |   Carousel.prototype.prev = function () { | 
					
						
							|  |  |  |     if (this.sliding) return | 
					
						
							|  |  |  |     return this.slide('prev') | 
					
						
							|  |  |  |   } | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |   Carousel.prototype.slide = function (type, next) { | 
					
						
							|  |  |  |     var $active   = this.$element.find('.item.active') | 
					
						
							|  |  |  |     var $next     = next || $active[type]() | 
					
						
							|  |  |  |     var isCycling = this.interval | 
					
						
							|  |  |  |     var direction = type == 'next' ? 'left' : 'right' | 
					
						
							|  |  |  |     var fallback  = type == 'next' ? 'first' : 'last' | 
					
						
							|  |  |  |     var that      = this | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2013-08-12 06:41:06 +08:00
										 |  |  |     if (!$next.length) { | 
					
						
							|  |  |  |       if (!this.options.wrap) return | 
					
						
							|  |  |  |       $next = this.$element.find('.item')[fallback]() | 
					
						
							|  |  |  |     } | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2013-08-31 14:03:09 +08:00
										 |  |  |     if ($next.hasClass('active')) return | 
					
						
							| 
									
										
										
										
											2013-05-17 02:06:30 +08:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2013-05-17 11:19:51 +08:00
										 |  |  |     var e = $.Event('slide.bs.carousel', { relatedTarget: $next[0], direction: direction }) | 
					
						
							| 
									
										
										
										
											2013-08-31 14:03:09 +08:00
										 |  |  |     this.$element.trigger(e) | 
					
						
							|  |  |  |     if (e.isDefaultPrevented()) return | 
					
						
							| 
									
										
										
										
											2013-05-17 02:06:30 +08:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2013-08-31 14:03:09 +08:00
										 |  |  |     this.sliding = true | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |     isCycling && this.pause() | 
					
						
							| 
									
										
										
										
											2013-05-17 02:06:30 +08:00
										 |  |  | 
 | 
					
						
							|  |  |  |     if (this.$indicators.length) { | 
					
						
							|  |  |  |       this.$indicators.find('.active').removeClass('active') | 
					
						
							| 
									
										
										
										
											2013-11-15 15:58:29 +08:00
										 |  |  |       this.$element.one('slid.bs.carousel', function () { | 
					
						
							| 
									
										
										
										
											2013-05-17 02:06:30 +08:00
										 |  |  |         var $nextIndicator = $(that.$indicators.children()[that.getActiveIndex()]) | 
					
						
							|  |  |  |         $nextIndicator && $nextIndicator.addClass('active') | 
					
						
							|  |  |  |       }) | 
					
						
							|  |  |  |     } | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |     if ($.support.transition && this.$element.hasClass('slide')) { | 
					
						
							|  |  |  |       $next.addClass(type) | 
					
						
							|  |  |  |       $next[0].offsetWidth // force reflow
 | 
					
						
							|  |  |  |       $active.addClass(direction) | 
					
						
							|  |  |  |       $next.addClass(direction) | 
					
						
							| 
									
										
										
										
											2013-07-25 11:10:16 +08:00
										 |  |  |       $active | 
					
						
							| 
									
										
										
										
											2013-07-24 09:44:08 +08:00
										 |  |  |         .one($.support.transition.end, function () { | 
					
						
							|  |  |  |           $next.removeClass([type, direction].join(' ')).addClass('active') | 
					
						
							|  |  |  |           $active.removeClass(['active', direction].join(' ')) | 
					
						
							|  |  |  |           that.sliding = false | 
					
						
							| 
									
										
										
										
											2013-11-15 15:58:29 +08:00
										 |  |  |           setTimeout(function () { that.$element.trigger('slid.bs.carousel') }, 0) | 
					
						
							| 
									
										
										
										
											2013-07-24 09:44:08 +08:00
										 |  |  |         }) | 
					
						
							| 
									
										
										
										
											2013-11-08 18:55:06 +08:00
										 |  |  |         .emulateTransitionEnd($active.css('transition-duration').slice(0, -1) * 1000) | 
					
						
							| 
									
										
										
										
											2013-05-17 02:06:30 +08:00
										 |  |  |     } else { | 
					
						
							|  |  |  |       $active.removeClass('active') | 
					
						
							|  |  |  |       $next.addClass('active') | 
					
						
							|  |  |  |       this.sliding = false | 
					
						
							| 
									
										
										
										
											2013-11-15 15:58:29 +08:00
										 |  |  |       this.$element.trigger('slid.bs.carousel') | 
					
						
							| 
									
										
										
										
											2013-05-17 02:06:30 +08:00
										 |  |  |     } | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |     isCycling && this.cycle() | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |     return this | 
					
						
							|  |  |  |   } | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |   // CAROUSEL PLUGIN DEFINITION
 | 
					
						
							|  |  |  |   // ==========================
 | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |   var old = $.fn.carousel | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |   $.fn.carousel = function (option) { | 
					
						
							|  |  |  |     return this.each(function () { | 
					
						
							|  |  |  |       var $this   = $(this) | 
					
						
							| 
									
										
										
										
											2013-05-17 11:19:51 +08:00
										 |  |  |       var data    = $this.data('bs.carousel') | 
					
						
							| 
									
										
										
										
											2013-07-24 09:54:00 +08:00
										 |  |  |       var options = $.extend({}, Carousel.DEFAULTS, $this.data(), typeof option == 'object' && option) | 
					
						
							| 
									
										
										
										
											2013-05-17 02:06:30 +08:00
										 |  |  |       var action  = typeof option == 'string' ? option : options.slide | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2013-05-17 11:19:51 +08:00
										 |  |  |       if (!data) $this.data('bs.carousel', (data = new Carousel(this, options))) | 
					
						
							| 
									
										
										
										
											2013-05-17 02:06:30 +08:00
										 |  |  |       if (typeof option == 'number') data.to(option) | 
					
						
							|  |  |  |       else if (action) data[action]() | 
					
						
							|  |  |  |       else if (options.interval) data.pause().cycle() | 
					
						
							|  |  |  |     }) | 
					
						
							|  |  |  |   } | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |   $.fn.carousel.Constructor = Carousel | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |   // CAROUSEL NO CONFLICT
 | 
					
						
							|  |  |  |   // ====================
 | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |   $.fn.carousel.noConflict = function () { | 
					
						
							|  |  |  |     $.fn.carousel = old | 
					
						
							|  |  |  |     return this | 
					
						
							|  |  |  |   } | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2013-05-17 08:18:15 +08:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2013-05-17 02:06:30 +08:00
										 |  |  |   // CAROUSEL DATA-API
 | 
					
						
							|  |  |  |   // =================
 | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2013-05-25 14:15:04 +08:00
										 |  |  |   $(document).on('click.bs.carousel.data-api', '[data-slide], [data-slide-to]', function (e) { | 
					
						
							| 
									
										
										
										
											2013-05-25 15:16:52 +08:00
										 |  |  |     var $this   = $(this), href | 
					
						
							| 
									
										
										
										
											2013-05-17 02:06:30 +08:00
										 |  |  |     var $target = $($this.attr('data-target') || (href = $this.attr('href')) && href.replace(/.*(?=#[^\s]+$)/, '')) //strip for ie7
 | 
					
						
							|  |  |  |     var options = $.extend({}, $target.data(), $this.data()) | 
					
						
							| 
									
										
										
										
											2013-07-18 12:08:50 +08:00
										 |  |  |     var slideIndex = $this.attr('data-slide-to') | 
					
						
							|  |  |  |     if (slideIndex) options.interval = false | 
					
						
							| 
									
										
										
										
											2013-05-17 02:06:30 +08:00
										 |  |  | 
 | 
					
						
							|  |  |  |     $target.carousel(options) | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |     if (slideIndex = $this.attr('data-slide-to')) { | 
					
						
							| 
									
										
										
										
											2013-07-18 12:08:50 +08:00
										 |  |  |       $target.data('bs.carousel').to(slideIndex) | 
					
						
							| 
									
										
										
										
											2013-05-17 02:06:30 +08:00
										 |  |  |     } | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |     e.preventDefault() | 
					
						
							|  |  |  |   }) | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2013-05-25 15:16:52 +08:00
										 |  |  |   $(window).on('load', function () { | 
					
						
							|  |  |  |     $('[data-ride="carousel"]').each(function () { | 
					
						
							|  |  |  |       var $carousel = $(this) | 
					
						
							|  |  |  |       $carousel.carousel($carousel.data()) | 
					
						
							|  |  |  |     }) | 
					
						
							|  |  |  |   }) | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2013-08-23 02:50:15 +08:00
										 |  |  | }(jQuery); |