Search only visible links
Give priority to links which are inside the visible area.
Only search the entire page, if there are no visible link which match the criteria or while iterating with ⌘G/⌘⇧G.
Agreed, this should be an improvement.
I'd love this. I had a look at the relevant code, which I'm guessing is injection.js, but it seemed quite stateful and so I wouldn't trust myself to modify it correctly. It seems to this could be done very easily, by testing whether elements are in the part of the document currently seen by the user. document.body.scrollTop and document.body.scrollLeft give the current X and Y offsets of where the user is in the document. (They even adjust correctly when zoomed in, unlike window.page{X,Y}offset). To get each element's position, you can ask for its .offsetTop and .offsetLeft, e.g.:
document.querySelector("a").offsetLeft
So, we can compare the element positions with the screen position and only select elements which are below and to the right of the user's screen, defaulting to the old behaviour only when no such elements are found.
Yep, that's the way I'd do it. Maybe I'll give it a go this evening or next.
Sent from my iPhone 5
On Mar 18, 2012, at 4:03 PM, Marius Kempe [email protected] wrote:
I'd love this. I had a look at the relevant code, which I'm guessing is
injection.js, but it seemed quite stateful and so I wouldn't trust myself to modify it correctly. It seems to this could be done very easily, by testing whether elements are in currently seen by the user.document.body.scrollTopanddocument.body.scrollLeftgive the current X and Y offsets of where the user is in the document. (They even adjust correctly when zoomed in, unlikewindow.page{X,Y}offset). To get each elements position, you can ask for its.offsetTopand.offsetLeft, e.g.:document.querySelector("a").offsetLeftSo that, we can compare the element positions with the screen position and only select elements which are below and to the right of the user's screen, defaulting to the old behaviour only when no such elements are found.
Reply to this email directly or view it on GitHub: https://github.com/dbergey/Type-To-Navigate/issues/5#issuecomment-4563916
Thanks!
PS. Your iPhone 5? ;-)
On 18 Mar 2012, at 8:04PM, Daniel Bergey wrote:
Yep, that's the way I'd do it. Maybe I'll give it a go this evening or next.
Sent from my iPhone 5
On Mar 18, 2012, at 4:03 PM, Marius Kempe [email protected] wrote:
I'd love this. I had a look at the relevant code, which I'm guessing is
injection.js, but it seemed quite stateful and so I wouldn't trust myself to modify it correctly. It seems to this could be done very easily, by testing whether elements are in currently seen by the user.document.body.scrollTopanddocument.body.scrollLeftgive the current X and Y offsets of where the user is in the document. (They even adjust correctly when zoomed in, unlikewindow.page{X,Y}offset). To get each elements position, you can ask for its.offsetTopand.offsetLeft, e.g.:document.querySelector("a").offsetLeftSo that, we can compare the element positions with the screen position and only select elements which are below and to the right of the user's screen, defaulting to the old behaviour only when no such elements are found.
Reply to this email directly or view it on GitHub: https://github.com/dbergey/Type-To-Navigate/issues/5#issuecomment-4563916
Reply to this email directly or view it on GitHub: https://github.com/dbergey/Type-To-Navigate/issues/5#issuecomment-4563934
You're the first person to notice that.
Sent from my iPhone 5
On Mar 18, 2012, at 4:06 PM, Marius Kempe [email protected] wrote:
Thanks!
PS. Your iPhone 5? ;-)
On 18 Mar 2012, at 8:04PM, Daniel Bergey wrote:
Yep, that's the way I'd do it. Maybe I'll give it a go this evening or next.
Sent from my iPhone 5
On Mar 18, 2012, at 4:03 PM, Marius Kempe [email protected] wrote:
I'd love this. I had a look at the relevant code, which I'm guessing is
injection.js, but it seemed quite stateful and so I wouldn't trust myself to modify it correctly. It seems to this could be done very easily, by testing whether elements are in currently seen by the user.document.body.scrollTopanddocument.body.scrollLeftgive the current X and Y offsets of where the user is in the document. (They even adjust correctly when zoomed in, unlikewindow.page{X,Y}offset). To get each elements position, you can ask for its.offsetTopand.offsetLeft, e.g.:document.querySelector("a").offsetLeftSo that, we can compare the element positions with the screen position and only select elements which are below and to the right of the user's screen, defaulting to the old behaviour only when no such elements are found.
Reply to this email directly or view it on GitHub: https://github.com/dbergey/Type-To-Navigate/issues/5#issuecomment-4563916
Reply to this email directly or view it on GitHub: https://github.com/dbergey/Type-To-Navigate/issues/5#issuecomment-4563934
Reply to this email directly or view it on GitHub: https://github.com/dbergey/Type-To-Navigate/issues/5#issuecomment-4563947
ahah