1jQuery(document).ready(function($) { 2 3 var carouselIds = new Array(); 4 5 $(".owl-carousel").each(function() { 6 carouselIds.push($(this).attr("id")); 7 }); 8 9 for (var i in carouselIds) { 10 var params = {}; 11 var datas = $(document.getElementById(carouselIds[i])).data(); 12 for (var paramName in datas) { 13 var data = $(document.getElementById(carouselIds[i])).data(paramName); 14 if (data !== "") { 15 // If it's an array (contains comma) parse the string to array 16 if(String(data).indexOf(",") > -1) { 17 data = data.split(","); 18 } 19 20 // New random param not available in Owl Carousel 21 if(paramName == "random") { 22 params[owlCarouselParamName("beforeInit")] = function(elem) { 23 random(elem); 24 }; 25 } else { 26 params[owlCarouselParamName(paramName)] = data; 27 } 28 } 29 } 30 31 $(document.getElementById(carouselIds[i])).owlCarousel(params); 32 } 33 34 /** 35 * Sort random function 36 * @param {Selector} owlSelector Owl Carousel selector 37 */ 38 function random(owlSelector){ 39 owlSelector.children().sort(function(){ 40 return Math.round(Math.random()) - 0.5; 41 }).each(function(){ 42 $(this).appendTo(owlSelector); 43 }); 44 } 45 46}); 47 48/** 49 * Fix Owl Carousel parameter name case. 50 * @param {String} paramName Parameter name 51 * @returns {String} Fixed parameter name 52 */ 53function owlCarouselParamName(paramName) { 54 55 var parameterArray = { 56 ADDCLASSACTIVE: "addClassActive", 57 AFTERACTION: "afterAction", 58 AFTERINIT: "afterInit", 59 AFTERLAZYLOAD: "afterLazyLoad", 60 AFTERMOVE: "afterMove", 61 AFTERUPDATE: "afterUpdate", 62 AUTOHEIGHT: "autoHeight", 63 AUTOPLAY: "autoPlay", 64 BASECLASS: "baseClass", 65 BEFOREINIT: "beforeInit", 66 BEFOREMOVE: "beforeMove", 67 BEFOREUPDATE: "beforeUpdate", 68 DRAGBEFOREANIMFINISH: "dragBeforeAnimFinish", 69 ITEMS: "items", 70 ITEMSCUSTOM: "itemsCustom", 71 ITEMSDESKTOP: "itemsDesktop", 72 ITEMSDESKTOPSMALL: "itemsDesktopSmall", 73 ITEMSMOBILE: "itemsMobile", 74 ITEMSSCALEUP: "itemsScaleUp", 75 ITEMSTABLET: "itemsTablet", 76 ITEMSTABLETSMALL: "itemsTabletSmall", 77 JSONPATH: "jsonPath", 78 JSONSUCCESS: "jsonSuccess", 79 LAZYLOAD: "lazyLoad", 80 LAZYFOLLOW: "lazyFollow", 81 LAZYEFFECT: "lazyEffect", 82 MOUSEDRAG: "mouseDrag", 83 NAVIGATION: "navigation", 84 NAVIGATIONTEXT: "navigationText", 85 PAGINATION: "pagination", 86 PAGINATIONNUMBERS: "paginationNumbers", 87 PAGINATIONSPEED: "paginationSpeed", 88 RESPONSIVE: "responsive", 89 RESPONSIVEBASEWIDTH: "responsiveBaseWidth", 90 RESPONSIVEREFRESHRATE: "responsiveRefreshRate", 91 REWINDNAV: "rewindNav", 92 REWINDSPEED: "rewindSpeed", 93 SCROLLPERPAGE: "scrollPerPage", 94 SINGLEITEM: "singleItem", 95 SLIDESPEED: "slideSpeed", 96 STARTDRAGGING: "startDragging", 97 STOPONHOVER: "stopOnHover", 98 THEME: "theme", 99 TOUCHDRAG: "touchDrag", 100 TRANSITIONSTYLE: "transitionStyle", 101 }; 102 103 return parameterArray[paramName.toUpperCase()]; 104}
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.