PageSourceSearch

https://www.sheetspetclinic.com/plugins/smb/gallery/components/assets/js/slideshow.js?v.1.2.78

js sheetspetclinic.com collected 2026-10-06 15:14:11 UTC 10,428 bytes, 304 lines download raw bytes

1+function ($) { "use strict";
2	var Slideshow = function(element, options) {
3        var self = this;
4
5        this.$element = $(element);
6        this.$topWrapper = $(element).closest('.gallery');
7
8        this.options = this.parseTrueFalseOptions(options);
9        this.options.muted = false;
10
11        function triggerScroll() {
12            setTimeout(function () { $(window).trigger("scroll"); }, 100);
13        }
14        // If its only one slide, make infiniteLoop to false in order to not make clones
15        if(this.options.count == 1){
16            this.options.infiniteLoop = false;
17        }
18
19        this.auto = this.options.auto;
20        this.options.auto = false;
21
22        var callbacks = {
23            onSlideAfter: function() {
24                if(self.options.auto){
25                    self.$element.stopAuto();
26                    self.$element.startAuto();
27                }
28            },
29            onSliderLoad: function () {
30                self.$element.css("visibility", "visible");
31                self.$wrapper = self.$element.closest('.bx-wrapper');
32                self.$viewport = self.$wrapper.find('.bx-viewport');
33               // self.$wrapper.find('.bx-viewport').css('height', '');
34
35                if(self.$element.getSlideCount() > 1) {
36                    self.options.pager = true;
37                    $(".bx-pager").show();
38                } else {
39                    self.options.pager = false;
40                    $(".bx-pager").hide();
41                }
42
43                if(self.options.easing == '')
44                    self.options.easing = null;
45
46                if(self.options.controlsHover && self.$element.getSlideCount() > 1){
47                    $(".bx-controls-direction", self.$wrapper).add(".bx-pager").hide();
48
49                    self.$wrapper.hover(
50                        function () { $(".bx-controls-direction", $(this)).add(".bx-pager").fadeIn(300); },
51                        function () { $(".bx-controls-direction", $(this)).add(".bx-pager").fadeOut(300); }
52                    );
53                }
54
55                if(self.options.autoHover){
56                    self.$wrapper.hover(
57                        function(){
58                            if(self.options.auto){
59                                self.$element.stopAuto();
60                            }
61                        },
62                        function(){
63                            if(self.options.auto){
64                                self.$element.startAuto();
65                            }
66                        }
67                    );
68                }
69
70                if(self.options.easing != null){
71                    self.options.useCSS = false;
72                }
73
74
75
76                if(self.auto){
77                    self.options.auto = true;
78                    self.$element.startAuto();
79                    self.makePauseSlideshowButton();
80                }
81
82                // SMBWMGR-3963
83                // if(self.options.videosCount > 0){
84                //     self.makeSoundOffButton();
85                // }
86
87                self.removeHighslideInClones();
88                self.addWrappers();
89            },
90            onSlideNext: function() {
91            },
92            onSlidePrev: function() {
93            }
94        };
95
96        $.extend(this.options, callbacks);
97
98        this.attachEvents();
99        this.initializeSlider();
100
101        return this;
102    }
103
104    Slideshow.prototype.attachEvents = function(){
105        var self = this;
106
107        self.$topWrapper.find('.gallery-slider').on('click', '.gallery-pause-slideshow', function(e, data){
108            $(this).hide();
109            self.$element.stopAuto();
110            self.options.auto = false;
111            self.$topWrapper.find('.gallery-slider .gallery-play-slideshow').fadeIn("slow", function(){
112                if(typeof data != "undefined"){
113                    $(this).focus();
114                }
115            });
116        });
117
118        self.$topWrapper.find('.gallery-slider').on('click', '.gallery-play-slideshow', function(e, data){
119            $(this).hide();
120            self.$element.startAuto();
121            self.options.auto = true;
122            self.$topWrapper.find('.gallery-slider .gallery-pause-slideshow').fadeIn("slow", function(){
123                if(typeof data != "undefined"){
124                    $(this).focus();
125                }
126            });
127        });
128
129        self.$topWrapper.find('.gallery-slider').on('click', '.sound-off', function(e, data){
130            $(this).hide();
131            self.options.muted = true;
132            self.$element.stopAuto();
133            self.$topWrapper.find('.gallery-slider .sound-on').fadeIn("slow", function(){
134                if(typeof data != "undefined"){
135                    $(this).focus();
136                }
137            });
138        });
139
140        self.$topWrapper.find('.gallery-slider').on('click', '.sound-on', function(e, data){
141            $(this).hide();
142            self.options.muted = false;
143            self.$element.startAuto();
144            self.$topWrapper.find('.gallery-slider .sound-off').fadeIn("slow", function(){
145                if(typeof data != "undefined"){
146                    $(this).focus();
147                }
148            });
149        });
150
151        $('body').keypress(function(e){
152            var key = e.which;
153            if(key == 13){
154                if(self.$topWrapper.find('.gallery-slider .play-slideshow').is(':focus')){
155                    self.$topWrapper.find('.gallery-slider .play-slideshow').trigger('click', { kb: true});
156                }
157
158                if(self.$topWrapper.find('.gallery-slider .pause-slideshow').is(':focus')){
159                    self.$topWrapper.find('.gallery-slider .pause-slideshow').trigger('click', { kb: true});
160                }
161
162                if(self.$topWrapper.find('.gallery-slider .sound-off').is(':focus')){
163                    self.$topWrapper.find('.gallery-slider .sound-off').trigger('click', { kb: true});
164                }
165
166                if(self.$topWrapper.find('.gallery-slider .sound-on').is(':focus')){
167                    self.$topWrapper.find('.gallery-slider .sound-on').trigger('click', { kb: true});
168                }
169            }
170        });
171    }
172
173    Slideshow.prototype.parseTrueFalseOptions = function(options, skip){
174        for (var key in options) {
175          if (options.hasOwnProperty(key) && Slideshow.BOOLEANS.indexOf(key) != -1) {
176            options[key] = !!options[key];
177          }
178        }
179
180	  	return options;
181    }
182
183    Slideshow.prototype.addWrappers = function(){
184        var self = this;
185
186        self.$element.closest('.bx-wrapper').find('.bx-controls').wrapAll("<div class='wrap__bx-controls' />");
187        self.$element.closest('.bx-wrapper').find(".bx-pager, .wrap_pause-play").wrapAll( "<div class='bx-controls-buttons' />");
188    }
189
190    Slideshow.prototype.initializeSlider = function(){
191        this.$bxSlider = this.$element.bxSlider(this.options);
192    }
193
194    Slideshow.prototype.destSlider = function(){
195        if(this.$bxSlider.length){
196            this.$bxSlider.destroySlider();
197            this.$topWrapper.find('.gallery-slider .wrap__bx-controls').remove();
198
199            // $('.gallery-slider .gallery-pause-slideshow').remove();
200            // $('.gallery-slider .gallery-play-slideshow').remove();
201            // $('.gallery-slider .sound-on').remove();
202            // $('.gallery-slider .sound-off').remove();
203        }
204    }
205
206    Slideshow.prototype.makePauseSlideshowButton = function(){
207        var self = this;
208
209        var htmlPauseSlideshow = [
210            '<div class="wrap_pause-play">',
211                '<div class="pause-slideshow gallery-pause-slideshow" aria-label="icon pause" title="Pause slideshow" tabindex="0">',
212                    '<span class="icon icon-pause"></span>',
213                '</div>',
214                '<div class="play-slideshow gallery-play-slideshow" aria-label="icon play" style="display: none" title="Play slideshow" tabindex="0">',
215                    '<span class="icon icon-play"></span>',
216                '</div>',
217            '</div>'
218        ];
219
220        self.$topWrapper.find('.gallery-slider .bx-wrapper .bx-controls').append(htmlPauseSlideshow.join(''));
221    }
222
223    // Slideshow.prototype.makeSoundOffButton = function(){
224    //     var self = this;
225
226    //     var htmlPauseSlideshow = [
227    //         '<div class="wrap_on-off">',
228    //             '<div class="sound-off" tabindex="0">',
229    //                 '<span class="cicon cicon-volume-mute"></span>',
230    //             '</div>',
231    //             '<div class="sound-on" aria-label="icon volume-up" style="display: none" tabindex="0">',
232    //                 '<span class="icon icon-volume-up"></span>',
233    //             '</div>',
234    //         '</div>'
235    //     ];
236
237    //     $('.gallery-slider').find('.bx-wrapper .bx-controls').append(htmlPauseSlideshow.join(''));
238
239    // }
240
241    Slideshow.prototype.removeHighslideInClones = function(){
242        var me = this;
243        var $clones = me.$element.find('.bx-clone');
244
245        $clones.each(function(index){
246            var $clone = $(this);
247            var $hs = $clone.find('.highslide');
248
249            $hs.removeClass('highslide');
250            $hs.removeAttr('onclick');
251        });
252    }
253
254    Slideshow.DEFAULTS = {
255    	pager: true,
256    	controls: true,
257    	autoControls: false,
258        autoHoverModified: false,
259        autoHover: false,
260        auto: true,
261        infiniteLoop: true,
262        randomStart: false,
263        controlsHover: false,
264        responsive: false,
265        mode: 'horizontal',
266        speed: 500,
267        pause: 4000,
268        autoDelay: 0,
269        easing: null,
270        useCSS: false,
271        autoPlayVideo: true
272    }
273
274    Slideshow.BOOLEANS = [
275        'pager',
276        'controls',
277        'autoControls',
278        'auto',
279        'infiniteLoop',
280        'randomStart',
281        'controlsHover',
282        'responsive',
283        'autoHoverModified'
284    ]
285
286    var old = $.fn.slideshow;
287
288    $.fn.slideshow = function(option) {
289        var args = arguments, result, obj;
290
291        var $this = $(this);
292
293        var options = $.extend({}, Slideshow.DEFAULTS, $this.data(), typeof option == 'object' && option);
294        var data = '';
295
296        return new Slideshow(this, options);
297    };
298
299    $.fn.slideshow.Constructor = Slideshow
300
301    $.fn.slideshow.noConflict = function () {
302        $.fn.slideshow = old
303    }
304}(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.