Refined-github: Make `toggle-files-button` feature persistent across pages

Created on 22 Sep 2020  路  6Comments  路  Source: sindresorhus/refined-github


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! 馃憤

enhancement help wanted

Most helpful comment

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.

All 6 comments

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.

@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.

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?

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

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.

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
Was this page helpful?
0 / 5 - 0 ratings