aboutsummaryrefslogtreecommitdiffstats
path: root/background_page.html
diff options
context:
space:
mode:
authorilya2010-03-28 17:43:53 -0700
committerilya2010-03-28 17:43:53 -0700
commitb9bf74fc6c02afed77da3ec991f8ac5da6687842 (patch)
tree407795359e75079b0dd50a7d51aaa9c454154fad /background_page.html
parent2878e73a14afaf3a803b93e506e2092138a49eea (diff)
downloadvimium-b9bf74fc6c02afed77da3ec991f8ac5da6687842.tar.bz2
Fix chaining of previousTab/nextTab commands. This closes #93.
Diffstat (limited to 'background_page.html')
-rw-r--r--background_page.html7
1 files changed, 4 insertions, 3 deletions
diff --git a/background_page.html b/background_page.html
index 90e3a410..0bed6594 100644
--- a/background_page.html
+++ b/background_page.html
@@ -273,13 +273,13 @@
chrome.tabs.create({}, function(tab) { callback(); });
}
- function nextTab() { selectTab("next"); }
- function previousTab() { selectTab("previous"); }
+ function nextTab(callback) { selectTab(callback, "next"); }
+ function previousTab(callback) { selectTab(callback, "previous"); }
/*
* Selects a tab before or after the currently selected tab. Direction is either "next" or "previous".
*/
- function selectTab(direction) {
+ function selectTab(callback, direction) {
chrome.tabs.getAllInWindow(null, function(tabs) {
if (tabs.length <= 1)
return;
@@ -287,6 +287,7 @@
if (tabs[i].selected) {
var delta = (direction == "next") ? 1 : -1;
var toSelect = tabs[(i + delta + tabs.length) % tabs.length];
+ selectionChangedHandlers.push(callback);
chrome.tabs.update(toSelect.id, { selected: true });
break;
}