diff --git a/web/templates/footer.html b/web/templates/footer.html index 77b4b0acf..23503e660 100644 --- a/web/templates/footer.html +++ b/web/templates/footer.html @@ -141,7 +141,8 @@ // Shortcuts - shortcut.add("Ctrl+Enter", function(){ + shortcut.add("Ctrl+Enter", function(){ + $('form#vstobjects').submit(); }, { 'type': 'keydown', @@ -151,10 +152,10 @@ } ); -// shortcut.add("Ctrl+Backspace", function(){ shortcut.add("Backspace", function(){ - console.log("read"); - if($('form#vstobjects .button.cancel')[0]){ + if(VE.tmp.form_changed && $('form#vstobjects .button.cancel')[0]){ + VE.helpers.createConfirmationDialog($('.confirmation-text-redirect'), '', $('form#vstobjects input.cancel').attr('onclick').replace("location.href='", "").replace("'","")); + } else if($('form#vstobjects .button.cancel')[0]){ location.href=$('form#vstobjects input.cancel').attr('onclick').replace("location.href='", "").replace("'",""); } }, { @@ -338,120 +339,6 @@ } ); - - shortcut.add("Ctrl+1", function(){ - if(VE.tmp.form_changed){ - VE.helpers.createConfirmationDialog($('.confirmation-text-redirect'), '', ('.l-menu .l-menu__item:nth-of-type(1) a').attr('href')); - } else { - location.href=$('.l-menu .l-menu__item:nth-of-type(1) a').attr('href'); - } - }, { - 'type': 'keydown', - 'propagate': false, - 'disable_in_input': true, - 'target': document - } - ); - - shortcut.add("Ctrl+2", function(){ - if(VE.tmp.form_changed){ - VE.helpers.createConfirmationDialog($('.confirmation-text-redirect'), '', ('.l-menu .l-menu__item:nth-of-type(2) a').attr('href')); - } else { - location.href=$('.l-menu .l-menu__item:nth-of-type(2) a').attr('href'); - } - }, { - 'type': 'keydown', - 'propagate': false, - 'disable_in_input': true, - 'target': document - } - ); - - shortcut.add("Ctrl+3", function(){ - if(VE.tmp.form_changed){ - VE.helpers.createConfirmationDialog($('.confirmation-text-redirect'), '', ('.l-menu .l-menu__item:nth-of-type(3) a').attr('href')); - } else { - location.href=$('.l-menu .l-menu__item:nth-of-type(3) a').attr('href'); - } - }, { - 'type': 'keydown', - 'propagate': false, - 'disable_in_input': true, - 'target': document - } - ); - - shortcut.add("Ctrl+4", function(){ - if(VE.tmp.form_changed){ - VE.helpers.createConfirmationDialog($('.confirmation-text-redirect'), '', ('.l-menu .l-menu__item:nth-of-type(4) a').attr('href')); - } else { - location.href=$('.l-menu .l-menu__item:nth-of-type(4) a').attr('href'); - } - }, { - 'type': 'keydown', - 'propagate': false, - 'disable_in_input': true, - 'target': document - } - ); - - shortcut.add("Ctrl+5", function(){ - if(VE.tmp.form_changed){ - VE.helpers.createConfirmationDialog($('.confirmation-text-redirect'), '', ('.l-menu .l-menu__item:nth-of-type(5) a').attr('href')); - } else { - location.href=$('.l-menu .l-menu__item:nth-of-type(5) a').attr('href'); - } - }, { - 'type': 'keydown', - 'propagate': false, - 'disable_in_input': true, - 'target': document - } - ); - - shortcut.add("Ctrl+6", function(){ - if(VE.tmp.form_changed){ - VE.helpers.createConfirmationDialog($('.confirmation-text-redirect'), '', ('.l-menu .l-menu__item:nth-of-type(6) a').attr('href')); - } else { - location.href=$('.l-menu .l-menu__item:nth-of-type(6) a').attr('href'); - } - }, { - 'type': 'keydown', - 'propagate': false, - 'disable_in_input': true, - 'target': document - } - ); - - shortcut.add("Ctrl+7", function(){ - if(VE.tmp.form_changed){ - VE.helpers.createConfirmationDialog($('.confirmation-text-redirect'), '', ('.l-menu .l-menu__item:nth-of-type(7) a').attr('href')); - } else { - location.href=$('.l-menu .l-menu__item:nth-of-type(7) a').attr('href'); - } - }, { - 'type': 'keydown', - 'propagate': false, - 'disable_in_input': true, - 'target': document - } - ); - - shortcut.add("Ctrl+8", function(){ - if(VE.tmp.form_changed){ - VE.helpers.createConfirmationDialog($('.confirmation-text-redirect'), '', ('.l-menu .l-menu__item:nth-of-type(8) a').attr('href')); - } else { - location.href=$('.l-menu .l-menu__item:nth-of-type(8) a').attr('href'); - } - }, { - 'type': 'keydown', - 'propagate': false, - 'disable_in_input': true, - 'target': document - } - ); - - shortcut.add("h", function(){ $('.shortcuts').toggle(); }, { @@ -493,7 +380,11 @@ ); shortcut.add("Enter", function(){ - VE.navigation.enter_focused(); + if(VE.tmp.form_changed){ + VE.helpers.createConfirmationDialog($('.confirmation-text-redirect'), '', $(VE.navigation.state.menu_selector + '.focus a').attr('href')); + } else { + VE.navigation.enter_focused(); + } }, { 'type': 'keydown', 'propagate': false, @@ -502,12 +393,12 @@ } ); - shortcut.add("Tab", function(){ + shortcut.add("Alt", function(){ VE.navigation.switch_menu(); }, { 'type': 'keydown', 'propagate': false, - 'disable_in_input': true, + 'disable_in_input': false, 'target': document } ); @@ -572,7 +463,7 @@ diff --git a/web/templates/header.html b/web/templates/header.html index ab11d821d..83696d9c4 100644 --- a/web/templates/header.html +++ b/web/templates/header.html @@ -59,6 +59,6 @@ - +