Commit 3def569d authored by Jannik Lehmann's avatar Jannik Lehmann

Remove obsolete DOMContentLoadedEventListener

parent b424f289
import UsersSelect from '~/users_select'; import UsersSelect from '~/users_select';
document.addEventListener('DOMContentLoaded', () => new UsersSelect()); new UsersSelect(); // eslint-disable-line no-new
import mountImportProjectsTable from '~/import_entities/import_projects'; import mountImportProjectsTable from '~/import_entities/import_projects';
document.addEventListener('DOMContentLoaded', () => { const mountElement = document.getElementById('import-projects-mount-element');
const mountElement = document.getElementById('import-projects-mount-element');
mountImportProjectsTable(mountElement); mountImportProjectsTable(mountElement);
});
import { initClose2faSuccessMessage } from '~/authentication/two_factor_auth'; import { initClose2faSuccessMessage } from '~/authentication/two_factor_auth';
import initProfileAccount from '~/profile/account'; import initProfileAccount from '~/profile/account';
document.addEventListener('DOMContentLoaded', initProfileAccount); initProfileAccount();
initClose2faSuccessMessage(); initClose2faSuccessMessage();
import initConfirmModal from '~/confirm_modal'; import initConfirmModal from '~/confirm_modal';
import AddSshKeyValidation from '~/profile/add_ssh_key_validation'; import AddSshKeyValidation from '~/profile/add_ssh_key_validation';
document.addEventListener('DOMContentLoaded', () => { initConfirmModal();
initConfirmModal();
function initSshKeyValidation() {
const input = document.querySelector('.js-add-ssh-key-validation-input'); const input = document.querySelector('.js-add-ssh-key-validation-input');
if (!input) return; if (!input) return;
...@@ -18,4 +18,6 @@ document.addEventListener('DOMContentLoaded', () => { ...@@ -18,4 +18,6 @@ document.addEventListener('DOMContentLoaded', () => {
confirmSubmit, confirmSubmit,
); );
addSshKeyValidation.register(); addSshKeyValidation.register();
}); }
initSshKeyValidation();
...@@ -2,17 +2,15 @@ import { mount2faRegistration } from '~/authentication/mount_2fa'; ...@@ -2,17 +2,15 @@ import { mount2faRegistration } from '~/authentication/mount_2fa';
import { initRecoveryCodes } from '~/authentication/two_factor_auth'; import { initRecoveryCodes } from '~/authentication/two_factor_auth';
import { parseBoolean } from '~/lib/utils/common_utils'; import { parseBoolean } from '~/lib/utils/common_utils';
document.addEventListener('DOMContentLoaded', () => { const twoFactorNode = document.querySelector('.js-two-factor-auth');
const twoFactorNode = document.querySelector('.js-two-factor-auth'); const skippable = twoFactorNode ? parseBoolean(twoFactorNode.dataset.twoFactorSkippable) : false;
const skippable = twoFactorNode ? parseBoolean(twoFactorNode.dataset.twoFactorSkippable) : false;
if (skippable) { if (skippable) {
const button = `<a class="btn btn-sm btn-warning float-right" data-qa-selector="configure_it_later_button" data-method="patch" href="${twoFactorNode.dataset.two_factor_skip_url}">Configure it later</a>`; const button = `<a class="btn btn-sm btn-warning float-right" data-qa-selector="configure_it_later_button" data-method="patch" href="${twoFactorNode.dataset.two_factor_skip_url}">Configure it later</a>`;
const flashAlert = document.querySelector('.flash-alert'); const flashAlert = document.querySelector('.flash-alert');
if (flashAlert) flashAlert.insertAdjacentHTML('beforeend', button); if (flashAlert) flashAlert.insertAdjacentHTML('beforeend', button);
} }
mount2faRegistration(); mount2faRegistration();
});
initRecoveryCodes(); initRecoveryCodes();
...@@ -7,8 +7,7 @@ import SeriesDataMixin from './series_data_mixin'; ...@@ -7,8 +7,7 @@ import SeriesDataMixin from './series_data_mixin';
const seriesDataToBarData = (raw) => Object.entries(raw).map(([name, data]) => ({ name, data })); const seriesDataToBarData = (raw) => Object.entries(raw).map(([name, data]) => ({ name, data }));
document.addEventListener('DOMContentLoaded', () => { waitForCSSLoaded(() => {
waitForCSSLoaded(() => {
const languagesContainer = document.getElementById('js-languages-chart'); const languagesContainer = document.getElementById('js-languages-chart');
const codeCoverageContainer = document.getElementById('js-code-coverage-chart'); const codeCoverageContainer = document.getElementById('js-code-coverage-chart');
const monthContainer = document.getElementById('js-month-chart'); const monthContainer = document.getElementById('js-month-chart');
...@@ -153,5 +152,4 @@ document.addEventListener('DOMContentLoaded', () => { ...@@ -153,5 +152,4 @@ document.addEventListener('DOMContentLoaded', () => {
}); });
}, },
}); });
});
}); });
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment