aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--background_page.html10
-rw-r--r--commands.js6
2 files changed, 14 insertions, 2 deletions
diff --git a/background_page.html b/background_page.html
index b334f7b1..5866ee48 100644
--- a/background_page.html
+++ b/background_page.html
@@ -331,9 +331,11 @@
function nextTab(callback) { selectTab(callback, "next"); }
function previousTab(callback) { selectTab(callback, "previous"); }
+ function firstTab(callback) { selectTab(callback, "first"); }
+ function lastTab(callback) { selectTab(callback, "last"); }
/*
- * Selects a tab before or after the currently selected tab. Direction is either "next" or "previous".
+ * Selects a tab before or after the currently selected tab. Direction is either "next", "previous", "first" or "last".
*/
function selectTab(callback, direction) {
chrome.tabs.getAllInWindow(null, function(tabs) {
@@ -347,6 +349,12 @@
case "previous":
toSelect = tabs[(currentTab.index - 1 + tabs.length) % tabs.length];
break;
+ case "first":
+ toSelect = tabs[0];
+ break;
+ case "last":
+ toSelect = tabs[tabs.length - 1];
+ break;
}
selectionChangedHandlers.push(callback);
chrome.tabs.update(toSelect.id, { selected: true });
diff --git a/commands.js b/commands.js
index f36c57b3..d214d2bf 100644
--- a/commands.js
+++ b/commands.js
@@ -131,6 +131,8 @@ function clearKeyMappingsAndSetDefaults() {
"J": "previousTab",
"gt": "nextTab",
"gT": "previousTab",
+ "g0": "firstTab",
+ "g$": "lastTab",
"t": "createTab",
"x": "removeTab",
@@ -195,6 +197,8 @@ var commandDescriptions = {
// Manipulating tabs
nextTab: ["Go one tab right", { background: true }],
previousTab: ["Go one tab left", { background: true }],
+ firstTab: ["Go to the first tab", { background: true }],
+ lastTab: ["Go to the last tab", { background: true }],
createTab: ["Create new tab", { background: true }],
removeTab: ["Close current tab", { background: true }],
restoreTab: ["Restore closed tab", { background: true }],
@@ -225,7 +229,7 @@ var commandGroups = {
historyNavigation:
["goBack", "goForward"],
tabManipulation:
- ["nextTab", "previousTab", "createTab", "removeTab", "restoreTab"],
+ ["nextTab", "previousTab", "firstTab", "lastTab", "createTab", "removeTab", "restoreTab"],
misc:
["showHelp"]
};