Commit c6fcc302 authored by Coung Ngo's avatar Coung Ngo

Delete DOMContentLoaded event listeners

Delete these as they are no longer needed in FE code because
JS files in GitLab have the defer attribute
parent b1ea491d
...@@ -48,4 +48,4 @@ export function initJiraConnect() { ...@@ -48,4 +48,4 @@ export function initJiraConnect() {
}); });
} }
document.addEventListener('DOMContentLoaded', initJiraConnect); initJiraConnect();
import initClustersListApp from '~/clusters_list'; import initClustersListApp from '~/clusters_list';
import PersistentUserCallout from '~/persistent_user_callout'; import PersistentUserCallout from '~/persistent_user_callout';
document.addEventListener('DOMContentLoaded', () => { const callout = document.querySelector('.gcp-signup-offer');
const callout = document.querySelector('.gcp-signup-offer'); PersistentUserCallout.factory(callout);
PersistentUserCallout.factory(callout); initClustersListApp();
initClustersListApp();
});
...@@ -10,21 +10,19 @@ import initSearchSettings from '~/search_settings'; ...@@ -10,21 +10,19 @@ import initSearchSettings from '~/search_settings';
import initSettingsPanels from '~/settings_panels'; import initSettingsPanels from '~/settings_panels';
import initConfirmDanger from '~/init_confirm_danger'; import initConfirmDanger from '~/init_confirm_danger';
document.addEventListener('DOMContentLoaded', () => { initFilePickers();
initFilePickers(); initConfirmDanger();
initConfirmDanger(); initSettingsPanels();
initSettingsPanels(); initTransferGroupForm();
initTransferGroupForm(); dirtySubmitFactory(
dirtySubmitFactory(
document.querySelectorAll('.js-general-settings-form, .js-general-permissions-form'), document.querySelectorAll('.js-general-settings-form, .js-general-permissions-form'),
); );
mountBadgeSettings(GROUP_BADGE); mountBadgeSettings(GROUP_BADGE);
// Initialize Subgroups selector // Initialize Subgroups selector
groupsSelect(); groupsSelect();
projectSelect(); projectSelect();
initSearchSettings(); initSearchSettings();
initCascadingSettingsLockPopovers(); initCascadingSettingsLockPopovers();
});
import initProfilePreferences from '~/profile/preferences/profile_preferences_bundle'; import initProfilePreferences from '~/profile/preferences/profile_preferences_bundle';
document.addEventListener('DOMContentLoaded', initProfilePreferences); initProfilePreferences();
...@@ -10,36 +10,34 @@ import initSharedRunnersToggle from '~/projects/settings/mount_shared_runners_to ...@@ -10,36 +10,34 @@ import initSharedRunnersToggle from '~/projects/settings/mount_shared_runners_to
import initSettingsPanels from '~/settings_panels'; import initSettingsPanels from '~/settings_panels';
import { initTokenAccess } from '~/token_access'; import { initTokenAccess } from '~/token_access';
document.addEventListener('DOMContentLoaded', () => { // Initialize expandable settings panels
// Initialize expandable settings panels initSettingsPanels();
initSettingsPanels();
const runnerToken = document.querySelector('.js-secret-runner-token'); const runnerToken = document.querySelector('.js-secret-runner-token');
if (runnerToken) { if (runnerToken) {
const runnerTokenSecretValue = new SecretValues({ const runnerTokenSecretValue = new SecretValues({
container: runnerToken, container: runnerToken,
}); });
runnerTokenSecretValue.init(); runnerTokenSecretValue.init();
} }
initVariableList(); initVariableList();
// hide extra auto devops settings based checkbox state // hide extra auto devops settings based checkbox state
const autoDevOpsExtraSettings = document.querySelector('.js-extra-settings'); const autoDevOpsExtraSettings = document.querySelector('.js-extra-settings');
const instanceDefaultBadge = document.querySelector('.js-instance-default-badge'); const instanceDefaultBadge = document.querySelector('.js-instance-default-badge');
document.querySelector('.js-toggle-extra-settings').addEventListener('click', (event) => { document.querySelector('.js-toggle-extra-settings').addEventListener('click', (event) => {
const { target } = event; const { target } = event;
if (instanceDefaultBadge) instanceDefaultBadge.style.display = 'none'; if (instanceDefaultBadge) instanceDefaultBadge.style.display = 'none';
autoDevOpsExtraSettings.classList.toggle('hidden', !target.checked); autoDevOpsExtraSettings.classList.toggle('hidden', !target.checked);
}); });
registrySettingsApp(); registrySettingsApp();
initDeployFreeze(); initDeployFreeze();
initSettingsPipelinesTriggers(); initSettingsPipelinesTriggers();
initArtifactsSettings(); initArtifactsSettings();
initSharedRunnersToggle(); initSharedRunnersToggle();
initInstallRunner(); initInstallRunner();
initRunnerAwsDeployments(); initRunnerAwsDeployments();
initTokenAccess(); initTokenAccess();
});
import MirrorRepos from '~/mirrors/mirror_repos'; import MirrorRepos from '~/mirrors/mirror_repos';
import initForm from '../form'; import initForm from '../form';
document.addEventListener('DOMContentLoaded', () => { initForm();
initForm();
const mirrorReposContainer = document.querySelector('.js-mirror-settings'); const mirrorReposContainer = document.querySelector('.js-mirror-settings');
if (mirrorReposContainer) new MirrorRepos(mirrorReposContainer).init(); if (mirrorReposContainer) new MirrorRepos(mirrorReposContainer).init();
});
import initDeprecatedRemoveRowBehavior from '~/behaviors/deprecated_remove_row_behavior'; import initDeprecatedRemoveRowBehavior from '~/behaviors/deprecated_remove_row_behavior';
document.addEventListener('DOMContentLoaded', () => { initDeprecatedRemoveRowBehavior();
initDeprecatedRemoveRowBehavior();
const locks = document.querySelector('.locks'); const locks = document.querySelector('.locks');
locks.addEventListener('ajax:success', () => { locks.addEventListener('ajax:success', () => {
const allRowsHidden = [...locks.querySelectorAll('li')].every((x) => x.offsetParent === null); const allRowsHidden = [...locks.querySelectorAll('li')].every((x) => x.offsetParent === null);
if (allRowsHidden) { if (allRowsHidden) {
locks.querySelector('.nothing-here-block.hidden')?.classList?.remove('hidden'); locks.querySelector('.nothing-here-block.hidden')?.classList?.remove('hidden');
} }
});
}); });
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