summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-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.