sindresorhus / hide-files-on-github

Chrome extension - Hide nonessential files from the GitHub file browser
https://chrome.google.com/webstore/detail/hide-files-on-github/lpnakhpaodhdkleejaehlapdhbgjbddp
MIT License
320 stars 36 forks source link

Inactive after browsing with the 'back button' in Chrome #20

Closed radiovisual closed 8 years ago

radiovisual commented 8 years ago

It seems the 'Show/Hide Dotfiles' button becomes disabled if you browse back to a repo page using the 'Back Button'.

To recreate:

  1. Open up any github repo.
  2. Verify that the 'Show/Hide Dotfiles' button works.
  3. Now click any link on that page.
  4. Hit the 'Back Button' to get back to the repo's main page.
  5. Now the 'Show/Hide Dotfiles' button is inactive.

I have only tested this behavior in Chrome Version 47.0.2526.106 (64-bit).

It's also true if you browse with the "Forward Button".

sindresorhus commented 8 years ago

I've seen this too. I guess it should use https://github.com/octo-linker/injection. Help welcome :)

radiovisual commented 8 years ago

@sindresorhus , I am happy to create a pull request for this, but first, can you tell me your preference for loading dependencies into a chrome extension? I have already experimented with octo-linker/injection and I can get the hide-files-on-github extension to work after browsing with the back/forward buttons, however, in my experiments, I just loaded the injection dependency directly in the manifest.json file, like so:

"js": [
    "deps/octo-linker-injection@0.1.0.js",
    "content.js"
]

This approach works, but it feels a bit too 'hands-on' for dependency management (upgrading the dependencies would be a manual process, for example). In other words: doing things this way doesn't allow us to bring the dependency in via npm, and also, XO complains about the global nature of the dependency (raising the no-undef flag in content.js):

69:2  error  "gitHubInjection" is not defined  no-undef

So I wanted to know what you think is a good way to bring in this dependency before I commit to one approach over the other.

I have also experimented a little injecting <script> tags into the <head>, but that still leaves me with manual dependency management.

Anyway, I would love to hear your thoughts.

sindresorhus commented 8 years ago

No perfect solution for this. I would just npm install it, then just commit the .js file, and then gitignore the rest of the node_modules folder.

radiovisual commented 8 years ago

Ok, sounds good. Thanks.