1document.addEventListener("DOMContentLoaded", function() { 2 const loginForm = document.getElementById("loginform"); 3 if (loginForm) { 4 // Create the parent container 5 const container = document.createElement('span'); 6 container.classList.add('caseproof-social-login-footer'); 7 8 // Add social login buttons 9 cspfslConfig.providers.forEach(provider => { 10 const button = document.createElement('span'); 11 button.className = `${provider.id}-login-btn`; 12 button.type = 'button'; 13 14 const iconSpan = document.createElement('span'); 15 iconSpan.className = 'icon'; 16 button.prepend(iconSpan); 17 18 const textSpan = document.createElement('span'); 19 textSpan.className = 'text'; 20 textSpan.textContent = cspfslConfig.loginText + ' ' + provider.name; 21 button.append(textSpan); 22 23 const link = document.createElement("a"); 24 link.classList.add("cspfsl-social-login-btn"); 25 26 link.href = `${provider.url}`; 27 28 link.append(button); 29 container.append(link); 30 }); 31 32 // Add error message if exists. 33 if (cspfslConfig.errorMessage) { 34 const errorDiv = document.createElement('div'); 35 errorDiv.className = 'notice notice-error'; 36 errorDiv.textContent = cspfslConfig.errorMessage; 37 container.append(errorDiv); 38 } 39 40 // Add OR text. 41 const orDiv = document.createElement('div'); 42 orDiv.className = 'cspfsl-div-content'; 43 const orText = document.createElement('p'); 44 orText.className = 'cspfsl-or-text'; 45 orText.textContent = cspfslConfig.orText; 46 orDiv.style.margin = '20px auto'; 47 orDiv.append(orText); 48 container.append(orDiv); 49 50 // Prepend to login form. 51 loginForm.prepend(container); 52 } 53 54 // Add random values to URL to prevent caching. 55 document.querySelectorAll('.cspfsl-social-login-btn').forEach(function(element) { 56 let url = element.getAttribute('href'); 57 const randomValue1 = Math.random().toString(36).substring(2, 8); 58 const randomValue2 = Math.random().toString(36).substring(2, 15); 59 url += '&' + randomValue1 + '=' + randomValue2; 60 element.setAttribute('href', url); 61 }); 62});
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.