Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

Add "Filter-Highlighted" Post Navigation Hotkeys #3262

Open
wants to merge 3 commits into
base: master
Choose a base branch
from

Conversation

pentargency
Copy link
Collaborator

@pentargency pentargency commented May 11, 2022

Why?

I've been using the filter functionality for highlighting of posts relevant to my interests lately, and have wanted a good way to jump between filter-highlighted posts. I really like the way the QuoteYou jumping works with the default Alt+Up/Alt+Down hotkeys, so this was the basis of my expectations for similar filter-based functionality.

What

The expectation is that, should you have a comment filter like:

/heinlein/i;highlight;boards:lit

That you can then enter a thread on /lit/ discussing people's favorite authors, and press the "next filter-highlight" hotkey to receive either two outcomes:

  1. A post mentioning Heinlein is found and the view jumps to it, in a manner similar to if the poster had quoted you and you pressed Alt+Down
  2. No posts mentioning Heinlein -- nor the subjects of any other applicable highlight-mode filters -- are found, and (similarly to the QuoteYou system) a message is displayed: "No posts match your lame filters."
    image

How

  • Extends the Filter.coffee script to duplicate the seek/scroll and "last highlighted post" memory functionality found within QuoteYou.coffee.
    • This might be a good candidate for consolidating the duplicated functionality into a single "post seeking" method in a common location, but I didn't want to presume to make broader architecture changes without further discussion. If this is more desirable, I can do this work if we work out where to put it.
  • Adds options for setting a hotkey for both Previous & Next filter-highlighted post navigation. By default, Shift+Alt+Up and Shift+Alt+Down, mirroring the QuoteYou default hotkeys.
  • Adds hotkey handlers for calling the Filter.cb.seek method as appropriate when the hotkey is used.

Testing

The extent of my testing is that I've loaded the resultant 4chan-x.user.js v1.14.21.7-based userscript into my Violentmonkey v2.13.0 on Firefox 100.0 and tested that the following conditions are met:

  • Hotkeys present and re-configurable in options
  • New hotkeys do nothing outside of a thread view on 4chan/yotsuba
  • New hotkeys do nothing but display the warning message above when used in a thread with no filter highlights
  • New hotkeys jump between filter-highlighted posts when used in a thread with filter highlights, and wrap at the extremes.
    • The OP is included in this, which may or may not be desirable, but I figured this was worth leaving as-is.
  • The use of the new Filter seeking system does not impede the use of the QuoteYou functionality.

# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant