1function monstra_program_showAlert() { 2 alert("Alert from JS file monstra program js"); 3} //test_js_file 4let slideIndex = 1; 5let slideIndexMax = 0; 6jQuery(document).ready(function() { 7 slideIndex = 1; 8 slideIndexMax = jQuery(".program_btn_block").length; 9 let timeOut = 0; 10 // console.log(jQuery(".program_btn_block").length); 11}); 12/**IN TESTS */ 13function plusSlides(n) { 14 let step = n 15 showSlides(step, slideIndex += n); 16} 17 18function showSlides(step, n) { 19 console.log(step); 20 console.log(n); 21 jQuery(".program_section_slide_row").find(".program_btn_visible").removeClass("program_btn_visible"); 22 for(let stepping = n; stepping < (n + 5); stepping++) { 23 jQuery("#btn_section_" + stepping).addClass("program_btn_visible"); 24 } 25} 26jQuery(document).ready(function($) { 27 let currentIndex = 0; 28 29 function getItemsPerPage() { 30 return $(window).width() < 768 ? 2 : 4; 31 } 32 const totalItems = $('.program_btn_slider_block').length; 33 34 let dragStartX = 0; 35 let isDragging = false; 36 37 function updateCarousel() { 38 const itemsPerPage = getItemsPerPage(); 39 const maxIndex = Math.ceil(totalItems / itemsPerPage) - 1; 40 if(currentIndex > maxIndex) { 41 currentIndex = maxIndex; 42 } 43 const containerWidth = $('.program_section_slide_row').parent().outerWidth(true); 44 const itemWidth = containerWidth / itemsPerPage; 45 const offset = -(currentIndex * itemsPerPage * itemWidth); 46 $('.program_section_slide_row').css({ 47 'transform': `translateX(${offset}px)`, 48 'transition': 'transform 0.3s ease' 49 }); 50 if(currentIndex === 0) { 51 $('.section_btn_prev').css('opacity', '0.3').prop('disabled', true); 52 } else { 53 $('.section_btn_prev').css('opacity', '1').prop('disabled', false); 54 } 55 if(currentIndex === maxIndex) { 56 $('.section_btn_next').css('opacity', '0.3').prop('disabled', true); 57 } else { 58 $('.section_btn_next').css('opacity', '1').prop('disabled', false); 59 } 60 } 61 // drag/touch 62 let didDrag = false; 63 64 $('.program_section_slide_row').parent() 65 .on('mousedown touchstart', function(e){ 66 if(e.type === 'mousedown') e.preventDefault(); 67 isDragging = true; 68 didDrag = false; 69 dragStartX = e.type === 'touchstart' ? e.originalEvent.touches[0].clientX : e.clientX; 70 $(this).css('transition', 'none'); 71 }) 72 .on('mousemove touchmove', function(e){ 73 if(!isDragging) return; 74 const x = e.type === 'touchmove' ? e.originalEvent.touches[0].clientX : e.clientX; 75 if(Math.abs(dragStartX - x) > 10) didDrag = true; 76 }) 77 .on('mouseup touchend', function(e){ 78 if(!isDragging) return; 79 isDragging = false; 80 const dragEndX = e.type === 'touchend' ? e.originalEvent.changedTouches[0].clientX : e.clientX; 81 const diff = dragStartX - dragEndX; 82 const itemsPerPage = getItemsPerPage(); 83 const maxIndex = Math.ceil(totalItems / itemsPerPage) - 1; 84 if(diff > 50 && currentIndex < maxIndex) { 85 currentIndex++; 86 } else if(diff < -50 && currentIndex > 0) { 87 currentIndex--; 88 } 89 updateCarousel(); 90 }) 91 .on('mouseleave', function(){ 92 if(isDragging) { 93 isDragging = false; 94 updateCarousel(); 95 } 96 }); 97 98// prevent button clicks when dragging 99$('.program_btn_slider_block button, .program_btn_slider_block a').on('click', function(e){ 100 if(didDrag) { 101 e.preventDefault(); 102 e.stopPropagation(); 103 didDrag = false; 104 } 105}); 106 $('.section_btn_next').on('click', function() { 107 const itemsPerPage = getItemsPerPage(); 108 const maxIndex = Math.ceil(totalItems / itemsPerPage) - 1; 109 if(currentIndex < maxIndex) { 110 currentIndex++; 111 updateCarousel(); 112 } 113 }); 114 $('.section_btn_prev').on('click', function() { 115 if(currentIndex > 0) { 116 currentIndex--; 117 updateCarousel(); 118 } 119 }); 120 $(window).on('resize', function() { 121 currentIndex = 0; 122 updateCarousel(); 123 }); 124 // Initialize 125 updateCarousel(); 126}); 127 128function scrollSlide(n) { 129 // console.log(jQuery("#program_section_slide_row_1").scrollLeft()); 130 // alert($("#program_section_slide_row_1").scrollLeft());
131 let currentPosition = jQuery("#program_section_slide_row_1").scrollLeft(); 132 if(n < 0) { 133 jQuery("#program_section_slide_row_1").scrollLeft(currentPosition - (1000)); 134 } else if(n > 0) { 135 jQuery("#program_section_slide_row_1").scrollLeft(currentPosition + (1000)); 136 } 137 // console.log(jQuery("#program_section_slide_row_1").scrollLeft()); 138 // content.scrollLeft = content_scoll_left; 139}
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.