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

Fix back-button browsing and state after mutation events #22

Closed radiovisual closed 8 years ago

radiovisual commented 8 years ago

Closes issues #20, #21. Adds new dependencies.

sindresorhus commented 8 years ago

I can't get it to work:

radiovisual commented 8 years ago

Whoops! I see what is happening. It seems that calling trigger() from within the injector is not working. The only thing that is working in my latest tests is to re-attach the click handlers to the toggle button upon each injection from within the injector's callback. For whatever reason the injector doesn't want to access the parent scope. I will run some more tests tomorrow and get this fixed.

radiovisual commented 8 years ago

Ok, you can try it now. The only way I can get it working after back-button browsing is to continuously attach the click handler. So you will see multiple calls to addToggleBtnEvents(). If a single call to this function is removed, the button will lose it's click event.

sindresorhus commented 8 years ago

Now the button doesn't work on the initial load.

radiovisual commented 8 years ago

Hm, that is weird. What is necessary to fix the initial load problem you are mentioning (which just got fixed in the latest push) is not necessary in the options branch I have going for the Options Page. There are a few mysterious forces at work here!

sindresorhus commented 8 years ago

I still can't get the button to work on load, but it works in the other PR, so merging. Thank you :)