Commit b97fb5bb 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 b53f0806
import { initCommitBoxInfo } from '~/projects/commit_box/info';
import initPipelines from '~/commit/pipelines/pipelines_bundle';
document.addEventListener('DOMContentLoaded', () => {
initCommitBoxInfo();
initPipelines();
});
initCommitBoxInfo();
initPipelines();
......@@ -15,35 +15,33 @@ import { __ } from '~/locale';
import loadAwardsHandler from '~/awards_handler';
import { initCommitBoxInfo } from '~/projects/commit_box/info';
document.addEventListener('DOMContentLoaded', () => {
const hasPerfBar = document.querySelector('.with-performance-bar');
const performanceHeight = hasPerfBar ? 35 : 0;
initChangesDropdown(document.querySelector('.navbar-gitlab').offsetHeight + performanceHeight);
new ZenMode();
new ShortcutsNavigation();
const hasPerfBar = document.querySelector('.with-performance-bar');
const performanceHeight = hasPerfBar ? 35 : 0;
initChangesDropdown(document.querySelector('.navbar-gitlab').offsetHeight + performanceHeight);
new ZenMode();
new ShortcutsNavigation();
initCommitBoxInfo();
initCommitBoxInfo();
initNotes();
initNotes();
const filesContainer = $('.js-diffs-batch');
const filesContainer = $('.js-diffs-batch');
if (filesContainer.length) {
const batchPath = filesContainer.data('diffFilesPath');
if (filesContainer.length) {
const batchPath = filesContainer.data('diffFilesPath');
axios
.get(batchPath)
.then(({ data }) => {
filesContainer.html($(data.html));
syntaxHighlight(filesContainer);
handleLocationHash();
new Diff();
})
.catch(() => {
flash({ message: __('An error occurred while retrieving diff files') });
});
} else {
new Diff();
}
loadAwardsHandler();
});
axios
.get(batchPath)
.then(({ data }) => {
filesContainer.html($(data.html));
syntaxHighlight(filesContainer);
handleLocationHash();
new Diff();
})
.catch(() => {
flash({ message: __('An error occurred while retrieving diff files') });
});
} else {
new Diff();
}
loadAwardsHandler();
import CommitsList from '~/commits';
import GpgBadges from '~/gpg_badges';
import ShortcutsNavigation from '~/behaviors/shortcuts/shortcuts_navigation';
import mountCommits from '~/projects/commits';
document.addEventListener('DOMContentLoaded', () => {
new CommitsList(document.querySelector('.js-project-commits-show').dataset.commitsLimit); // eslint-disable-line no-new
new ShortcutsNavigation(); // eslint-disable-line no-new
GpgBadges.fetch();
mountCommits(document.getElementById('js-author-dropdown'));
});
new CommitsList(document.querySelector('.js-project-commits-show').dataset.commitsLimit); // eslint-disable-line no-new
new ShortcutsNavigation(); // eslint-disable-line no-new
GpgBadges.fetch();
mountCommits(document.getElementById('js-author-dropdown'));
import initExpiresAtField from '~/access_tokens';
document.addEventListener('DOMContentLoaded', initExpiresAtField);
initExpiresAtField();
import initForm from '../form';
document.addEventListener('DOMContentLoaded', initForm);
initForm();
......@@ -15,31 +15,29 @@ import DueDateSelectors from '~/due_date_select';
import fileUpload from '~/lib/utils/file_upload';
import EEMirrorRepos from './ee_mirror_repos';
document.addEventListener('DOMContentLoaded', () => {
new UsersSelect();
new UserCallout();
new UsersSelect();
new UserCallout();
initDeployKeys();
initSettingsPanels();
initDeployKeys();
initSettingsPanels();
if (document.querySelector('.js-protected-refs-for-users')) {
new ProtectedBranchCreate({ hasLicense: true });
new ProtectedBranchEditList();
if (document.querySelector('.js-protected-refs-for-users')) {
new ProtectedBranchCreate({ hasLicense: true });
new ProtectedBranchEditList();
new ProtectedTagCreate();
new ProtectedTagEditList();
} else {
new ProtectedBranchCreate({ hasLicense: false });
new CEProtectedBranchEditList();
new ProtectedTagCreate();
new ProtectedTagEditList();
} else {
new ProtectedBranchCreate({ hasLicense: false });
new CEProtectedBranchEditList();
new CEProtectedTagCreate();
new CEProtectedTagEditList();
}
new CEProtectedTagCreate();
new CEProtectedTagEditList();
}
const pushPullContainer = document.querySelector('.js-mirror-settings');
if (pushPullContainer) new EEMirrorRepos(pushPullContainer).init();
const pushPullContainer = document.querySelector('.js-mirror-settings');
if (pushPullContainer) new EEMirrorRepos(pushPullContainer).init();
new DueDateSelectors();
new DueDateSelectors();
fileUpload('.js-choose-file', '.js-object-map-input');
});
fileUpload('.js-choose-file', '.js-object-map-input');
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