From 1ab9477ac1c89821cbf397eacc647ee8be1f3379 Mon Sep 17 00:00:00 2001 From: Thomas Pulzer Date: Fri, 29 Jul 2016 11:31:46 +0200 Subject: [PATCH 1/5] Fixed user menu to not show spinner on ctrl+click. Fixes #616 --- core/js/js.js | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/core/js/js.js b/core/js/js.js index d2bbbae636..31d5b87712 100644 --- a/core/js/js.js +++ b/core/js/js.js @@ -1519,14 +1519,21 @@ function initCore() { function setupUserMenu() { var $menu = $('#header #settings'); + // show loading feedback $menu.delegate('a', 'click', function(event) { var $page = $(event.target); if (!$page.is('a')) { $page = $page.closest('a'); } - $page.find('img').remove(); - $page.find('div').remove(); // prevent odd double-clicks - $page.prepend($('
').addClass('icon-loading-small-dark')); + if(!event.ctrlKey) { + $page.find('img').remove(); + $page.find('div').remove(); // prevent odd double-clicks + $page.prepend($('
').addClass('icon-loading-small-dark')); + } else { + // Close navigation when opening menu entry in + // a new tab + OC.hideMenus(); + } }); } From 8c9961aa22ee07a121382565e5efa679d46f3d36 Mon Sep 17 00:00:00 2001 From: Thomas Pulzer Date: Fri, 29 Jul 2016 14:32:25 +0200 Subject: [PATCH 2/5] Added OS X meta key check for stopping spinning animation in app and user menu. --- core/js/js.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/core/js/js.js b/core/js/js.js index 31d5b87712..2b0b6e2891 100644 --- a/core/js/js.js +++ b/core/js/js.js @@ -1506,7 +1506,7 @@ function initCore() { if(!$app.is('a')) { $app = $app.closest('a'); } - if(!event.ctrlKey) { + if(!event.ctrlKey && !event.metaKey) { $app.addClass('app-loading'); } else { // Close navigation when opening app in @@ -1525,7 +1525,7 @@ function initCore() { if (!$page.is('a')) { $page = $page.closest('a'); } - if(!event.ctrlKey) { + if(!event.ctrlKey && !event.metaKey) { $page.find('img').remove(); $page.find('div').remove(); // prevent odd double-clicks $page.prepend($('
').addClass('icon-loading-small-dark')); From c5033670d5d2b487b621cbc2704b33ec791a13ea Mon Sep 17 00:00:00 2001 From: Thomas Pulzer Date: Thu, 4 Aug 2016 08:28:37 +0200 Subject: [PATCH 3/5] Changed app and user menu delegates to mousedown events. Added proper handling of primary mouse button click with and without ctrl-/meta-key modifier. Added handlig of middle mouse button click. --- core/js/js.js | 17 +++++++++++++---- 1 file changed, 13 insertions(+), 4 deletions(-) diff --git a/core/js/js.js b/core/js/js.js index 2b0b6e2891..f2301928a3 100644 --- a/core/js/js.js +++ b/core/js/js.js @@ -1501,17 +1501,21 @@ function initCore() { $navigation.hide(); // show loading feedback - $navigation.delegate('a', 'click', function(event) { + $navigation.delegate('a', 'mousedown', function(event) { var $app = $(event.target); if(!$app.is('a')) { $app = $app.closest('a'); } - if(!event.ctrlKey && !event.metaKey) { + if(event.which === 1 && !event.ctrlKey && !event.metaKey) { $app.addClass('app-loading'); } else { // Close navigation when opening app in // a new tab OC.hideMenus(); + // On middle click or on first button click with ctrl key or meta key hold + if(event.which === 2 || (event.which === 1 && (event.ctrlKey || event.metaKey))) { + window.open($page, '_blank'); + } } }); } @@ -1520,12 +1524,12 @@ function initCore() { var $menu = $('#header #settings'); // show loading feedback - $menu.delegate('a', 'click', function(event) { + $menu.delegate('a', 'mousedown', function(event) { var $page = $(event.target); if (!$page.is('a')) { $page = $page.closest('a'); } - if(!event.ctrlKey && !event.metaKey) { + if(event.which === 1 && !event.ctrlKey && !event.metaKey) { $page.find('img').remove(); $page.find('div').remove(); // prevent odd double-clicks $page.prepend($('
').addClass('icon-loading-small-dark')); @@ -1533,7 +1537,12 @@ function initCore() { // Close navigation when opening menu entry in // a new tab OC.hideMenus(); + // On middle click or on first button click with ctrl key or meta key hold + if(event.which === 2 || (event.which === 1 && (event.ctrlKey || event.metaKey))) { + window.open($page, '_blank'); + } } + $($page).click(); }); } From b2b7fa485462cb460a19f0dfefbb4d7f87c841e6 Mon Sep 17 00:00:00 2001 From: Thomas Pulzer Date: Thu, 11 Aug 2016 07:22:13 +0200 Subject: [PATCH 4/5] Fixed user and main menu closing on right mouse button click. Fixed wrong variable assignment when trying to open link in new window. --- core/js/js.js | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-) diff --git a/core/js/js.js b/core/js/js.js index f2301928a3..2231ba7388 100644 --- a/core/js/js.js +++ b/core/js/js.js @@ -1509,12 +1509,13 @@ function initCore() { if(event.which === 1 && !event.ctrlKey && !event.metaKey) { $app.addClass('app-loading'); } else { - // Close navigation when opening app in - // a new tab - OC.hideMenus(); // On middle click or on first button click with ctrl key or meta key hold + console.log(event.which); if(event.which === 2 || (event.which === 1 && (event.ctrlKey || event.metaKey))) { - window.open($page, '_blank'); + // Close navigation when opening app in + // a new tab + OC.hideMenus(); + window.open($app, '_blank'); } } }); @@ -1534,11 +1535,11 @@ function initCore() { $page.find('div').remove(); // prevent odd double-clicks $page.prepend($('
').addClass('icon-loading-small-dark')); } else { - // Close navigation when opening menu entry in - // a new tab - OC.hideMenus(); // On middle click or on first button click with ctrl key or meta key hold if(event.which === 2 || (event.which === 1 && (event.ctrlKey || event.metaKey))) { + // Close navigation when opening menu entry in + // a new tab + OC.hideMenus(); window.open($page, '_blank'); } } From 14bf18083713be379862b88b0ac2261bdad12990 Mon Sep 17 00:00:00 2001 From: Faldon Date: Thu, 11 Aug 2016 16:43:07 +0200 Subject: [PATCH 5/5] Removed debug code. --- core/js/js.js | 1 - 1 file changed, 1 deletion(-) diff --git a/core/js/js.js b/core/js/js.js index 2231ba7388..af294d4506 100644 --- a/core/js/js.js +++ b/core/js/js.js @@ -1510,7 +1510,6 @@ function initCore() { $app.addClass('app-loading'); } else { // On middle click or on first button click with ctrl key or meta key hold - console.log(event.which); if(event.which === 2 || (event.which === 1 && (event.ctrlKey || event.metaKey))) { // Close navigation when opening app in // a new tab