UX: If you ctrl or cmd click a user card link, don't show the card

This commit is contained in:
Robin Ward 2015-03-30 12:08:16 -04:00
parent 28864e74bc
commit 60ab62b73a
1 changed files with 5 additions and 1 deletions

View File

@ -47,7 +47,7 @@ export default Discourse.View.extend(CleansUp, {
return true;
});
var expand = function(username, $target){
var expand = function(username, $target) {
const postId = $target.parents('article').data('post-id');
self.get('controller')
.show(username, postId, $target[0])
@ -60,12 +60,16 @@ export default Discourse.View.extend(CleansUp, {
};
$('#main-outlet').on(clickDataExpand, '[data-user-card]', function(e) {
if (e.ctrlKey || e.metaKey) { return; }
const $target = $(e.currentTarget),
username = $target.data('user-card');
return expand(username, $target);
});
$('#main-outlet').on(clickMention, 'a.mention', function(e) {
if (e.ctrlKey || e.metaKey) { return; }
const $target = $(e.target),
username = $target.text().replace(/^@/, '');
return expand(username, $target);