1/** 2 * Modern Social Login JavaScript 3 * Handles interactions and loading states for the modern social login interface 4 */ 5(function ($) { 6 "use strict"; 7 8 $(document).ready(function () { 9 // Add loading state when social login is clicked 10 $(".wpuf-social-signin-btn").on("click", function (e) { 11 var $this = $(this); 12 13 // Prevent double-clicks 14 if ($this.hasClass("wpuf-social-loading")) { 15 e.preventDefault(); 16 return false; 17 } 18 19 // Add loading state 20 $this.addClass("wpuf-social-loading"); 21 22 // Remove loading state after 5 seconds (failsafe) 23 setTimeout(function () { 24 $this.removeClass("wpuf-social-loading"); 25 }, 5000); 26 }); 27 28 // Add keyboard navigation support 29 $(".wpuf-social-signin-btn").on("keydown", function (e) { 30 if (e.key === "Enter" || e.key === " ") { 31 e.preventDefault(); 32 $(this)[0].click(); 33 } 34 }); 35 36 // Handle form ID propagation for dynamic forms 37 function updateSocialLinksWithFormId() { 38 var formId = ""; 39 40 // Try to get form ID from various sources 41 var $formIdInput = $('input[name="form_id"]'); 42 if ($formIdInput.length) { 43 formId = $formIdInput.val(); 44 } else { 45 // Check for form ID in URL 46 var urlParams = new URLSearchParams(window.location.search); 47 formId = urlParams.get("form_id") || ""; 48 } 49 50 if (formId) { 51 $(".wpuf-social-signin-btn").each(function () { 52 var href = $(this).attr("href"); 53 if (href && href.indexOf("form_id=") === -1) { 54 var separator = href.indexOf("?") > -1 ? "&" : "?"; 55 $(this).attr( 56 "href", 57 href + separator + "form_id=" + formId, 58 ); 59 } 60 }); 61 } 62 } 63 64 // Update links initially 65 updateSocialLinksWithFormId(); 66 67 // Update links when new forms are loaded (for AJAX forms) 68 $(document).on("wpuf_form_loaded", updateSocialLinksWithFormId); 69 70 // Handle dynamic content loading 71 var observer = new MutationObserver(function (mutations) { 72 mutations.forEach(function (mutation) { 73 if (mutation.addedNodes.length) { 74 updateSocialLinksWithFormId(); 75 } 76 }); 77 }); 78 79 // Start observing 80 observer.observe(document.body, { 81 childList: true, 82 subtree: true, 83 }); 84 }); 85})(jQuery);
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.