mirror of
https://github.com/gryf/pentadactyl-pm.git
synced 2026-04-19 05:13:32 +02:00
don't attempt to add the frame indicator if v.buffer.shiftFrameFocus is called
on a non-HTML document
This commit is contained in:
@@ -311,8 +311,9 @@ vimperator.Buffer = function() //{{{
|
|||||||
// TODO: allow callback for filtering out unwanted frames? User defined?
|
// TODO: allow callback for filtering out unwanted frames? User defined?
|
||||||
this.shiftFrameFocus = function(count, forward)
|
this.shiftFrameFocus = function(count, forward)
|
||||||
{
|
{
|
||||||
try
|
if (!window.content.document instanceof HTMLDocument)
|
||||||
{
|
return;
|
||||||
|
|
||||||
var frames = [];
|
var frames = [];
|
||||||
|
|
||||||
// find all frames - depth-first search
|
// find all frames - depth-first search
|
||||||
@@ -328,7 +329,7 @@ vimperator.Buffer = function() //{{{
|
|||||||
return;
|
return;
|
||||||
|
|
||||||
// remove all unfocusable frames
|
// remove all unfocusable frames
|
||||||
// TODO: find a better way to do this
|
// TODO: find a better way to do this - walking the tree is too slow
|
||||||
var start = document.commandDispatcher.focusedWindow;
|
var start = document.commandDispatcher.focusedWindow;
|
||||||
frames = frames.filter(function(frame) {
|
frames = frames.filter(function(frame) {
|
||||||
frame.focus();
|
frame.focus();
|
||||||
@@ -391,6 +392,8 @@ vimperator.Buffer = function() //{{{
|
|||||||
frames[next].frameElement.scrollIntoView(false);
|
frames[next].frameElement.scrollIntoView(false);
|
||||||
|
|
||||||
// add the frame indicator
|
// add the frame indicator
|
||||||
|
// TODO: make this an XBL element rather than messing with the content
|
||||||
|
// document
|
||||||
var doc = frames[next].document;
|
var doc = frames[next].document;
|
||||||
var indicator = doc.createElement("div");
|
var indicator = doc.createElement("div");
|
||||||
indicator.id = "vimperator-frame-indicator";
|
indicator.id = "vimperator-frame-indicator";
|
||||||
@@ -403,12 +406,6 @@ vimperator.Buffer = function() //{{{
|
|||||||
// remove the frame indicator
|
// remove the frame indicator
|
||||||
setTimeout(function() { doc.body.removeChild(indicator); }, 500);
|
setTimeout(function() { doc.body.removeChild(indicator); }, 500);
|
||||||
}
|
}
|
||||||
catch (e)
|
|
||||||
{
|
|
||||||
// FIXME: fail silently here for now
|
|
||||||
//vimperator.log(e);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// updates the buffer preview in place only if list is visible
|
// updates the buffer preview in place only if list is visible
|
||||||
this.updateBufferList = function()
|
this.updateBufferList = function()
|
||||||
|
|||||||
Reference in New Issue
Block a user