1'use strict'; 2angular.module('slick', []).directive('slick', [ 3 '$timeout', 4 function ($timeout) { 5 return { 6 restrict: 'AEC', 7 scope: { 8 initOnload: '@', 9 data: '=', 10 currentIndex: '=', 11 accessibility: '@', 12 adaptiveHeight: '@', 13 arrows: '@', 14 asNavFor: '@', 15 appendArrows: '@', 16 appendDots: '@', 17 autoplay: '@', 18 autoplaySpeed: '@', 19 centerMode: '@', 20 centerPadding: '@', 21 cssEase: '@', 22 customPaging: '&', 23 dots: '@', 24 draggable: '@', 25 easing: '@', 26 fade: '@', 27 focusOnSelect: '@', 28 infinite: '@', 29 initialSlide: '@', 30 lazyLoad: '@', 31 onBeforeChange: '&', 32 onAfterChange: '&', 33 onInit: '&', 34 onReInit: '&', 35 onSetPosition: '&', 36 pauseOnHover: '@', 37 pauseOnDotsHover: '@', 38 responsive: '=', 39 rtl: '@', 40 slide: '@', 41 slidesToShow: '@', 42 slidesToScroll: '@', 43 speed: '@', 44 swipe: '@', 45 swipeToSlide: '@', 46 touchMove: '@', 47 touchThreshold: '@', 48 useCSS: '@', 49 variableWidth: '@', 50 vertical: '@', 51 prevArrow: '@', 52 nextArrow: '@' 53 }, 54 link: function (scope, element, attrs) { 55 var destroySlick, initializeSlick, isInitialized; 56 destroySlick = function () { 57 return $timeout(function () { 58 var slider; 59 slider = $(element); 60 slider.slick('unslick'); 61 slider.find('.slick-list').remove(); 62 return slider; 63 }); 64 }; 65 initializeSlick = function () { 66 return $timeout(function () { 67 var currentIndex, customPaging, slider; 68 slider = $(element); 69 if (scope.currentIndex != null) { 70 currentIndex = scope.currentIndex; 71 } 72 customPaging = function (slick, index) { 73 return scope.customPaging({ 74 slick: slick, 75 index: index 76 }); 77 }; 78 slider.slick({ 79 accessibility: scope.accessibility !== 'false', 80 adaptiveHeight: scope.adaptiveHeight === 'true', 81 arrows: scope.arrows !== 'false', 82 asNavFor: scope.asNavFor ? scope.asNavFor : void 0, 83 appendArrows: scope.appendArrows ? $(scope.appendArrows) : $(element), 84 appendDots: scope.appendDots ? $(scope.appendDots) : $(element), 85 autoplay: scope.autoplay === 'true', 86 autoplaySpeed: scope.autoplaySpeed != null ? parseInt(scope.autoplaySpeed, 10) : 3000, 87 centerMode: scope.centerMode === 'true', 88 centerPadding: scope.centerPadding || '50px', 89 cssEase: scope.cssEase || 'ease', 90 customPaging: attrs.customPaging ? customPaging : void 0, 91 dots: scope.dots === 'true', 92 draggable: scope.draggable !== 'false', 93 easing: scope.easing || 'linear', 94 fade: scope.fade === 'true',
95 focusOnSelect: scope.focusOnSelect === 'true', 96 infinite: scope.infinite !== 'false', 97 initialSlide: scope.initialSlide || 0, 98 lazyLoad: scope.lazyLoad || 'ondemand', 99 beforeChange: attrs.onBeforeChange ? scope.onBeforeChange : void 0, 100 onReInit: attrs.onReInit ? scope.onReInit : void 0, 101 onSetPosition: attrs.onSetPosition ? scope.onSetPosition : void 0, 102 pauseOnHover: scope.pauseOnHover !== 'false', 103 responsive: scope.responsive || void 0, 104 rtl: scope.rtl === 'true', 105 slide: scope.slide || 'div', 106 slidesToShow: scope.slidesToShow != null ? parseInt(scope.slidesToShow, 10) : 1, 107 slidesToScroll: scope.slidesToScroll != null ? parseInt(scope.slidesToScroll, 10) : 1, 108 speed: scope.speed != null ? parseInt(scope.speed, 10) : 300, 109 swipe: scope.swipe !== 'false', 110 swipeToSlide: scope.swipeToSlide === 'true', 111 touchMove: scope.touchMove !== 'false', 112 touchThreshold: scope.touchThreshold ? parseInt(scope.touchThreshold, 10) : 5, 113 useCSS: scope.useCSS !== 'false', 114 variableWidth: scope.variableWidth === 'true', 115 vertical: scope.vertical === 'true', 116 prevArrow: scope.prevArrow ? $(scope.prevArrow) : void 0, 117 nextArrow: scope.nextArrow ? $(scope.nextArrow) : void 0 118 }); 119 slider.on('init', function (sl) { 120 if (attrs.onInit) { 121 scope.onInit(); 122 } 123 if (currentIndex != null) { 124 return sl.slideHandler(currentIndex); 125 } 126 }); 127 slider.on('afterChange', function (event, slick, currentSlide, nextSlide) { 128 if (scope.onAfterChange) { 129 scope.onAfterChange(); 130 } 131 if (currentIndex != null) { 132 return scope.$apply(function () { 133 currentIndex = currentSlide; 134 return scope.currentIndex = currentSlide; 135 }); 136 } 137 }); 138 return scope.$watch('currentIndex', function (newVal, oldVal) { 139 if (currentIndex != null && newVal != null && newVal !== currentIndex) { 140 return slider.slick('slickGoTo', newVal); 141 } 142 }); 143 }); 144 }; 145 if (scope.initOnload) { 146 isInitialized = false; 147 return scope.$watch('data', function (newVal, oldVal) { 148 if (newVal != null) { 149 if (isInitialized) { 150 destroySlick(); 151 } 152 initializeSlick(); 153 return isInitialized = true; 154 } 155 }); 156 } else { 157 return initializeSlick(); 158 } 159 } 160 }; 161 } 162]);
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.