1
0
mirror of https://github.com/gryf/pentadactyl-pm.git synced 2025-12-29 06:22:27 +01:00

The global marks correctly jump to their stored position, once the page has been loaded

This commit is contained in:
Viktor Kojouharov
2007-06-09 13:20:03 +00:00
parent c5722aaee2
commit 2e143ffe1a

View File

@@ -380,6 +380,25 @@ function QM()
function Marks()
{
var marks = {};
var pendingMarks = [];
var appcontent = document.getElementById("appcontent");
if (appcontent)
appcontent.addEventListener("load", onPageLoad, true);
function onPageLoad(event)
{
var win = event.originalTarget.defaultView;
for (var i = 0, length = pendingMarks.length; i < length; i++)
{
var mark = pendingMarks[i];
if (win.location.href == mark.location)
{
win.scrollTo(mark.position.x * win.scrollMaxX, mark.position.y * win.scrollMaxY);
pendingMarks.splice(i, 1);
return;
}
}
}
function remove(mark)
{
@@ -485,21 +504,14 @@ function Marks()
vimperator.tabs.select(vimperator.tabs.index(slice.tab));
if (!slice.tab.parentNode)
{
/* FIXME: this doesn't work
setTimeout(function()
{
vimperator.getCurrentBuffer().addEventListener('load', function()
{
this.scrollTo(slice.position.x, slice.position.y);
}, false);
}, 100);
*/
pendingMarks.push(slice);
openURLsInNewTab(slice.location);
return;
}
var win = slice.tab.linkedBrowser.contentWindow;
if (win.location.href != slice.location)
{
pendingMarks.push(slice);
win.location.href = slice.location;
return;
}