1// Function to detect mobile device and show appropriate app links 2function detectMobileDevice() { 3 const userAgent = navigator.userAgent || navigator.vendor || window.opera; 4 5 // Check if it's a mobile device 6 if (/android|iphone|ipad|ipod/i.test(userAgent.toLowerCase())) { 7 // Get all mobile app link elements 8 const mobileAppLinks = document.querySelectorAll('.mobile-app-link'); 9 // Get all desktop login buttons 10 const desktopLoginBtns = document.querySelectorAll('.desktop-login-btn'); 11 // Get all mobile browser login messages 12 const mobileBrowserLoginMessages = document.querySelectorAll('.mobile-browser-login-message'); 13 14 // Determine if it's an Android or iOS device 15 const isAndroid = /android/i.test(userAgent); 16 const isIOS = /iphone|ipad|ipod/i.test(userAgent); 17 18 // If we have a mobile device, show the appropriate app links 19 if (isAndroid || isIOS) { 20 // Hide all desktop login buttons 21 desktopLoginBtns.forEach(function(button) { 22 button.style.display = 'none'; 23 }); 24 25 // Show all mobile browser login messages 26 mobileBrowserLoginMessages.forEach(function(message) { 27 message.style.display = 'block'; 28 }); 29 30 mobileAppLinks.forEach(function(element) { 31 const linkElement = element.querySelector('a'); 32 if (linkElement) { 33 // Get the user type from the data attribute 34 const userType = element.getAttribute('data-user-type'); 35 36 // Set the appropriate app link based on device type and user type 37 if (userType && appLinks) { 38 let linkKey = userType + '_' + (isAndroid ? 'android' : 'ios'); 39 if (appLinks[linkKey]) { 40 linkElement.href = appLinks[linkKey]; 41 element.style.display = 'block'; 42 } 43 } 44 } 45 }); 46 } 47 } 48}
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.