Commit 129539e0 authored by Kushal Pandya's avatar Kushal Pandya

Merge branch 'remove-DOMContentLoaded-commit-Pages' into 'master'

Remove DOMContentLoaded Eventlisteners

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