Commit 505c04c7 authored by Jannik Lehmann's avatar Jannik Lehmann

Remove DOMContentLoaded Eventlisteners

Removing DOMContentLoaded Eventlisteners from
index files since the scripts
are embedded using the defer tag.
parent 5fa9332d
import CiTemplate from './ci_template'; import CiTemplate from './ci_template';
// eslint-disable-next-line no-new
document.addEventListener('DOMContentLoaded', () => new CiTemplate()); new CiTemplate();
...@@ -38,39 +38,37 @@ const getDropdownConfig = (placeholder, apiPath, textProp) => ({ ...@@ -38,39 +38,37 @@ const getDropdownConfig = (placeholder, apiPath, textProp) => ({
}, },
}); });
document.addEventListener('DOMContentLoaded', () => { groupsSelect();
groupsSelect();
// ElasticSearch // ElasticSearch
const $container = $('#js-elasticsearch-settings'); const $container = $('#js-elasticsearch-settings');
$container $container
.find('.js-limit-checkbox') .find('.js-limit-checkbox')
.on('change', e => .on('change', e =>
onLimitCheckboxChange( onLimitCheckboxChange(
e.currentTarget.checked, e.currentTarget.checked,
$container.find('.js-limit-namespaces'), $container.find('.js-limit-namespaces'),
$container.find('.js-limit-projects'), $container.find('.js-limit-projects'),
), ),
); );
$container $container
.find('.js-elasticsearch-namespaces') .find('.js-elasticsearch-namespaces')
.select2( .select2(
getDropdownConfig( getDropdownConfig(
s__('Elastic|None. Select namespaces to index.'), s__('Elastic|None. Select namespaces to index.'),
Api.namespacesPath, Api.namespacesPath,
'full_path', 'full_path',
), ),
); );
$container $container
.find('.js-elasticsearch-projects') .find('.js-elasticsearch-projects')
.select2( .select2(
getDropdownConfig( getDropdownConfig(
s__('Elastic|None. Select projects to index.'), s__('Elastic|None. Select projects to index.'),
Api.projectsPath, Api.projectsPath,
'name_with_namespace', 'name_with_namespace',
), ),
); );
});
...@@ -36,38 +36,36 @@ const getDropdownConfig = (placeholder, url) => ({ ...@@ -36,38 +36,36 @@ const getDropdownConfig = (placeholder, url) => ({
}, },
}); });
document.addEventListener('DOMContentLoaded', () => { const callout = document.querySelector('.js-admin-integrations-moved');
const callout = document.querySelector('.js-admin-integrations-moved'); PersistentUserCallout.factory(callout);
PersistentUserCallout.factory(callout);
// ElasticSearch // ElasticSearch
const $container = $('#js-elasticsearch-settings'); const $container = $('#js-elasticsearch-settings');
$container $container
.find('.js-limit-checkbox') .find('.js-limit-checkbox')
.on('change', e => .on('change', e =>
onLimitCheckboxChange( onLimitCheckboxChange(
e.currentTarget.checked, e.currentTarget.checked,
$container.find('.js-limit-namespaces'), $container.find('.js-limit-namespaces'),
$container.find('.js-limit-projects'), $container.find('.js-limit-projects'),
), ),
); );
$container $container
.find('.js-elasticsearch-namespaces') .find('.js-elasticsearch-namespaces')
.select2( .select2(
getDropdownConfig( getDropdownConfig(
s__('Elastic|None. Select namespaces to index.'), s__('Elastic|None. Select namespaces to index.'),
'/-/autocomplete/namespace_routes.json', '/-/autocomplete/namespace_routes.json',
), ),
); );
$container $container
.find('.js-elasticsearch-projects') .find('.js-elasticsearch-projects')
.select2( .select2(
getDropdownConfig( getDropdownConfig(
s__('Elastic|None. Select projects to index.'), s__('Elastic|None. Select projects to index.'),
'/-/autocomplete/project_routes.json', '/-/autocomplete/project_routes.json',
), ),
); );
});
import AdminEmailSelect from './admin_email_select'; import AdminEmailSelect from './admin_email_select';
document.addEventListener('DOMContentLoaded', () => { AdminEmailSelect();
AdminEmailSelect();
});
import initGeoSettingsForm from 'ee/geo_settings'; import initGeoSettingsForm from 'ee/geo_settings';
document.addEventListener('DOMContentLoaded', initGeoSettingsForm); initGeoSettingsForm();
import { initEpicForm } from 'ee/epic/new_epic_bundle'; import { initEpicForm } from 'ee/epic/new_epic_bundle';
document.addEventListener('DOMContentLoaded', () => { initEpicForm();
initEpicForm();
});
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