ccloli / E-Hentai-Downloader

Download E-Hentai archive as zip file
GNU General Public License v3.0
1.82k stars 137 forks source link

Use a hotkey to select pages #246

Open Franck-Nein opened 11 months ago

Franck-Nein commented 11 months ago

Something like this:

https://github.com/ccloli/E-Hentai-Downloader/assets/35365671/afd84d76-7cf1-4f91-9de8-3c866e7dd9b5

If you want to download a few separate page ranges, it is kind of annoying to have to remember the page numbers and then write them into the range field I implemented it on my fork, but I don't really have much experience with JavaScript, so while it works, it probably has problems.

ccloli commented 10 months ago

Sorry for the late reply, I just checked your implementation, it looks great, and even compatible with EX Better Thumbnails, a userscript I'm using that can autoload thumbnails of next page.

Normalizing selected pages into pages range (1,2,3,4,5 -> 1-5) is not necessary I think, but happy to see it happens.

Would be great if it supports batch selection like drag a rectangle to select, or hold E key and move your mouse to select (it works somehow but has bug). Or keep selected pages range when you're navigate to next page (like using sessionStorage stuff).

If it's not easy for you to implement this, I could made such changes. Though when it comes out will be Soon™, I don't have a decent plan to complete recent features.

Franck-Nein commented 10 months ago

I used sessionStorage to store ranges between page changes on the same day I opened the issue. However, I think I did it in a messy way. So, I decided not to update the issue in case I figure out a better solution.

https://github.com/ccloli/E-Hentai-Downloader/assets/35365671/29bbebcd-de76-44d9-9a3b-7086c2bd74a8

I store the page list using the gallery ID as the key. This way, if you open a different gallery in the same tab, it doesn't cause any issues. I use the key "Clear" to remove it the next time the user selects something after clicking the Clear button. Screenshot from 2023-08-20 13-23-09

The batch selection/drag-to-select is causing me a lot of trouble. I did make it work using a different key. You press the key to select the first item and then press it again for the last item of the range. But, it doesn't update the selection in real-time, so it's not great. Also, I couldn't get the "hold to select range" to work. It seems to sometimes detect an extra key press when releasing the held key.

I also included a temporary "clear selection" button until I can work out how to update the range when the user manually changes or deletes the ranges.