Add utility `isMetaClick` to identify cross-platform meta-click

This commit is contained in:
Kushal Pandya 2017-02-07 21:38:54 +05:30
parent 049ef298e9
commit 36431288a2
1 changed files with 8 additions and 0 deletions

View File

@ -134,6 +134,14 @@
return e.metaKey || e.ctrlKey || e.altKey || e.shiftKey;
};
gl.utils.isMetaClick = function(e) {
// Identify following special clicks
// 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)
return e.metaKey || e.ctrlKey || e.which === 2;
};
gl.utils.scrollToElement = function($el) {
var top = $el.offset().top;
gl.navBarHeight = gl.navBarHeight || $('.navbar-gitlab').height();