PageSourceSearch

https://www.familyoffice.com/themes/custom/f10x/js/login.js?tm76qv

js familyoffice.com collected 2026-10-02 10:04:27 UTC 2,903 bytes, 95 lines download raw bytes

1/**
2 * @file
3 * FOX Login Page JavaScript
4 *
5 * Handles password visibility toggle and form enhancements.
6 */
7
8(function ($, Drupal) {
9  'use strict';
10
11  /**
12   * Toggle password visibility.
13   */
14  Drupal.behaviors.foxLoginPasswordToggle = {
15    attach: function (context, settings) {
16      // Find password fields in login form
17      const passwordFields = context.querySelectorAll('.fox-login-form-section input[type="password"]');
18
19      passwordFields.forEach(function (passwordInput) {
20        // Check if toggle already exists
21        if (passwordInput.parentElement.querySelector('.toggle-password')) {
22          return;
23        }
24
25        // Create wrapper if needed
26        let wrapper = passwordInput.parentElement;
27        if (!wrapper.classList.contains('password-wrapper')) {
28          wrapper = document.createElement('div');
29          wrapper.className = 'password-wrapper';
30          passwordInput.parentElement.insertBefore(wrapper, passwordInput);
31          wrapper.appendChild(passwordInput);
32        }
33
34        // Create toggle button
35        const toggleBtn = document.createElement('button');
36        toggleBtn.type = 'button';
37        toggleBtn.className = 'toggle-password';
38        toggleBtn.textContent = 'Show';
39        toggleBtn.setAttribute('aria-label', 'Toggle password visibility');
40
41        // Add click handler
42        toggleBtn.addEventListener('click', function () {
43          if (passwordInput.type === 'password') {
44            passwordInput.type = 'text';
45            toggleBtn.textContent = 'Hide';
46          } else {
47            passwordInput.type = 'password';
48            toggleBtn.textContent = 'Show';
49          }
50        });
51
52        wrapper.appendChild(toggleBtn);
53      });
54    }
55  };
56
57  /**
58   * Form loading state.
59   */
60  Drupal.behaviors.foxLoginFormState = {
61    attach: function (context, settings) {
62      const loginForm = context.querySelector('.fox-login-form-section form');
63
64      if (loginForm && !loginForm.dataset.foxProcessed) {
65        loginForm.dataset.foxProcessed = 'true';
66
67        loginForm.addEventListener('submit', function (e) {
68          const submitBtn = loginForm.querySelector('input[type="submit"], button[type="submit"]');
69          if (submitBtn) {
70            submitBtn.classList.add('btn-loading');
71            submitBtn.disabled = true;
72          }
73        });
74      }
75    }
76  };
77
78  /**
79   * Auto-focus email field.
80   */
81  Drupal.behaviors.foxLoginAutoFocus = {
82    attach: function (context, settings) {
83      const emailField = context.querySelector('.fox-login-form-section input[type="email"], .fox-login-form-section input[name="name"]');
84
85      if (emailField && !emailField.dataset.foxFocused) {
86        emailField.dataset.foxFocused = 'true';
87        // Small delay to ensure DOM is ready
88        setTimeout(function () {
89          emailField.focus();
90        }, 100);
91      }
92    }
93  };
94
95})(jQuery, Drupal);

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.