ubershmekel / redditp

Convert any reddit page to a presentation or slide show
https://redditp.com
MIT License
261 stars 102 forks source link

Added history / back button support. #78

Closed murgo closed 4 years ago

murgo commented 5 years ago

I implemented back button and history support just for kicks (as discussed on #77). Feel free to merge it or not at your own pleasure.

I tried to break it but it seems to work pretty ok. There is a small 1 item queue for animations, so when you frantically hit back button many times you end up on the same pic you're supposed to even with animations running.

There are some edge cases like going to the slideshow, then going a lot of images further, then going via a link to external site and returning to redditp via back (so the image is no longer loaded or the image with the same index might be wrong), but these cases should just throw you to the start of the slideshow as before.

I suggest you give it a spin, for me it increases usability dramatically.

murgo commented 5 years ago

This might need some additional checks and safeguards for IE <10.

ubershmekel commented 5 years ago

Thank you for implementing this @murgo - I'll try and look at it during the next week.

murgo commented 5 years ago

I added some checks to make sure everything should work even if some browser didn't have history api defined.

ubershmekel commented 4 years ago

I finally got to that weekend. Seriously though, thank you for this work. I like it, I feel bad it took so long, and have merged it in.

I wish redditp was structured better, with defined boundaries for the different parts. Specifically I feel bad that the History / back button stuff comment is just a section, and right now it isn't clear why scheduledAnimation and rp.session.isAnimating are both needed. I'll get to clean ups some day.