PageSourceSearch

https://matthaeusgemeinde.de/wp-content/themes/pranayama-yoga/js/build/owl.carousel2.thumbs.js?ver=2.2.1

js matthaeusgemeinde.de collected 2026-10-06 07:17:20 UTC 7,194 bytes, 218 lines download raw bytes

vendor: 7,194 bytes, lines 1-218
1/*! owl.carousel2.thumbs - v0.1.8 | (c) 2016 @gijsroge | MIT license | https://github.com/gijsroge/OwlCarousel2-Thumbs */
2/**
3 * Thumbs Plugin
4 * @version 2.0.0
5 * @author Gijs Rogé
6 * @license The MIT License (MIT)
7 */
8(function ($, window, document, undefined) {
9    'use strict';
10
11    /**
12     * Creates the thumbs plugin.
13     * @class The thumbs Plugin
14     * @param {Owl} carousel - The Owl Carousel
15     */
16    var Thumbs = function (carousel) {
17
18
19        /**
20         * Reference to the core.
21         * @protected
22         * @type {Owl}
23         */
24        this.owl = carousel;
25
26
27        /**
28         * All DOM elements for thumbnails
29         * @protected
30         * @type {Object}
31         */
32        this._thumbcontent = [];
33
34
35        /**
36         * Instance identiefier
37         * @type {number}
38         * @private
39         */
40        this._identifier = 0;
41
42
43        /**
44         * Return current item regardless of clones
45         * @protected
46         * @type {Object}
47         */
48        this.owl_currentitem = this.owl.options.startPosition;
49
50
51        /**
52         * The carousel element.
53         * @type {jQuery}
54         */
55        this.$element = this.owl.$element;
56
57
58        /**
59         * All event handlers.
60         * @protected
61         * @type {Object}
62         */
63        this._handlers = {
64            'prepared.owl.carousel': $.proxy(function (e) {
65                if (e.namespace && this.owl.options.thumbs && !this.owl.options.thumbImage && !this.owl.options.thumbsPrerendered && !this.owl.options.thumbImage) {
66                    if ($(e.content).find('[data-thumb]').attr('data-thumb') !== undefined) {
67                        this._thumbcontent.push($(e.content).find('[data-thumb]').attr('data-thumb'));
68                    }
69                } else if (e.namespace && this.owl.options.thumbs && this.owl.options.thumbImage) {
70                    var innerImage = $(e.content).find('img');
71                    this._thumbcontent.push(innerImage);
72                }
73            }, this),
74
75            'initialized.owl.carousel': $.proxy(function (e) {
76                if (e.namespace && this.owl.options.thumbs) {
77                    this.render();
78                    this.listen();
79                    this._identifier = this.owl.$element.data('slider-id');
80                    this.setActive();
81                }
82            }, this),
83
84            'changed.owl.carousel': $.proxy(function (e) {
85                if (e.namespace && e.property.name === 'position' && this.owl.options.thumbs) {
86                    this._identifier = this.owl.$element.data('slider-id');
87                    this.setActive();
88                }
89            }, this)
90        };
91
92        // set default options
93        this.owl.options = $.extend({}, Thumbs.Defaults, this.owl.options);
94
95        // register the event handlers
96        this.owl.$element.on(this._handlers);
97    };
98
99
100    /**
101     * Default options.
102     * @public
103     */
104    Thumbs.Defaults = {
105        thumbs: true,
106        thumbImage: false,
107        thumbContainerClass: 'owl-thumbs',
108        thumbItemClass: 'owl-thumb-item',
109        moveThumbsInside: false
110    };
111
112
113    /**
114     * Listen for thumbnail click
115     * @protected
116     */
117    Thumbs.prototype.listen = function () {
118
119        //set default options
120        var options = this.owl.options;
121
122        if (options.thumbsPrerendered) {
123            this._thumbcontent._thumbcontainer = $('.' + options.thumbContainerClass);
124        }
125
126        //check what thumbitem has been clicked and move slider to that item
127        $(this._thumbcontent._thumbcontainer).on('click', this._thumbcontent._thumbcontainer.children(), $.proxy(function (e) {
128
129            // find relative slider
130            this._identifier = $(e.target).closest('.' + options.thumbContainerClass).data('slider-id');
131
132            // get index of clicked thumbnail
133            var index = $(e.target).parent().is(this._thumbcontent._thumbcontainer) ? $(e.target).index() : $(e.target).closest('.'+options.thumbItemClass).index();
134
135            if (options.thumbsPrerendered) {
136                // slide to slide :)
137                $('[data-slider-id=' + this._identifier + ']').trigger('to.owl.carousel', [index, options.dotsSpeed, true]);
138            } else {
139                this.owl.to(index, options.dotsSpeed);
140            }
141
142            e.preventDefault();
143        }, this));
144    };
145
146
147    /**
148     * Builds thumbnails
149     * @protected
150     */
151    Thumbs.prototype.render = function () {
152
153        //set default options
154        var options = this.owl.options;
155
156        //create thumbcontainer
157        if (!options.thumbsPrerendered) {
158            this._thumbcontent._thumbcontainer = $('<div>').addClass(options.thumbContainerClass).appendTo(this.$element);
159        } else {
160            this._thumbcontent._thumbcontainer = $('.' + options.thumbContainerClass + '');
161            if(options.moveThumbsInside){
162                this._thumbcontent._thumbcontainer.appendTo(this.$element);
163            }
164        }
165
166        //create thumb items
167        var i;
168        if (!options.thumbImage) {
169            for (i = 0; i < this._thumbcontent.length; ++i) {
170                this._thumbcontent._thumbcontainer.append('<button class=' + options.thumbItemClass + '>' + this._thumbcontent[i] + '</button>');
171            }
172        } else {
173            for (i = 0; i < this._thumbcontent.length; ++i) {
174                this._thumbcontent._thumbcontainer.append('<button class=' + options.thumbItemClass + '><img src="' + this._thumbcontent[i].attr('src') + '" alt="' + this._thumbcontent[i].attr('alt') + '" /></button>');
175            }
176        }
177    };
178
179
180    /**
181     * Updates active class on thumbnails
182     * @protected
183     */
184    Thumbs.prototype.setActive = function () {
185
186        // get startslide
187        this.owl_currentitem = this.owl._current - (this.owl._clones.length / 2);
188        if (this.owl_currentitem === this.owl._items.length) {
189            this.owl_currentitem = 0;
190        }
191
192        //set default options
193        var options = this.owl.options;
194
195        // set relative thumbnail container
196        var thumbContainer = options.thumbsPrerendered ? $('.' + options.thumbContainerClass + '[data-slider-id="' + this._identifier + '"]') : this._thumbcontent._thumbcontainer;
197        thumbContainer.children().filter('.active').removeClass('active');
198        thumbContainer.children().eq(this.owl_currentitem).addClass('active');
199    };
200
201
202    /**
203     * Destroys the plugin.
204     * @public
205     */
206    Thumbs.prototype.destroy = function () {
207        var handler, property;
208        for (handler in this._handlers) {
209            this.owl.$element.off(handler, this._handlers[handler]);
210        }
211        for (property in Object.getOwnPropertyNames(this)) {
212            typeof this[property] !== 'function' && (this[property] = null);
213        }
214    };
215
216    $.fn.owlCarousel.Constructor.Plugins.Thumbs = Thumbs;
217
218})(window.Zepto || window.jQuery, window, document);

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.