1window.jQuery(document).ready(function() { 2 var $ = window.jQuery; 3 var cupoSliderAnimationDuration = 1000; 4 var cupoSliderDelay = 6000; 5 var stopCupoSlider = false; 6 var currentCupoSlideProgressId = null; 7 var cupoSlideInProgress = false; 8 9 function endlessSlide() { 10 if (stopCupoSlider) { 11 return; 12 } 13 14 var itemCount = $('.cupo-notification_list .cupo-notification_list_item').length; 15 16 if (itemCount > 1) { 17 setTimeout(function() { 18 if (stopCupoSlider) { 19 return; 20 } 21 22 $currentActive = $('.cupo-notification_list_item.active'); 23 24 var indexPosition = getIndexPosition($currentActive.data()); 25 var nextItemToSlide = indexPosition < itemCount ? indexPosition + 1 : 1; 26 27 slideNotification(nextItemToSlide); 28 29 setTimeout(function () { 30 endlessSlide(); 31 }, cupoSliderAnimationDuration); 32 }, cupoSliderDelay); 33 } 34 } 35 36 function getIndexPosition(dataset) { 37 if (typeof dataset === 'object' && dataset.hasOwnProperty('indexPosition')) { 38 return parseInt(dataset.indexPosition, 10); 39 } 40 41 return null; 42 } 43 44 function slideNotification(indexPosition) { 45 if (cupoSlideInProgress) { 46 return; 47 } 48 49 cupoSlideInProgress = true; 50 51 $('.cupo-notification_counter_item').removeClass('active'); 52 $('.cupo-notification_counter_item-' + indexPosition).addClass('active'); 53 54 var $toHide = $('.cupo-notification_list_item.active'); 55 var $toShow = $('.cupo-notification_list_item-' + indexPosition); 56 57 $toHide.animate({ left: '-100%'}, 800); 58 $toShow.css('left', '100%').animate({ left: '0'}, 800); 59 60 setTimeout(function() { 61 $toHide.removeClass('active'); 62 $toShow.addClass('active'); 63 64 $('.cupo-notification_list_item').removeAttr('style'); 65 66 setTimeout(function() { 67 cupoSlideInProgress = false; 68 }, 100); 69 }, cupoSliderAnimationDuration); 70 } 71 72 $('.cupo-notification_counter_item').on('click', function(e) { 73 if (cupoSlideInProgress) { 74 return; 75 } 76 77 var indexPosition = getIndexPosition($(this).data()); 78 var slideProgressId = 'cupo-slide-' + new Date().getTime(); 79 80 stopCupoSlider = true; 81 currentCupoSlideProgressId = slideProgressId; 82 83 if (typeof indexPosition === 'number') { 84 slideNotification(indexPosition); 85 86 setTimeout(function() { 87 if (slideProgressId === currentCupoSlideProgressId) { 88 currentCupoSlideProgressId = null; 89 stopCupoSlider = false;
90 endlessSlide(); 91 } 92 }, 2 * (cupoSliderAnimationDuration + cupoSliderDelay)); 93 } 94 }); 95 96 endlessSlide(); 97});
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.