PageSourceSearch

https://www.alderac.com/wp-content/themes/magazine-hoot-premium/js/jquery.lightSlider.js?ver=1.1.1

js alderac.com collected 2026-09-24 18:01:35 UTC 49,347 bytes, 1,122 lines download raw bytes

vendor: 31,329 bytes, lines 1-692
1/*! lightslider - v1.1.2 - 2015-04-14
2* {WPHOOT modified}
3* https://github.com/sachinchoolur/lightslider
4* Copyright (c) 2015 Sachin N; Licensed MIT */
5(function ($, undefined) {
6    'use strict';
7    var defaults = {
8        item: 3,
9        autoWidth: false,
10        slideMove: 1,
11        slideMargin: 10,
12        addClass: '',
13        mode: 'slide',
14        useCSS: true,
15        cssEasing: 'ease', //'cubic-bezier(0.25, 0, 0.25, 1)',
16        easing: 'linear', //'for jquery animation',//
17        speed: 400, //ms'
18        auto: false,
19        loop: false,
20        slideEndAnimation: true,
21        pause: 2000,
22        keyPress: false,
23        controls: true,
24        prevHtml: '',
25        nextHtml: '',
26        rtl: false,
27        adaptiveHeight: false,
28        vertical: false,
29        verticalHeight: 500,
30        vThumbWidth: 100,
31        thumbItem: 10,
32        pager: true,
33        gallery: false,
34        galleryMargin: 5,
35        thumbMargin: 5,
36        currentPagerPosition: 'middle',
37        enableTouch: true,
38        enableDrag: true,
39        freeMove: true,
40        swipeThreshold: 40,
41        responsive: [],
42        /* jshint ignore:start */
43        onBeforeStart: function ($el) {},
44        onSliderLoad: function ($el) {},
45        onBeforeSlide: function ($el, scene) {},
46        onAfterSlide: function ($el, scene) {},
47        onBeforeNextSlide: function ($el, scene) {},
48        onBeforePrevSlide: function ($el, scene) {}
49        /* jshint ignore:end */
50    };
51    $.fn.lightSlider = function (options) {
52        if (this.length === 0) {
53            return this;
54        }
55
56        if (this.length > 1) {
57            this.each(function () {
58                $(this).lightSlider(options);
59            });
60            return this;
61        }
62
63        var plugin = {},
64            settings = $.extend(true, {}, defaults, options),
65            settingsTemp = {},
66            $el = this;
67        plugin.$el = this;
68
69        if (settings.mode === 'fade') {
70            settings.vertical = false;
71        }
72        var $children = $el.children(),
73            windowW = $(window).width(),
74            breakpoint = null,
75            resposiveObj = null,
76            length = 0,
77            w = 0,
78            on = false,
79            elSize = 0,
80            $slide = '',
81            scene = 0,
82            property = (settings.vertical === true) ? 'height' : 'width',
83            gutter = (settings.vertical === true) ? 'margin-bottom' : 'margin-right',
84            slideValue = 0,
85            pagerWidth = 0,
86            slideWidth = 0,
87            thumbWidth = 0,
88            interval = null,
89            isTouch = ('ontouchstart' in document.documentElement);
90        var refresh = {};
91
92        refresh.chbreakpoint = function () {
93            windowW = $(window).width();
94            if (settings.responsive.length) {
95                var item;
96                if (settings.autoWidth === false) {
97                    item = settings.item;
98                }
99                if (windowW < settings.responsive[0].breakpoint) {
100                    for (var i = 0; i < settings.responsive.length; i++) {
101                        if (windowW < settings.responsive[i].breakpoint) {
102                            breakpoint = settings.responsive[i].breakpoint;
103                            resposiveObj = settings.responsive[i];
104                        }
105                    }
106                }
107                if (typeof resposiveObj !== 'undefined' && resposiveObj !== null) {
108                    for (var j in resposiveObj.settings) {
109                        if (resposiveObj.settings.hasOwnProperty(j)) {
110                            if (typeof settingsTemp[j] === 'undefined' || settingsTemp[j] === null) {
111                                settingsTemp[j] = settings[j];
112                            }
113                            settings[j] = resposiveObj.settings[j];
114                        }
115                    }
116                }
117                if (!$.isEmptyObject(settingsTemp) && windowW > settings.responsive[0].breakpoint) {
118                    for (var k in settingsTemp) {
119                        if (settingsTemp.hasOwnProperty(k)) {
120                            settings[k] = settingsTemp[k];
121                        }
122                    }
123                }
124                if (settings.autoWidth === false) {
125                    if (slideValue > 0 && slideWidth > 0) {
126                        if (item !== settings.item) {
127                            scene = Math.round(slideValue / ((slideWidth + settings.slideMargin) * settings.slideMove));
128                        }
129                    }
130                }
131            }
132        };
133
134        refresh.calSW = function () {
135            if (settings.autoWidth === false) {
136                slideWidth = (elSize - ((settings.item * (settings.slideMargin)) - settings.slideMargin)) / settings.item;
137            }
138        };
139
140        refresh.calWidth = function (cln) {
141            var ln = cln === true ? $slide.find('.lslide').length : $children.length;
142            if (settings.autoWidth === false) {
143                w = ln * (slideWidth + settings.slideMargin);
144            } else {
145                w = 0;
146                for (var i = 0; i < ln; i++) {
147                    w += (parseInt($children.eq(i).width()) + settings.slideMargin);
148                }
149            }
150            return w;
151        };
152        plugin = {
153            doCss: function () {
154                var support = function () {
155                    var transition = ['transition', 'MozTransition', 'WebkitTransition', 'OTransition', 'msTransition', 'KhtmlTransition'];
156                    var root = document.documentElement;
157                    for (var i = 0; i < transition.length; i++) {
158                        if (transition[i] in root.style) {
159                            return true;
160                        }
161                    }
162                };
163                if (settings.useCSS && support()) {
164                    return true;
165                }
166                return false;
167            },
168            keyPress: function () {
169                if (settings.keyPress) {
170                    $(document).on('keyup.lightslider', function (e) {
171                        if (!$(':focus').is('input, textarea')) {
172                            if (e.preventDefault) {
173                                e.preventDefault();
174                            } else {
175                                e.returnValue = false;
176                            }
177                            if (e.keyCode === 37) {
178                                $el.goToPrevSlide();
179                                clearInterval(interval);
180                            } else if (e.keyCode === 39) {
181                                $el.goToNextSlide();
182                                clearInterval(interval);
183                            }
184                        }
185                    });
186                }
187            },
188            controls: function () {
189                if (settings.controls) {
190                    $el.after('<div class="lSAction"><a class="lSPrev">' + settings.prevHtml + '</a><a class="lSNext">' + settings.nextHtml + '</a></div>');
191                    if (!settings.autoWidth) {
192                        if (length <= settings.item) {
193                            $slide.find('.lSAction').hide();
194                        }
195                    } else {
196                        if (refresh.calWidth(false) < elSize) {
197                            $slide.find('.lSAction').hide();
198                        }
199                    }
200                    $slide.find('.lSAction a').on('click', function (e) {
201                        if (e.preventDefault) {
202                            e.preventDefault();
203                        } else {
204                            e.returnValue = false;
205                        }
206                        if ($(this).attr('class') === 'lSPrev') {
207                            $el.goToPrevSlide();
208                        } else {
209                            $el.goToNextSlide();
210                        }
211                        clearInterval(interval);
212                        return false;
213                    });
214                }
215            },
216            initialStyle: function () {
217                var $this = this;
218                if (settings.mode === 'fade') {
219                    settings.autoWidth = false;
220                    settings.slideEndAnimation = false;
221                }
222                if (settings.auto) {
223                    settings.slideEndAnimation = false;
224                }
225                if (settings.autoWidth) {
226                    settings.slideMove = 1;
227                    settings.item = 1;
228                }
229                if (settings.loop) {
230                    settings.slideMove = 1;
231                    settings.freeMove = false;
232                }
233                settings.onBeforeStart.call(this, $el);
234                refresh.chbreakpoint();
235                $el.addClass('lightSlider').wrap('<div class="lSSlideOuter ' + settings.addClass + '"><div class="lSSlideWrapper"></div></div>');
236                $slide = $el.parent('.lSSlideWrapper');
237                if (settings.rtl === true) {
238                    $slide.parent().addClass('lSrtl');
239                }
240                if (settings.vertical) {
241                    $slide.parent().addClass('vertical');
242                    elSize = settings.verticalHeight;
243                    $slide.css('height', elSize + 'px');
244                } else {
245                    elSize = $el.outerWidth();
246                }
247                $children.addClass('lslide');
248                if (settings.loop === true && settings.mode === 'slide') {
249                    refresh.calSW();
250                    refresh.clone = function () {
251                        if (refresh.calWidth(true) > elSize) {
252                            /**/
253                            var tWr = 0,
254                                tI = 0;
255                            for (var k = 0; k < $children.length; k++) {
256                                tWr += (parseInt($el.find('.lslide').eq(k).width()) + settings.slideMargin);
257                                tI++;
258                                if (tWr >= (elSize + settings.slideMargin)) {
259                                    break;
260                                }
261                            }
262                            var tItem = settings.autoWidth === true ? tI : settings.item;
263
264                            /**/
265                            if (tItem < $el.find('.clone.left').length) {
266                                for (var i = 0; i < $el.find('.clone.left').length - tItem; i++) {
267                                    $children.eq(i).remove();
268                                }
269                            }
270                            if (tItem < $el.find('.clone.right').length) {
271                                for (var j = $children.length - 1; j > ($children.length - 1 - $el.find('.clone.right').length); j--) {
272                                    scene--;
273                                    $children.eq(j).remove();
274                                }
275                            }
276                            /**/
277                            for (var n = $el.find('.clone.right').length; n < tItem; n++) {
278                                $el.find('.lslide').eq(n).clone().removeClass('lslide').addClass('clone right').appendTo($el);
279                                scene++;
280                            }
281                            for (var m = $el.find('.lslide').length - $el.find('.clone.left').length; m > ($el.find('.lslide').length - tItem); m--) {
282                                $el.find('.lslide').eq(m - 1).clone().removeClass('lslide').addClass('clone left').prependTo($el);
283                            }
284                            $children = $el.children();
285                        } else {
286                            if ($children.hasClass('clone')) {
287                                $el.find('.clone').remove();
288                                $this.move($el, 0);
289                            }
290                        }
291                    };
292                    refresh.clone();
293                }
294                refresh.sSW = function () {
295                    length = $children.length;
296                    if (settings.rtl === true && settings.vertical === false) {
297                        gutter = 'margin-left';
298                    }
299                    if (settings.autoWidth === false) {
300                        $children.css(property, slideWidth + 'px');
301                    }
302                    $children.css(gutter, settings.slideMargin + 'px');
303                    w = refresh.calWidth(false);
304                    $el.css(property, w + 'px');
305                    if (settings.loop === true && settings.mode === 'slide') {
306                        if (on === false) {
307                            scene = $el.find('.clone.left').length;
308                        }
309                    }
310                };
311                refresh.calL = function () {
312                    $children = $el.children();
313                    length = $children.length;
314                };
315                if (this.doCss()) {
316                    $slide.addClass('usingCss');
317                }
318                refresh.calL();
319                if (settings.mode === 'slide') {
320                    refresh.calSW();
321                    refresh.sSW();
322                    if (settings.loop === true) {
323                        slideValue = $this.slideValue();
324                        this.move($el, slideValue);
325                    }
326                    if (settings.vertical === false) {
327                        this.setHeight($el, false);
328                    }
329
330                } else {
331                    this.setHeight($el, true);
332                    $el.addClass('lSFade');
333                    if (!this.doCss()) {
334                        $children.not('.active').css('display', 'none');
335                    }
336                }
337                if (settings.loop === true && settings.mode === 'slide') {
338                    $children.eq(scene).addClass('active');
339                } else {
340                    $children.first().addClass('active');
341                }
342            },
343            pager: function () {
344                var $this = this;
345                refresh.createPager = function () {
346                    thumbWidth = (elSize - ((settings.thumbItem * (settings.thumbMargin)) - settings.thumbMargin)) / settings.thumbItem;
347                    var $children = $slide.find('.lslide');
348                    var length = $slide.find('.lslide').length;
349                    var i = 0,
350                        pagers = '',
351                        v = 0;
352                    for (i = 0; i < length; i++) {
353                        if (settings.mode === 'slide') {
354                            // calculate scene * slide value
355                            if (!settings.autoWidth) {
356                                v = i * ((slideWidth + settings.slideMargin) * settings.slideMove);
357                            } else {
358                                v += ((parseInt($children.eq(i).width()) + settings.slideMargin) * settings.slideMove);
359                            }
360                        }
361                        var thumb = $children.eq(i * settings.slideMove).attr('data-thumb');
362                        if (settings.gallery === true) {
363                            pagers += '<li style="width:100%;' + property + ':' + thumbWidth + 'px;' + gutter + ':' + settings.thumbMargin + 'px"><a href="#"><img src="' + thumb + '" /></a></li>';
364                        } else {
365                            /* WPHOOT MOD : https://wphoot.com/support/topic/slider-and-google-search-results-page/ */
366                            pagers += '<li><a href="#"></a></li>';
367                            // pagers += '<li><a href="#">' + (i + 1) + '</a></li>';
368                            /* WPHOOT MOD END */
369                        }
370                        if (settings.mode === 'slide') {
371                            if ((v) >= w - elSize - settings.slideMargin) {
372                                i = i + 1;
373                                var minPgr = 2;
374                                if (settings.autoWidth) {
375                                    pagers += '<li><a href="#">' + (i + 1) + '</a></li>';
376                                    minPgr = 1;
377                                }
378                                if (i < minPgr) {
379                                    pagers = null;
380                                    $slide.parent().addClass('noPager');
381                                } else {
382                                    $slide.parent().removeClass('noPager');
383                                }
384                                break;
385                            }
386                        }
387                    }
388                    var $cSouter = $slide.parent();
389                    $cSouter.find('.lSPager').html(pagers); 
390                    if (settings.gallery === true) {
391                        if (settings.vertical === true) {
392                            // set Gallery thumbnail width
393                            $cSouter.find('.lSPager').css('width', settings.vThumbWidth + 'px');
394                        }
395                        pagerWidth = (i * (settings.thumbMargin + thumbWidth)) + 0.5;
396                        $cSouter.find('.lSPager').css({
397                            property: pagerWidth + 'px',
398                            'transition-duration': settings.speed + 'ms'
399                        });
400                        if (settings.vertical === true) {
401                            $slide.parent().css('padding-right', (settings.vThumbWidth + settings.galleryMargin) + 'px');
402                        }
403                        $cSouter.find('.lSPager').css(property, pagerWidth + 'px');
404                    }
405                    var $pager = $cSouter.find('.lSPager').find('li');
406                    $pager.first().addClass('active');
407                    $pager.on('click', function () {
408                        if (settings.loop === true && settings.mode === 'slide') {
409                            scene = scene + ($pager.index(this) - $cSouter.find('.lSPager').find('li.active').index());
410                        } else {
411                            scene = $pager.index(this);
412                        }
413                        $el.mode(false);
414                        if (settings.gallery === true) {
415                            $this.slideThumb();
416                        }
417                        clearInterval(interval);
418                        return false;
419                    });
420                };
421                if (settings.pager) {
422                    var cl = 'lSpg';
423                    if (settings.gallery) {
424                        cl = 'lSGallery';
425                    }
426                    $slide.after('<ul class="lSPager ' + cl + '"></ul>');
427                    var gMargin = (settings.vertical) ? 'margin-left' : 'margin-top';
428                    $slide.parent().find('.lSPager').css(gMargin, settings.galleryMargin + 'px');
429                    refresh.createPager();
430                }
431
432                setTimeout(function () {
433                    refresh.init();
434                }, 0);
435            },
436            setHeight: function (ob, fade) {
437                var obj = null,
438                    $this = this;
439                if (settings.loop) {
440                    obj = ob.children('.lslide ').first();
441                } else {
442                    obj = ob.children().first();
443                }
444                var setCss = function () {
445                    var tH = obj.outerHeight(),
446                        tP = 0,
447                        tHT = tH;
448                    if (fade) {
449                        tH = 0;
450                        tP = ((tHT) * 100) / elSize;
451                    }
452                    ob.css({
453                        'height': tH + 'px',
454                        'padding-bottom': tP + '%'
455                    });
456                };
457                setCss();
458                /* WPHOOT MOD : Unreliable load https://api.jquery.com/load-event/ */
459                /* @credit http://stackoverflow.com/questions/3877027 */
460                if (obj.find('img').length > 0) {
461                    obj.find('img').one("load",function () {
462                // if (obj.has('img')) {
463                //     obj.find('img').load(function () {
464                        setTimeout(function () {
465                            setCss();
466                            if (!interval) {
467                                $this.auto();
468                            }
469                        }, 100);
470                    }).each(function() { if(this.complete) $(this).trigger('load'); });
471                //  });
472                /* WPHOOT MOD END */
473                }else{
474                    if (!interval) {
475                        $this.auto();
476                    }
477                }
478            },
479            active: function (ob, t) {
480                if (this.doCss() && settings.mode === 'fade') {
481                    $slide.addClass('on');
482                }
483                var sc = 0;
484                if (scene * settings.slideMove < length) {
485                    ob.removeClass('active');
486                    if (!this.doCss() && settings.mode === 'fade' && t === false) {
487                        ob.fadeOut(settings.speed);
488                    }
489                    if (t === true) {
490                        sc = scene;
491                    } else {
492                        sc = scene * settings.slideMove;
493                    }
494                    //t === true ? sc = scene : sc = scene * settings.slideMove;
495                    var l, nl;
496                    if (t === true) {
497                        l = ob.length;
498                        nl = l - 1;
499                        if (sc + 1 >= l) {
500                            sc = nl;
501                        }
502                    }
503                    if (settings.loop === true && settings.mode === 'slide') {
504                        //t === true ? sc = scene - $el.find('.clone.left').length : sc = scene * settings.slideMove;
505                        if (t === true) {
506                            sc = scene - $el.find('.clone.left').length;
507                        } else {
508                            sc = scene * settings.slideMove;
509                        }
510                        if (t === true) {
511                            l = ob.length;
512                            nl = l - 1;
513                            if (sc + 1 === l) {
514                                sc = nl;
515                            } else if (sc + 1 > l) {
516                                sc = 0;
517                            }
518                        }
519                    }
520
521                    if (!this.doCss() && settings.mode === 'fade' && t === false) {
522                        ob.eq(sc).fadeIn(settings.speed);
523                    }
524                    ob.eq(sc).addClass('active');
525                } else {
526                    ob.removeClass('active');
527                    ob.eq(ob.length - 1).addClass('active');
528                    if (!this.doCss() && settings.mode === 'fade' && t === false) {
529                        ob.fadeOut(settings.speed);
530                        ob.eq(sc).fadeIn(settings.speed);
531                    }
532                }
533            },
534            move: function (ob, v) {
535                if (settings.rtl === true) {
536                    v = -v;
537                }
538                if (this.doCss()) {
539                    if (settings.vertical === true) {
540                        ob.css({
541                            'transform': 'translate3d(0px, ' + (-v) + 'px, 0px)',
542                            '-webkit-transform': 'translate3d(0px, ' + (-v) + 'px, 0px)'
543                        });
544                    } else {
545                        ob.css({
546                            'transform': 'translate3d(' + (-v) + 'px, 0px, 0px)',
547                            '-webkit-transform': 'translate3d(' + (-v) + 'px, 0px, 0px)',
548                        });
549                    }
550                } else {
551                    if (settings.vertical === true) {
552                        ob.css('position', 'relative').animate({
553                            top: -v + 'px'
554                        }, settings.speed, settings.easing);
555                    } else {
556                        ob.css('position', 'relative').animate({
557                            left: -v + 'px'
558                        }, settings.speed, settings.easing);
559                    }
560                }
561                var $thumb = $slide.parent().find('.lSPager').find('li');
562                this.active($thumb, true);
563                /* WPHOOT MOD */
564                // We use setInterval instead of setTimeout(function(){$(window).trigger('hootSliderAnimated');},400);
565                var triggerCount = 1, triggerEvent = setInterval(function(){
566                    $(window).trigger('hootSliderAnimated');
567                    triggerCount++;
568                    if ( triggerCount == 5 ) clearInterval(triggerEvent);
569                }, 100); // total 400ms i.e. defaults.speed set above (options)
570                /* WPHOOT MOD END */
571            },
572            fade: function () {
573                this.active($children, false);
574                var $thumb = $slide.parent().find('.lSPager').find('li');
575                this.active($thumb, true);
576            },
577            slide: function () {
578                var $this = this;
579                refresh.calSlide = function () {
580                    if (w > elSize) {
581                        slideValue = $this.slideValue();
582                        $this.active($children, false);
583                        if ((slideValue) > w - elSize - settings.slideMargin) {
584                            slideValue = w - elSize - settings.slideMargin;
585                        } else if (slideValue < 0) {
586                            slideValue = 0;
587                        }
588                        $this.move($el, slideValue);
589                        if (settings.loop === true && settings.mode === 'slide') {
590                            if (scene >= (length - ($el.find('.clone.left').length / settings.slideMove))) {
591                                $this.resetSlide($el.find('.clone.left').length);
592                            }
593                            if (scene === 0) {
594                                $this.resetSlide($slide.find('.lslide').length);
595                            }
596                        }
597                    }
598                };
599                refresh.calSlide();
600            },
601            resetSlide: function (s) {
602                var $this = this;
603                $slide.find('.lSAction a').addClass('disabled');
604                setTimeout(function () {
605                    scene = s;
606                    $slide.css('transition-duration', '0ms');
607                    slideValue = $this.slideValue();
608                    $this.active($children, false);
609                    plugin.move($el, slideValue);
610                    setTimeout(function () {
611                        $slide.css('transition-duration', settings.speed + 'ms');
612                        $slide.find('.lSAction a').removeClass('disabled');
613                    }, 50);
614                }, settings.speed + 100);
615            },
616            slideValue: function () {
617                var _sV = 0;
618                if (settings.autoWidth === false) {
619                    _sV = scene * ((slideWidth + settings.slideMargin) * settings.slideMove);
620                } else {
621                    _sV = 0;
622                    for (var i = 0; i < scene; i++) {
623                        _sV += (parseInt($children.eq(i).width()) + settings.slideMargin);
624                    }
625                }
626                return _sV;
627            },
628            slideThumb: function () {
629                var position;
630                switch (settings.currentPagerPosition) {
631                case 'left':
632                    position = 0;
633                    break;
634                case 'middle':
635                    position = (elSize / 2) - (thumbWidth / 2);
636                    break;
637                case 'right':
638                    position = elSize - thumbWidth;
639                }
640                var sc = scene - $el.find('.clone.left').length;
641                var $pager = $slide.parent().find('.lSPager');
642                if (settings.mode === 'slide' && settings.loop === true) {
643                    if (sc >= $pager.children().length) {
644                        sc = 0;
645                    } else if (sc < 0) {
646                        sc = $pager.children().length;
647                    }
648                }
649                var thumbSlide = sc * ((thumbWidth + settings.thumbMargin)) - (position);
650                if ((thumbSlide + elSize) > pagerWidth) {
651                    thumbSlide = pagerWidth - elSize - settings.thumbMargin;
652                }
653                if (thumbSlide < 0) {
654                    thumbSlide = 0;
655                }
656                this.move($pager, thumbSlide);
657            },
658            auto: function () {
659                if (settings.auto) {
660                    interval = setInterval(function () {
661                        $el.goToNextSlide();
662                    }, settings.pause);
663                }
664            },
665
666            touchMove: function (endCoords, startCoords) {
667                $slide.css('transition-duration', '0ms');
668                if (settings.mode === 'slide') {
669                    var distance = endCoords - startCoords;
670                    var swipeVal = slideValue - distance;
671                    if ((swipeVal) >= w - elSize - settings.slideMargin) {
672                        if (settings.freeMove === false) {
673                            swipeVal = w - elSize - settings.slideMargin;
674                        } else {
675                            var swipeValT = w - elSize - settings.slideMargin;
676                            swipeVal = swipeValT + ((swipeVal - swipeValT) / 5);
677
678                        }
679                    } else if (swipeVal < 0) {
680                        if (settings.freeMove === false) {
681                            swipeVal = 0;
682                        } else {
683                            swipeVal = swipeVal / 5;
684                        }
685                    }
686                    this.move($el, swipeVal);
687                }
688            },
689
690            touchEnd: function (distance) {
691                $slide.css('transition-duration', settings.speed + 'ms');
692                clearInterval(interval
vendor: 8,426 bytes, lines 692-876
692);
693                if (settings.mode === 'slide') {
694                    var mxVal = false;
695                    var _next = true;
696                    slideValue = slideValue - distance;
697                    if ((slideValue) > w - elSize - settings.slideMargin) {
698                        slideValue = w - elSize - settings.slideMargin;
699                        if (settings.autoWidth === false) {
700                            mxVal = true;
701                        }
702                    } else if (slideValue < 0) {
703                        slideValue = 0;
704                    }
705                    var gC = function (next) {
706                        var ad = 0;
707                        if (!mxVal) {
708                            if (next) {
709                                ad = 1;
710                            }
711                        }
712                        if (!settings.autoWidth) {
713                            var num = slideValue / ((slideWidth + settings.slideMargin) * settings.slideMove);
714                            scene = parseInt(num) + ad;
715                            if (slideValue >= (w - elSize - settings.slideMargin)) {
716                                if (num % 1 !== 0) {
717                                    scene++;
718                                }
719                            }
720                        } else {
721                            var tW = 0;
722                            for (var i = 0; i < $children.length; i++) {
723                                tW += (parseInt($children.eq(i).width()) + settings.slideMargin);
724                                scene = i + ad;
725                                if (tW >= slideValue) {
726                                    break;
727                                }
728                            }
729                        }
730                    };
731                    if (distance >= settings.swipeThreshold) {
732                        gC(false);
733                        _next = false;
734                    } else if (distance <= -settings.swipeThreshold) {
735                        gC(true);
736                        _next = false;
737                    }
738                    $el.mode(_next);
739                    this.slideThumb();
740                } else {
741                    if (distance >= settings.swipeThreshold) {
742                        $el.goToPrevSlide();
743                    } else if (distance <= -settings.swipeThreshold) {
744                        $el.goToNextSlide();
745                    }
746                }
747            },
748
749
750
751            enableDrag: function () {
752                var $this = this;
753                if (!isTouch) {
754                    var startCoords = 0,
755                        endCoords = 0,
756                        isDraging = false;
757                    $slide.find('.lightSlider').addClass('lsGrab');
758                    $slide.on('mousedown', function (e) {
759                        if (w < elSize) {
760                            if (w !== 0) {
761                                return false;
762                            }
763                        }
764                        if ($(e.target).attr('class') !== ('lSPrev') && $(e.target).attr('class') !== ('lSNext')) {
765                            startCoords = (settings.vertical === true) ? e.pageY : e.pageX;
766                            isDraging = true;
767                            if (e.preventDefault) {
768                                e.preventDefault();
769                            } else {
770                                e.returnValue = false;
771                            }
772                            // ** Fix for webkit cursor issue https://code.google.com/p/chromium/issues/detail?id=26723
773                            $slide.scrollLeft += 1;
774                            $slide.scrollLeft -= 1;
775                            // *
776                            $slide.find('.lightSlider').removeClass('lsGrab').addClass('lsGrabbing');
777                            clearInterval(interval);
778                        }
779                    });
780                    $(window).on('mousemove', function (e) {
781                        if (isDraging) {
782                            endCoords = (settings.vertical === true) ? e.pageY : e.pageX;
783                            $this.touchMove(endCoords, startCoords);
784                        }
785                    });
786                    $(window).on('mouseup', function (e) {
787                        if (isDraging) {
788                            $slide.find('.lightSlider').removeClass('lsGrabbing').addClass('lsGrab');
789                            isDraging = false;
790                            endCoords = (settings.vertical === true) ? e.pageY : e.pageX;
791                            var distance = endCoords - startCoords;
792                            if (Math.abs(distance) >= settings.swipeThreshold) {
793                                $(window).on('click.ls', function (e) {
794                                    if (e.preventDefault) {
795                                        e.preventDefault();
796                                    } else {
797                                        e.returnValue = false;
798                                    }
799                                    e.stopImmediatePropagation();
800                                    e.stopPropagation();
801                                    $(window).off('click.ls');
802                                });
803                            }
804
805                            $this.touchEnd(distance);
806
807                        }
808                    });
809                }
810            },
811
812
813
814
815            enableTouch: function () {
816                var $this = this;
817                if (isTouch) {
818                    var startCoords = {},
819                        endCoords = {};
820                    $slide.on('touchstart', function (e) {
821                        endCoords = e.originalEvent.targetTouches[0];
822                        startCoords.pageX = e.originalEvent.targetTouches[0].pageX;
823                        startCoords.pageY = e.originalEvent.targetTouches[0].pageY;
824                        clearInterval(interval);
825                    });
826                    $slide.on('touchmove', function (e) {
827                        if (w < elSize) {
828                            if (w !== 0) {
829                                return false;
830                            }
831                        }
832                        var orig = e.originalEvent;
833                        endCoords = orig.targetTouches[0];
834                        var xMovement = Math.abs(endCoords.pageX - startCoords.pageX);
835                        var yMovement = Math.abs(endCoords.pageY - startCoords.pageY);
836                        if (settings.vertical === true) {
837                            if ((yMovement * 3) > xMovement) {
838                                e.preventDefault();
839                            }
840                            $this.touchMove(endCoords.pageY, startCoords.pageY);
841                        } else {
842                            if ((xMovement * 3) > yMovement) {
843                                e.preventDefault();
844                            }
845                            $this.touchMove(endCoords.pageX, startCoords.pageX);
846                        }
847
848                    });
849                    $slide.on('touchend', function () {
850                        if (w < elSize) {
851                            if (w !== 0) {
852                                return false;
853                            }
854                        }
855                        var distance;
856                        if (settings.vertical === true) {
857                            distance = endCoords.pageY - startCoords.pageY;
858                        } else {
859                            distance = endCoords.pageX - startCoords.pageX;
860                        }
861                        $this.touchEnd(distance);
862                    });
863                }
864            },
865            build: function () {
866                var $this = this;
867                $this.initialStyle();
868                if (this.doCss()) {
869
870                    if (settings.enableTouch === true) {
871                        $this.enableTouch();
872                    }
873                    if (settings.enableDrag === true) {
874                        $this.enableDrag();
875                    }
876                }
vendor: 9,592 bytes, lines 877-1122
877                $this.pager();
878                $this.controls();
879                $this.keyPress();
880            }
881        };
882        plugin.build();
883        refresh.init = function () {
884            refresh.chbreakpoint();
885            if (settings.vertical === true) {
886                if (settings.item > 1) {
887                    elSize = settings.verticalHeight;
888                } else {
889                    elSize = $children.outerHeight();
890                }
891                $slide.css('height', elSize + 'px');
892            } else {
893                elSize = $slide.outerWidth();
894            }
895            if (settings.loop === true && settings.mode === 'slide') {
896                if(length>1)/* WPHOOT MOD */
897                refresh.clone();
898            }
899            refresh.calL();
900            if (settings.mode === 'slide') {
901                $el.removeClass('lSSlide');
902            }
903            if (settings.mode === 'slide') {
904                refresh.calSW();
905                refresh.sSW();
906            }
907            setTimeout(function () {
908                if (settings.mode === 'slide') {
909                    $el.addClass('lSSlide');
910                }
911            }, 1000);
912            if (settings.pager) {
913                refresh.createPager();
914            }
915            if (settings.adaptiveHeight === true && settings.vertical === false) {
916                /* WPHOOT MOD: https://github.com/sachinchoolur/lightslider/issues/119 */
917                // $el.css('height', $children.eq(scene).outerHeight(true));
918                var adHeight = 0;
919                for (var i = 0; i < settings.item; i++) {
920                    // check tallest slide in the viewport 
921                    if ($children.eq(scene+i).outerHeight(true) > adHeight) {
922                        adHeight = $children.eq(scene+i).outerHeight(true)
923                    };
924                };
925                $el.css('height', adHeight);
926                /* WPHOOT MOD END */
927            }
928            if (settings.adaptiveHeight === false) {
929                if (settings.mode === 'slide') {
930                    if (settings.vertical === false) {
931                        plugin.setHeight($el, false);
932                    }
933                } else {
934                    plugin.setHeight($el, true);
935                }
936            }
937            if (settings.gallery === true) {
938                plugin.slideThumb();
939            }
940            if (settings.mode === 'slide') {
941                plugin.slide();
942            }
943            if (settings.autoWidth === false) {
944                if ($children.length <= settings.item) {
945                    $slide.find('.lSAction').hide();
946                } else {
947                    $slide.find('.lSAction').show();
948                }
949            } else {
950                if ((refresh.calWidth(false) < elSize) && (w !== 0)) {
951                    $slide.find('.lSAction').hide();
952                } else {
953                    $slide.find('.lSAction').show();
954                }
955            }
956        };
957        $el.goToPrevSlide = function () {
958            if (scene > 0) {
959                settings.onBeforePrevSlide.call(this, $el, scene);
960                scene--;
961                $el.mode(false);
962                if (settings.gallery === true) {
963                    plugin.slideThumb();
964                }
965            } else {
966                if (settings.loop === true) {
967                    settings.onBeforePrevSlide.call(this, $el, scene);
968                    if (settings.mode === 'fade') {
969                        var l = (length - 1);
970                        scene = parseInt(l / settings.slideMove);
971                    }
972                    $el.mode(false);
973                    if (settings.gallery === true) {
974                        plugin.slideThumb();
975                    }
976                } else if (settings.slideEndAnimation === true) {
977                    $el.addClass('leftEnd');
978                    setTimeout(function () {
979                        $el.removeClass('leftEnd');
980                    }, 400);
981                }
982            }
983        };
984        $el.goToNextSlide = function () {
985            var nextI = true;
986            if (settings.mode === 'slide') {
987                var _slideValue = plugin.slideValue();
988                nextI = _slideValue < w - elSize - settings.slideMargin;
989            }
990            if (((scene * settings.slideMove) < length - settings.slideMove) && nextI) {
991                settings.onBeforeNextSlide.call(this, $el, scene);
992                scene++;
993                $el.mode(false);
994                if (settings.gallery === true) {
995                    plugin.slideThumb();
996                }
997            } else {
998                if (settings.loop === true) {
999                    settings.onBeforeNextSlide.call(this, $el, scene);
1000                    scene = 0;
1001                    $el.mode(false);
1002                    if (settings.gallery === true) {
1003                        plugin.slideThumb();
1004                    }
1005                } else if (settings.slideEndAnimation === true) {
1006                    $el.addClass('rightEnd');
1007                    setTimeout(function () {
1008                        $el.removeClass('rightEnd');
1009                    }, 400);
1010                }
1011            }
1012        };
1013        $el.mode = function (_touch) {
1014            if (settings.adaptiveHeight === true && settings.vertical === false) {
1015                /* WPHOOT MOD: https://github.com/sachinchoolur/lightslider/issues/119 */
1016                // $el.css('height', $children.eq(scene).outerHeight(true));
1017                var adHeight = 0;
1018                for (var i = 0; i < settings.item; i++) {
1019                    // check tallest slide in the viewport 
1020                    if ($children.eq(scene+i).outerHeight(true) > adHeight) {
1021                        adHeight = $children.eq(scene+i).outerHeight(true)
1022                    };
1023                };
1024                $el.css('height', adHeight);
1025                /* WPHOOT MOD END */
1026            }
1027            if (on === false) {
1028                if (settings.mode === 'slide') {
1029                    if (plugin.doCss()) {
1030                        $el.addClass('lSSlide');
1031                        if (settings.speed !== '') {
1032                            $slide.css('transition-duration', settings.speed + 'ms');
1033                        }
1034                        if (settings.cssEasing !== '') {
1035                            $slide.css('transition-timing-function', settings.cssEasing);
1036                        }
1037                    }
1038                } else {
1039                    if (plugin.doCss()) {
1040                        if (settings.speed !== '') {
1041                            $el.css('transition-duration', settings.speed + 'ms');
1042                        }
1043                        if (settings.cssEasing !== '') {
1044                            $el.css('transition-timing-function', settings.cssEasing);
1045                        }
1046                    }
1047                }
1048            }
1049            if (!_touch) {
1050                settings.onBeforeSlide.call(this, $el, scene);
1051            }
1052            if (settings.mode === 'slide') {
1053                plugin.slide();
1054            } else {
1055                plugin.fade();
1056            }
1057            setTimeout(function () {
1058                if (!_touch) {
1059                    settings.onAfterSlide.call(this, $el, scene);
1060                }
1061            }, settings.speed);
1062            on = true;
1063        };
1064        $el.play = function () {
1065            clearInterval(interval);
1066            $el.goToNextSlide();
1067            interval = setInterval(function () {
1068                $el.goToNextSlide();
1069            }, settings.pause);
1070        };
1071        $el.pause = function () {
1072            clearInterval(interval);
1073        };
1074        $el.refresh = function () {
1075            refresh.init();
1076        };
1077        $el.getCurrentSlideCount = function () {
1078            var sc = scene;
1079            if (settings.loop) {
1080                var ln = $slide.find('.lslide').length,
1081                    cl = $el.find('.clone.left').length;
1082                if (scene <= cl - 1) {
1083                    sc = ln + (scene - cl);
1084                } else if (scene >= (ln + cl)) {
1085                    sc = scene - ln - cl;
1086                } else {
1087                    sc = scene - cl;
1088                }
1089            }
1090            return sc + 1;
1091        };
1092        $el.getTotalSlideCount = function () {
1093            return $slide.find('.lslide').length;
1094        };
1095        $el.goToSlide = function (s) {
1096            if (settings.loop) {
1097                scene = (s + $el.find('.clone.left').length - 1);
1098            } else {
1099                scene = s;
1100            }
1101            $el.mode(false);
1102            if (settings.gallery === true) {
1103                plugin.slideThumb();
1104            }
1105        };
1106        setTimeout(function () {
1107            settings.onSliderLoad.call(this, $el);
1108        }, 10);
1109        $(window).on('resize orientationchange', function (e) {
1110            setTimeout(function () {
1111                if (e.preventDefault) {
1112                    e.preventDefault();
1113                } else {
1114                    e.returnValue = false;
1115                }
1116                refresh.init();
1117                $(window).trigger('hootSliderAnimated'); // WPHOOT MOD
1118            }, 200);
1119        });
1120        return this;
1121    };
1122}(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.