1/* ======================================================================== 2 * Bootstrap: carousel.js v3.0.0 3 * http://twbs.github.com/bootstrap/javascript.html#carousel 4 * ======================================================================== 5 * Copyright 2012 Twitter, Inc. 6 * 7 * Licensed under the Apache License, Version 2.0 (the "License"); 8 * you may not use this file except in compliance with the License. 9 * You may obtain a copy of the License at 10 * 11 * http://www.apache.org/licenses/LICENSE-2.0 12 * 13 * Unless required by applicable law or agreed to in writing, software 14 * distributed under the License is distributed on an "AS IS" BASIS, 15 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 16 * See the License for the specific language governing permissions and 17 * limitations under the License. 18 * ======================================================================== */ 19 20 21+function ($) { "use strict"; 22 23 // CAROUSEL CLASS DEFINITION 24 // ========================= 25 var Carousel = function (element, options) { 26 this.$element = $(element) 27 this.$indicators = this.$element.find('.carousel-indicators') 28 this.options = options 29 this.paused = 30 this.sliding = 31 this.interval = 32 this.$active = 33 this.$items = null 34 35 this.options.pause == 'hover' && this.$element 36 .on('mouseenter', $.proxy(this.pause, this)) 37 .on('mouseleave', $.proxy(this.cycle, this)) 38 } 39 40 Carousel.DEFAULTS = { 41 interval: 5000 42 , pause: 'hover' 43 , wrap: true 44 } 45 46 Carousel.prototype.cycle = function (e) { 47 e || (this.paused = false) 48 49 this.interval && clearInterval(this.interval) 50 51 this.options.interval 52 && !this.paused 53 && (this.interval = setInterval($.proxy(this.next, this), this.options.interval)) 54 55 return this 56 } 57 58 Carousel.prototype.getActiveIndex = function () { 59 this.$active = this.$element.find('.item.active') 60 this.$items = this.$active.parent().children() 61 62 return this.$items.index(this.$active) 63 } 64 65 Carousel.prototype.to = function (pos) { 66 var that = this 67 var activeIndex = this.getActiveIndex() 68 69 if (pos > (this.$items.length - 1) || pos < 0) return 70 71 if (this.sliding) return this.$element.one('slid', function () { that.to(pos) }) 72 if (activeIndex == pos) return this.pause().cycle() 73 74 return this.slide(pos > activeIndex ? 'next' : 'prev', $(this.$items[pos])) 75 } 76 77 Carousel.prototype.pause = function (e) { 78 e || (this.paused = true) 79 80 //if (this.$element.find('.next, .prev').length && $.support.transition.end) { 81 //this.$element.trigger($.support.transition.end) 82 this.cycle(true) 83 //} 84 85 this.interval = clearInterval(this.interval) 86 87 return this 88 } 89 90 Carousel.prototype.next = function () { 91 if (this.sliding) return 92 return this.slide('next') 93 } 94 95 Carousel.prototype.prev = function () { 96 if (this.sliding) return 97 return this.slide('prev') 98 } 99 100 Carousel.prototype.slide = function (type, next) { 101 var $active = this.$element.find('.item.active') 102 var $next = next || $active[type]() 103 var isCycling = this.interval 104 var direction = type == 'next' ? 'left' : 'right' 105 var fallback = type == 'next' ? 'first' : 'last' 106 var that = this 107 108 if (!$next.length) { 109 if (!this.options.wrap) return 110 $next = this.$element.find('.item')[fallback]() 111 } 112 113 this.sliding = true 114 115 isCycling && this.pause() 116 117 var e = $.Event('slide.bs.carousel', { relatedTarget: $next[0], direction: direction }) 118 119 if ($next.hasClass('active')) return 120 121 if (this.$indicators.length) { 122 this.$indicators.find('.active').removeClass('active') 123 this.$element.one('slid', function () { 124 var $nextIndicator = $(that.$indicators.children()[that.getActiveIndex()]) 125 $nextIndicator && $nextIndicator.addClass('active') 126 }) 127 } 128 129 var $this = this.$element.hasClass('header_effect');
130 if ($.support.transition && this.$element.hasClass('slide')) { 131 this.$element.trigger(e) 132 if (e.isDefaultPrevented()) return 133 var timer; 134 135 136 timer = setTimeout(function(){ 137 if( 'object' === typeof qode.modules.qodeSlider ) { 138 qode.modules.qodeSlider.checkSliderForHeaderStyle($next, $this); 139 } 140 $next.addClass(type) 141 $next[0].offsetWidth // force reflow 142 $active.addClass(direction) 143 $next.addClass(direction) 144 $active 145 .one($.support.transition.end, function () { 146 $next.removeClass([type, direction].join(' ')).removeClass('inactive').addClass('active') 147 $active.removeClass(['active', direction].join(' ')).addClass('inactive') 148 that.sliding = false 149 setTimeout(function () { that.$element.trigger('slid') }, 0) 150 }) 151 .emulateTransitionEnd(600) 152 clearTimeout(timer); 153 }, 1000); 154 } else { 155 this.$element.trigger(e) 156 if (e.isDefaultPrevented()) return 157 $active.removeClass('active') 158 $next.addClass('active') 159 this.sliding = false 160 this.$element.trigger('slid') 161 } 162 163 isCycling && this.cycle() 164 165 return this 166 } 167 168 169 // CAROUSEL PLUGIN DEFINITION 170 // ========================== 171 172 var old = $.fn.carousel 173 174 $.fn.carousel = function (option) { 175 return this.each(function () { 176 var $this = $(this) 177 var data = $this.data('bs.carousel') 178 var options = $.extend({}, Carousel.DEFAULTS, $this.data(), typeof option == 'object' && option) 179 var action = typeof option == 'string' ? option : options.slide 180 181 if (!data) $this.data('bs.carousel', (data = new Carousel(this, options))) 182 if (typeof option == 'number') data.to(option) 183 else if (action) data[action]() 184 else if (options.interval) data.pause().cycle() 185 }) 186 } 187 188 $.fn.carousel.Constructor = Carousel 189 190 191 // CAROUSEL NO CONFLICT 192 // ==================== 193 194 $.fn.carousel.noConflict = function () { 195 $.fn.carousel = old 196 return this 197 } 198 199 200 // CAROUSEL DATA-API 201 // ================= 202 203 $(document).on('click.bs.carousel.data-api', '[data-slide], [data-slide-to]', function (e) { 204 var $this = $(this), href 205 var $target = $($this.attr('data-target') || (href = $this.attr('href')) && href.replace(/.*(?=#[^\s]+$)/, '')) //strip for ie7 206 var options = $.extend({}, $target.data(), $this.data()) 207 var slideIndex = $this.attr('data-slide-to') 208 if (slideIndex) options.interval = false 209 210 $target.carousel(options) 211 212 if (slideIndex = $this.attr('data-slide-to')) { 213 $target.data('bs.carousel').to(slideIndex) 214 } 215 216 e.preventDefault() 217 }) 218 219 $(window).on('load', function () { 220 $('[data-ride="carousel"]').each(function () { 221 var $carousel = $(this) 222 $carousel.carousel($carousel.data()) 223 }) 224 }) 225 226 function transitionEnd() { 227 var el = document.createElement('bootstrap') 228 229 var transEndEventNames = { 230 WebkitTransition : 'webkitTransitionEnd', 231 MozTransition : 'transitionend', 232 OTransition : 'oTransitionEnd otransitionend', 233 transition : 'transitionend' 234 } 235 236 for (var name in transEndEventNames) { 237 if (el.style[name] !== undefined) { 238 return { end: transEndEventNames[name] } 239 } 240 } 241 242 return false // explicit for ie8 ( ._.) 243 } 244 245 // http://blog.alexmaccaw.com/css-transitions 246 $.fn.emulateTransitionEnd = function (duration) { 247 var called = false 248 var $el = this 249 $(this).one('bsTransitionEnd', function () { called = true }) 250 var callback = function () { if (!called) $($el).trigger($.support.transition.end) } 251 setTimeout(callback, duration) 252 return this 253 } 254 255 $(function () { 256 $.support.transition = transitionEnd() 257 258 if (!$.support.transition) return 259 260 $.event.special.bsTransitionEnd = { 261 bindType: $.support.transition.end, 262 delegateType: $.support.transition.end, 263 handle: function (e) { 264 if ($(e.target).is(this)) return e.handleObj.handler.apply(this, arguments) 265 } 266 } 267 }) 268 269}(window.jQuery);
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.