diff options
author | GitLab Bot <gitlab-bot@gitlab.com> | 2022-01-20 12:16:11 +0300 |
---|---|---|
committer | GitLab Bot <gitlab-bot@gitlab.com> | 2022-01-20 12:16:11 +0300 |
commit | edaa33dee2ff2f7ea3fac488d41558eb5f86d68c (patch) | |
tree | 11f143effbfeba52329fb7afbd05e6e2a3790241 /app/assets/javascripts/tree.js | |
parent | d8a5691316400a0f7ec4f83832698f1988eb27c1 (diff) |
Add latest changes from gitlab-org/gitlab@14-7-stable-eev14.7.0-rc42
Diffstat (limited to 'app/assets/javascripts/tree.js')
-rw-r--r-- | app/assets/javascripts/tree.js | 64 |
1 files changed, 0 insertions, 64 deletions
diff --git a/app/assets/javascripts/tree.js b/app/assets/javascripts/tree.js deleted file mode 100644 index 58bff370fa5..00000000000 --- a/app/assets/javascripts/tree.js +++ /dev/null @@ -1,64 +0,0 @@ -/* eslint-disable func-names, consistent-return, one-var, class-methods-use-this */ - -import $ from 'jquery'; -import { visitUrl } from './lib/utils/url_utility'; - -export default class TreeView { - constructor() { - this.initKeyNav(); - // Code browser tree slider - // Make the entire tree-item row clickable, but not if clicking another link (like a commit message) - $('.tree-content-holder .tree-item').on('click', function (e) { - const $clickedEl = $(e.target); - const path = $('.tree-item-file-name a', this).attr('href'); - if (!$clickedEl.is('a') && !$clickedEl.is('.str-truncated')) { - if (e.metaKey || e.which === 2) { - e.preventDefault(); - return window.open(path, '_blank'); - } - return visitUrl(path); - } - }); - // Show the "Loading commit data" for only the first element - $('span.log_loading').first().removeClass('hide'); - } - - initKeyNav() { - const li = $('tr.tree-item'); - let liSelected = null; - return $('body').keydown((e) => { - let next, path; - if ($('input:focus').length > 0 && (e.which === 38 || e.which === 40)) { - return false; - } - if (e.which === 40) { - if (liSelected) { - next = liSelected.next(); - if (next.length > 0) { - liSelected.removeClass('selected'); - liSelected = next.addClass('selected'); - } - } else { - liSelected = li.eq(0).addClass('selected'); - } - return $(liSelected).focus(); - } else if (e.which === 38) { - if (liSelected) { - next = liSelected.prev(); - if (next.length > 0) { - liSelected.removeClass('selected'); - liSelected = next.addClass('selected'); - } - } else { - liSelected = li.last().addClass('selected'); - } - return $(liSelected).focus(); - } else if (e.which === 13) { - path = $('.tree-item.selected .tree-item-file-name a').attr('href'); - if (path) { - return visitUrl(path); - } - } - }); - } -} |