summaryrefslogtreecommitdiff
path: root/app/assets/javascripts/todos.js.es6
diff options
context:
space:
mode:
authorKushal Pandya <kushal@gitlab.com>2017-02-07 11:20:55 +0530
committerKushal Pandya <kushal@gitlab.com>2017-02-07 21:12:01 +0530
commitf9c23de6de28eaf3a90877a3db9ddd0c5f634b0c (patch)
treef4022b6324f3457c5a961b93465d44062d3e4015 /app/assets/javascripts/todos.js.es6
parent8a4da74030d32cf911f9a293f6774fc12a5e7ae4 (diff)
downloadgitlab-ce-f9c23de6de28eaf3a90877a3db9ddd0c5f634b0c.tar.gz
Use plain JS in `goToTodoUrl`, make comment more concise
Diffstat (limited to 'app/assets/javascripts/todos.js.es6')
-rw-r--r--app/assets/javascripts/todos.js.es615
1 files changed, 8 insertions, 7 deletions
diff --git a/app/assets/javascripts/todos.js.es6 b/app/assets/javascripts/todos.js.es6
index bf84d82af97..5b1b585dfac 100644
--- a/app/assets/javascripts/todos.js.es6
+++ b/app/assets/javascripts/todos.js.es6
@@ -146,20 +146,21 @@
}
goToTodoUrl(e) {
- const todoLink = $(this).data('url');
- let targetLink = $(e.target).attr('href');
+ const todoLink = this.dataset.url;
+ let targetLink = e.target.getAttribute('href');
- if ($(e.target).is('img')) { // See if clicked target was Avatar
- targetLink = $(e.target).parent().attr('href'); // Parent of Avatar is link
+ if (e.target.tagName === 'IMG') { // See if clicked target was Avatar
+ targetLink = e.target.parentElement.getAttribute('href'); // Parent of Avatar is link
}
if (!todoLink) {
return;
}
- // Allow Meta-Click (Cmd+Click or Ctrl+Click)
- // or Mouse3-click (middle-click)
- // to open in a new tab
+ // Allow following special clicks to make link open in new tab
+ // 1) Cmd + Click on Mac (e.metaKey)
+ // 2) Ctrl + Click on PC (e.ctrlKey)
+ // 3) Middle-click or Mouse Wheel Click (e.which is 2)
if (e.metaKey || e.ctrlKey || e.which === 2) {
e.preventDefault();
// Meta-Click on username leads to different URL than todoLink.