From baa2a0748ee15fe8e51f7f980c20980ca0948307 Mon Sep 17 00:00:00 2001 From: Simon Vieille Date: Tue, 13 Oct 2020 14:32:15 +0200 Subject: [PATCH] fix links that must be opened in new window --- templates/js/_topMenuApps.js | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) diff --git a/templates/js/_topMenuApps.js b/templates/js/_topMenuApps.js index 567456a..57b7088 100644 --- a/templates/js/_topMenuApps.js +++ b/templates/js/_topMenuApps.js @@ -108,6 +108,28 @@ var updateTopMenu = function() { k++ }) + // Hack for https://github.com/nextcloud/server/blob/23b0b63c213f5b31eecae817ffd4a9e26f6624d0/core/src/components/MainMenu.js#L74-L96 + menu.undelegate('li:not(#more-apps) > a', 'click') + menu.delegate('li:not(#more-apps) > a', 'click', function(e) { + var a = $(e.target) + + if (!a.is('a')) { + a = a.closest('a') + } + + if (a.attr('target') !== '_blank' && e.which === 1 && !e.ctrlKey && !e.metaKey && a.parent('#more-apps').length === 0) { + a.find('svg').remove() + a.find('div').remove() + a.prepend(jQuery('
').addClass( + OCA.Theming && OCA.Theming.inverted + ? 'icon-loading-small' + : 'icon-loading-small-dark' + )) + + window.location.href = a.attr('href') + } + }) + jQuery('#apps li.app-external-site').each(function(i, app) { app = jQuery(app) var appId = app.attr('data-id')