1/* ======================================================================== 2 * Bootstrap: carousel.js v3.3.5 3 * http://getbootstrap.com/javascript/#carousel 4 * ======================================================================== 5 * Copyright 2011-2015 Twitter, Inc. 6 * Licensed under MIT (https://github.com/twbs/bootstrap/blob/master/LICENSE) 7 * ======================================================================== */ 8 9+function () { 10 'use strict'; 11 12 if (BX.browser.IsIE() || BX.browser.IsIE11() || !window.CustomEvent) 13 { 14 (function () { 15 function CustomEvent ( event, params ) { 16 params = params || { bubbles: false, cancelable: false, detail: undefined }; 17 var evt = document.createEvent( 'CustomEvent' ); 18 evt.initCustomEvent( event, params.bubbles, params.cancelable, params.detail ); 19 return evt; 20 } 21 22 CustomEvent.prototype = window.Event.prototype; 23 window.CustomEvent = CustomEvent; 24 })(); 25 } 26 // CAROUSEL CLASS DEFINITION 27 // ========================= 28 var Carousel = function (element, options) 29 { 30 options.pause = options.pause !== 'false' ? true : false, 31 options.wrap = options.wrap !== 'false' ? true : false, 32 options.interval = options.interval !== 'false' ? parseInt(options.interval) : false, 33 options.keyboard = options.keyboard !== 'false' ? true : false, 34 this.$element = BX(element); 35 this.$indicators = this.$element.querySelectorAll('.carousel-indicators'); 36 this.options = options; 37 this.paused = null; 38 this.sliding = null; 39 this.interval = null; 40 this.$active = null; 41 this.$items = null; 42 this.slidEvent = null; 43 this.slideEvent = null; 44 45 this.options.keyboard && BX.bind(this.$element, 'keydown', BX.proxy(this.keydown, this)); 46 47 if (this.options.pause && !(BX.hasClass(document.documentElement, 'bx-touch'))) 48 { 49 BX.bind(this.$element, 'mouseover', BX.proxy(this.pause, this)); 50 BX.bind(this.$element, 'mouseout', BX.proxy(this.cycle, this)); 51 } 52 }; 53 54 Carousel.VERSION = '3.3.5'; 55 56 Carousel.TRANSITION_DURATION = 600; 57 58 Carousel.DEFAULTS = { 59 interval: 5000, 60 pause: true, 61 wrap: true, 62 keyboard: true 63 }; 64 65 Carousel.prototype.keydown = function (e) 66 { 67 if (/input|textarea/i.test(e.target.tagName)) return; 68 switch (e.which) { 69 case 37: this.prev(); break; 70 case 39: this.next(); break; 71 default: return 72 } 73 74 e.preventDefault() 75 }; 76 77 Carousel.prototype.cycle = function (e) 78 { 79 e || (this.paused = false); 80 81 this.interval && clearInterval(this.interval); 82 83 this.options.interval 84 && !this.paused 85 && (this.interval = setInterval(BX.proxy(this.next, this), this.options.interval)); 86 87 return this 88 }; 89 90 Carousel.prototype.getItemIndex = function (item) 91 { 92 this.$items = BX.findChildren(item.parentNode, {className: 'carousel-item'}, true); 93 return this.$items.indexOf(item || this.$active) 94 }; 95 96 Carousel.prototype.eq = function (obj, i) 97 { 98 var len = obj.length, 99 j = +i + (i < 0 ? len : 0); 100 return j >= 0 && j < len ? obj[j] : {}; 101 }; 102 103 Carousel.prototype.getItemForDirection = function (direction, active) 104 { 105 var activeIndex = this.getItemIndex(active); 106 var willWrap = (direction === 'prev' && activeIndex === 0) 107 || (direction === 'next' && activeIndex === (this.$items.length - 1)); 108 if (willWrap && !this.options.wrap) return active; 109 var delta = direction === 'prev' ? -1 : 1; 110 var itemIndex = (activeIndex + delta) % this.$items.length; 111 return this.eq(this.$items, itemIndex) 112 }; 113 114 Carousel.prototype.to = function (pos) { 115 var activeIndex = this.getItemIndex(this.$active = BX.findChild(this.$element.parentNode, {className: 'carousel-item active'}, true, false)); 116 117 if (pos > (this.$items.length - 1) || pos < 0) return; 118 119 120 //TODO click on indicator when still sliding 121 if (this.sliding) 122 { 123 return false;
124 } 125 if (activeIndex === pos) return this.pause().cycle(); 126 127 return this.slide(pos > activeIndex ? 'next' : 'prev', this.eq(this.$items, pos)) 128 }; 129 130 Carousel.prototype.pause = function (e) 131 { 132 e || (this.paused = true); 133 134 if (BX.findChildren(this.$element, {className: 'carousel-control'}, true, true).length) { 135 this.cycle(true) 136 } 137 138 this.interval = clearInterval(this.interval); 139 140 return this 141 }; 142 143 Carousel.prototype.next = function () 144 { 145 if (this.sliding) return; 146 return this.slide('next') 147 }; 148 149 Carousel.prototype.prev = function () 150 { 151 if (this.sliding) return; 152 return this.slide('prev') 153 }; 154 155 Carousel.prototype.loadEvents = function () 156 { 157 var $active = BX.findChild(this.$element, {"class" : "carousel-item active"}, true, false) || BX.findChild(this.$element, {"class" : "carousel-item active"}, true, false); 158 var startSlid = new CustomEvent("slid.bs.carousel", {detail: {curSlide: $active}}); 159 var startSlide = new CustomEvent("slide.bs.carousel", {detail: {curSlide: $active}}); 160 this.$element.dispatchEvent(startSlid); 161 this.$element.dispatchEvent(startSlide) 162 }; 163 164 Carousel.prototype.slide = function (type, next) 165 { 166 var $active = BX.findChild(this.$element, {"class" : "carousel-item active"}, true, false) || BX.findChild(this.$element, {"class" : "carousel-item active"}, true, false); 167 var $next = next || this.getItemForDirection(type, $active); 168 var isCycling = this.interval; 169 var direction = type === 'next' ? 'left' : 'right'; 170 var videoActive = BX.findChild($active, {tagName: 'video', className: 'embed-responsive-item'}, true, false); 171 var videoNext = BX.findChild($next, {tagName: 'video', className: 'embed-responsive-item'}, true, false); 172 var ytActive = BX.findChild($active, {tagName: 'iframe', className: 'embed-responsive-item'}, true, false); 173 var ytNext = BX.findChild($next, {tagName: 'iframe', className: 'embed-responsive-item'}, true, false); 174 175 if (BX.hasClass($next, 'active')) return (this.sliding = false); 176 //register events 177 this.slidEvent = new CustomEvent("slid.bs.carousel", {detail: {curSlide: $next}}); 178 this.slideEvent = new CustomEvent("slide.bs.carousel", {detail: {curSlide: $next}}); 179 this.$element.dispatchEvent(this.slidEvent); 180 this.sliding = true; 181 182 isCycling && this.pause(); 183 184 if (this.$indicators.length) 185 { 186 BX.removeClass(BX.findChild(this.$indicators[0], {className: 'active'}, true, false), 'active'); 187 var $nextIndicator = BX.findChildren(this.$indicators[0], {tagName: 'li'}, false, true)[this.getItemIndex($next)]; 188 $nextIndicator && BX.addClass($nextIndicator, 'active') 189 } 190 191 if (BX.hasClass(this.$element, 'slide') && !BX.browser.IsIE()) 192 { 193 var self = this; 194 BX.addClass($next, type); 195 $next.offsetWidth // force reflow 196 BX.addClass($active, direction); 197 BX.addClass($next, direction); 198 setTimeout(function() 199 { 200 BX.addClass($next, 'active'); 201 BX.removeClass($active, 'active'); 202 BX.removeClass($active, direction); 203 BX.removeClass($next, type); 204 BX.removeClass($next, direction); 205 206 if (self.options.interval && !self.paused) 207 { 208 clearInterval(self.interval); 209 self.cycle(); 210 } 211 self.$element.dispatchEvent(self.slideEvent); //here we go with the slide 212 self.sliding = false 213 }, 214 Carousel.TRANSITION_DURATION + 100 ); 215 } 216 else 217 { 218 BX.removeClass($active, 'active'); 219 BX.addClass($next, 'active'); 220 this.$element.dispatchEvent(this.slideEvent); 221 this.sliding = false 222 } 223 224 isCycling && this.cycle(); 225 226 videoActive && videoActive.pause(); 227 videoNext && videoNext.play(); 228 ytActive && window[ytActive.id] && window[ytActive.id].pauseVideo && window[ytActive.id].pauseVideo(); 229 ytNext && window[ytNext.id] && window[ytNext.id].playVideo && window[ytNext.id].playVideo(); 230 return this 231 }; 232 233 // CAROUSEL PLUGIN DEFINITION 234 // ========================== 235 function Plugin(option) 236 { 237 function func() 238 { 239 function extend() 240 { 241 for(var i=1; i<arguments.length; i++) 242 for(var key in arguments[i]) 243 if(arguments[i].hasOwnProperty(key)) 244 arguments[0][key] = arguments[i][key]; 245 return arguments[0]; 246 } 247 var data = this.data ? this.data : undefined; 248 var carousel = this.carousel ? this.carousel : undefined; 249 var options = extend({}, Carousel.DEFAULTS, data, typeof option === 'object' && option); 250 var action = typeof option === 'string' ? option : options.slide; 251 var active; 252 if (!carousel) 253 { 254 carousel = this.carousel = new Carousel(this, options); 255 active = BX.findChild(carousel.$element, {"class" : "carousel-item active"}, true, false); 256 if (active) carousel.loadEvents() 257 } 258 var vid = BX.findChild(BX.findChild(carousel.$element, {"class" : "carousel-item active"}, true, false), {tagName: 'video', className: 'embed-responsive-item'}, true, false); 259 active = active || BX.findChild(carousel.$element, {"class" : "carousel-item active"}, true, false); 260 if (vid) vid.play(); 261 if (typeof option === 'number') carousel.to(option); 262 else if (action) carousel[action](); 263 else if (options.interval) carousel.pause().cycle() 264 } 265 return func.call(this) 266 } 267 268 // CAROUSEL DATA-API 269 // ================= 270 var clickHandler = function (e) 271 { 272 var href; 273 var id = this.getAttribute('data-target') || (href = this.getAttribute('href')) && href.replace(/.*(?=#[^\s]+$)/, ''); 274 if(id && id.length > 1) id = id.substr(1); 275 var $target = BX(id); 276 if (!BX.hasClass($target, 'carousel')) return;
277 var options = {slide: this.getAttribute('data-slide')}; 278 var slideIndex = this.getAttribute('data-slide-to'); 279 if (slideIndex) options.interval = false; 280 281 Plugin.call($target, options); 282 283 if (slideIndex) 284 { 285 $target.carousel.to(slideIndex) 286 } 287 288 e.preventDefault() 289 }; 290 291 var initThis = function () 292 { 293 var dataSlide = document.querySelectorAll('[data-slide]'), s; 294 for (s in dataSlide) 295 { 296 BX.bind(dataSlide[s], 'click', clickHandler) 297 } 298 var dataSlideTo = document.querySelectorAll('[data-slide-to]'), ss; 299 for (ss in dataSlideTo) 300 { 301 BX.bind(dataSlideTo[ss], 'click', clickHandler) 302 } 303 var i, value; 304 function carouselInit() 305 { 306 var $carousel = this; 307 $carousel.data = { 308 ride: this.getAttribute('data-ride'), 309 pause: this.getAttribute('data-pause'), 310 wrap: this.getAttribute('data-wrap'), 311 interval: this.getAttribute('data-interval'), 312 keyboard: this.getAttribute('data-keyboard') 313 }; 314 Plugin.call($carousel, $carousel.data) 315 } 316 var obj = document.querySelectorAll('[data-ride="carousel"]'); 317 for (i in obj) 318 { 319 if (obj.hasOwnProperty(i)) 320 { 321 value = carouselInit.call(obj[i]); 322 } 323 } 324 }; 325 326 if (window.frameCacheVars !== undefined) 327 { 328 BX.addCustomEvent("onFrameDataReceived" , function() { 329 initThis(); 330 }); 331 } 332 else 333 { 334 BX.ready(function() { 335 initThis(); 336 }); 337 } 338}();
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.