1/***************************************************************************** 2 * Handle navigation item click events. 3 * 4 * When a navigation item is clicked, this script removes the 'active' 5 * class from all navigation items and adds the 'active' class to the 6 * clicked item's parent <li> element, ensuring the clicked item is 7 * visually marked as active. 8 * 9 * @param {Event} event - The click event on a navigation link. 10*****************************************************************************/ 11$('.nav-item a').on('click', function () { 12 $('.nav-item').find('li.active').removeClass('active'); 13 $(this).parent('li').addClass('active'); 14}); 15 16/***************************************************************************** 17 * Handle form submission. 18 * 19 * @param {string} buttonId - The ID of the button. 20 * @param {string} formId - The ID of the form. 21*****************************************************************************/ 22function handleFormSubmission(buttonId, formId) { 23 var isValid = $(formId).valid(); 24 if (isValid) { 25 $(buttonId).prop('disabled', true); // Disables visually + functionally 26 $(buttonId).html("<i class=\"fa-solid fa-spinner fa-spin me-2\"></i>"); 27 $(formId).submit(); 28 } 29} 30 31/***************************************************************************** 32 * Handle link sharing functionality. 33 * 34 * @param {Event} event - The click event. 35*****************************************************************************/ 36function shareLink(event) { 37 // Prevent the default link behavior 38 event.preventDefault(); 39 40 // Retrieve data attributes from the clicked element 41 var tenant = $(event.currentTarget).data('tenant'); 42 var title = $(event.currentTarget).data('title'); 43 var id = $(event.currentTarget).data('id'); 44 45 // Check if the clicked element has the 'share-link' class 46 if (!$(event.target).hasClass('share-link')) { 47 // If it's not the share icon, redirect to the link's URL 48 window.location.href = event.currentTarget.href; 49 } else { 50 // If it's the share icon, perform the share action 51 52 // Now use 'title' and 'url' for sharing logic 53 console.log('Tenant:', tenant); 54 console.log('Title:', title); 55 console.log('Id:', id); 56 57 // Example of using the Web Share API 58 if (navigator.share) { 59 navigator.share({ 60 title: title, 61 url: 'https://linknbio.com/'+ tenant +'/link/' + id 62 }).then(() => { 63 console.log('Thanks for sharing with your family and friends!'); 64 }).catch(err => { 65 console.log("Error while using Web share API:"); 66 console.log(err); 67 }); 68 } else { 69 alert("Browser doesn't support this API!"); 70 } 71 } 72} 73 74/***************************************************************************** 75 * Adds click event listeners to all elements with the class 'share-button'. 76 * 77 * @param {Event} event - The DOMContentLoaded event. 78*****************************************************************************/ 79 80document.addEventListener('DOMContentLoaded', (event) => { 81 // Web Share API - Header Section 82 const shareButtons = document.querySelectorAll('.share-button'); 83 84 shareButtons.forEach(button => { 85 button.addEventListener('click', (event) => { 86 // Fallback, Tries to use API only if navigator.share function is available 87 if (navigator.share) { 88 navigator.share({ 89 // Dynamically get the current page title and URL 90 title: document.title, 91 url: window.location.href 92 }).then(() => { 93 console.log('Thanks for sharing with your family and friends!'); 94 }).catch((err) => { 95 // Handle errors, if occurred 96 console.log("Error while using Web share API:"); 97 console.log(err); 98 }); 99 } else { 100 // Alerts user if API not available 101 alert("Browser doesn't support this API!"); 102 } 103 }); 104 });
vendor: 3 bytes, line 105
105});
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.