PageSourceSearch

https://sourceknowledge.com/wp-content/themes/startit/assets/js/modules/plugins/bootstrapCarousel.js?ver=7.1.2

js sourceknowledge.com collected 2026-09-24 08:44:11 UTC 10,153 bytes, 305 lines download raw bytes

vendor: 6,960 bytes, lines 1-206
1/* ========================================================================
2 * Bootstrap: transition.js v3.3.5
3 * http://getbootstrap.com/javascript/#transitions
4 * ========================================================================
5 * Copyright 2011-2015 Twitter, Inc.
6 * Licensed under MIT (https://github.com/twbs/bootstrap/blob/master/LICENSE)
7 * ======================================================================== */
8
9
10+function ($) {
11    'use strict';
12
13    // CSS TRANSITION SUPPORT (Shoutout: http://www.modernizr.com/)
14    // ============================================================
15
16    function transitionEnd() {
17        var el = document.createElement('bootstrap')
18
19        var transEndEventNames = {
20            WebkitTransition : 'webkitTransitionEnd',
21            MozTransition    : 'transitionend',
22            OTransition      : 'oTransitionEnd otransitionend',
23            transition       : 'transitionend'
24        }
25
26        for (var name in transEndEventNames) {
27            if (el.style[name] !== undefined) {
28                return { end: transEndEventNames[name] }
29            }
30        }
31
32        return false // explicit for ie8 (  ._.)
33    }
34
35    // http://blog.alexmaccaw.com/css-transitions
36    $.fn.emulateTransitionEnd = function (duration) {
37        var called = false
38        var $el = this
39        $(this).one('bsTransitionEnd', function () { called = true })
40        var callback = function () { if (!called) $($el).trigger($.support.transition.end) }
41        setTimeout(callback, duration)
42        return this
43    }
44
45    $(function () {
46        $.support.transition = transitionEnd()
47
48        if (!$.support.transition) return
49
50        $.event.special.bsTransitionEnd = {
51            bindType: $.support.transition.end,
52            delegateType: $.support.transition.end,
53            handle: function (e) {
54                if ($(e.target).is(this)) return e.handleObj.handler.apply(this, arguments)
55            }
56        }
57    })
58
59}(jQuery);
60
61
62/* ========================================================================
63 * Bootstrap: carousel.js v3.3.5
64 * http://getbootstrap.com/javascript/#carousel
65 * ========================================================================
66 * Copyright 2011-2015 Twitter, Inc.
67 * Licensed under MIT (https://github.com/twbs/bootstrap/blob/master/LICENSE)
68 * ======================================================================== */
69
70
71+function ($) {
72    'use strict';
73
74    // CAROUSEL CLASS DEFINITION
75    // =========================
76
77    var Carousel = function (element, options) {
78        this.$element    = $(element)
79        this.$indicators = this.$element.find('.carousel-indicators')
80        this.options     = options
81        this.paused      = null
82        this.sliding     = null
83        this.interval    = null
84        this.$active     = null
85        this.$items      = null
86
87        this.options.keyboard && this.$element.on('keydown.bs.carousel', $.proxy(this.keydown, this))
88
89        this.options.pause == 'hover' && !('ontouchstart' in document.documentElement) && this.$element
90            .on('mouseenter.bs.carousel', $.proxy(this.pause, this))
91            .on('mouseleave.bs.carousel', $.proxy(this.cycle, this))
92    }
93
94    Carousel.VERSION  = '3.3.5'
95
96    Carousel.TRANSITION_DURATION = 600
97
98    Carousel.DEFAULTS = {
99        interval: 5000,
100        pause: 'hover',
101        wrap: true,
102        keyboard: true
103    }
104
105    Carousel.prototype.keydown = function (e) {
106        if (/input|textarea/i.test(e.target.tagName)) return
107        switch (e.which) {
108            case 37: this.prev(); break
109            case 39: this.next(); break
110            default: return
111        }
112
113        e.preventDefault()
114    }
115
116    Carousel.prototype.cycle = function (e) {
117        e || (this.paused = false)
118
119        this.interval && clearInterval(this.interval)
120
121        this.options.interval
122        && !this.paused
123        && (this.interval = setInterval($.proxy(this.next, this), this.options.interval))
124
125        return this
126    }
127
128    Carousel.prototype.getItemIndex = function (item) {
129        this.$items = item.parent().children('.item')
130        return this.$items.index(item || this.$active)
131    }
132
133    Carousel.prototype.getItemForDirection = function (direction, active) {
134        var activeIndex = this.getItemIndex(active)
135        var willWrap = (direction == 'prev' && activeIndex === 0)
136            || (direction == 'next' && activeIndex == (this.$items.length - 1))
137        if (willWrap && !this.options.wrap) return active
138        var delta = direction == 'prev' ? -1 : 1
139        var itemIndex = (activeIndex + delta) % this.$items.length
140        return this.$items.eq(itemIndex)
141    }
142
143    Carousel.prototype.to = function (pos) {
144        var that        = this
145        var activeIndex = this.getItemIndex(this.$active = this.$element.find('.item.active'))
146
147        if (pos > (this.$items.length - 1) || pos < 0) return
148
149        if (this.sliding)       return this.$element.one('slid.bs.carousel', function () { that.to(pos) }) // yes, "slid"
150        if (activeIndex == pos) return this.pause().cycle()
151
152        return this.slide(pos > activeIndex ? 'next' : 'prev', this.$items.eq(pos))
153    }
154
155    Carousel.prototype.pause = function (e) {
156        e || (this.paused = true)
157
158        if (this.$element.find('.next, .prev').length && $.support.transition) {
159            this.$element.trigger($.support.transition.end)
160            this.cycle(true)
161        }
162
163        this.interval = clearInterval(this.interval)
164
165        return this
166    }
167
168    Carousel.prototype.next = function () {
169        if (this.sliding) return
170        return this.slide('next')
171    }
172
173    Carousel.prototype.prev = function () {
174        if (this.sliding) return
175        return this.slide('prev')
176    }
177
178    Carousel.prototype.slide = function (type, next) {
179        var $active   = this.$element.find('.item.active')
180        var $next     = next || this.getItemForDirection(type, $active)
181        var isCycling = this.interval
182        var direction = type == 'next' ? 'left' : 'right'
183        var that      = this
184
185        if ($next.hasClass('active')) return (this.sliding = false)
186
187        var relatedTarget = $next[0]
188        var slideEvent = $.Event('slide.bs.carousel', {
189            relatedTarget: relatedTarget,
190            direction: direction
191        })
192        this.$element.trigger(slideEvent)
193        if (slideEvent.isDefaultPrevented()) return
194
195        this.sliding = true
196
197        isCycling && this.pause()
198
199        if (this.$indicators.length) {
200            this.$indicators.find('.active').removeClass('active')
201            var $nextIndicator = $(this.$indicators.children()[this.getItemIndex($next)])
202            $nextIndicator && $nextIndicator.addClass('active')
203        }
204
205        var slidEvent = $.Event('slid.bs.carousel', { relatedTarget: relatedTarget, direction: direction }) // yes, "slid"
206        var $this = this.$element.hasClass('qodef-header-effect');
207        if ($.support.transition && this.$element.hasClass('slide')) {
208            var timer;
209
210            timer = setTimeout(function(){
211                qodef.modules.shortcodes.qodefCheckSliderForHeaderStyle($next, $this);
212                $next.addClass(type)
213                $next[0].offsetWidth // force reflow
214                $active.addClass(direction)
215                $next.addClass(direction)
216                $active
217                    .one('bsTransitionEnd', function () {
218                        $next.removeClass([type, direction].join(' ')).addClass('active')
219                        $active.removeClass(['active', direction].join(' '))
220                        that.sliding = false
221                        setTimeout(function () {
222                            that.$element.trigger(slidEvent)
223                        }, 0)
224                    })
225                    .emulateTransitionEnd(600);
226                clearTimeout(timer);
227            }, 300);
228        } else {
229            $active.removeClass('active')
230            $next.addClass('active')
231            this.sliding = false
232            this.$element.trigger(slidEvent)
233        }
234
235        isCycling && this.cycle()
236
237        return this
238    }
239
240
241    // CAROUSEL PLUGIN DEFINITION
242    // ==========================
243
244    function Plugin(option) {
245        return this.each(function () {
246            var $this   = $(this)
247            var data    = $this.data('bs.carousel')
248            var options = $.extend({}, Carousel.DEFAULTS, $this.data(), typeof option == 'object' && option)
249            var action  = typeof option == 'string' ? option : options.slide
250
251            if (!data) $this.data('bs.carousel', (data = new Carousel(this, options)))
252            if (typeof option == 'number') data.to(option)
253            else if (action) data[action]()
254            else if (options.interval) data.pause().cycle()
255        })
256    }
257
258    var old = $.fn.carousel
259
260    $.fn.carousel             = Plugin
261    $.fn.carousel.Constructor = Carousel
262
263
264    // CAROUSEL NO CONFLICT
265    // ====================
266
267    $.fn.carousel.noConflict = function () {
268        $.fn.carousel = old
269        return this
270    }
271
272
273    // CAROUSEL DATA-API
274    // =================
275
276    var clickHandler = function (e) {
277        var href
278        var $this   = $(this)
279        var $target = $($this.attr('data-target') || (href = $this.attr('href')) && href.replace(/.*(?=#[^\s]+$)/, '')) // strip for ie7
280        if (!$target.hasClass('carousel')) return
281        var options = $.extend({}, $target.data(), $this.data())
282        var slideIndex = $this.attr('data-slide-to')
283        if (slideIndex) options.interval = false
284
285        Plugin.call($target, options)
286
287        if (slideIndex) {
288            $target.data('bs.carousel').to(slideIndex)
289        }
290
291        e.preventDefault()
292    }
293
294    $(document)
295        .on('click.bs.carousel.data-api', '[data-slide]', clickHandler)
296        .on('click.bs.carousel.data-api', '[data-slide-to]', clickHandler)
297
298    $(window).on('load', function () {
299        $('[data-ride="carousel"]').each(function () {
300            var $carousel = $(this)
301            Plugin.call($carousel, $carousel.data())
302        })
303    })
304
305}(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.