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