debian-mirror-gitlab/app/assets/javascripts/pages/projects/init_blob.js

Ignoring revisions in .git-blame-ignore-revs. Click here to bypass and see the normal blame view.

38 lines
1.6 KiB
JavaScript
Raw Normal View History

2018-12-05 23:21:45 +05:30
import ShortcutsBlob from '~/behaviors/shortcuts/shortcuts_blob';
2021-03-11 19:13:27 +05:30
import ShortcutsNavigation from '~/behaviors/shortcuts/shortcuts_navigation';
2018-03-17 18:26:18 +05:30
import BlobForkSuggestion from '~/blob/blob_fork_suggestion';
2021-03-11 19:13:27 +05:30
import BlobLinePermalinkUpdater from '~/blob/blob_line_permalink_updater';
2022-03-02 08:16:31 +05:30
import LineHighlighter from '~/blob/line_highlighter';
2018-03-17 18:26:18 +05:30
export default () => {
new LineHighlighter(); // eslint-disable-line no-new
2018-11-08 19:23:39 +05:30
// eslint-disable-next-line no-new
new BlobLinePermalinkUpdater(
2018-03-17 18:26:18 +05:30
document.querySelector('#blob-content-holder'),
2022-08-27 11:52:29 +05:30
'.file-line-num[data-line-number], .file-line-num[data-line-number] *',
2018-03-17 18:26:18 +05:30
document.querySelectorAll('.js-data-file-blob-permalink-url, .js-blob-blame-link'),
);
const fileBlobPermalinkUrlElement = document.querySelector('.js-data-file-blob-permalink-url');
2018-12-13 13:39:08 +05:30
const fileBlobPermalinkUrl =
fileBlobPermalinkUrlElement && fileBlobPermalinkUrlElement.getAttribute('href');
2018-03-17 18:26:18 +05:30
new ShortcutsNavigation(); // eslint-disable-line no-new
2018-11-08 19:23:39 +05:30
// eslint-disable-next-line no-new
new ShortcutsBlob({
2018-03-17 18:26:18 +05:30
skipResetBindings: true,
fileBlobPermalinkUrl,
2020-03-13 15:44:24 +05:30
fileBlobPermalinkUrlElement,
2018-03-17 18:26:18 +05:30
});
2018-11-08 19:23:39 +05:30
new BlobForkSuggestion({
2018-03-17 18:26:18 +05:30
openButtons: document.querySelectorAll('.js-edit-blob-link-fork-toggler'),
forkButtons: document.querySelectorAll('.js-fork-suggestion-button'),
cancelButtons: document.querySelectorAll('.js-cancel-fork-suggestion-button'),
suggestionSections: document.querySelectorAll('.js-file-fork-suggestion-section'),
actionTextPieces: document.querySelectorAll('.js-file-fork-suggestion-section-action'),
}).init();
};