CoreFiles by mySites.guru
two-factor-switcher.js30 lines, 930 bytes, from Joomla_4.0.2-Stable-Full_Package.zip
Raw History Compare with 4.0.1
md5
aee82e5ae42a583be85fd32f3718c593
sha1
c63ec93f1b46bd6c420c6d6eb86a265e6f7ac587
sha256
5125bbdf808f09c4ec9d8713d7a55a6380a839bf9a951c9452d1acb3b4e5e6ba
/**
 * @copyright   (C) 2018 Open Source Matters, Inc. <https://www.joomla.org>
 * @license     GNU General Public License version 2 or later; see LICENSE.txt
 */
Joomla = window.Joomla || {};

(Joomla => {

  document.addEventListener('DOMContentLoaded', () => {
    Joomla.twoFactorMethodChange = () => {
      const method = document.getElementById('jform_twofactor_method');

      if (method) {
        const selectedPane = `com_users_twofactor_${method.value}`;
        const twoFactorForms = [].slice.call(document.querySelectorAll('#com_users_twofactor_forms_container > div'));
        twoFactorForms.forEach(value => {
          const {
            id
          } = value;

          if (id !== selectedPane) {
            document.getElementById(id).classList.add('hidden');
          } else {
            document.getElementById(id).classList.remove('hidden');
          }
        });
      }
    };
  });
})(Joomla);

The same content is in 47 releases, Joomla 4.0.0-rc1 to 4.2.0-alpha3. See them all, or every version of this file.