e-hentai preload next page

preload and cache next page image for faster loading

Voici les versions de ce script où le code a été modifié. Voir toutes les versions.

  • v0.4.5 11/09/2024
    • make cache viewer load its gallery asynchronously
  • v0.4.4 11/09/2024
    • fixed storage directory may not work due to unknown dom exception, by creating a test file to see if storage directory actually works, and fallback to key-based storage if it doesnt
    • backend improvements
  • v0.4.3 08/09/2024
    • minor quality-of-life changes to the cache viewer:
      • added empty message for gallery that is empty once cleared
      • added current gallery indicator
      • moved refresh button to each galleries
    • fixed image fetching incorrectly
  • v0.4.2 08/09/2024

    hotfix update

    • fixed page-cache-limit compatibility mapping
  • v0.4.1 08/09/2024
    • added "Fetch All" button that forces the userscript to fetch all images according to image-caching-limit option
    • fixed potential bug where image is saved incorrectly due to the server responding incorrect file
    • removed debugger statement .-.
  • v0.4.0 08/09/2024
    • added cache viewer to view all of your persistent cache
      • view and download specific gallery saved in the cache using the cache viewer
      • cache viewer can be opened up by "[ view persistent cache ]" button on the very bottom of the page
    • refactor how persistent cache are saved
      • this will make previous cache invalid, so it is recommended to clear and refetch all the caches
    • moved download cache button into the cache viewer
    • fixed bug where the current page is incorrectly loaded
    • massive code refactors
  • v0.3.5 06/09/2024
    • fixed a really bad memory leak from infinite while loop
  • v0.3.4 06/09/2024

    hotfix update (sorry the previous update was a bit rushed >.<)

    • fixed persistent-cache.keys wrong default, causing new users unable to start the userscript
    • removed unexpected debugger statement
  • v0.3.3 06/09/2024
    • fixed deleting page cache not working properly
    • backend code improvements
  • v0.3.2 04/09/2024

    hotfix update

    • fixed cache deletion not working properly
  • v0.3.1 04/09/2024
    • readded key-value based storage caching as a fallback because navigator.storage.getDirectory() (or OPFS) may not work on firefox private browsing
      • this was also added by request via email
      • option to switch between OPFS and key-value based storage caching will be added soon™
    • automatically save images between fetching if image caching limit is greater than 13 images
  • v0.3.0 31/08/2024
    • replaced key-value based storage into file-based storage using origin private filesystem
      • improved performance by storing the image data directly into files instead of first serializing it via base64
    • renamed some buttons to fit their functionality better
    • removed "Sync Cache Store" button, since "Refetch Cache" button already automatically saves for you
    • changed image fetch locking so it always prioritizes image fetch in the current tab, instead of waiting image fetching in other tab to finish
    • changed logging function, now shows blue "ehtp" for logs in the browser console for better visibility
    • changed license into GPL-2.0-or-later
    • backend code improvements
  • v0.2.4 18/08/2024
    • backend code improvements
  • v0.2.3 17/08/2024
    • removed janky lock implementation instead opting for Web Locks API, this'll also means the userscript will only work on HTTPS-only
  • v0.2.2 11/08/2024
    • added refetch button, and reset cache button no longer automatically refetches the image
    • changed extensive description to expandable for each options
    • increase default persistent-cache-limit from 270 to 300
    • fixed dead-lock: locks that will never get unlocked from closed tab, thus image caching will never happen
    • fixed image caching triggerred multiple times when changing settings, etc.
    • fixed reset cache button not properly resetting cache across tabs
    • improved image caching by fetching next page and image at the same time
      • previous behavior will fetch all future pages, and then fetch the images, which is slow
    • backend code improvements
  • v0.2.1 10/08/2024
    • requires GM_addValueChangeListener api
    • adding locking-unlocking mechanism between tabs to prevent downloading simultaneously, reducing site-ban
    • "reset cache" functionality now resets cache globally across tabs
    • minor backend code cleanup
  • v0.2.0 10/08/2024
    • added new concurrent image caching option: this will set how many image the script will download concurrently. if it reaches the limit, it will defer remaining image caching later.
    • added new download page store cache: this will download all of the images from the page cache. if it was previous synced with persistent cache before, it will also download caches from other tabs. to prevent this, and specifically target the current page, you may reset the cache.
    • renamed and migrated options to better fit the functionality, specifically:
      • "Max Image Cache" -> "Image caching limit"
      • "Max Image Cache while Idling" -> "Idle concurrent image caching limit"
      • "Saved Cache" -> "Persistent cache limit" set to -1
      • "Saved Cache Limit" -> "Persistent cache limit"
      • "Saved Cache Timeout" -> "Persistent cache store timeout"
    • better debug information
    • massive backend code refactoring
    • revised greasyfork userscript page description
  • v0.1.3 30/06/2024
    • removed 'all rights reserved' as its uses gm_fetch library from trim21
    • no source code changes
  • v0.1.3 30/06/2024
    • sync saved cache after fetching all images on a new page
    • added caching image while the user is idling, with seperate max image limit
    • general code improvements
  • v0.1.2 29/06/2024
    • fixed several storage bugs, notable ones include:
      • clearing saved cache not working properly
      • getting the cache returns undefined
      • unneccessary image re-downloading when saved cache limit is set lower than max image cache limit
      • saved cached images sometime get randomly deleted
    • fixed incorrect @connect domain syntax for tampermonkey
    • made version code dynamically updated using GM_info
    • removed GM_listValues dependency
    • other than that, nothing major feature-wise, just general code improvement and other fixes
  • v0.1.1 29/06/2024
    • hotfix of previous still-error hotfix >-<"
  • v0.1.1 29/06/2024
    • hotfix: fixed getPersistentCache reference error
  • v0.1.1 29/06/2024
    • fixed wrong version on the settings popup
    • fixed saved cache limit doesn't work
  • v0.1.0 28/06/2024
    • minor UI changes, and cache indicator on top of the image:
      • cache indicator shows when the userscript is caching the image, or the image is cached. you can see this on top right, above the hentai page
      • settings UI now can be toggled by a button on top left, above the hentai page
    • rehaul the caching system by fetching the images directly instead relying on the browser's . this improves image caching A LOT by forcing it to download images, compared to previous solution, using the browser's caching, which is unreliable because they may be cleared automatically by the browser, and/or fail to load
      • also made possible using GM_fetch by trim21 on github. thanks for your hard work!
    • users can now save their cache into their userscript storage! this is called "saved cache" or "persistent cache". next time the user loads the same hentai pages, the userscript will load the previous saved cache, making it faster!
      • but be careful, as going too overbroad can take up lots of storage space! (i know this well from experience :P)

    oh well, it was a big update to work on (and a lot of materials to work with~)

    i hope you guys enjoy!

  • v0.0.3 29/01/2024
    • modified greasyfork description and userscript description, trying to differentiate "downloading" and "preloading"
    • added owowed sign-off
  • v0.0.2 28/01/2024
    • changed the preload image execution by observing changes in the page image, and then checks for the current page number, instead of listening for event from the "next" anchor element. this method is far more efficient than the previous one
    • rewrote the code by staying away from bad function recursion code, and directly mutate variables instead
    • improved greasyfork description
    • minor modification to the userscript metadata, specifically consistent spacing and changing "namespace" value
  • v0.0.1 28/01/2024