aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorjez2010-12-28 22:30:35 +0800
committerjez2010-12-28 22:30:35 +0800
commit064a8b523ea53d4999bbd5987be5dc3db5caa4c8 (patch)
tree068ddf6fb1ad210113cd6023deb05929104ba6d1
parentbb9387946cb573123a33541eb01b90fd8f9a744d (diff)
downloadvimium-064a8b523ea53d4999bbd5987be5dc3db5caa4c8.tar.bz2
Add command repetition for goUp command. Closes #179.
-rw-r--r--commands.js2
-rw-r--r--vimiumFrontend.js4
2 files changed, 3 insertions, 3 deletions
diff --git a/commands.js b/commands.js
index c86b129f..3b9203dc 100644
--- a/commands.js
+++ b/commands.js
@@ -170,7 +170,7 @@ addCommand('goBack', 'Go back in history');
addCommand('goForward', 'Go forward in history');
// Navigating the URL hierarchy
-addCommand('goUp', 'Go up the URL hierarchy');
+addCommand('goUp', 'Go up the URL hierarchy', false, true);
// Manipulating tabs:
addCommand('nextTab', 'Go one tab right', true);
diff --git a/vimiumFrontend.js b/vimiumFrontend.js
index e3c28371..a18c7966 100644
--- a/vimiumFrontend.js
+++ b/vimiumFrontend.js
@@ -266,7 +266,7 @@ function reload() { window.location.reload(); }
function goBack() { history.back(); }
function goForward() { history.forward(); }
-function goUp() {
+function goUp(count) {
var url = window.location.href;
if (url[url.length-1] == '/')
url = url.substring(0, url.length - 1);
@@ -274,7 +274,7 @@ function goUp() {
var urlsplit = url.split('/');
// make sure we haven't hit the base domain yet
if (urlsplit.length > 3) {
- delete urlsplit[urlsplit.length-1];
+ urlsplit = urlsplit.slice(0, Math.max(3, urlsplit.length - count));
window.location.href = urlsplit.join('/');
}
}