PageSourceSearch

https://majidbabaei.com/js/carousel.js

js majidbabaei.com collected 2026-10-06 14:00:34 UTC 54,025 bytes, 1,500 lines download raw bytes

1
2if (typeof Object.create !== "function") {
3    Object.create = function (obj) {
4        function F() {}
5        F.prototype = obj;
6        return new F();
7    };
8}
9(function ($, window, document) {
10
11    var Carousel = {
12        init : function (options, el) {
13            var base = this;
14
15            base.$elem = $(el);
16            base.options = $.extend({}, $.fn.owlCarousel.options, base.$elem.data(), options);
17
18            base.userOptions = options;
19            base.loadContent();
20        },
21
22        loadContent : function () {
23            var base = this, url;
24
25            function getData(data) {
26                var i, content = "";
27                if (typeof base.options.jsonSuccess === "function") {
28                    base.options.jsonSuccess.apply(this, [data]);
29                } else {
30                    for (i in data.owl) {
31                        if (data.owl.hasOwnProperty(i)) {
32                            content += data.owl[i].item;
33                        }
34                    }
35                    base.$elem.html(content);
36                }
37                base.logIn();
38            }
39
40            if (typeof base.options.beforeInit === "function") {
41                base.options.beforeInit.apply(this, [base.$elem]);
42            }
43
44            if (typeof base.options.jsonPath === "string") {
45                url = base.options.jsonPath;
46                $.getJSON(url, getData);
47            } else {
48                base.logIn();
49            }
50        },
51
52        logIn : function () {
53            var base = this;
54
55            base.$elem.data("owl-originalStyles", base.$elem.attr("style"));
56            base.$elem.data("owl-originalClasses", base.$elem.attr("class"));
57
58            base.$elem.css({opacity: 0});
59            base.orignalItems = base.options.items;
60            base.checkBrowser();
61            base.wrapperWidth = 0;
62            base.checkVisible = null;
63            base.setVars();
64        },
65
66        setVars : function () {
67            var base = this;
68            if (base.$elem.children().length === 0) {return false; }
69            base.baseClass();
70            base.eventTypes();
71            base.$userItems = base.$elem.children();
72            base.itemsAmount = base.$userItems.length;
73            base.wrapItems();
74            base.$owlItems = base.$elem.find(".owl-item");
75            base.$owlWrapper = base.$elem.find(".owl-wrapper");
76            base.playDirection = "next";
77            base.prevItem = 0;
78            base.prevArr = [0];
79            base.currentItem = 0;
80            base.customEvents();
81            base.onStartup();
82        },
83
84        onStartup : function () {
85            var base = this;
86            base.updateItems();
87            base.calculateAll();
88            base.buildControls();
89            base.updateControls();
90            base.response();
91            base.moveEvents();
92            base.stopOnHover();
93            base.owlStatus();
94
95            if (base.options.transitionStyle !== false) {
96                base.transitionTypes(base.options.transitionStyle);
97            }
98            if (base.options.autoPlay === true) {
99                base.options.autoPlay = 5000;
100            }
101            base.play();
102
103            base.$elem.find(".owl-wrapper").css("display", "block");
104
105            if (!base.$elem.is(":visible")) {
106                base.watchVisibility();
107            } else {
108                base.$elem.css("opacity", 1);
109            }
110            base.onstartup = false;
111            base.eachMoveUpdate();
112            if (typeof base.options.afterInit === "function") {
113                base.options.afterInit.apply(this, [base.$elem]);
114            }
115        },
116
117        eachMoveUpdate : function () {
118            var base = this;
119
120            if (base.options.lazyLoad === true) {
121                base.lazyLoad();
122            }
123            if (base.options.autoHeight === true) {
124                base.autoHeight();
125            }
126            base.onVisibleItems();
127
128            if (typeof base.options.afterAction === "function") {
129                base.options.afterAction.apply(this, [base.$elem]);
130            }
131        },
132
133        updateVars : function () {
134            var base = this;
135            if (typeof base.options.beforeUpdate === "function") {
136                base.options.beforeUpdate.apply(this, [base.$elem]);
137            }
138            base.watchVisibility();
139            base.updateItems();
140            base.calculateAll();
141            base.updatePosition();
142            base.updateControls();
143            base.eachMoveUpdate();
144            if (typeof base.options.afterUpdate === "function") {
145                base.options.afterUpdate.apply(this, [base.$elem]);
146            }
147        },
148
149        reload : function () {
150            var base = this;
151            window.setTimeout(function () {
152                base.updateVars();
153            }, 0);
154        },
155
156        watchVisibility : function () {
157            var base = this;
158
159            if (base.$elem.is(":visible") === false) {
160                base.$elem.css({opacity: 0});
161                window.clearInterval(base.autoPlayInterval);
162                window.clearInterval(base.checkVisible);
163            } else {
164                return false;
165            }
166            base.checkVisible = window.setInterval(function () {
167                if (base.$elem.is(":visible")) {
168                    base.reload();
169                    base.$elem.animate({opacity: 1}, 200);
170                    window.clearInterval(base.checkVisible);
171                }
172            }, 500);
173        },
174
175        wrapItems : function () {
176            var base = this;
177            base.$userItems.wrapAll("<div class=\"owl-wrapper\">").wrap("<div class=\"owl-item\"></div>");
178            base.$elem.find(".owl-wrapper").wrap("<div class=\"owl-wrapper-outer\">");
179            base.wrapperOuter = base.$elem.find(".owl-wrapper-outer");
180            base.$elem.css("display", "block");
181        },
182
183        baseClass : function () {
184            var base = this,
185                hasBaseClass = base.$elem.hasClass(base.options.baseClass),
186                hasThemeClass = base.$elem.hasClass(base.options.theme);
187
188            if (!hasBaseClass) {
189                base.$elem.addClass(base.options.baseClass);
190            }
191
192            if (!hasThemeClass) {
193                base.$elem.addClass(base.options.theme);
194            }
195        },
196
197        updateItems : function () {
198            var base = this, width, i;
199
200            if (base.options.responsive === false) {
201                return false;
202            }
203            if (base.options.singleItem === true) {
204                base.options.items = base.orignalItems = 1;
205                base.options.itemsCustom = false;
206                base.options.itemsDesktop = false;
207                base.options.itemsDesktopSmall = false;
208                base.options.itemsTablet = false;
209                base.options.itemsTabletSmall = false;
210                base.options.itemsMobile = false;
211                return false;
212            }
213
214            width = $(base.options.responsiveBaseWidth).width();
215
216            if (width > (base.options.itemsDesktop[0] || base.orignalItems)) {
217                base.options.items = base.orignalItems;
218            }
219            if (base.options.itemsCustom !== false) {
220                //Reorder array by screen size
221                base.options.itemsCustom.sort(function (a, b) {return a[0] - b[0]; });
222
223                for (i = 0; i < base.options.itemsCustom.length; i += 1) {
224                    if (base.options.itemsCustom[i][0] <= width) {
225                        base.options.items = base.options.itemsCustom[i][1];
226                    }
227                }
228
229            } else {
230
231                if (width <= base.options.itemsDesktop[0] && base.options.itemsDesktop !== false) {
232                    base.options.items = base.options.itemsDesktop[1];
233                }
234
235                if (width <= base.options.itemsDesktopSmall[0] && base.options.itemsDesktopSmall !== false) {
236                    base.options.items = base.options.itemsDesktopSmall[1];
237                }
238
239                if (width <= base.options.itemsTablet[0] && base.options.itemsTablet !== false) {
240                    base.options.items = base.options.itemsTablet[1];
241                }
242
243                if (width <= base.options.itemsTabletSmall[0] && base.options.itemsTabletSmall !== false) {
244                    base.options.items = base.options.itemsTabletSmall[1];
245                }
246
247                if (width <= base.options.itemsMobile[0] && base.options.itemsMobile !== false) {
248                    base.options.items = base.options.itemsMobile[1];
249                }
250            }
251
252            //if number of items is less than declared
253            if (base.options.items > base.itemsAmount && base.options.itemsScaleUp === true) {
254                base.options.items = base.itemsAmount;
255            }
256        },
257
258        response : function () {
259            var base = this,
260                smallDelay,
261                lastWindowWidth;
262
263            if (base.options.responsive !== true) {
264                return false;
265            }
266            lastWindowWidth = $(window).width();
267
268            base.resizer = function () {
269                if ($(window).width() !== lastWindowWidth) {
270                    if (base.options.autoPlay !== false) {
271                        window.clearInterval(base.autoPlayInterval);
272                    }
273                    window.clearTimeout(smallDelay);
274                    smallDelay = window.setTimeout(function () {
275                        lastWindowWidth = $(window).width();
276                        base.updateVars();
277                    }, base.options.responsiveRefreshRate);
278                }
279            };
280            $(window).resize(base.resizer);
281        },
282
283        updatePosition : function () {
284            var base = this;
285            base.jumpTo(base.currentItem);
286            if (base.options.autoPlay !== false) {
287                base.checkAp();
288            }
289        },
290
291        appendItemsSizes : function () {
292            var base = this,
293                roundPages = 0,
294                lastItem = base.itemsAmount - base.options.items;
295
296            base.$owlItems.each(function (index) {
297                var $this = $(this);
298                $this
299                    .css({"width": base.itemWidth})
300                    .data("owl-item", Number(index));
301
302                if (index % base.options.items === 0 || index === lastItem) {
303                    if (!(index > lastItem)) {
304                        roundPages += 1;
305                    }
306                }
307                $this.data("owl-roundPages", roundPages);
308            });
309        },
310
311        appendWrapperSizes : function () {
312            var base = this,
313                width = base.$owlItems.length * base.itemWidth;
314
315            base.$owlWrapper.css({
316                "width": width * 2,
317                "left": 0
318            });
319            base.appendItemsSizes();
320        },
321
322        calculateAll : function () {
323            var base = this;
324            base.calculateWidth();
325            base.appendWrapperSizes();
326            base.loops();
327            base.max();
328        },
329
330        calculateWidth : function () {
331            var base = this;
332			//alert(base.itemWidth);
333            base.itemWidth = Math.round(base.$elem.width() / base.options.items);
334        },
335
336        max : function () {
337            var base = this,
338                maximum = ((base.itemsAmount * base.itemWidth) - base.options.items * base.itemWidth) * -1;
339            if (base.options.items > base.itemsAmount) {
340                base.maximumItem = 0;
341                maximum = 0;
342                base.maximumPixels = 0;
343            } else {
344                base.maximumItem = base.itemsAmount - base.options.items;
345                base.maximumPixels = maximum;
346            }
347            return maximum;
348        },
349
350        min : function () {
351            return 0;
352        },
353
354        loops : function () {
355            var base = this,
356                prev = 0,
357                elWidth = 0,
358                i,
359                item,
360                roundPageNum;
361
362            base.positionsInArray = [0];
363            base.pagesInArray = [];
364
365            for (i = 0; i < base.itemsAmount; i += 1) {
366                elWidth += base.itemWidth;
367                base.positionsInArray.push(-elWidth);
368
369                if (base.options.scrollPerPage === true) {
370                    item = $(base.$owlItems[i]);
371                    roundPageNum = item.data("owl-roundPages");
372                    if (roundPageNum !== prev) {
373                        base.pagesInArray[prev] = base.positionsInArray[i];
374                        prev = roundPageNum;
375                    }
376                }
377            }
378        },
379
380        buildControls : function () {
381            var base = this;
382            if (base.options.navigation === true || base.options.pagination === true) {
383                base.owlControls = $("<div class=\"owl-controls\"/>").toggleClass("clickable", !base.browser.isTouch).appendTo(base.$elem);
384            }
385            if (base.options.pagination === true) {
386                base.buildPagination();
387            }
388            if (base.options.navigation === true) {
389                base.buildButtons();
390            }
391        },
392
393        buildButtons : function () {
394            var base = this,
395                buttonsWrapper = $("<div class=\"owl-buttons\"/>");
396            base.owlControls.append(buttonsWrapper);
397
398            base.buttonPrev = $("<div/>", {
399                "class" : "owl-prev",
400                "html" : base.options.navigationText[0] || ""
401            });
402
403            base.buttonNext = $("<div/>", {
404                "class" : "owl-next",
405                "html" : base.options.navigationText[1] || ""
406            });
407
408            buttonsWrapper
409                .append(base.buttonPrev)
410                .append(base.buttonNext);
411
412            buttonsWrapper.on("touchstart.owlControls mousedown.owlControls", "div[class^=\"owl\"]", function (event) {
413                event.preventDefault();
414            });
415
416            buttonsWrapper.on("touchend.owlControls mouseup.owlControls", "div[class^=\"owl\"]", function (event) {
417                event.preventDefault();
418                if ($(this).hasClass("owl-next")) {
419                    base.next();
420                } else {
421                    base.prev();
422                }
423            });
424        },
425
426        buildPagination : function () {
427            var base = this;
428
429            base.paginationWrapper = $("<div class=\"owl-pagination\"/>");
430            base.owlControls.append(base.paginationWrapper);
431
432            base.paginationWrapper.on("touchend.owlControls mouseup.owlControls", ".owl-page", function (event) {
433                event.preventDefault();
434                if (Number($(this).data("owl-page")) !== base.currentItem) {
435                    base.goTo(Number($(this).data("owl-page")), true);
436                }
437            });
438        },
439
440        updatePagination : function () {
441            var base = this,
442                counter,
443                lastPage,
444                lastItem,
445                i,
446                paginationButton,
447                paginationButtonInner;
448
449            if (base.options.pagination === false) {
450                return false;
451            }
452
453            base.paginationWrapper.html("");
454
455            counter = 0;
456            lastPage = base.itemsAmount - base.itemsAmount % base.options.items;
457
458            for (i = 0; i < base.itemsAmount; i += 1) {
459                if (i % base.options.items === 0) {
460                    counter += 1;
461                    if (lastPage === i) {
462                        lastItem = base.itemsAmount - base.options.items;
463                    }
464                    paginationButton = $("<div/>", {
465                        "class" : "owl-page"
466                    });
467                    paginationButtonInner = $("<span></span>", {
468                        "text": base.options.paginationNumbers === true ? counter : "",
469                        "class": base.options.paginationNumbers === true ? "owl-numbers" : ""
470                    });
471                    paginationButton.append(paginationButtonInner);
472
473                    paginationButton.data("owl-page", lastPage === i ? lastItem : i);
474                    paginationButton.data("owl-roundPages", counter);
475
476                    base.paginationWrapper.append(paginationButton);
477                }
478            }
479            base.checkPagination();
480        },
481        checkPagination : function () {
482            var base = this;
483            if (base.options.pagination === false) {
484                return false;
485            }
486            base.paginationWrapper.find(".owl-page").each(function () {
487                if ($(this).data("owl-roundPages") === $(base.$owlItems[base.currentItem]).data("owl-roundPages")) {
488                    base.paginationWrapper
489                        .find(".owl-page")
490                        .removeClass("active");
491                    $(this).addClass("active");
492                }
493            });
494        },
495
496        checkNavigation : function () {
497            var base = this;
498
499            if (base.options.navigation === false) {
500                return false;
501            }
502            if (base.options.rewindNav === false) {
503                if (base.currentItem === 0 && base.maximumItem === 0) {
504                    base.buttonPrev.addClass("disabled");
505                    base.buttonNext.addClass("disabled");
506                } else if (base.currentItem === 0 && base.maximumItem !== 0) {
507                    base.buttonPrev.addClass("disabled");
508                    base.buttonNext.removeClass("disabled");
509                } else if (base.currentItem === base.maximumItem) {
510                    base.buttonPrev.removeClass("disabled");
511                    base.buttonNext.addClass("disabled");
512                } else if (base.currentItem !== 0 && base.currentItem !== base.maximumItem) {
513                    base.buttonPrev.removeClass("disabled");
514                    base.buttonNext.removeClass("disabled");
515                }
516            }
517        },
518
519        updateControls : function () {
520            var base = this;
521            base.updatePagination();
522            base.checkNavigation();
523            if (base.owlControls) {
524                if (base.options.items >= base.itemsAmount) {
525                    base.owlControls.hide();
526                } else {
527                    base.owlControls.show();
528                }
529            }
530        },
531
532        destroyControls : function () {
533            var base = this;
534            if (base.owlControls) {
535                base.owlControls.remove();
536            }
537        },
538
539        next : function (speed) {
540            var base = this;
541
542            if (base.isTransition) {
543                return false;
544            }
545
546            base.currentItem += base.options.scrollPerPage === true ? base.options.items : 1;
547            if (base.currentItem > base.maximumItem + (base.options.scrollPerPage === true ? (base.options.items - 1) : 0)) {
548                if (base.options.rewindNav === true) {
549                    base.currentItem = 0;
550                    speed = "rewind";
551                } else {
552                    base.currentItem = base.maximumItem;
553                    return false;
554                }
555            }
556            base.goTo(base.currentItem, speed);
557        },
558
559        prev : function (speed) {
560            var base = this;
561
562            if (base.isTransition) {
563                return false;
564            }
565
566            if (base.options.scrollPerPage === true && base.currentItem > 0 && base.currentItem < base.options.items) {
567                base.currentItem = 0;
568            } else {
569                base.currentItem -= base.options.scrollPerPage === true ? base.options.items : 1;
570            }
571            if (base.currentItem < 0) {
572                if (base.options.rewindNav === true) {
573                    base.currentItem = base.maximumItem;
574                    speed = "rewind";
575                } else {
576                    base.currentItem = 0;
577                    return false;
578                }
579            }
580            base.goTo(base.currentItem, speed);
581        },
582
583        goTo : function (position, speed, drag) {
584            var base = this,
585                goToPixel;
586
587            if (base.isTransition) {
588                return false;
589            }
590            if (typeof base.options.beforeMove === "function") {
591                base.options.beforeMove.apply(this, [base.$elem]);
592            }
593            if (position >= base.maximumItem) {
594                position = base.maximumItem;
595            } else if (position <= 0) {
596                position = 0;
597            }
598
599            base.currentItem = base.owl.currentItem = position;
600            if (base.options.transitionStyle !== false && drag !== "drag" && base.options.items === 1 && base.browser.support3d === true) {
601                base.swapSpeed(0);
602                if (base.browser.support3d === true) {
603                    base.transition3d(base.positionsInArray[position]);
604                } else {
605                    base.css2slide(base.positionsInArray[position], 1);
606                }
607                base.afterGo();
608                base.singleItemTransition();
609                return false;
610            }
611            goToPixel = base.positionsInArray[position];
612
613            if (base.browser.support3d === true) {
614                base.isCss3Finish = false;
615
616                if (speed === true) {
617                    base.swapSpeed("paginationSpeed");
618                    window.setTimeout(function () {
619                        base.isCss3Finish = true;
620                    }, base.options.paginationSpeed);
621
622                } else if (speed === "rewind") {
623                    base.swapSpeed(base.options.rewindSpeed);
624                    window.setTimeout(function () {
625                        base.isCss3Finish = true;
626                    }, base.options.rewindSpeed);
627
628                } else {
629                    base.swapSpeed("slideSpeed");
630                    window.setTimeout(function () {
631                        base.isCss3Finish = true;
632                    }, base.options.slideSpeed);
633                }
634                base.transition3d(goToPixel);
635            } else {
636                if (speed === true) {
637                    base.css2slide(goToPixel, base.options.paginationSpeed);
638                } else if (speed === "rewind") {
639                    base.css2slide(goToPixel, base.options.rewindSpeed);
640                } else {
641                    base.css2slide(goToPixel, base.options.slideSpeed);
642                }
643            }
644            base.afterGo();
645        },
646
647        jumpTo : function (position) {
648            var base = this;
649            if (typeof base.options.beforeMove === "function") {
650                base.options.beforeMove.apply(this, [base.$elem]);
651            }
652            if (position >= base.maximumItem || position === -1) {
653                position = base.maximumItem;
654            } else if (position <= 0) {
655                position = 0;
656            }
657            base.swapSpeed(0);
658            if (base.browser.support3d === true) {
659                base.transition3d(base.positionsInArray[position]);
660            } else {
661                base.css2slide(base.positionsInArray[position], 1);
662            }
663            base.currentItem = base.owl.currentItem = position;
664            base.afterGo();
665        },
666
667        afterGo : function () {
668            var base = this;
669
670            base.prevArr.push(base.currentItem);
671            base.prevItem = base.owl.prevItem = base.prevArr[base.prevArr.length - 2];
672            base.prevArr.shift(0);
673
674            if (base.prevItem !== base.currentItem) {
675                base.checkPagination();
676                base.checkNavigation();
677                base.eachMoveUpdate();
678
679                if (base.options.autoPlay !== false) {
680                    base.checkAp();
681                }
682            }
683            if (typeof base.options.afterMove === "function" && base.prevItem !== base.currentItem) {
684                base.options.afterMove.apply(this, [base.$elem]);
685            }
686        },
687
688        stop : function () {
689            var base = this;
690            base.apStatus = "stop";
691            window.clearInterval(base.autoPlayInterval);
692        },
693
694        checkAp : function () {
695            var base = this;
696            if (base.apStatus !== "stop") {
697                base.play();
698            }
699        },
700
701        play : function () {
702            var base = this;
703            base.apStatus = "play";
704            if (base.options.autoPlay === false) {
705                return false;
706            }
707            window.clearInterval(base.autoPlayInterval);
708            base.autoPlayInterval = window.setInterval(function () {
709                base.next(true);
710            }, base.options.autoPlay);
711        },
712
713        swapSpeed : function (action) {
714            var base = this;
715            if (action === "slideSpeed") {
716                base.$owlWrapper.css(base.addCssSpeed(base.options.slideSpeed));
717            } else if (action === "paginationSpeed") {
718                base.$owlWrapper.css(base.addCssSpeed(base.options.paginationSpeed));
719            } else if (typeof action !== "string") {
720                base.$owlWrapper.css(base.addCssSpeed(action));
721            }
722        },
723
724        addCssSpeed : function (speed) {
725            return {
726                "-webkit-transition": "all " + speed + "ms ease",
727                "-moz-transition": "all " + speed + "ms ease",
728                "-o-transition": "all " + speed + "ms ease",
729                "transition": "all " + speed + "ms ease"
730            };
731        },
732
733        removeTransition : function () {
734            return {
735                "-webkit-transition": "",
736                "-moz-transition": "",
737                "-o-transition": "",
738                "transition": ""
739            };
740        },
741
742        doTranslate : function (pixels) {
743            return {
744                "-webkit-transform": "translate3d(" + pixels + "px, 0px, 0px)",
745                "-moz-transform": "translate3d(" + pixels + "px, 0px, 0px)",
746                "-o-transform": "translate3d(" + pixels + "px, 0px, 0px)",
747                "-ms-transform": "translate3d(" + pixels + "px, 0px, 0px)",
748                "transform": "translate3d(" + pixels + "px, 0px,0px)"
749            };
750        },
751
752        transition3d : function (value) {
753            var base = this;
754            base.$owlWrapper.css(base.doTranslate(value));
755        },
756
757        css2move : function (value) {
758            var base = this;
759            base.$owlWrapper.css({"left" : value});
760        },
761
762        css2slide : function (value, speed) {
763            var base = this;
764
765            base.isCssFinish = false;
766            base.$owlWrapper.stop(true, true).animate({
767                "left" : value
768            }, {
769                duration : speed || base.options.slideSpeed,
770                complete : function () {
771                    base.isCssFinish = true;
772                }
773            });
774        },
775
776        checkBrowser : function () {
777            var base = this,
778                translate3D = "translate3d(0px, 0px, 0px)",
779                tempElem = document.createElement("div"),
780                regex,
781                asSupport,
782                support3d,
783                isTouch;
784
785            tempElem.style.cssText = "  -moz-transform:" + translate3D +
786                                  "; -ms-transform:"     + translate3D +
787                                  "; -o-transform:"      + translate3D +
788                                  "; -webkit-transform:" + translate3D +
789                                  "; transform:"         + translate3D;
790            regex = /translate3d\(0px, 0px, 0px\)/g;
791            asSupport = tempElem.style.cssText.match(regex);
792            support3d = (asSupport !== null && asSupport.length === 1);
793
794            isTouch = "ontouchstart" in window || window.navigator.msMaxTouchPoints;
795
796            base.browser = {
797                "support3d" : support3d,
798                "isTouch" : isTouch
799            };
800        },
801
802        moveEvents : function () {
803            var base = this;
804            if (base.options.mouseDrag !== false || base.options.touchDrag !== false) {
805                base.gestures();
806                base.disabledEvents();
807            }
808        },
809
810        eventTypes : function () {
811            var base = this,
812                types = ["s", "e", "x"];
813
814            base.ev_types = {};
815
816            if (base.options.mouseDrag === true && base.options.touchDrag === true) {
817                types = [
818                    "touchstart.owl mousedown.owl",
819                    "touchmove.owl mousemove.owl",
820                    "touchend.owl touchcancel.owl mouseup.owl"
821                ];
822            } else if (base.options.mouseDrag === false && base.options.touchDrag === true) {
823                types = [
824                    "touchstart.owl",
825                    "touchmove.owl",
826                    "touchend.owl touchcancel.owl"
827                ];
828            } else if (base.options.mouseDrag === true && base.options.touchDrag === false) {
829                types = [
830                    "mousedown.owl",
831                    "mousemove.owl",
832                    "mouseup.owl"
833                ];
834            }
835
836            base.ev_types.start = types[0];
837            base.ev_types.move = types[1];
838            base.ev_types.end = types[2];
839        },
840
841        disabledEvents :  function () {
842            var base = this;
843            base.$elem.on("dragstart.owl", function (event) { event.preventDefault(); });
844            base.$elem.on("mousedown.disableTextSelect", function (e) {
845                return $(e.target).is('input, textarea, select, option');
846            });
847        },
848
849        gestures : function () {
850            /*jslint unparam: true*/
851            var base = this,
852                locals = {
853                    offsetX : 0,
854                    offsetY : 0,
855                    baseElWidth : 0,
856                    relativePos : 0,
857                    position: null,
858                    minSwipe : null,
859                    maxSwipe: null,
860                    sliding : null,
861                    dargging: null,
862                    targetElement : null
863                };
864
865            base.isCssFinish = true;
866
867            function getTouches(event) {
868                if (event.touches !== undefined) {
869                    return {
870                        x : event.touches[0].pageX,
871                        y : event.touches[0].pageY
872                    };
873                }
874
875                if (event.touches === undefined) {
876                    if (event.pageX !== undefined) {
877                        return {
878                            x : event.pageX,
879                            y : event.pageY
880                        };
881                    }
882                    if (event.pageX === undefined) {
883                        return {
884                            x : event.clientX,
885                            y : event.clientY
886                        };
887                    }
888                }
889            }
890
891            function swapEvents(type) {
892                if (type === "on") {
893                    $(document).on(base.ev_types.move, dragMove);
894                    $(document).on(base.ev_types.end, dragEnd);
895                } else if (type === "off") {
896                    $(document).off(base.ev_types.move);
897                    $(document).off(base.ev_types.end);
898                }
899            }
900
901            function dragStart(event) {
902                var ev = event.originalEvent || event || window.event,
903                    position;
904
905                if (ev.which === 3) {
906                    return false;
907                }
908                if (base.itemsAmount <= base.options.items) {
909                    return;
910                }
911                if (base.isCssFinish === false && !base.options.dragBeforeAnimFinish) {
912                    return false;
913                }
914                if (base.isCss3Finish === false && !base.options.dragBeforeAnimFinish) {
915                    return false;
916                }
917
918                if (base.options.autoPlay !== false) {
919                    window.clearInterval(base.autoPlayInterval);
920                }
921
922                if (base.browser.isTouch !== true && !base.$owlWrapper.hasClass("grabbing")) {
923                    base.$owlWrapper.addClass("grabbing");
924                }
925
926                base.newPosX = 0;
927                base.newRelativeX = 0;
928
929                $(this).css(base.removeTransition());
930
931                position = $(this).position();
932                locals.relativePos = position.left;
933
934                locals.offsetX = getTouches(ev).x - position.left;
935                locals.offsetY = getTouches(ev).y - position.top;
936
937                swapEvents("on");
938
939                locals.sliding = false;
940                locals.targetElement = ev.target || ev.srcElement;
941            }
942
943            function dragMove(event) {
944                var ev = event.originalEvent || event || window.event,
945                    minSwipe,
946                    maxSwipe;
947
948                base.newPosX = getTouches(ev).x - locals.offsetX;
949                base.newPosY = getTouches(ev).y - locals.offsetY;
950                base.newRelativeX = base.newPosX - locals.relativePos;
951
952                if (typeof base.options.startDragging === "function" && locals.dragging !== true && base.newRelativeX !== 0) {
953                    locals.dragging = true;
954                    base.options.startDragging.apply(base, [base.$elem]);
955                }
956
957                if ((base.newRelativeX > 8 || base.newRelativeX < -8) && (base.browser.isTouch === true)) {
958                    if (ev.preventDefault !== undefined) {
959                        ev.preventDefault();
960                    } else {
961                        ev.returnValue = false;
962                    }
963                    locals.sliding = true;
964                }
965
966                if ((base.newPosY > 10 || base.newPosY < -10) && locals.sliding === false) {
967                    $(document).off("touchmove.owl");
968                }
969
970                minSwipe = function () {
971                    return base.newRelativeX / 5;
972                };
973
974                maxSwipe = function () {
975                    return base.maximumPixels + base.newRelativeX / 5;
976                };
977
978                base.newPosX = Math.max(Math.min(base.newPosX, minSwipe()), maxSwipe());
979                if (base.browser.support3d === true) {
980                    base.transition3d(base.newPosX);
981                } else {
982                    base.css2move(base.newPosX);
983                }
984            }
985
986            function dragEnd(event) {
987                var ev = event.originalEvent || event || window.event,
988                    newPosition,
989                    handlers,
990                    owlStopEvent;
991
992                ev.target = ev.target || ev.srcElement;
993
994                locals.dragging = false;
995
996                if (base.browser.isTouch !== true) {
997                    base.$owlWrapper.removeClass("grabbing");
998                }
999
1000                if (base.newRelativeX < 0) {
1001                    base.dragDirection = base.owl.dragDirection = "left";
1002                } else {
1003                    base.dragDirection = base.owl.dragDirection = "right";
1004                }
1005
1006                if (base.newRelativeX !== 0) {
1007                    newPosition = base.getNewPosition();
1008                    base.goTo(newPosition, false, "drag");
1009                    if (locals.targetElement === ev.target && base.browser.isTouch !== true) {
1010                        $(ev.target).on("click.disable", function (ev) {
1011                            ev.stopImmediatePropagation();
1012                            ev.stopPropagation();
1013                            ev.preventDefault();
1014                            $(ev.target).off("click.disable");
1015                        });
1016                        handlers = $._data(ev.target, "events").click;
1017                        owlStopEvent = handlers.pop();
1018                        handlers.splice(0, 0, owlStopEvent);
1019                    }
1020                }
1021                swapEvents("off");
1022            }
1023            base.$elem.on(base.ev_types.start, ".owl-wrapper", dragStart);
1024        },
1025
1026        getNewPosition : function () {
1027            var base = this,
1028                newPosition = base.closestItem();
1029
1030            if (newPosition > base.maximumItem) {
1031                base.currentItem = base.maximumItem;
1032                newPosition  = base.maximumItem;
1033            } else if (base.newPosX >= 0) {
1034                newPosition = 0;
1035                base.currentItem = 0;
1036            }
1037            return newPosition;
1038        },
1039        closestItem : function () {
1040            var base = this,
1041                array = base.options.scrollPerPage === true ? base.pagesInArray : base.positionsInArray,
1042                goal = base.newPosX,
1043                closest = null;
1044
1045            $.each(array, function (i, v) {
1046                if (goal - (base.itemWidth / 20) > array[i + 1] && goal - (base.itemWidth / 20) < v && base.moveDirection() === "left") {
1047                    closest = v;
1048                    if (base.options.scrollPerPage === true) {
1049                        base.currentItem = $.inArray(closest, base.positionsInArray);
1050                    } else {
1051                        base.currentItem = i;
1052                    }
1053                } else if (goal + (base.itemWidth / 20) < v && goal + (base.itemWidth / 20) > (array[i + 1] || array[i] - base.itemWidth) && base.moveDirection() === "right") {
1054                    if (base.options.scrollPerPage === true) {
1055                        closest = array[i + 1] || array[array.length - 1];
1056                        base.currentItem = $.inArray(closest, base.positionsInArray);
1057                    } else {
1058                        closest = array[i + 1];
1059                        base.currentItem = i + 1;
1060                    }
1061                }
1062            });
1063            return base.currentItem;
1064        },
1065
1066        moveDirection : function () {
1067            var base = this,
1068                direction;
1069            if (base.newRelativeX < 0) {
1070                direction = "right";
1071                base.playDirection = "next";
1072            } else {
1073                direction = "left";
1074                base.playDirection = "prev";
1075            }
1076            return direction;
1077        },
1078
1079        customEvents : function () {
1080            /*jslint unparam: true*/
1081            var base = this;
1082            base.$elem.on("owl.next", function () {
1083                base.next();
1084            });
1085            base.$elem.on("owl.prev", function () {
1086                base.prev();
1087            });
1088            base.$elem.on("owl.play", function (event, speed) {
1089                base.options.autoPlay = speed;
1090                base.play();
1091                base.hoverStatus = "play";
1092            });
1093            base.$elem.on("owl.stop", function () {
1094                base.stop();
1095                base.hoverStatus = "stop";
1096            });
1097            base.$elem.on("owl.goTo", function (event, item) {
1098                base.goTo(item);
1099            });
1100            base.$elem.on("owl.jumpTo", function (event, item) {
1101                base.jumpTo(item);
1102            });
1103        },
1104
1105        stopOnHover : function () {
1106            var base = this;
1107            if (base.options.stopOnHover === true && base.browser.isTouch !== true && base.options.autoPlay !== false) {
1108                base.$elem.on("mouseover", function () {
1109                    base.stop();
1110                });
1111                base.$elem.on("mouseout", function () {
1112                    if (base.hoverStatus !== "stop") {
1113                        base.play();
1114                    }
1115                });
1116            }
1117        },
1118
1119        lazyLoad : function () {
1120            var base = this,
1121                i,
1122                $item,
1123                itemNumber,
1124                $lazyImg,
1125                follow;
1126
1127            if (base.options.lazyLoad === false) {
1128                return false;
1129            }
1130            for (i = 0; i < base.itemsAmount; i += 1) {
1131                $item = $(base.$owlItems[i]);
1132
1133                if ($item.data("owl-loaded") === "loaded") {
1134                    continue;
1135                }
1136
1137                itemNumber = $item.data("owl-item");
1138                $lazyImg = $item.find(".lazyOwl");
1139
1140                if (typeof $lazyImg.data("src") !== "string") {
1141                    $item.data("owl-loaded", "loaded");
1142                    continue;
1143                }
1144                if ($item.data("owl-loaded") === undefined) {
1145                    $lazyImg.hide();
1146                    $item.addClass("loading").data("owl-loaded", "checked");
1147                }
1148                if (base.options.lazyFollow === true) {
1149                    follow = itemNumber >= base.currentItem;
1150                } else {
1151                    follow = true;
1152                }
1153                if (follow && itemNumber < base.currentItem + base.options.items && $lazyImg.length) {
1154                    base.lazyPreload($item, $lazyImg);
1155                }
1156            }
1157        },
1158
1159        lazyPreload : function ($item, $lazyImg) {
1160            var base = this,
1161                iterations = 0,
1162                isBackgroundImg;
1163
1164            if ($lazyImg.prop("tagName") === "DIV") {
1165                $lazyImg.css("background-image", "url(" + $lazyImg.data("src") + ")");
1166                isBackgroundImg = true;
1167            } else {
1168                $lazyImg[0].src = $lazyImg.data("src");
1169            }
1170
1171            function showImage() {
1172                $item.data("owl-loaded", "loaded").removeClass("loading");
1173                $lazyImg.removeAttr("data-src");
1174                if (base.options.lazyEffect === "fade") {
1175                    $lazyImg.fadeIn(400);
1176                } else {
1177                    $lazyImg.show();
1178                }
1179                if (typeof base.options.afterLazyLoad === "function") {
1180                    base.options.afterLazyLoad.apply(this, [base.$elem]);
1181                }
1182            }
1183
1184            function checkLazyImage() {
1185                iterations += 1;
1186                if (base.completeImg($lazyImg.get(0)) || isBackgroundImg === true) {
1187                    showImage();
1188                } else if (iterations <= 100) {//if image loads in less than 10 seconds 
1189                    window.setTimeout(checkLazyImage, 100);
1190                } else {
1191                    showImage();
1192                }
1193            }
1194
1195            checkLazyImage();
1196        },
1197
1198        autoHeight : function () {
1199            var base = this,
1200                $currentimg = $(base.$owlItems[base.currentItem]).find("img"),
1201                iterations;
1202
1203            function addHeight() {
1204                var $currentItem = $(base.$owlItems[base.currentItem]).height();
1205                base.wrapperOuter.css("height", $currentItem + "px");
1206                if (!base.wrapperOuter.hasClass("autoHeight")) {
1207                    window.setTimeout(function () {
1208                        base.wrapperOuter.addClass("autoHeight");
1209                    }, 0);
1210                }
1211            }
1212
1213            function checkImage() {
1214                iterations += 1;
1215                if (base.completeImg($currentimg.get(0))) {
1216                    addHeight();
1217                } else if (iterations <= 100) { //if image loads in less than 10 seconds 
1218                    window.setTimeout(checkImage, 100);
1219                } else {
1220                    base.wrapperOuter.css("height", ""); //Else remove height attribute
1221                }
1222            }
1223
1224            if ($currentimg.get(0) !== undefined) {
1225                iterations = 0;
1226                checkImage();
1227            } else {
1228                addHeight();
1229            }
1230        },
1231
1232        completeImg : function (img) {
1233            var naturalWidthType;
1234
1235            if (!img.complete) {
1236                return false;
1237            }
1238            naturalWidthType = typeof img.naturalWidth;
1239            if (naturalWidthType !== "undefined" && img.naturalWidth === 0) {
1240                return false;
1241            }
1242            return true;
1243        },
1244
1245        onVisibleItems : function () {
1246            var base = this,
1247                i;
1248
1249            if (base.options.addClassActive === true) {
1250                base.$owlItems.removeClass("active");
1251            }
1252            base.visibleItems = [];
1253            for (i = base.currentItem; i < base.currentItem + base.options.items; i += 1) {
1254                base.visibleItems.push(i);
1255
1256                if (base.options.addClassActive === true) {
1257                    $(base.$owlItems[i]).addClass("active");
1258                }
1259            }
1260            base.owl.visibleItems = base.visibleItems;
1261        },
1262
1263        transitionTypes : function (className) {
1264            var base = this;
1265            //Currently available: "fade", "backSlide", "goDown", "fadeUp"
1266            base.outClass = "owl-" + className + "-out";
1267            base.inClass = "owl-" + className + "-in";
1268        },
1269
1270        singleItemTransition : function () {
1271            var base = this,
1272                outClass = base.outClass,
1273                inClass = base.inClass,
1274                $currentItem = base.$owlItems.eq(base.currentItem),
1275                $prevItem = base.$owlItems.eq(base.prevItem),
1276                prevPos = Math.abs(base.positionsInArray[base.currentItem]) + base.positionsInArray[base.prevItem],
1277                origin = Math.abs(base.positionsInArray[base.currentItem]) + base.itemWidth / 2,
1278                animEnd = 'webkitAnimationEnd oAnimationEnd MSAnimationEnd animationend';
1279
1280            base.isTransition = true;
1281
1282            base.$owlWrapper
1283                .addClass('owl-origin')
1284                .css({
1285                    "-webkit-transform-origin" : origin + "px",
1286                    "-moz-perspective-origin" : origin + "px",
1287                    "perspective-origin" : origin + "px"
1288                });
1289            function transStyles(prevPos) {
1290                return {
1291                    "position" : "relative",
1292                    "left" : prevPos + "px"
1293                };
1294            }
1295
1296            $prevItem
1297                .css(transStyles(prevPos, 10))
1298                .addClass(outClass)
1299                .on(animEnd, function () {
1300                    base.endPrev = true;
1301                    $prevItem.off(animEnd);
1302                    base.clearTransStyle($prevItem, outClass);
1303                });
1304
1305            $currentItem
1306                .addClass(inClass)
1307                .on(animEnd, function () {
1308                    base.endCurrent = true;
1309                    $currentItem.off(animEnd);
1310                    base.clearTransStyle($currentItem, inClass);
1311                });
1312        },
1313
1314        clearTransStyle : function (item, classToRemove) {
1315            var base = this;
1316            item.css({
1317                "position" : "",
1318                "left" : ""
1319            }).removeClass(classToRemove);
1320
1321            if (base.endPrev && base.endCurrent) {
1322                base.$owlWrapper.removeClass('owl-origin');
1323                base.endPrev = false;
1324                base.endCurrent = false;
1325                base.isTransition = false;
1326            }
1327        },
1328
1329        owlStatus : function () {
1330            var base = this;
1331            base.owl = {
1332                "userOptions"   : base.userOptions,
1333                "baseElement"   : base.$elem,
1334                "userItems"     : base.$userItems,
1335                "owlItems"      : base.$owlItems,
1336                "currentItem"   : base.currentItem,
1337                "prevItem"      : base.prevItem,
1338                "visibleItems"  : base.visibleItems,
1339                "isTouch"       : base.browser.isTouch,
1340                "browser"       : base.browser,
1341                "dragDirection" : base.dragDirection
1342            };
1343        },
1344
1345        clearEvents : function () {
1346            var base = this;
1347            base.$elem.off(".owl owl mousedown.disableTextSelect");
1348            $(document).off(".owl owl");
1349            $(window).off("resize", base.resizer);
1350        },
1351
1352        unWrap : function () {
1353            var base = this;
1354            if (base.$elem.children().length !== 0) {
1355                base.$owlWrapper.unwrap();
1356                base.$userItems.unwrap().unwrap();
1357                if (base.owlControls) {
1358                    base.owlControls.remove();
1359                }
1360            }
1361            base.clearEvents();
1362            base.$elem
1363                .attr("style", base.$elem.data("owl-originalStyles") || "")
1364                .attr("class", base.$elem.data("owl-originalClasses"));
1365        },
1366
1367        destroy : function () {
1368            var base = this;
1369            base.stop();
1370            window.clearInterval(base.checkVisible);
1371            base.unWrap();
1372            base.$elem.removeData();
1373        },
1374
1375        reinit : function (newOptions) {
1376            var base = this,
1377                options = $.extend({}, base.userOptions, newOptions);
1378            base.unWrap();
1379            base.init(options, base.$elem);
1380        },
1381
1382        addItem : function (htmlString, targetPosition) {
1383            var base = this,
1384                position;
1385
1386            if (!htmlString) {return false; }
1387
1388            if (base.$elem.children().length === 0) {
1389                base.$elem.append(htmlString);
1390                base.setVars();
1391                return false;
1392            }
1393            base.unWrap();
1394            if (targetPosition === undefined || targetPosition === -1) {
1395                position = -1;
1396            } else {
1397                position = targetPosition;
1398            }
1399            if (position >= base.$userItems.length || position === -1) {
1400                base.$userItems.eq(-1).after(htmlString);
1401            } else {
1402                base.$userItems.eq(position).before(htmlString);
1403            }
1404
1405            base.setVars();
1406        },
1407
1408        removeItem : function (targetPosition) {
1409            var base = this,
1410                position;
1411
1412            if (base.$elem.children().length === 0) {
1413                return false;
1414            }
1415            if (targetPosition === undefined || targetPosition === -1) {
1416                position = -1;
1417            } else {
1418                position = targetPosition;
1419            }
1420
1421            base.unWrap();
1422            base.$userItems.eq(position).remove();
1423            base.setVars();
1424        }
1425
1426    };
1427
1428    $.fn.owlCarousel = function (options) {
1429        return this.each(function () {
1430            if ($(this).data("owl-init") === true) {
1431                return false;
1432            }
1433            $(this).data("owl-init", true);
1434            var carousel = Object.create(Carousel);
1435            carousel.init(options, this);
1436            $.data(this, "owlCarousel", carousel);
1437        });
1438    };
1439
1440    $.fn.owlCarousel.options = {
1441
1442        items : 5,
1443        itemsCustom : false,
1444        itemsDesktop : [1199, 4],
1445        itemsDesktopSmall : [979, 3],
1446        itemsTablet : [768, 2],
1447        itemsTabletSmall : false,
1448        itemsMobile : [479, 1],
1449        singleItem : false,
1450        itemsScaleUp : false,
1451
1452        slideSpeed : 200,
1453        paginationSpeed : 800,
1454        rewindSpeed : 1000,
1455
1456        autoPlay : false,
1457        stopOnHover : false,
1458
1459        navigation : false,
1460        navigationText : ["prev", "next"],
1461        rewindNav : true,
1462        scrollPerPage : false,
1463
1464        pagination : true,
1465        paginationNumbers : false,
1466
1467        responsive : true,
1468        responsiveRefreshRate : 200,
1469        responsiveBaseWidth : window,
1470
1471        baseClass : "owl-carousel",
1472        theme : "owl-theme",
1473
1474        lazyLoad : false,
1475        lazyFollow : true,
1476        lazyEffect : "fade",
1477
1478        autoHeight : false,
1479
1480        jsonPath : false,
1481        jsonSuccess : false,
1482
1483        dragBeforeAnimFinish : true,
1484        mouseDrag : true,
1485        touchDrag : true,
1486
1487        addClassActive : false,
1488        transitionStyle : false,
1489
1490        beforeUpdate : false,
1491        afterUpdate : false,
1492        beforeInit : false,
1493        afterInit : false,
1494        beforeMove : false,
1495        afterMove : false,
1496        afterAction : false,
1497        startDragging : false,
1498        afterLazyLoad: false
1499    };
1500}(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.