sindresorhus/refined-github

Make `toggle-files-button` feature persistent across pages #3588

cheap-glitch posted onGitHub

<!-- 1. Make sure your requested feature makes sense for Refined GitHub: https://github.com/sindresorhus/refined-github/issues/2960 2. Include a full URL where the feature should appear. -->

Currently the toggle-file-button feature is not extremely useful, as it basically gets you to the readme quicker, and that's it. Ever since a new link popped up on the right side of the page, it might make sense to remove this feature as mentioned in #3580 and #3587.

But I think it would be very nice to keep this feature, and to give more usefulness by making it persist during navigation -- meaning if the file list is toggled off, it will be off when reloading or navigating to a different repo page.

I seldom browse the repo files directly on GitHub, so having the list hidden by default would save quite a bit of scrolling (and yes I do know and use "Hide Files on GitHub", but it doesn't really help with this kind of repo for example).

Feature checklist:

  1. It doesn't already exist as a userscript or extension.
  2. It makes sense as a default for everyone: if you hide the files on a repo page, there's a good chance you might want it hidden on the other pages as well. Otherwise if you just want to jump to the readme, there's a link for that.
  3. It doesn't require options: if the list is open, it stays open ; if it's closed it stays closed.
  4. It doesn't require a lot of view/UI, code and effort to maintain: no new UI, but the business logic might be a tad tricky (I tried a naive implementation by adding a check in init() but it creates some annoying jitter on page load)
  5. It doesn't require an external server.
  6. It doesn't require too much HTTP traffic.
  7. It doesn't enhance "Projects"

I'm willing to try implementing this if you accept it as a valid feature request.

Thank you for maintaining and improving this indispensable extension! 👍


This feature already persists across pages, did you encounter a bug?

That said, I support your point. This feature may not be useful on the repo's home page, but it does in other pages. For example, Telegraf.js has a standalone docs website, but it uses docute and initial loading takes a long time, so I go to see the source instead, where toggle-files-button makes it easy to hide the files section so I can concentrate on the docs. Yeah I know I can click the file to achieve the same effect, but toggle-files-button is more convenient.

In a word, I'm not in favor of dropping this feature.

posted by kidonng over 4 years ago

@cheap-glitch thank you for the detailed and clear issue!

I agree, the reason we wanted to drop the feature was due to the Readme link already existing. However even that, only exists on the root of the repository.

posted by yakov116 over 4 years ago

This feature already persists across pages, did you encounter a bug?

Really? That's news to me! I've been using RG on Firefox for quite a while now, and it was never persistent -- even before the big redesign of the repo page.

Should I change the template into a bug report?

posted by cheap-glitch over 4 years ago

This feature already persists across pages, did you encounter a bug?

Hey @kidonng, I don't think this feature is persistent across pages. Just tried it on Firefox, and checked https://github.com/sindresorhus/refined-github/blob/master/source/features/toggle-files-button.tsx, couldn't find anything that handles persistence.


However even that, only exists on the root of the repository.

@yakov116 Yup, we should not drop this feature. /cc @fregante on https://github.com/sindresorhus/refined-github/issues/3580#issuecomment-696236432

posted by notlmn over 4 years ago

I agree, the reason we wanted to drop the feature was due to the Readme link already existing. However even that, only exists on the root of the repository.

Good point, let's not drop the feature for this reason.

posted by fregante over 4 years ago

I think we can apply this suggestion.

  1. Update the feature to use elementReady: https://github.com/sindresorhus/refined-github/issues/2671
  2. Use the cache to remember whether the file list was closed
posted by fregante over 4 years ago

Fund this Issue

$0.00
Funded

Pull requests