Skip to content
This repository has been archived by the owner on Nov 7, 2022. It is now read-only.

Go to previous/next page #60

Open
asymmetric opened this issue Sep 29, 2017 · 9 comments
Open

Go to previous/next page #60

asymmetric opened this issue Sep 29, 2017 · 9 comments

Comments

@asymmetric
Copy link

As mentioned in #18, it would be great to have a keybinding for 'prev', 'next' links.

This is useful for navigating forums, github issues, long articles, etc. On VimFx, the keybindings were [, and ].

@lydell
Copy link

lydell commented Sep 30, 2017

Just wanted to share my experience with this feature from VimFx, both as a user and as an implementor:

This is a VimFx feature I kinda liked, but also disliked a bit. The thing is that you more or less have to learn which pages it works on. When you press ] in VimFx, one of three things happen:

  • You’re taken to the next page as expected.
  • You’re taken to an unexpected page (because some link happened to match a “next” pattern).
  • Nothing at all happens.

So I mostly didn’t use it. Only on a few forums I often visit, for github issues listings, and for search results on a couple of pages.

Another weakness of the feature is that users mostly have to customize the default patterns for their language. For example, adding “nästa” as a “next” pattern and “föregående” as a “previous” pattern for Swedish.

Here’s the VimFx implementation. It’s mostly regex search. But also nasty a hardcoded hack to make things work on Google.

Here are some tricky issues:

I guess what I’m trying to say is that copying VimFx is not super difficult. But then you also inherit that half-good experience, and open a can of worms. You can also try to come up with a better heuristic for finding the links. Or make a database of selectors for every site, like the old Autopagerize extension/userscript: http://wedata.net/databases/AutoPagerize/items_all.json. It also feels like machine learning would be appropriate for this challenge ... how far down this rabbit hole can we go?

@asymmetric
Copy link
Author

I would be fine with it only working when there's a <link rel=prev/next/first/last> (which honestly is how it should be implemented by websites anyway).

I agree with you that it was annoying that it didn't always work, but hey, that's not the plugin's fault necessarily.

@WishCow
Copy link

WishCow commented Oct 1, 2017

I think even with the shortcomings that @lydell mentioned, it was a great feature, I would be perfectly okay with that implementation.

@eejdoowad
Copy link
Member

Placeholders for these commands actually already exist in Saka Key's source code. I'll probably end up porting VimFX's implementation when I get around to it.

https://key.saka.io/dev_docs/adding_commands

@alexherbo2
Copy link
Contributor

How about implementing the commands as site plug-in?

Access to Site mode on Space, and [ and ] commands to go to the previous and next page.

A global and naive implementation could be added.

The site could hijack the global implementation.

Interactive creation of plug-in would be neat for non-developers.

It would seamless allow the Next / Previous page functionalities creation.

All that on-the-fly.

@Stebalien
Copy link

@alexherbo2 FYI, rel=next/prev/etc... is in the standard: https://www.w3.org/TR/html5/links.html#sequential-link-types (for what that's worth, anyways).

@alexherbo2
Copy link
Contributor

Yep, I don’t know for you, but none of the sites I use use that. XD

@Stebalien
Copy link

Ah. Sorry, I assumed you wanted sites to implement this. I agree it would be nice to be able to override commands (really, all commands) for arbitrary websites. However, I believe that discussion belongs in #45.

@grepsuzette
Copy link

grepsuzette commented Oct 4, 2019

Since searching "bing" in 'issues' gave me nothing, I would like to mention the prev and next page did not work for me on Bing. It seems to be because their prev/next buttons don't have any text, and also lack something like rel="next".

I have created a greasyfork to have those buttons get the rel="prev" and rel="next" attribute needed to make them work with Saka: https://greasyfork.org/en/scripts/390762-bing-rel-next-prev

But it's a mystery for me why while the next button works perfectly with Saka (]), the prev button ([ here) also acts as a next (and not a prev). Where's the bug? I already double checked the greasyscript and my mapping in Saka for [ and ] but also find it hard to believe it would come from Saka.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

7 participants