diff options
| -rw-r--r-- | commands.js | 4 | ||||
| -rw-r--r-- | vimiumFrontend.js | 13 | 
2 files changed, 17 insertions, 0 deletions
| diff --git a/commands.js b/commands.js index de6ce701..2a180966 100644 --- a/commands.js +++ b/commands.js @@ -95,6 +95,7 @@ function clearKeyMappingsAndSetDefaults() {    mapKeyToCommand('H', 'goBack');    mapKeyToCommand('L', 'goForward'); +  mapKeyToCommand('gu', 'goUp');    mapKeyToCommand('zi', 'zoomIn');    mapKeyToCommand('zo', 'zoomOut'); @@ -150,6 +151,9 @@ addCommand('performBackwardsFind', 'Cycle backward to the previous find match');  addCommand('goBack',              'Go back in history');  addCommand('goForward',           'Go forward in history'); +// Navigating the URL hierarchy +addCommand('goUp',                'Go up the URL hierarchy'); +  // Manipulating tabs:  addCommand('nextTab',             'Go one tab right',  true);  addCommand('previousTab',         'Go one tab left',   true); diff --git a/vimiumFrontend.js b/vimiumFrontend.js index 4346d18f..c33e87db 100644 --- a/vimiumFrontend.js +++ b/vimiumFrontend.js @@ -200,6 +200,19 @@ function reload() { window.location.reload(); }  function goBack() { history.back(); }  function goForward() { history.forward(); } +function goUp() { +  var url = window.location.href; +  if (url[url.length-1] == '/') +    url = url.substring(0, url.length - 1); + +  var urlsplit = url.split('/'); +  // make sure we haven't hit the base domain yet +  if (urlsplit.length > 3) { +    delete urlsplit[urlsplit.length-1]; +    window.location.href = urlsplit.join('/'); +  } +} +  function toggleViewSource() {    getCurrentUrlHandlers.push(toggleViewSourceCallback); | 
