1$(function () { 2 3 function scrollToPosition(targetPosition, duration) { 4 const startPosition = window.pageYOffset || document.documentElement.scrollTop; 5 const distance = targetPosition - startPosition; 6 const startTime = performance.now(); 7 8 function easeOutCubic(progress) { 9 return 1 - Math.pow(1 - progress, 3); 10 } 11 12 function animateScroll(currentTime) { 13 const elapsed = currentTime - startTime; 14 const progress = Math.min(elapsed / duration, 1); 15 16 window.scrollTo(0, startPosition + distance * easeOutCubic(progress)); 17 18 if (progress < 1) { 19 window.requestAnimationFrame(animateScroll); 20 } 21 } 22 23 window.requestAnimationFrame(animateScroll); 24 } 25 26 $(".lecturer-list ul.pagination li .scrollToIndex").on("click", function () { 27 const index = $(this).attr('data-scrollTo'); 28 const headerOffset = $('header#page-header').outerHeight() || $('header').outerHeight(); 29 const targetPosition = $("h2#" + index).offset().top - (headerOffset || 0) - 5; 30 31 scrollToPosition(targetPosition, 2000); 32 }); 33 34 /** 35 * lecturer search 36 */ 37 const lecturerSearchForm = $("#lecturer-search"); 38 if (lecturerSearchForm.length > 0) { 39 40 lecturerSearchForm.toggleClass("d-none", false); 41 42 lecturerSearchForm.on('submit', function (event) { 43 const input = $("#lecturer-search input"); 44 input.toggleClass('is-invalid', true); 45 46 event.preventDefault(); 47 }); 48 49 if ($.fn.autoComplete) { 50 $("#lecturer-search input").autoComplete({ 51 noResultsText: '', 52 resolver: 'custom', 53 events: { 54 search: function (qry, callback) { 55 56 const input = $("#lecturer-search input"); 57 input.toggleClass('is-invalid', false); 58 59 const lecturers = []; 60 $(".lecturer-list ul.lecturers li").each((index, el) => { 61 const name = $(el).data("name"); 62 if (name.toLowerCase().includes(qry.toLowerCase())) 63 lecturers.push(name); 64 }); 65 callback(lecturers); 66 } 67 } 68 }).on('autocomplete.select', function(e, val){ 69 const li = $(".lecturer-list ul.lecturers li[data-name='"+val+"']"); 70 window.location.href = li.find("a").attr("href"); 71 }); 72 } 73 74 } 75 76});
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.