1angular.module('slider.controllers', []) 2 .controller('dCartuSlider', function ($scope, $timeout) { 3 $scope.hammerPan = false; 4 $scope.panLeftV = false; 5 $scope.panRightV = false; 6 $scope.setScroll = function (){ 7 if (!$scope.hammerPan) 8 $scope.scrollTop = (window.pageYOffset || document.documentElement.scrollTop) - (document.documentElement.clientTop || 0) 9 }; 10 $scope.setScroll(); 11 $(window).on('scroll', function(){ 12 $scope.setScroll(); 13 }); 14 $scope.panEvent = function(e){ 15 if (!$scope.hammerPan) { 16 $scope.scrollTop = $scope.scrollTop - e.deltaY/2; 17 } 18 $scope.hammerPan = true; 19 window.scrollTo(0,$scope.scrollTop - e.deltaY); 20 if (e.isFinal) { 21 $scope.hammerPan = false; 22 $timeout( function(){ $scope.setScroll();}, 300); 23 } 24 }; 25 $scope.visible = true; 26 $scope.config = $scope.slides = []; 27 $scope.init = function (config, slides) { 28 $scope.config = config; 29 if (slides.length) { 30 $scope.slides = slides; 31 } else { 32 $scope.visible = false; 33 } 34 $scope.slideDuration = config.slideDuration; 35 }; 36 $scope.isCurrent = function (index) { 37 return $scope.currentIndex === index; 38 }; 39 $scope.setCurrent = function (index) { 40 $scope.currentIndex = index; 41 $scope.timerReset(); 42 if (typeof logListItems != "undefined") { 43 logListItems.getJsonDataForGtm() 44 } 45 }; 46 $scope.forward = function () { 47 $scope.setCurrent($scope.currentIndex == $scope.slides.length - 1 ? 0 : $scope.currentIndex + 1); 48 }; 49 $scope.backward = function () { 50 $scope.setCurrent($scope.currentIndex == 0 ? $scope.slides.length - 1 : $scope.currentIndex - 1); 51 }; 52 $scope.panLeft = function() { 53 $scope.panLeftV = true; 54 $scope.panRightV = false; 55 }; 56 $scope.panRight = function() { 57 $scope.panLeftV = false; 58 $scope.panRightV = true; 59 }; 60 $scope.panEnd = function() { 61 $scope.panLeftV ? $scope.forward() : $scope.backward(); 62 }; 63 $scope.stop = function () { 64 $timeout.cancel($scope.slideChangeTimer); 65 }; 66 $scope.animateBar = function () { 67 $scope.slideChangeTimer = $timeout(function () { 68 $scope.forward() 69 }, $scope.slideDuration); 70 }; 71 $scope.timerReset = function () { 72 $scope.stop(); 73 74 if (!$(".cartuSlider").is(":hover")) { 75 $timeout.cancel($scope.barAnimation); 76 $scope.barAnimation = $timeout(function () { 77 $scope.animateBar() 78 }, 500); 79 } 80 }; 81 $scope.styleSlider = function(){ 82 if (!$scope.slides.length) return undefined; 83 84 return $scope.slides.length? ($scope.h.m.any ? { 85 'min-height':$scope.bodyWidth * 300 / 525 + 'px', 86 'height':$scope.bodyWidth * 300 / 525 + 'px' 87 } : { 88 }):{}; 89 90 }; 91 $scope.setCurrent(0); 92 93 }) 94 .controller('cartuSlide', function ($scope) { 95 $scope.style = function (slide) { 96 return { 97 'background-image': 'url("' + slide.src + '")' 98 } 99 }; 100 $scope.slideClass = function (index, slide) { 101 return (slide.link ? 'hasLink ' : '') + ($scope.$parent.isCurrent(index) ? 'active' : ''); 102 }; 103 $scope.prodStyle = function (p) { 104 return { 105 'background-image': 'url(' + p.src + ')' 106 } 107 }; 108 $scope.scaleFactor = function () { 109 var bodyWidth = $scope.bodyWidth, 110 scaleFactor = (bodyWidth * .001077844311377246) - .1867065868263473; 111 return (bodyWidth > 599 && bodyWidth < 768) ? { 112 'transform': 'scale(' + ((bodyWidth * .001077844311377246) - .1867065868263473) + ')',
113 '-webkit-transform': 'scale(' + scaleFactor + ')', 114 } : {} 115 }; 116 }) 117;
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.