Merge pull request #778 from nextcloud/Faldon-user_menu_ui
Fixing infinite spinning animation on user menu ctrl+click
This commit is contained in:
commit
3e7710c0d8
|
@ -1501,17 +1501,21 @@ function initCore() {
|
||||||
$navigation.hide();
|
$navigation.hide();
|
||||||
|
|
||||||
// show loading feedback
|
// show loading feedback
|
||||||
$navigation.delegate('a', 'click', function(event) {
|
$navigation.delegate('a', 'mousedown', function(event) {
|
||||||
var $app = $(event.target);
|
var $app = $(event.target);
|
||||||
if(!$app.is('a')) {
|
if(!$app.is('a')) {
|
||||||
$app = $app.closest('a');
|
$app = $app.closest('a');
|
||||||
}
|
}
|
||||||
if(!event.ctrlKey) {
|
if(event.which === 1 && !event.ctrlKey && !event.metaKey) {
|
||||||
$app.addClass('app-loading');
|
$app.addClass('app-loading');
|
||||||
} else {
|
} else {
|
||||||
// Close navigation when opening app in
|
// On middle click or on first button click with ctrl key or meta key hold
|
||||||
// a new tab
|
if(event.which === 2 || (event.which === 1 && (event.ctrlKey || event.metaKey))) {
|
||||||
OC.hideMenus();
|
// Close navigation when opening app in
|
||||||
|
// a new tab
|
||||||
|
OC.hideMenus();
|
||||||
|
window.open($app, '_blank');
|
||||||
|
}
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
@ -1519,14 +1523,26 @@ function initCore() {
|
||||||
function setupUserMenu() {
|
function setupUserMenu() {
|
||||||
var $menu = $('#header #settings');
|
var $menu = $('#header #settings');
|
||||||
|
|
||||||
$menu.delegate('a', 'click', function(event) {
|
// show loading feedback
|
||||||
|
$menu.delegate('a', 'mousedown', function(event) {
|
||||||
var $page = $(event.target);
|
var $page = $(event.target);
|
||||||
if (!$page.is('a')) {
|
if (!$page.is('a')) {
|
||||||
$page = $page.closest('a');
|
$page = $page.closest('a');
|
||||||
}
|
}
|
||||||
$page.find('img').remove();
|
if(event.which === 1 && !event.ctrlKey && !event.metaKey) {
|
||||||
$page.find('div').remove(); // prevent odd double-clicks
|
$page.find('img').remove();
|
||||||
$page.prepend($('<div/>').addClass('icon-loading-small-dark'));
|
$page.find('div').remove(); // prevent odd double-clicks
|
||||||
|
$page.prepend($('<div/>').addClass('icon-loading-small-dark'));
|
||||||
|
} else {
|
||||||
|
// 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');
|
||||||
|
}
|
||||||
|
}
|
||||||
|
$($page).click();
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue