PageSourceSearch

https://www.sep-ensemble.fr/resources/js/page/261ba8d37f2a4df99e6d9be48bb697f1.js

js sep-ensemble.fr collected 2026-10-02 18:42:51 UTC 69,156 bytes, 1,978 lines download raw bytes

1
2/* -------------------
3BEGIN  
4Sitecore Resource: a5c6481e-bb43-4c84-a471-9a7238ba4c62
5   -------------------*/
6var hashSelectedTagsArray = {};
7var blAllowMultiple = false;
8
9$(document).ready(function () {
10    
11    //Added for tablet displayParThematique
12    
13    if($(window).width()< 1024 && $(window).width() > 767)
14
15{
16 $(".pagination").attr("style","display:inline-block");
17
18
19}
20//Added for tablet display
21
22    $("body#chroniques-charlotte div.ParProfil.visible-xs div.custom-dd-values").attr("style", "display:none");
23    $("body#chroniques-charlotte ul.ParProfil.hidden-xs li:nth-child(1) a").addClass("active");
24    $("body#chroniques-charlotte div.ParProfil.visible-xs div.custom-dd-values div:nth-child(1) a").addClass("active");
25    if($(".custom-sel-val").is(":visible")){
26		$(".Slider.TagTypeDivDisplay").toggle();
27	}
28	//$(".score-center")[0].firstElementChild.firstElementChild.remove();
29	$("ul.ParProfil > li:nth-child(1) > a:nth-child(1)").addClass("active");
30    $("ul.ParThematique.hidden-xs li:nth-child(1) a").addClass("active");
31    var owl = $("#owl-demo");
32    var itemsCount = $('#itemsPerSlide').attr('value');
33
34    owl.owlCarousel({
35        rewindNav: false,
36        items: parseInt(itemsCount),
37        scrollPerPage: true,
38        pagination: true,
39        afterAction: function () {
40            if (this.itemsAmount > this.visibleItems.length) {
41                $('.news-next').show();
42                $('.news-prev').show();
43
44                $('.news-next').removeClass('disabled');
45                $('.news-prev').removeClass('disabled');
46
47
48                $('.owl-prev').removeClass('disabled');
49                $('.owl-next').removeClass('disabled');
50
51
52                if (this.currentItem === 0) {
53                    $('.news-prev').addClass('disabled');
54                    $('.owl-prev').addClass('disabled');
55                }
56                if (this.currentItem == this.maximumItem) {
57                    $('.news-next').addClass('disabled');
58                    $('.owl-next').addClass('disabled');
59                }
60
61            } else {
62                $('.news-next').hide();
63                $('.news-prev').hide();
64            }
65        }
66    });
67
68    // Custom Navigation Events
69    $(".news-next").click(function () {
70        $('#itemsPerSlide').attr("navflag", "next");
71        owl.trigger('owl.next');
72    });
73    $(".news-prev").click(function () {
74        $('#itemsPerSlide').attr("navflag", "prev");
75        owl.trigger('owl.prev');
76    });
77
78    //adding code for tag changes
79    if ($('#hdnTagsRequiredFlag') !== undefined && $('#hdnTagsRequiredFlag').val()) {
80        ShowItemTagName();
81    }
82    
83    $('.listboxcontent-container > div.newsitemsdiv').each(function () {
84	if (i <= 8){
85                pageno = 1;
86				$(this).attr("data-PageNo", pageno);
87				}
88            else{
89                pageno = Math.ceil(i / 8);
90				$(this).attr("data-PageNo", pageno);
91				}
92				
93				i++;
94	});
95	
96	$('.listboxcontent-container > div.newsitemsdiv').hide();
97    $('.listboxcontent-container > div.newsitemsdiv').each(function () {
98        if ($(this).attr('data-PageNo') == "1" && $(this).find("img").hasClass("news-image")) {
99            $(this).show();
100             $(this).css('display', "inline-block");
101            $(this).find("img").attr('Src',$(this).find("img").attr('data-src'));
102        }
103        else if(!$(this).attr('data-PageNo') == "1" ){
104            $(this).hide();
105        }
106
107        
108    });
109
110  /* if ($('.listboxcontent-container') !== undefined && $('.listboxcontent-container-hidden') !== undefined) {
111       // $('.listboxcontent-container').html('');
112        var i = 1;
113        var pageno = 0;
114        var pager = 0;
115        var paginghtml = "<ul id='custompagerlist' class='pagination'>";
116        $('.listboxcontent-container-hidden > .newsitemsdiv').each(function () {
117            var obj = $(this);
118
119            if (i <= $('#listboxPageSize').val())
120                pageno = 1;
121            else
122                pageno = Math.ceil(i / $('#listboxPageSize').val());
123
124            obj.attr("data-PageNo", pageno);
125            obj.appendTo('.listboxcontent-container');
126            i++;
127            if ($('#pagination').val() == "True" && pager !== pageno) {
128                pager = pageno;
129                if (pageno === 1) {
130                    paginghtml = paginghtml + '<li class="active"><a class="pagegoto" onclick=ManangePaging("' + pageno + '") title="' + pageno + '">' + pageno + '</a></li>';
131                }
132                else {
133                    paginghtml = paginghtml + '<li><a class="pagegoto" onclick=ManangePaging("' + pageno + '") title="' + pageno + '">' + pageno + '</a></li>';
134                }
135            }
136        });
137
138        if ($('#pagination').val() === "True") {
139            $('#custompager').html(paginghtml + '</ul>');
140            ManangePaging(1);
141        }
142    }*/
143
144    $('.tagitemdisplay').click(function (e) {
145        e.preventDefault();
146        $("#charollete-old-articles").show();
147        var classname = "." + $(this).attr('data-tagtype');
148        var classlen = $('.DropDownName').length;
149        var filterName = $(this).text();
150        if (classlen > 0) {
151            $(classname).hide();
152        }
153        if(filterName == "Tous"){
154            $('.ParThematique > li').each(function () {
155            var title = $(this).find("a");
156            title.removeClass('active')    ;
157            });
158            $(this).addClass('active');
159           // $('.listboxcontent-container > div.newsitemsdiv').siblings().show();
160            /* for broken image issue 
161            $('.listboxcontent-container > div.newsitemsdiv').each(function () {
162                   $(this).find("img").attr('Src',$(this).find("img").attr('data-src'));
163            }); */
164            var i=0;
165             $('.listboxcontent-container > div.newsitemsdiv').attr("data-pageno","");
166                $('.listboxcontent-container > div.newsitemsdiv').each(function () {
167            	if (i <= 8){
168                      pageno = 1;
169			        	$(this).attr("data-pageno", pageno);
170			        	 $(this).show();
171			        	  $(this).css('display', "inline-block");
172                        $(this).find("img").attr('Src',$(this).find("img").attr('data-src'));
173				}
174                else{
175                pageno = Math.ceil(i / 8);
176				$(this).attr("data-pageno", pageno);
177				}
178			    	i++;
179	            });
180        }
181        else{
182        $('.listboxcontent-container > div.newsitemsdiv').siblings().hide();
183        }
184
185        if ($('#hdnTagSpecificBannerRequiredFlag').val() == "True") {
186            if ($(this).attr('data-bannerimagesrc') != "#") {
187                $('.tagbannerimage').attr('src', $(this).attr('data-bannerimagesrc'));
188
189                if ($(this).attr('data-bannerlinkurl') != "#") {
190                    $('.tagbannerlink').attr('href', $(this).attr('data-bannerlinkurl'));
191                }
192                else {
193                    $('.tagbannerlink').removeAttr('href');
194                }
195
196                if ($(this).attr('data-bannerdescription') != "#") {
197                    $('.tagbannerdescription').empty();
198                    $('.tagbannerdescription').html($(this).attr('data-bannerdescription'));
199                }
200                else {
201                    $('.tagbannerdescription').empty();
202                }
203                $('#LatestTag').val($(this).text());
204            }
205        }
206
207        if (!blAllowMultiple && filterName != "Tous") {
208            hashSelectedTagsArray[$(this).attr('data-tagtype')] = $(this).attr('data-value');
209            FilterSingleTagsPerTagType();
210           //paginateItems();
211        }
212        var isdropdownfilter = $("span.DropDownName").length;
213        if (isdropdownfilter > 0) {
214            var tagtype = $(this).attr("data-tagtype");
215            FilterLabelupdate(hashSelectedTagsArray, tagtype);
216        }
217    });
218
219    $('.DropDownName').click(function () {
220        var classname = "." + $(this).attr('data-tagtype');
221
222        if ($(classname).is(':visible')) {
223            $(classname).hide();
224        }
225        else {
226            $(classname).show();
227        }
228    });
229    
230    $("body#chroniques-charlotte div.custom-sel-val").click(function() {
231    	var a = "body#chroniques-charlotte div.ParProfil.visible-xs div.custom-dd-values";
232            if ($(a).is(":visible")) {
233                $(a).attr("style", "display:none");
234            } else {
235                $(a).attr("style", "display:block");
236            }
237            $(".Slider.TagTypeDivDisplay").toggle();
238    });
239    
240    $("body#chroniques-charlotte div.ParProfil.visible-xs .tagitemdisplay").click(function() {
241    		$("body#chroniques-charlotte div.custom-sel-val").text($(this).text());
242    		$(".Slider.TagTypeDivDisplay .custom-dd-values").toggle();
243    });
244    $("body#chroniques-charlotte ul.ParProfil.hidden-xs .tagitemdisplay").click(function() {
245	    $("body#chroniques-charlotte div.head-sepau div.custom-sel-val").text($(this).text());
246	    if($(".custom-sel-val").is(":visible")){
247			$(".Slider.TagTypeDivDisplay").toggle();
248		}
249    });
250});
251
252function ClearFilterAndLoadThematique() {
253    $('#selectedthematic').text('');
254    $('#clearfilterThemtique').hide();
255    var tagtype = $('#selectedthematic').attr('data_tagtype');
256    delete hashSelectedTagsArray[tagtype];
257    //FilterSingleTagsPerTagType();
258    paginateItems();
259    
260    if(Object.keys(hashSelectedTagsArray).length === 0)
261    {
262	    $('.tagbannerimage').attr('src', $('#DefaultImageSrc').val());
263	    $('.tagbannerdescription').empty();
264        $('.tagbannerdescription').html($('#DefaultImageDescription').val());
265    }
266}
267
268function ClearFilterAndLoadProfil() {
269    $('#selectedprofil').text('');
270    $('#clearfilter').hide();
271    var tagtype = $('#selectedprofil').attr('data_tagtype');
272    delete hashSelectedTagsArray[tagtype];
273    //FilterSingleTagsPerTagType();
274    paginateItems();
275    
276    if(Object.keys(hashSelectedTagsArray).length === 0)
277    {
278	    $('.tagbannerimage').attr('src', $('#DefaultImageSrc').val());
279	    $('.tagbannerdescription').empty();
280        $('.tagbannerdescription').html($('#DefaultImageDescription').val());
281    }
282}
283
284function FilterSingleTagsPerTagType() {
285    var hashItemAvailableInLists = {};
286    var j = 0;
287	var a = 1;
288	$('.listboxcontent-container > div.newsitemsdiv').attr("data-pageno","")
289    $('.listboxcontent-container > div.newsitemsdiv').each(function () {
290
291        var newsitem = $(this);
292        var array = $(this).attr('data-tagsmapped').split("|");
293        $.each(array, function (i) {
294            for (var item in hashSelectedTagsArray) {
295                if (hashSelectedTagsArray[item].trim() == array[i].trim()) {
296                    j = j + 1;
297                   
298                }
299            }
300            i = i + 1;
301        });
302        if (j >= Object.keys(hashSelectedTagsArray).length) {
303		if (a <= 8){
304		 pageno = 1;
305				$(this).attr("data-PageNo", pageno);
306           //$(this).show();
307		   }
308            else{
309                pageno = Math.ceil(a / 8);
310				$(this).attr("data-PageNo", pageno);
311				}
312				
313				a++;
314        }
315
316        j = 0;
317    });
318    $('.listboxcontent-container > div.newsitemsdiv').each(function () {
319        if ($(this).attr('data-PageNo') == "1") {
320            $(this).show();
321            $(this).css('display', "inline-block");
322            $(this).find("img").attr('Src',$(this).find("img").attr('data-src'));
323        }
324    });
325    articlePageCount = 1;
326}
327
328function ClearNewsItemSearch(e) {
329    e.preventDefault();
330    $('.listboxcontent-container > div.newsitemsdiv').siblings().show();
331    hashSelectedTagsArray = {};
332    //FilterSingleTagsPerTagType();
333    paginateItems();
334}
335
336function FilterLabelupdate(hashSelectedTagsArray, tagtype) {
337
338    var chosentext = tagtype.bold() + " <b>choisie :</b> " + hashSelectedTagsArray[tagtype];
339
340    var thematic = $('#selectedthematic').attr('data_tagtype');
341    var profil = $('#selectedprofil').attr('data_tagtype');
342
343    if (thematic == tagtype) {
344        $('#selectedthematic').html(chosentext);
345        $('#clearfilterThemtique').show();
346    }
347
348    if (profil == tagtype) {
349        $('#selectedprofil').html(chosentext);
350        $('#clearfilter').show();
351    }
352
353}
354
355function ShowItemTagName() {
356    $('.listboxcontent-container > div.newsitemsdiv').each(function () {
357        $(this).find('.SelectedTagTitle').html($(this).attr('data-tagsmapped').split(",")[0]);
358
359        var color = GetSelectedTagForeColor($(this).attr('data-tagsmapped').split(",")[0]);
360
361        if (color !== undefined) {
362            $(this).find('.SelectedTagTitle').css('color', color);
363        }
364        $(this).removeAttr('href');
365    });
366}
367
368function GetSelectedTagForeColor(TagName) {
369    var color;
370    $('a.tagitem').each(function () {
371        if ($(this).text().trim() === TagName.trim() && $(this).attr('style') !== undefined) {
372            color = ($(this).css('color').trim());
373        }
374    });
375    return String(color);
376}
377
378function paginateItems() {
379    //$('.listboxcontent-container').html('');
380    $('#custompagerlist').html('');
381    //$('#custompager').html('');
382
383    var i = 1;
384    var pageno = 0;
385    var pager = 0;
386    var paginghtml = "<ul id='custompagerlist' class='pagination'>";
387        if ($('.listboxcontent-container > div.newsitemsdiv[style*="display: block"]').length > 0 || $('.listboxcontent-container-hidden > div.newsitemsdiv[style*="display: inline-block"]').length > 0) {
388        $('.listboxcontent-container > div.newsitemsdiv[style*="display: block"]').each(function () {
389            var obj = $(this);
390
391            if (i <= $('#listboxPageSize').val())
392                pageno = 1;
393            else
394                pageno = Math.ceil(i / $('#listboxPageSize').val());
395
396            obj.attr("data-PageNo", pageno);
397            obj.appendTo('.listboxcontent-container');
398            i++;
399            if ($('#pagination').val() == "True" && pager !== pageno) {
400                pager = pageno;
401                if (pageno === 1) {
402                    paginghtml = paginghtml + '<li class="active"><a class="pagegoto" onclick=ManangePaging("' + pageno + '") title="' + pageno + '">' + pageno + '</a></li>';
403                }
404                else {
405                    paginghtml = paginghtml + '<li><a class="pagegoto" onclick=ManangePaging("' + pageno + '") title="' + pageno + '">' + pageno + '</a></li>';
406                }
407            }
408        });
409
410        //for mobile the show() becomes inline-block in div element
411        $('.listboxcontent-container > div.newsitemsdiv[style*="display: inline-block"]').each(function () {
412            var obj = $(this);
413
414            if (i <= $('#listboxPageSize').val())
415                pageno = 1;
416            else
417                pageno = Math.ceil(i / $('#listboxPageSize').val());
418
419            obj.attr("data-PageNo", pageno);
420            obj.appendTo('.listboxcontent-container');
421            i++;
422            if ($('#pagination').val() == "True" && pager !== pageno) {
423                pager = pageno;
424                if (pageno === 1) {
425                    paginghtml = paginghtml + '<li class="active"><a class="pagegoto" onclick=ManangePaging("' + pageno + '") title="' + pageno + '">' + pageno + '</a></li>';
426                }
427                else {
428                    paginghtml = paginghtml + '<li><a class="pagegoto" onclick=ManangePaging("' + pageno + '") title="' + pageno + '">' + pageno + '</a></li>';
429                }
430            }
431        });
432
433        if ($('#pagination').val() == "True") {
434            $('#custompager').html(paginghtml + '</ul>');
435            ManangePaging(1);
436        }
437    }
438}
439
440
441
442function ManangePaging(pageno) {
443
444    $('.pagegoto').each(function () {
445        var element = $(this).attr('title');
446
447        if (element == pageno) {
448            $(this).parent().addClass('active');
449        }
450        else {
451            $(this).parent().removeClass('active');
452        }
453
454    });
455
456    
457}
458
459/* -------------------
460BEGIN  
461Sitecore Resource: 6e3037b3-3fc2-4f01-b2b1-8d03bf141283
462   -------------------*/
463if (typeof Object.create !== "function") {
464    Object.create = function (obj) {
465        function F() { }
466        F.prototype = obj;
467        return new F();
468    };
469}
470(function ($, window, document) {
471
472    //Higlighting first carousel indicator on page load
473    $('.owl-controls .owl-pagination div:eq(0)').addClass("active");
474
475    var Carousel = {
476        init: function (options, el) {
477            var base = this;
478
479            base.$elem = $(el);
480            base.options = $.extend({}, $.fn.owlCarousel.options, base.$elem.data(), options);
481
482            base.userOptions = options;
483            base.loadContent();
484        },
485
486        loadContent: function () {
487            var base = this, url;
488
489            function getData(data) {
490                var i, content = "";
491                if (typeof base.options.jsonSuccess === "function") {
492                    base.options.jsonSuccess.apply(this, [data]);
493                } else {
494                    for (i in data.owl) {
495                        if (data.owl.hasOwnProperty(i)) {
496                            content += data.owl[i].item;
497                        }
498                    }
499                    base.$elem.html(content);
500                }
501                base.logIn();
502            }
503
504            if (typeof base.options.beforeInit === "function") {
505                base.options.beforeInit.apply(this, [base.$elem]);
506            }
507
508            if (typeof base.options.jsonPath === "string") {
509                url = base.options.jsonPath;
510                $.getJSON(url, getData);
511            } else {
512                base.logIn();
513            }
514        },
515
516        logIn: function () {
517            var base = this;
518
519            base.$elem.data("owl-originalStyles", base.$elem.attr("style"));
520            base.$elem.data("owl-originalClasses", base.$elem.attr("class"));
521
522            base.$elem.css({ opacity: 0 });
523            base.orignalItems = base.options.items;
524            base.checkBrowser();
525            base.wrapperWidth = 0;
526            base.checkVisible = null;
527            base.setVars();
528        },
529
530        setVars: function () {
531            var base = this;
532            if (base.$elem.children().length === 0) { return false; }
533            base.baseClass();
534            base.eventTypes();
535            base.$userItems = base.$elem.children();
536            base.itemsAmount = base.$userItems.length;
537            base.wrapItems();
538            base.$owlItems = base.$elem.find(".owl-item");
539            base.$owlWrapper = base.$elem.find(".owl-wrapper");
540            base.playDirection = "next";
541            base.prevItem = 0;
542            base.prevArr = [0];
543            base.currentItem = 0;
544            base.customEvents();
545            base.onStartup();
546        },
547
548        onStartup: function () {
549            var base = this;
550            base.updateItems();
551            base.calculateAll();
552            base.buildControls();
553            base.updateControls();
554            base.response();
555            base.moveEvents();
556            base.stopOnHover();
557            base.owlStatus();
558
559            if (base.options.transitionStyle !== false) {
560                base.transitionTypes(base.options.transitionStyle);
561            }
562            if (base.options.autoPlay === true) {
563                base.options.autoPlay = 5000;
564            }
565            base.play();
566
567            base.$elem.find(".owl-wrapper").css("display", "block");
568
569            if (!base.$elem.is(":visible")) {
570                base.watchVisibility();
571            } else {
572                base.$elem.css("opacity", 1);
573            }
574            base.onstartup = false;
575            base.eachMoveUpdate();
576            if (typeof base.options.afterInit === "function") {
577                base.options.afterInit.apply(this, [base.$elem]);
578            }
579        },
580
581        eachMoveUpdate: function () {
582            var base = this;
583
584            if (base.options.lazyLoad === true) {
585                base.lazyLoad();
586            }
587            if (base.options.autoHeight === true) {
588                base.autoHeight();
589            }
590            base.onVisibleItems();
591
592            if (typeof base.options.afterAction === "function") {
593                base.options.afterAction.apply(this, [base.$elem]);
594            }
595        },
596
597        updateVars: function () {
598            var base = this;
599            if (typeof base.options.beforeUpdate === "function") {
600                base.options.beforeUpdate.apply(this, [base.$elem]);
601            }
602            base.watchVisibility();
603            base.updateItems();
604            base.calculateAll();
605            base.updatePosition();
606            base.updateControls();
607            base.eachMoveUpdate();
608            if (typeof base.options.afterUpdate === "function") {
609                base.options.afterUpdate.apply(this, [base.$elem]);
610            }
611        },
612
613        reload: function () {
614            var base = this;
615            window.setTimeout(function () {
616                base.updateVars();
617            }, 0);
618        },
619
620        watchVisibility: function () {
621            var base = this;
622
623            if (base.$elem.is(":visible") === false) {
624                base.$elem.css({ opacity: 0 });
625                window.clearInterval(base.autoPlayInterval);
626                window.clearInterval(base.checkVisible);
627            } else {
628                return false;
629            }
630            base.checkVisible = window.setInterval(function () {
631                if (base.$elem.is(":visible")) {
632                    base.reload();
633                    base.$elem.animate({ opacity: 1 }, 200);
634                    window.clearInterval(base.checkVisible);
635                }
636            }, 500);
637        },
638
639        wrapItems: function () {
640            var base = this;
641            base.$userItems.wrapAll("<div class=\"owl-wrapper\">").wrap("<div class=\"owl-item\"></div>");
642            base.$elem.find(".owl-wrapper").wrap("<div class=\"owl-wrapper-outer\">");
643            base.wrapperOuter = base.$elem.find(".owl-wrapper-outer");
644            base.$elem.css("display", "block");
645        },
646
647        baseClass: function () {
648            var base = this,
649                hasBaseClass = base.$elem.hasClass(base.options.baseClass),
650                hasThemeClass = base.$elem.hasClass(base.options.theme);
651
652            if (!hasBaseClass) {
653                base.$elem.addClass(base.options.baseClass);
654            }
655
656            if (!hasThemeClass) {
657                base.$elem.addClass(base.options.theme);
658            }
659        },
660
661        updateItems: function () {
662            var base = this, width, i;
663
664            if (base.options.responsive === false) {
665                return false;
666            }
667            if (base.options.singleItem === true) {
668                base.options.items = base.orignalItems = 1;
669                base.options.itemsCustom = false;
670                base.options.itemsDesktop = false;
671                base.options.itemsDesktopSmall = false;
672                base.options.itemsTablet = false;
673                base.options.itemsTabletSmall = false;
674                base.options.itemsMobile = false;
675                return false;
676            }
677
678            width = $(base.options.responsiveBaseWidth).width();
679
680            if (width > (base.options.itemsDesktop[0] || base.orignalItems)) {
681                base.options.items = base.orignalItems;
682            }
683            if (base.options.itemsCustom !== false) {
684                //Reorder array by screen size
685                base.options.itemsCustom.sort(function (a, b) { return a[0] - b[0]; });
686
687                for (i = 0; i < base.options.itemsCustom.length; i += 1) {
688                    if (base.options.itemsCustom[i][0] <= width) {
689                        base.options.items = base.options.itemsCustom[i][1];
690                    }
691                }
692
693            } else {
694
695                if (width <= base.options.itemsDesktop[0] && base.options.itemsDesktop !== false) {
696                    base.options.items = base.options.itemsDesktop[1];
697                }
698
699                if (width <= base.options.itemsDesktopSmall[0] && base.options.itemsDesktopSmall !== false) {
700                    base.options.items = base.options.itemsDesktopSmall[1];
701                }
702
703                if (width <= base.options.itemsTablet[0] && base.options.itemsTablet !== false) {
704                    base.options.items = base.options.itemsTablet[1];
705                }
706
707                if (width <= base.options.itemsTabletSmall[0] && base.options.itemsTabletSmall !== false) {
708                    base.options.items = base.options.itemsTabletSmall[1];
709                }
710
711                if (width <= base.options.itemsMobile[0] && base.options.itemsMobile !== false) {
712                    base.options.items = base.options.itemsMobile[1];
713                }
714            }
715
716            //if number of items is less than declared
717            if (base.options.items > base.itemsAmount && base.options.itemsScaleUp === true) {
718                base.options.items = base.itemsAmount;
719            }
720        },
721
722        response: function () {
723            var base = this,
724                smallDelay,
725                lastWindowWidth;
726
727            if (base.options.responsive !== true) {
728                return false;
729            }
730            lastWindowWidth = $(window).width();
731
732            base.resizer = function () {
733                if ($(window).width() !== lastWindowWidth) {
734                    if (base.options.autoPlay !== false) {
735                        window.clearInterval(base.autoPlayInterval);
736                    }
737                    window.clearTimeout(smallDelay);
738                    smallDelay = window.setTimeout(function () {
739                        lastWindowWidth = $(window).width();
740                        base.updateVars();
741                    }, base.options.responsiveRefreshRate);
742                }
743            };
744            $(window).resize(base.resizer);
745        },
746
747        updatePosition: function () {
748            var base = this;
749            base.jumpTo(base.currentItem);
750            if (base.options.autoPlay !== false) {
751                base.checkAp();
752            }
753        },
754
755        appendItemsSizes: function () {
756            var base = this,
757                roundPages = 0,
758                lastItem = base.itemsAmount - base.options.items;
759
760            base.$owlItems.each(function (index) {
761                var $this = $(this);
762                $this
763                    .css({ "width": base.itemWidth })
764                    .data("owl-item", Number(index));
765
766                if (index % base.options.items === 0 || index === lastItem) {
767                    if (!(index > lastItem)) {
768                        roundPages += 1;
769                    }
770                }
771                $this.data("owl-roundPages", roundPages);
772            });
773        },
774
775        appendWrapperSizes: function () {
776            var base = this,
777                width = base.$owlItems.length * base.itemWidth;
778
779            base.$owlWrapper.css({
780                "width": width * 2,
781                "left": 0
782            });
783            base.appendItemsSizes();
784        },
785
786        calculateAll: function () {
787            var base = this;
788            base.calculateWidth();
789            base.appendWrapperSizes();
790            base.loops();
791            base.max();
792        },
793
794        calculateWidth: function () {
795            var base = this;
796            base.itemWidth = Math.round(base.$elem.width() / base.options.items);
797        },
798
799        max: function () {
800            var base = this,
801                maximum = ((base.itemsAmount * base.itemWidth) - base.options.items * base.itemWidth) * -1;
802            if (base.options.items > base.itemsAmount) {
803                base.maximumItem = 0;
804                maximum = 0;
805                base.maximumPixels = 0;
806            } else {
807                base.maximumItem = base.itemsAmount - base.options.items;
808                base.maximumPixels = maximum;
809            }
810            return maximum;
811        },
812
813        min: function () {
814            return 0;
815        },
816
817        loops: function () {
818            var base = this,
819                prev = 0,
820                elWidth = 0,
821                i,
822                item,
823                roundPageNum;
824
825            base.positionsInArray = [0];
826            base.pagesInArray = [];
827
828            for (i = 0; i < base.itemsAmount; i += 1) {
829                elWidth += base.itemWidth;
830                base.positionsInArray.push(-elWidth);
831
832                if (base.options.scrollPerPage === true) {
833                    item = $(base.$owlItems[i]);
834                    roundPageNum = item.data("owl-roundPages");
835                    if (roundPageNum !== prev) {
836                        base.pagesInArray[prev] = base.positionsInArray[i];
837                        prev = roundPageNum;
838                    }
839                }
840            }
841        },
842
843        buildControls: function () {
844            var base = this;
845            if (base.options.navigation === true || base.options.pagination === true) {
846                base.owlControls = $("<div class=\"owl-controls\"/>").toggleClass("clickable", !base.browser.isTouch).appendTo(base.$elem);
847            }
848            if (base.options.pagination === true) {
849                base.buildPagination();
850            }
851            if (base.options.navigation === true) {
852                base.buildButtons();
853            }
854        },
855
856        buildButtons: function () {
857            var base = this,
858                buttonsWrapper = $("<div class=\"owl-buttons\"/>");
859            base.owlControls.append(buttonsWrapper);
860
861            base.buttonPrev = $("<div/>", {
862                "class": "owl-prev",
863                "html": base.options.navigationText[0] || ""
864            });
865
866            base.buttonNext = $("<div/>", {
867                "class": "owl-next",
868                "html": base.options.navigationText[1] || ""
869            });
870
871            buttonsWrapper
872                .append(base.buttonPrev)
873                .append(base.buttonNext);
874
875            buttonsWrapper.on("touchstart.owlControls mousedown.owlControls", "div[class^=\"owl\"]", function (event) {
876                event.preventDefault();
877            });
878
879            buttonsWrapper.on("touchend.owlControls mouseup.owlControls", "div[class^=\"owl\"]", function (event) {
880                event.preventDefault();
881                if ($(this).hasClass("owl-next")) {
882                    base.next();
883                } else {
884                    base.prev();
885                }
886            });
887        },
888
889        buildPagination: function () {
890            var base = this;
891
892            base.paginationWrapper = $("<div class=\"owl-pagination\"/>");
893            base.owlControls.append(base.paginationWrapper);
894
895            base.paginationWrapper.on("touchend.owlControls mouseup.owlControls", ".owl-page", function (event) {
896                event.preventDefault();
897                if (Number($(this).data("owl-page")) !== base.currentItem) {
898                    base.goTo(Number($(this).data("owl-page")), true);
899                }
900            });
901        },
902
903        updatePagination: function () {
904            var base = this,
905                counter,
906                lastPage,
907                lastItem,
908                i,
909                paginationButton,
910                paginationButtonInner;
911
912            if (base.options.pagination === false) {
913                return false;
914            }
915
916            base.paginationWrapper.html("");
917
918            counter = 0;
919            lastPage = base.itemsAmount - base.itemsAmount % base.options.items;
920
921            for (i = 0; i < base.itemsAmount; i += 1) {
922                if (i % base.options.items === 0) {
923                    counter += 1;
924                    if (lastPage === i) {
925                        lastItem = base.itemsAmount - base.options.items;
926                    }
927                    paginationButton = $("<div/>", {
928                        "class": "owl-page"
929                    });
930                    paginationButtonInner = $("<span></span>", {
931                        "text": base.options.paginationNumbers === true ? counter : "",
932                        "class": base.options.paginationNumbers === true ? "owl-numbers" : ""
933                    });
934                    paginationButton.append(paginationButtonInner);
935
936                    paginationButton.data("owl-page", lastPage === i ? lastItem : i);
937                    paginationButton.data("owl-roundPages", counter);
938
939                    base.paginationWrapper.append(paginationButton);
940                }
941            }
942            base.checkPagination();
943        },
944        checkPagination: function () {
945            var base = this;
946            if (base.options.pagination === false) {
947                return false;
948            }
949
950            // Changes added to fix backward issue for carousel indication selection
951            var $activeDiv = $('.owl-controls .owl-pagination div.active');
952            if ($('#itemsPerSlide').attr('navflag') == "prev") {
953                $activeDiv.removeClass("active");
954                $activeDiv.prev().addClass("active");
955                $('#itemsPerSlide').removeAttr("navflag");
956            }
957            else if ($('#itemsPerSlide').attr('navflag') == "next") {
958                $activeDiv.removeClass("active");
959                $activeDiv.next().addClass("active");
960                $('#itemsPerSlide').removeAttr("navflag");
961            }
962            else {
963                base.paginationWrapper.find(".owl-page").each(function () {
964                    if ($(this).data("owl-roundPages") === $(base.$owlItems[base.currentItem]).data("owl-roundPages")) {
965                        base.paginationWrapper
966                            .find(".owl-page")
967                            .removeClass("active");
968                        $(this).addClass("active");
969                    }
970                });
971            }
972        },
973
974        checkNavigation: function () {
975            var base = this;
976
977            if (base.options.navigation === false) {
978                return false;
979            }
980            if (base.options.rewindNav === false) {
981                if (base.currentItem === 0 && base.maximumItem === 0) {
982                    base.buttonPrev.addClass("disabled");
983                    base.buttonNext.addClass("disabled");
984                } else if (base.currentItem === 0 && base.maximumItem !== 0) {
985                    base.buttonPrev.addClass("disabled");
986                    base.buttonNext.removeClass("disabled");
987                } else if (base.currentItem === base.maximumItem) {
988                    base.buttonPrev.removeClass("disabled");
989                    base.buttonNext.addClass("disabled");
990                } else if (base.currentItem !== 0 && base.currentItem !== base.maximumItem) {
991                    base.buttonPrev.removeClass("disabled");
992                    base.buttonNext.removeClass("disabled");
993                }
994            }
995        },
996
997        updateControls: function () {
998            var base = this;
999            base.updatePagination();
1000            base.checkNavigation();
1001            if (base.owlControls) {
1002                if (base.options.items >= base.itemsAmount) {
1003                    base.owlControls.hide();
1004                } else {
1005                    base.owlControls.show();
1006                }
1007            }
1008        },
1009
1010        destroyControls: function () {
1011            var base = this;
1012            if (base.owlControls) {
1013                base.owlControls.remove();
1014            }
1015        },
1016
1017        next: function (speed) {
1018            var base = this;
1019
1020            if (base.isTransition) {
1021                return false;
1022            }
1023
1024            base.currentItem += base.options.scrollPerPage === true ? base.options.items : 1;
1025            if (base.currentItem > base.maximumItem + (base.options.scrollPerPage === true ? (base.options.items - 1) : 0)) {
1026                if (base.options.rewindNav === true) {
1027                    base.currentItem = 0;
1028                    speed = "rewind";
1029                } else {
1030                    base.currentItem = base.maximumItem;
1031                    return false;
1032                }
1033            }
1034            base.goTo(base.currentItem, speed);
1035        },
1036
1037        prev: function (speed) {
1038            var base = this;
1039
1040            if (base.isTransition) {
1041                return false;
1042            }
1043
1044            if (base.options.scrollPerPage === true && base.currentItem > 0 && base.currentItem < base.options.items) {
1045                base.currentItem = 0;
1046            } else {
1047                base.currentItem -= base.options.scrollPerPage === true ? base.options.items : 1;
1048            }
1049            if (base.currentItem < 0) {
1050                if (base.options.rewindNav === true) {
1051                    base.currentItem = base.maximumItem;
1052                    speed = "rewind";
1053                } else {
1054                    base.currentItem = 0;
1055                    return false;
1056                }
1057            }
1058            base.goTo(base.currentItem, speed);
1059        },
1060
1061        goTo: function (position, speed, drag) {
1062            var base = this,
1063                goToPixel;
1064
1065            if (base.isTransition) {
1066                return false;
1067            }
1068            if (typeof base.options.beforeMove === "function") {
1069                base.options.beforeMove.apply(this, [base.$elem]);
1070            }
1071            if (position >= base.maximumItem) {
1072                position = base.maximumItem;
1073            } else if (position <= 0) {
1074                position = 0;
1075            }
1076
1077            base.currentItem = base.owl.currentItem = position;
1078            if (base.options.transitionStyle !== false && drag !== "drag" && base.options.items === 1 && base.browser.support3d === true) {
1079                base.swapSpeed(0);
1080                if (base.browser.support3d === true) {
1081                    base.transition3d(base.positionsInArray[position]);
1082                } else {
1083                    base.css2slide(base.positionsInArray[position], 1);
1084                }
1085                base.afterGo();
1086                base.singleItemTransition();
1087                return false;
1088            }
1089            goToPixel = base.positionsInArray[position];
1090
1091            if (base.browser.support3d === true) {
1092                base.isCss3Finish = false;
1093
1094                if (speed === true) {
1095                    base.swapSpeed("paginationSpeed");
1096                    window.setTimeout(function () {
1097                        base.isCss3Finish = true;
1098                    }, base.options.paginationSpeed);
1099
1100                } else if (speed === "rewind") {
1101                    base.swapSpeed(base.options.rewindSpeed);
1102                    window.setTimeout(function () {
1103                        base.isCss3Finish = true;
1104                    }, base.options.rewindSpeed);
1105
1106                } else {
1107                    base.swapSpeed("slideSpeed");
1108                    window.setTimeout(function () {
1109                        base.isCss3Finish = true;
1110                    }, base.options.slideSpeed);
1111                }
1112                base.transition3d(goToPixel);
1113            } else {
1114                if (speed === true) {
1115                    base.css2slide(goToPixel, base.options.paginationSpeed);
1116                } else if (speed === "rewind") {
1117                    base.css2slide(goToPixel, base.options.rewindSpeed);
1118                } else {
1119                    base.css2slide(goToPixel, base.options.slideSpeed);
1120                }
1121            }
1122            base.afterGo();
1123        },
1124
1125        jumpTo: function (position) {
1126            var base = this;
1127            if (typeof base.options.beforeMove === "function") {
1128                base.options.beforeMove.apply(this, [base.$elem]);
1129            }
1130            if (position >= base.maximumItem || position === -1) {
1131                position = base.maximumItem;
1132            } else if (position <= 0) {
1133                position = 0;
1134            }
1135            base.swapSpeed(0);
1136            if (base.browser.support3d === true) {
1137                base.transition3d(base.positionsInArray[position]);
1138            } else {
1139                base.css2slide(base.positionsInArray[position], 1);
1140            }
1141            base.currentItem = base.owl.currentItem = position;
1142            base.afterGo();
1143        },
1144
1145        afterGo: function () {
1146            var base = this;
1147
1148            base.prevArr.push(base.currentItem);
1149            base.prevItem = base.owl.prevItem = base.prevArr[base.prevArr.length - 2];
1150            base.prevArr.shift(0);
1151
1152            if (base.prevItem !== base.currentItem) {
1153                base.checkPagination();
1154                base.checkNavigation();
1155                base.eachMoveUpdate();
1156
1157                if (base.options.autoPlay !== false) {
1158                    base.checkAp();
1159                }
1160            }
1161            if (typeof base.options.afterMove === "function" && base.prevItem !== base.currentItem) {
1162                base.options.afterMove.apply(this, [base.$elem]);
1163            }
1164        },
1165
1166        stop: function () {
1167            var base = this;
1168            base.apStatus = "stop";
1169            window.clearInterval(base.autoPlayInterval);
1170        },
1171
1172        checkAp: function () {
1173            var base = this;
1174            if (base.apStatus !== "stop") {
1175                base.play();
1176            }
1177        },
1178
1179        play: function () {
1180            var base = this;
1181            base.apStatus = "play";
1182            if (base.options.autoPlay === false) {
1183                return false;
1184            }
1185            window.clearInterval(base.autoPlayInterval);
1186            base.autoPlayInterval = window.setInterval(function () {
1187                base.next(true);
1188            }, base.options.autoPlay);
1189        },
1190
1191        swapSpeed: function (action) {
1192            var base = this;
1193            if (action === "slideSpeed") {
1194                base.$owlWrapper.css(base.addCssSpeed(base.options.slideSpeed));
1195            } else if (action === "paginationSpeed") {
1196                base.$owlWrapper.css(base.addCssSpeed(base.options.paginationSpeed));
1197            } else if (typeof action !== "string") {
1198                base.$owlWrapper.css(base.addCssSpeed(action));
1199            }
1200        },
1201
1202        addCssSpeed: function (speed) {
1203            return {
1204                "-webkit-transition": "all " + speed + "ms ease",
1205                "-moz-transition": "all " + speed + "ms ease",
1206                "-o-transition": "all " + speed + "ms ease",
1207                "transition": "all " + speed + "ms ease"
1208            };
1209        },
1210
1211        removeTransition: function () {
1212            return {
1213                "-webkit-transition": "",
1214                "-moz-transition": "",
1215                "-o-transition": "",
1216                "transition": ""
1217            };
1218        },
1219
1220        doTranslate: function (pixels) {
1221            return {
1222                "-webkit-transform": "translate3d(" + pixels + "px, 0px, 0px)",
1223                "-moz-transform": "translate3d(" + pixels + "px, 0px, 0px)",
1224                "-o-transform": "translate3d(" + pixels + "px, 0px, 0px)",
1225                "-ms-transform": "translate3d(" + pixels + "px, 0px, 0px)",
1226                "transform": "translate3d(" + pixels + "px, 0px,0px)"
1227            };
1228        },
1229
1230        transition3d: function (value) {
1231            var base = this;
1232            base.$owlWrapper.css(base.doTranslate(value));
1233        },
1234
1235        css2move: function (value) {
1236            var base = this;
1237            base.$owlWrapper.css({ "left": value });
1238        },
1239
1240        css2slide: function (value, speed) {
1241            var base = this;
1242
1243            base.isCssFinish = false;
1244            base.$owlWrapper.stop(true, true).animate({
1245                "left": value
1246            }, {
1247                duration: speed || base.options.slideSpeed,
1248                complete: function () {
1249                    base.isCssFinish = true;
1250                }
1251            });
1252        },
1253
1254        checkBrowser: function () {
1255            var base = this,
1256                translate3D = "translate3d(0px, 0px, 0px)",
1257                tempElem = document.createElement("div"),
1258                regex,
1259                asSupport,
1260                support3d,
1261                isTouch;
1262
1263            tempElem.style.cssText = "  -moz-transform:" + translate3D +
1264                                  "; -ms-transform:" + translate3D +
1265                                  "; -o-transform:" + translate3D +
1266                                  "; -webkit-transform:" + translate3D +
1267                                  "; transform:" + translate3D;
1268            regex = /translate3d\(0px, 0px, 0px\)/g;
1269            asSupport = tempElem.style.cssText.match(regex);
1270            support3d = (asSupport !== null && asSupport.length === 1);
1271
1272            isTouch = "ontouchstart" in window || window.navigator.msMaxTouchPoints;
1273
1274            base.browser = {
1275                "support3d": support3d,
1276                "isTouch": isTouch
1277            };
1278        },
1279
1280        moveEvents: function () {
1281            var base = this;
1282            if (base.options.mouseDrag !== false || base.options.touchDrag !== false) {
1283                base.gestures();
1284                base.disabledEvents();
1285            }
1286        },
1287
1288        eventTypes: function () {
1289            var base = this,
1290                types = ["s", "e", "x"];
1291
1292            base.ev_types = {};
1293
1294            if (base.options.mouseDrag === true && base.options.touchDrag === true) {
1295                types = [
1296                    "touchstart.owl mousedown.owl",
1297                    "touchmove.owl mousemove.owl",
1298                    "touchend.owl touchcancel.owl mouseup.owl"
1299                ];
1300            } else if (base.options.mouseDrag === false && base.options.touchDrag === true) {
1301                types = [
1302                    "touchstart.owl",
1303                    "touchmove.owl",
1304                    "touchend.owl touchcancel.owl"
1305                ];
1306            } else if (base.options.mouseDrag === true && base.options.touchDrag === false) {
1307                types = [
1308                    "mousedown.owl",
1309                    "mousemove.owl",
1310                    "mouseup.owl"
1311                ];
1312            }
1313
1314            base.ev_types.start = types[0];
1315            base.ev_types.move = types[1];
1316            base.ev_types.end = types[2];
1317        },
1318
1319        disabledEvents: function () {
1320            var base = this;
1321            base.$elem.on("dragstart.owl", function (event) { event.preventDefault(); });
1322            base.$elem.on("mousedown.disableTextSelect", function (e) {
1323                return $(e.target).is('input, textarea, select, option');
1324            });
1325        },
1326
1327        gestures: function () {
1328            /*jslint unparam: true*/
1329            var base = this,
1330                locals = {
1331                    offsetX: 0,
1332                    offsetY: 0,
1333                    baseElWidth: 0,
1334                    relativePos: 0,
1335                    position: null,
1336                    minSwipe: null,
1337                    maxSwipe: null,
1338                    sliding: null,
1339                    dargging: null,
1340                    targetElement: null
1341                };
1342
1343            base.isCssFinish = true;
1344
1345            function getTouches(event) {
1346                if (event.touches !== undefined) {
1347                    return {
1348                        x: event.touches[0].pageX,
1349                        y: event.touches[0].pageY
1350                    };
1351                }
1352
1353                if (event.touches === undefined) {
1354                    if (event.pageX !== undefined) {
1355                        return {
1356                            x: event.pageX,
1357                            y: event.pageY
1358                        };
1359                    }
1360                    if (event.pageX === undefined) {
1361                        return {
1362                            x: event.clientX,
1363                            y: event.clientY
1364                        };
1365                    }
1366                }
1367            }
1368
1369            function swapEvents(type) {
1370                if (type === "on") {
1371                    $(document).on(base.ev_types.move, dragMove);
1372                    $(document).on(base.ev_types.end, dragEnd);
1373                } else if (type === "off") {
1374                    $(document).off(base.ev_types.move);
1375                    $(document).off(base.ev_types.end);
1376                }
1377            }
1378
1379            function dragStart(event) {
1380                var ev = event.originalEvent || event || window.event,
1381                    position;
1382
1383                if (ev.which === 3) {
1384                    return false;
1385                }
1386                if (base.itemsAmount <= base.options.items) {
1387                    return;
1388                }
1389                if (base.isCssFinish === false && !base.options.dragBeforeAnimFinish) {
1390                    return false;
1391                }
1392                if (base.isCss3Finish === false && !base.options.dragBeforeAnimFinish) {
1393                    return false;
1394                }
1395
1396                if (base.options.autoPlay !== false) {
1397                    window.clearInterval(base.autoPlayInterval);
1398                }
1399
1400                if (base.browser.isTouch !== true && !base.$owlWrapper.hasClass("grabbing")) {
1401                    base.$owlWrapper.addClass("grabbing");
1402                }
1403
1404                base.newPosX = 0;
1405                base.newRelativeX = 0;
1406
1407                $(this).css(base.removeTransition());
1408
1409                position = $(this).position();
1410                locals.relativePos = position.left;
1411
1412                locals.offsetX = getTouches(ev).x - position.left;
1413                locals.offsetY = getTouches(ev).y - position.top;
1414
1415                swapEvents("on");
1416
1417                locals.sliding = false;
1418                locals.targetElement = ev.target || ev.srcElement;
1419            }
1420
1421            function dragMove(event) {
1422                var ev = event.originalEvent || event || window.event,
1423                    minSwipe,
1424                    maxSwipe;
1425
1426                base.newPosX = getTouches(ev).x - locals.offsetX;
1427                base.newPosY = getTouches(ev).y - locals.offsetY;
1428                base.newRelativeX = base.newPosX - locals.relativePos;
1429
1430                if (typeof base.options.startDragging === "function" && locals.dragging !== true && base.newRelativeX !== 0) {
1431                    locals.dragging = true;
1432                    base.options.startDragging.apply(base, [base.$elem]);
1433                }
1434
1435                if ((base.newRelativeX > 8 || base.newRelativeX < -8) && (base.browser.isTouch === true)) {
1436                    if (ev.preventDefault !== undefined) {
1437                        ev.preventDefault();
1438                    } else {
1439                        ev.returnValue = false;
1440                    }
1441                    locals.sliding = true;
1442                }
1443
1444                if ((base.newPosY > 10 || base.newPosY < -10) && locals.sliding === false) {
1445                    $(document).off("touchmove.owl");
1446                }
1447
1448                minSwipe = function () {
1449                    return base.newRelativeX / 5;
1450                };
1451
1452                maxSwipe = function () {
1453                    return base.maximumPixels + base.newRelativeX / 5;
1454                };
1455
1456                base.newPosX = Math.max(Math.min(base.newPosX, minSwipe()), maxSwipe());
1457                if (base.browser.support3d === true) {
1458                    base.transition3d(base.newPosX);
1459                } else {
1460                    base.css2move(base.newPosX);
1461                }
1462            }
1463
1464            function dragEnd(event) {
1465                var ev = event.originalEvent || event || window.event,
1466                    newPosition,
1467                    handlers,
1468                    owlStopEvent;
1469
1470                ev.target = ev.target || ev.srcElement;
1471
1472                locals.dragging = false;
1473
1474                if (base.browser.isTouch !== true) {
1475                    base.$owlWrapper.removeClass("grabbing");
1476                }
1477
1478                if (base.newRelativeX < 0) {
1479                    base.dragDirection = base.owl.dragDirection = "left";
1480                } else {
1481                    base.dragDirection = base.owl.dragDirection = "right";
1482                }
1483
1484                if (base.newRelativeX !== 0) {
1485                    newPosition = base.getNewPosition();
1486                    base.goTo(newPosition, false, "drag");
1487                    if (locals.targetElement === ev.target && base.browser.isTouch !== true) {
1488                        $(ev.target).on("click.disable", function (ev) {
1489                            ev.stopImmediatePropagation();
1490                            ev.stopPropagation();
1491                            ev.preventDefault();
1492                            $(ev.target).off("click.disable");
1493                        });
1494                        handlers = $._data(ev.target, "events").click;
1495                        owlStopEvent = handlers.pop();
1496                        handlers.splice(0, 0, owlStopEvent);
1497                    }
1498                }
1499                swapEvents("off");
1500            }
1501            base.$elem.on(base.ev_types.start, ".owl-wrapper", dragStart);
1502        },
1503
1504        getNewPosition: function () {
1505            var base = this,
1506                newPosition = base.closestItem();
1507
1508            if (newPosition > base.maximumItem) {
1509                base.currentItem = base.maximumItem;
1510                newPosition = base.maximumItem;
1511            } else if (base.newPosX >= 0) {
1512                newPosition = 0;
1513                base.currentItem = 0;
1514            }
1515            return newPosition;
1516        },
1517        closestItem: function () {
1518            var base = this,
1519                array = base.options.scrollPerPage === true ? base.pagesInArray : base.positionsInArray,
1520                goal = base.newPosX,
1521                closest = null;
1522
1523            $.each(array, function (i, v) {
1524                if (goal - (base.itemWidth / 20) > array[i + 1] && goal - (base.itemWidth / 20) < v && base.moveDirection() === "left") {
1525                    closest = v;
1526                    if (base.options.scrollPerPage === true) {
1527                        base.currentItem = $.inArray(closest, base.positionsInArray);
1528                    } else {
1529                        base.currentItem = i;
1530                    }
1531                } else if (goal + (base.itemWidth / 20) < v && goal + (base.itemWidth / 20) > (array[i + 1] || array[i] - base.itemWidth) && base.moveDirection() === "right") {
1532                    if (base.options.scrollPerPage === true) {
1533                        closest = array[i + 1] || array[array.length - 1];
1534                        base.currentItem = $.inArray(closest, base.positionsInArray);
1535                    } else {
1536                        closest = array[i + 1];
1537                        base.currentItem = i + 1;
1538                    }
1539                }
1540            });
1541            return base.currentItem;
1542        },
1543
1544        moveDirection: function () {
1545            var base = this,
1546                direction;
1547            if (base.newRelativeX < 0) {
1548                direction = "right";
1549                base.playDirection = "next";
1550            } else {
1551                direction = "left";
1552                base.playDirection = "prev";
1553            }
1554            return direction;
1555        },
1556
1557        customEvents: function () {
1558            /*jslint unparam: true*/
1559            var base = this;
1560            base.$elem.on("owl.next", function () {
1561                base.next();
1562            });
1563            base.$elem.on("owl.prev", function () {
1564                base.prev();
1565            });
1566            base.$elem.on("owl.play", function (event, speed) {
1567                base.options.autoPlay = speed;
1568                base.play();
1569                base.hoverStatus = "play";
1570            });
1571            base.$elem.on("owl.stop", function () {
1572                base.stop();
1573                base.hoverStatus = "stop";
1574            });
1575            base.$elem.on("owl.goTo", function (event, item) {
1576                base.goTo(item);
1577            });
1578            base.$elem.on("owl.jumpTo", function (event, item) {
1579                base.jumpTo(item);
1580            });
1581        },
1582
1583        stopOnHover: function () {
1584            var base = this;
1585            if (base.options.stopOnHover === true && base.browser.isTouch !== true && base.options.autoPlay !== false) {
1586                base.$elem.on("mouseover", function () {
1587                    base.stop();
1588                });
1589                base.$elem.on("mouseout", function () {
1590                    if (base.hoverStatus !== "stop") {
1591                        base.play();
1592                    }
1593                });
1594            }
1595        },
1596
1597        lazyLoad: function () {
1598            var base = this,
1599                i,
1600                $item,
1601                itemNumber,
1602                $lazyImg,
1603                follow;
1604
1605            if (base.options.lazyLoad === false) {
1606                return false;
1607            }
1608            for (i = 0; i < base.itemsAmount; i += 1) {
1609                $item = $(base.$owlItems[i]);
1610
1611                if ($item.data("owl-loaded") === "loaded") {
1612                    continue;
1613                }
1614
1615                itemNumber = $item.data("owl-item");
1616                $lazyImg = $item.find(".lazyOwl");
1617
1618                if (typeof $lazyImg.data("src") !== "string") {
1619                    $item.data("owl-loaded", "loaded");
1620                    continue;
1621                }
1622                if ($item.data("owl-loaded") === undefined) {
1623                    $lazyImg.hide();
1624                    $item.addClass("loading").data("owl-loaded", "checked");
1625                }
1626                if (base.options.lazyFollow === true) {
1627                    follow = itemNumber >= base.currentItem;
1628                } else {
1629                    follow = true;
1630                }
1631                if (follow && itemNumber < base.currentItem + base.options.items && $lazyImg.length) {
1632                    base.lazyPreload($item, $lazyImg);
1633                }
1634            }
1635        },
1636
1637        lazyPreload: function ($item, $lazyImg) {
1638            var base = this,
1639                iterations = 0,
1640                isBackgroundImg;
1641
1642            if ($lazyImg.prop("tagName") === "DIV") {
1643                $lazyImg.css("background-image", "url(" + $lazyImg.data("src") + ")");
1644                isBackgroundImg = true;
1645            } else {
1646                $lazyImg[0].src = $lazyImg.data("src");
1647            }
1648
1649            function showImage() {
1650                $item.data("owl-loaded", "loaded").removeClass("loading");
1651                $lazyImg.removeAttr("data-src");
1652                if (base.options.lazyEffect === "fade") {
1653                    $lazyImg.fadeIn(400);
1654                } else {
1655                    $lazyImg.show();
1656                }
1657                if (typeof base.options.afterLazyLoad === "function") {
1658                    base.options.afterLazyLoad.apply(this, [base.$elem]);
1659                }
1660            }
1661
1662            function checkLazyImage() {
1663                iterations += 1;
1664                if (base.completeImg($lazyImg.get(0)) || isBackgroundImg === true) {
1665                    showImage();
1666                } else if (iterations <= 100) {//if image loads in less than 10 seconds 
1667                    window.setTimeout(checkLazyImage, 100);
1668                } else {
1669                    showImage();
1670                }
1671            }
1672
1673            checkLazyImage();
1674        },
1675
1676        autoHeight: function () {
1677            var base = this,
1678                $currentimg = $(base.$owlItems[base.currentItem]).find("img"),
1679                iterations;
1680
1681            function addHeight() {
1682                var $currentItem = $(base.$owlItems[base.currentItem]).height();
1683                base.wrapperOuter.css("height", $currentItem + "px");
1684                if (!base.wrapperOuter.hasClass("autoHeight")) {
1685                    window.setTimeout(function () {
1686                        base.wrapperOuter.addClass("autoHeight");
1687                    }, 0);
1688                }
1689            }
1690
1691            function checkImage() {
1692                iterations += 1;
1693                if (base.completeImg($currentimg.get(0))) {
1694                    addHeight();
1695                } else if (iterations <= 100) { //if image loads in less than 10 seconds 
1696                    window.setTimeout(checkImage, 100);
1697                } else {
1698                    base.wrapperOuter.css("height", ""); //Else remove height attribute
1699                }
1700            }
1701
1702            if ($currentimg.get(0) !== undefined) {
1703                iterations = 0;
1704                checkImage();
1705            } else {
1706                addHeight();
1707            }
1708        },
1709
1710        completeImg: function (img) {
1711            var naturalWidthType;
1712
1713            if (!img.complete) {
1714                return false;
1715            }
1716            naturalWidthType = typeof img.naturalWidth;
1717            if (naturalWidthType !== "undefined" && img.naturalWidth === 0) {
1718                return false;
1719            }
1720            return true;
1721        },
1722
1723        onVisibleItems: function () {
1724            var base = this,
1725                i;
1726
1727            if (base.options.addClassActive === true) {
1728                base.$owlItems.removeClass("active");
1729            }
1730            base.visibleItems = [];
1731            for (i = base.currentItem; i < base.currentItem + base.options.items; i += 1) {
1732                base.visibleItems.push(i);
1733
1734                if (base.options.addClassActive === true) {
1735                    $(base.$owlItems[i]).addClass("active");
1736                }
1737            }
1738            base.owl.visibleItems = base.visibleItems;
1739        },
1740
1741        transitionTypes: function (className) {
1742            var base = this;
1743            //Currently available: "fade", "backSlide", "goDown", "fadeUp"
1744            base.outClass = "owl-" + className + "-out";
1745            base.inClass = "owl-" + className + "-in";
1746        },
1747
1748        singleItemTransition: function () {
1749            var base = this,
1750                outClass = base.outClass,
1751                inClass = base.inClass,
1752                $currentItem = base.$owlItems.eq(base.currentItem),
1753                $prevItem = base.$owlItems.eq(base.prevItem),
1754                prevPos = Math.abs(base.positionsInArray[base.currentItem]) + base.positionsInArray[base.prevItem],
1755                origin = Math.abs(base.positionsInArray[base.currentItem]) + base.itemWidth / 2,
1756                animEnd = 'webkitAnimationEnd oAnimationEnd MSAnimationEnd animationend';
1757
1758            base.isTransition = true;
1759
1760            base.$owlWrapper
1761                .addClass('owl-origin')
1762                .css({
1763                    "-webkit-transform-origin": origin + "px",
1764                    "-moz-perspective-origin": origin + "px",
1765                    "perspective-origin": origin + "px"
1766                });
1767            function transStyles(prevPos) {
1768                return {
1769                    "position": "relative",
1770                    "left": prevPos + "px"
1771                };
1772            }
1773
1774            $prevItem
1775                .css(transStyles(prevPos, 10))
1776                .addClass(outClass)
1777                .on(animEnd, function () {
1778                    base.endPrev = true;
1779                    $prevItem.off(animEnd);
1780                    base.clearTransStyle($prevItem, outClass);
1781                });
1782
1783            $currentItem
1784                .addClass(inClass)
1785                .on(animEnd, function () {
1786                    base.endCurrent = true;
1787                    $currentItem.off(animEnd);
1788                    base.clearTransStyle($currentItem, inClass);
1789                });
1790        },
1791
1792        clearTransStyle: function (item, classToRemove) {
1793            var base = this;
1794            item.css({
1795                "position": "",
1796                "left": ""
1797            }).removeClass(classToRemove);
1798
1799            if (base.endPrev && base.endCurrent) {
1800                base.$owlWrapper.removeClass('owl-origin');
1801                base.endPrev = false;
1802                base.endCurrent = false;
1803                base.isTransition = false;
1804            }
1805        },
1806
1807        owlStatus: function () {
1808            var base = this;
1809            base.owl = {
1810                "userOptions": base.userOptions,
1811                "baseElement": base.$elem,
1812                "userItems": base.$userItems,
1813                "owlItems": base.$owlItems,
1814                "currentItem": base.currentItem,
1815                "prevItem": base.prevItem,
1816                "visibleItems": base.visibleItems,
1817                "isTouch": base.browser.isTouch,
1818                "browser": base.browser,
1819                "dragDirection": base.dragDirection
1820            };
1821        },
1822
1823        clearEvents: function () {
1824            var base = this;
1825            base.$elem.off(".owl owl mousedown.disableTextSelect");
1826            $(document).off(".owl owl");
1827            $(window).off("resize", base.resizer);
1828        },
1829
1830        unWrap: function () {
1831            var base = this;
1832            if (base.$elem.children().length !== 0) {
1833                base.$owlWrapper.unwrap();
1834                base.$userItems.unwrap().unwrap();
1835                if (base.owlControls) {
1836                    base.owlControls.remove();
1837                }
1838            }
1839            base.clearEvents();
1840            base.$elem
1841                .attr("style", base.$elem.data("owl-originalStyles") || "")
1842                .attr("class", base.$elem.data("owl-originalClasses"));
1843        },
1844
1845        destroy: function () {
1846            var base = this;
1847            base.stop();
1848            window.clearInterval(base.checkVisible);
1849            base.unWrap();
1850            base.$elem.removeData();
1851        },
1852
1853        reinit: function (newOptions) {
1854            var base = this,
1855                options = $.extend({}, base.userOptions, newOptions);
1856            base.unWrap();
1857            base.init(options, base.$elem);
1858        },
1859
1860        addItem: function (htmlString, targetPosition) {
1861            var base = this,
1862                position;
1863
1864            if (!htmlString) { return false; }
1865
1866            if (base.$elem.children().length === 0) {
1867                base.$elem.append(htmlString);
1868                base.setVars();
1869                return false;
1870            }
1871            base.unWrap();
1872            if (targetPosition === undefined || targetPosition === -1) {
1873                position = -1;
1874            } else {
1875                position = targetPosition;
1876            }
1877            if (position >= base.$userItems.length || position === -1) {
1878                base.$userItems.eq(-1).after(htmlString);
1879            } else {
1880                base.$userItems.eq(position).before(htmlString);
1881            }
1882
1883            base.setVars();
1884        },
1885
1886        removeItem: function (targetPosition) {
1887            var base = this,
1888                position;
1889
1890            if (base.$elem.children().length === 0) {
1891                return false;
1892            }
1893            if (targetPosition === undefined || targetPosition === -1) {
1894                position = -1;
1895            } else {
1896                position = targetPosition;
1897            }
1898
1899            base.unWrap();
1900            base.$userItems.eq(position).remove();
1901            base.setVars();
1902        }
1903
1904    };
1905
1906    $.fn.owlCarousel = function (options) {
1907        return this.each(function () {
1908            if ($(this).data("owl-init") === true) {
1909                return false;
1910            }
1911            $(this).data("owl-init", true);
1912            var carousel = Object.create(Carousel);
1913            carousel.init(options, this);
1914            $.data(this, "owlCarousel", carousel);
1915        });
1916    };
1917
1918    $.fn.owlCarousel.options = {
1919
1920        items: 5,
1921        itemsCustom: false,
1922        itemsDesktop: [1199, 4],
1923        itemsDesktopSmall: [979, 3],
1924        itemsTablet: [768, 2],
1925        itemsTabletSmall: false,
1926        itemsMobile: [479, 1],
1927        singleItem: false,
1928        itemsScaleUp: false,
1929
1930        slideSpeed: 200,
1931        paginationSpeed: 800,
1932        rewindSpeed: 1000,
1933
1934        autoPlay: false,
1935        stopOnHover: false,
1936
1937        navigation: false,
1938        navigationText: ["prev", "next"],
1939        rewindNav: true,
1940        scrollPerPage: false,
1941
1942        pagination: true,
1943        paginationNumbers: false,
1944
1945        responsive: true,
1946        responsiveRefreshRate: 200,
1947        responsiveBaseWidth: window,
1948
1949        baseClass: "owl-carousel",
1950        theme: "owl-theme",
1951
1952        lazyLoad: false,
1953        lazyFollow: true,
1954        lazyEffect: "fade",
1955
1956        autoHeight: false,
1957
1958        jsonPath: false,
1959        jsonSuccess: false,
1960
1961        dragBeforeAnimFinish: true,
1962        mouseDrag: false,
1963        touchDrag: true,
1964
1965        addClassActive: false,
1966        transitionStyle: false,
1967
1968        beforeUpdate: false,
1969        afterUpdate: false,
1970        beforeInit: false,
1971        afterInit: false,
1972        beforeMove: false,
1973        afterMove: false,
1974        afterAction: false,
1975        startDragging: false,
1976        afterLazyLoad: false
1977    };
1978}(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.