aboutsummaryrefslogtreecommitdiffstats
path: root/background_page.html
diff options
context:
space:
mode:
authorTim Morgan2010-09-03 22:38:45 -0500
committerTim Morgan2010-09-03 22:46:20 -0500
commitf146e5908bd79dcab4d4afa219af79d4a892b099 (patch)
treea00c7189c2352f3a7666fde996215ed48b419808 /background_page.html
parentf9f5208f4d88873ee55a4c54062920981ad22eb8 (diff)
downloadvimium-f146e5908bd79dcab4d4afa219af79d4a892b099.tar.bz2
Command to go to next frame.
I remapped toggleViewSource to 'gs' and set 'gf' to nextFrame. Sorry this is such a huge commit. This is really the simplest way I can find to allow the extension to track all available frames as well as the currently-focused frame. If Chrome would allow access to window.frames[i], then this could probably be simpler.
Diffstat (limited to 'background_page.html')
-rw-r--r--background_page.html31
1 files changed, 31 insertions, 0 deletions
diff --git a/background_page.html b/background_page.html
index 8abe2f9e..6014d4c8 100644
--- a/background_page.html
+++ b/background_page.html
@@ -68,6 +68,8 @@
getLinkHintCss: getLinkHintCss,
openUrlInCurrentTab: openUrlInCurrentTab,
openOptionsPageInNewTab: openOptionsPageInNewTab,
+ registerFrame: registerFrame,
+ focusFrame: focusFrame,
upgradeNotificationClosed: upgradeNotificationClosed,
updateScrollPosition: handleUpdateScrollPosition
};
@@ -593,6 +595,35 @@
});
}
+ var framesForTab = {};
+
+ function registerFrame(request, sender) {
+ if(request.top)
+ framesForTab[sender.tab.id] = [];
+ framesForTab[sender.tab.id].push(request.frameId);
+ }
+
+ var focusedFrame = null;
+ function focusFrame(request, sender) {
+ focusedFrame = request.frameId;
+ }
+
+ function nextFrame(callback, frameId) {
+ chrome.tabs.getSelected(null, function(tab) {
+ //chrome.tabs.sendRequest(tab.id, { name: "showHelpDialog", dialogHtml: helpDialogHtml(), frameId:frameId });
+ var index;
+ var frames = framesForTab[tab.id];
+ for(index=0; index<frames.length; index++) {
+ if(frames[index] == focusedFrame) break;
+ }
+ if(index >= frames.length-1)
+ index = 0;
+ else
+ index++;
+ chrome.tabs.sendRequest(tab.id, { name: "focusFrame", frameId: frames[index] });
+ });
+ }
+
function init() {
clearKeyMappingsAndSetDefaults();