e-hentai images overload

preload and cache next pages for faster loading time!

These are versions of this script where the code was updated. Show all versions.

  • v1.4.5 2025-01-01

    fix:

    • fix: re-use requestAnimationFrame again, but only initialized it the first time (abc65cd)
    • fix: miscategorized data between image blob and source in gallery collection (0b6daa2)

    others:

    • v1.4.5 (9506173)
  • v1.4.4 2025-01-01

    fix:

    • fix: use window "load" event instead of requestAnimationFrame due to performance degradation (c4955d8)

    refactor:

    • refactor: rework storage for gallery revision in order to generate gallery links in the explorer (b309a35)
    • refactor: rename "parseGalleryPageId" to "parseGalleryPageInfo" (3ed1484)
    • refactor: the GalleryPageImageSource and GalleryPageImageBlob's "description" property to "page" (ef01a5e)
    • refactor: adjust saving priority in fetchGalleryPages(), ensuring images are saved timely (083a104)

    chore:

    • chore: add commit version skipping, and docs (673f2c8)
    • chore: upgrade npm packages (950ceae)

    others:

    • v1.4.4 (c02426b)
  • v1.4.3 2024-12-31

    notable change include replacing the obselete image auto viewport with image auto fit. image auto fit resizes the image's width and height, containing it within the browser screen (tl;dr: does not overflow), regardless if the image is oversized

    refactor:

    • refactor: sorting imports ascending (69d6154)
    • refactor: change auto focus startup order (ef533d0)
    • refactor: unblur the first gallery page in the gallery panel (3de5577)
    • refactor: sort gallery panel's page list (86103b1)
    • refactor: replace image auto viewport height with image auto fit (50b3b20)

    others:

    • v1.4.3 (bbc2787)
  • v1.4.2 2024-12-31

    this update improves image auto viewport height reliability

    refactor:

    • refactor: use CSS variable and dataset state for reliability (af62c38)
    • refactor: ensure code only executes when the setting is enabled (cb41b7b)
    • refactor: save image after loaded in getImageUrlFast() (55d6e92)
    • refactor: image centering when image width overflows, ... (b1fdfe4)

    others:

    • v1.4.2 (5a67d96)
  • v1.4.1 2024-12-28

    this release contains an important fix (-.-") to the previous update

    fix:

    • fix: image width oversized in some cases when its height is forced to fit to the viewport (5125f97)

    refactor:

    • refactor: automatically scroll into view to the status bar when image's height is dynamically set (fa229e8)

    others:

    • v1.4.1 (b0bacb4)
  • v1.4.0 2024-12-28

    this release contains a feature related to image height and translation keys improvements

    feature:

    • feat: automatically sets the image's height to 99% of viewport height ... (9f76fd6)
      • this is useful to dynamically size image so that it is readable and not too oversized

    refactor:

    • refactor: improve translation keys and namespaces (13ffbcf)

    others:

    • v1.4.0 (2f751b9)
  • v1.3.5 2024-12-28

    this release contains an important hotfix for image loading stability

    fix:

    • fix: re-add patchCacheImage() to main function, and an if guard to patchCacheImage ... (f99ceed)

    others:

    • v1.3.5 (6b641e0)
  • v1.3.4 2024-12-28

    this release contains major rework behind storage and save/load-ing images mechanism

    fix:

    • fix: properly cap preloaded images by preload-cached-image (2b77e6a)
    • fix: gallery collection timeout not properly initializing (330b480)
    • fix: memory leak of setInterval in waitImageElement() (d4b5a4f)

    refactor:

    • refactor: reload gallery panels and gallery pages when gallery collection item has been saved (fdd92f9)
    • refactor: save necessary images while fetching them (d6d2aec)
    • refactor: improve cache loading by loading specific gallery asyncronously ... (94ca85f)
    • refactor: remove unavailability by settings for userscript directory (6092ee0)
    • refactor: stop saving gallery revision, since it was unnecessary (f0ac7fd)
    • refactor: rename gallery collection "store" term to "shelf" (62bdb39)
    • refactor: page/patch-cache-image now forces patching (7668835)
    • refactor: no longer use patchCacheImage in main.ts (replaced by monkey/i3-setter.ts) (5c56414)
    • refactor: preload 10 images before the current image for backward navigation (56e1488)
    • refactor: use for-of (1e5d029)
    • refactor: add logging for loadGalleryCollectionStore and gallery collection store timeout (51f5bf1)
    • refactor: hard limit for key-value type storage for userscript stability (aca74df)
    • refactor: rename storage/directory to storage/opfs-directory for clarity (42433e8)
    • refactor: remove usage of .tsx, separate preloadCachedImages from patch-cache-image.ts script (b04805a)
    • refactor: move monkey patch related imports after other imports on main file (ea4501c)
    • refactor: rename "save-storage" folder to "storage" (e754212)
    • refactor: move monkey patching related scripts into its own folder (b11d05b)

    others:

    • v1.3.4 (cb36233)
    • docs: fast-image-url explanation, add pointer (see also links) in other related scripts (0f6ed40)
    • docs: minor explanations for the monkey patch scripts (6cdc117)
  • v1.3.3 2024-12-25

    this release contains minor improvements and bugfix

    fix:

    • fix: gallery explorer not correct loading when clicked (e070896)

    refactor:

    • refactor: rework scheduling so UIs are loaded first, also fixes gallery explorer UI loading (ad7383e)

    others:

    • v1.3.3 (eea6f96)
  • v1.3.2 2024-12-25

    this update contains a hotfix for a performance improvement which does not work in the previous update:

    • fix: use unsafeWindow to patch setTimeout function ... (6bd4e86)

    chore:

    • chore: remove commits.txt (bbc3517)
    • chore: write commits.txt file in dist so it gets properly .gitignore'd (84cc89c)
    • chore: include version in the first iterating commit (c5f061a)

    others:

    • v1.3.2 (d1f6583)
  • v1.3.1 2024-12-25

    view release note at https://gitgud.io/owowed/e-hentai-images-overload/-/releases/v1.3.1

    perf:

    • perf: increase preload-cached-image limit to 10 (059722c)
    • perf: make page navigation faster by removing unneccessary cooldown from monkey patching setTimeout (09db3d4)
    • perf: improve image loading by monkey patching i3 setter from ehg_show.c.js (a334f2f)
    • perf: improve image loading by using preload image href (0c20af2)

    fix:

    • fix: use observer instead of setInterval for element update reliability in firefox (873b101)
    • fix: file writing error (OPFS) because incorrect usage of writeable stream (a9581de)

    refactor:

    • refactor: use GM_deleteValue where GM_deleteValues are not available (10e54ea)
    • refactor: schedule low priority tasks using scheduler.postTask (bae9a8e)
    • refactor: use setInterval and navigation API for detecting page changes (63dc807)
    • refactor: replace "ehp" prefix for time log message into plain text (no CSS) (9f19ae6)
    • refactor: make log related settings configurable from unsafeWindow (e2a8d6b)
    • refactor: add timing log functions (time, timeLog, timeEnd) (f06d63b)
    • refactor: remove unused serialize functions, refactor serialzable blob related files (efdd33f)

    chore:

    • chore: ignore commits.txt (changelog) for inconsistency between commits (e79927f)
    • chore: update changelog (commits.txt) (80dfe22)
    • chore: use .txt file instead of .md (markdown) (44be49f)
    • chore: include dev version commit in the changelog (575bf79)
    • chore: create python script to automatically generate changelog from commit history (683922f)

    others:

    • v1.3.1 (c778d46)
    • v1.3.1-dev (afbbb5e)
  • v1.3.0 2024-12-23

    view release note at https://gitgud.io/owowed/e-hentai-images-overload/-/releases/v1.3.0

    minor features for gallery panel in the gallery explorer:

    • feat: add "fetch more" button to fetch more gallery pages, only available within current gallery (7a9e1f0)
    • feat: add delete button for GalleryPanel (deleting per-gallery) (f69e392)

    bugfixes and performance improvements:

    • perf: load image source and blob on-demand instead of all gallery collection (d56b53f)
    • fix: deleting specific gallery wasn't working properly due to incorrect filtering (4854dbb)
    • fix: gallery not loaded from storage due to incorrect property format (4b64785)

    refactors:

    • refactor: keep GalleryPanel state by reloading neccessary parts instead of replacing them whole (f4e5dec)
    • refactor: add fech gallery pages result information, currently it returns lastPageIndex info (c97b1af)
    • refactor: forgot await here otherwise the task wouldnt be yielded (cc07d21)
    • refactor: make lazy load/save the default, use scheduler.yield() ... (b723baf)
    • refactor: rename rotateDeleteGalleryCollectionStore count -> maxIteration (c072671)
    • refactor: limitGalleryCollectionStore now deletes entry on collection shelf ... (a451b71)
    • refactor: make GalleryPanel require collectionShelf to be reusable (94b0b5e)
    • refactor: use updated loadGalleryCollectionStoreInfo function parameters (3b9d28f)
    • refactor: lazy load gallery collection when its only needed by gallery explorer (4b9adaf)
    • refactor: loadGalleryCollectionStoreItem use GalleryPageInfo instead of id (62fa384)
    • refactor: introduce lazy saving for fetching images (9c7019d)
    • refactor: load/save with optional blob, instead of outright deleting it (d9a6703)

    chores:

    • chore: check script that runs both typecheck and link scripts (bb6a0a0)
    • chore: typecheck script that runs tsc --noEmit (31973eb)
  • v1.2.0 2024-12-02

    new configuration for limiting image caching on background session:

    • feat: add background session image caching limit (f8f71a8)
      • this setting limits how many background session can still run image fetching/caching
      • background session means an inactive tab or a browser tab that is not currently in use by the user

    bugfixes, refactor, etc.:

    • fix: make galleryId parameter in getGalleryCollectionItem required (fe66cda)
    • fix: apiDataRaw not being converted to GalleryPageApiData before passing into argument (a3c8b4b)
    • fix: revert d7a360f[!], apparently stealing is only available for exclusive lock (775ddca)
    • fix: stop fetching images when gallery collection store is reset/cleared (dfbca3d)
    • refactor: remove unused feature code for fetching more images in gallery explorer (27fb090)
    • refactor: fetchGalleryPages to use object init instead of positional arguments (6824bff)
    • refactor: make fetchGalleryPages's maxPageCount parameter required (3cff787)
    • refactor: simplify the shared lock lmit algorithm (db922b7)
    • refactor: reorder background-session-image-caching-limit SettingsEntry (14fb702)
    • refactor: query locks in the loop to get latest value instead of being static (628b2fb)
    • refactor: steal lock for current active session regardless of the background session caching limit (d7a360f)
    • refactor: reorder settings properties to match SettingsPage's entries order (6397fb7)
    • chore: clarify status section, add Greasy Fork page (8ddf1c3)
    • chore: add screenshots to README (0753cd0)

    [!] corrected, this was incorrectly linked on the commit history

  • v1.1.0 2024-12-01

    view release note at https://gitgud.io/owowed/e-hentai-images-overload/-/releases/v1.1.0

    couple of neat QoL features:

    • feat: add images/zip packaging for download status indicator (8dc41f9)
    • feat: add refetch pages button to gallery explorer, change toolbar buttons order (af601de)
    • feat: gallery link in gallery panel title, made with gallery revision (0c19358)

    bugfixes, refactor, etc.:

    • fix: missing revision parameter (98d6822)
    • fix: incorrect splitting pathname, blank string at start (b4ae494)
    • fix: imageOriginalUrl may be undefined (a722648)
    • fix: unquoted attribute in CSS selector (e47d8b6)
    • refactor: change refetch pages button functionality to not force fetch images (4a73edd)
    • refactor: move getCurrentGalleryPage[Info] function to gallery-page-info (e72e76e)
    • refactor: move gallery api data related parts into gallery-page-api file (1f3c836)
    • refactor: gallery-page-description to gallery-page-info (495cf9a)
    • refactor: parse imageOriginalUrl from api data, moving parts around in parseGalleryPageImageSource (bf47eb1)
    • refactor: move gallery page api data interfaces to gallery-page-api (93ac0ad)
    • refactor: add "#"-prefix for gallery id in title (25d9c89)
    • refactor: log image fetching failure (a60fb9f)
    • chore: setup commitlint and husky, following conventional commit spec for commit messages (e38fc1f)
    • chore: sync version from package.json (df5f10b)
  • v1.0.1 2024-12-01

    nothing major has changed, this release simply contains bug fixes and optimizations:

    • optimize collection load/save by checking existing items, and load/save if needed
    • keep gallery explorer UI state temporarily by checking if gallery collection's size was changed before reloading it
    • fix: account for -1 (disable setting) value for persistent-cache-timeout and image-caching-cooldown
    • fix: xml-http-request-sniffer not working at all because of unparsed JSON data
  • v1.0.0 2024-12-01

    view the source code at https://gitgud.io/owowed/e-hentai-images-overload

    this release notes contain changes from v0.4.5 to v1.0.0:

    • rewrite the userscript from the ground-up, now written largely across different folders and files, and not as a singular userscript file. this greatly improves code readability and maintenance.
      • this would also mean rewriting the code behind fetching and caching the images, dropping/fixing some of the instability, hacky workarounds, and performance issues from the previous userscript.
      • the project uses jsx-dom to rewrite all the UI components, getting new and better UI refresh for all menus and pages.
    • remove some features largely due to complicated implementation. these removed features include, but not all:
      • Idle image caching - caching more images than the set limit while the user is idling.
      • Page cache limit - a limit on how many pages can be stored in persistent cache, in the user session (each tab).
    • downloading pages or galleries inside the new gallery explorer would download a zip instead of multiple image files.
      • the userscript would require JSZip version 3.9.1 for this feature.
    • reduce bandwidth and requests, specifically:
      • using e-hentai API instead of scrapping next pages just to get image sources. a side effect of this is that the userscript now can generate page URLs for each pages in the gallery explorer.
      • lazily checking fetched images instead of re-fetching a new one.
    • previous saves of images are now incompatible, and need to be reset first in the old userscript version to clean up unused space.
      • future releases may include a tool for this.
    • for v1.0.0 release on Greasy Fork, the namespace is left unchanged from previous release, this is done purposely to make upgrading to this version easy for the end users. note that for future update (>1.0.0), the namespace will be changed and users will have to migrate.
      • you can migrate by changing this line of code from: "// @namespace e.owowed.moe" to "// @namespace owowed.moe"
  • v0.4.5 2024-09-11
    • make cache viewer load its gallery asynchronously
  • v0.4.4 2024-09-11
    • 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 2024-09-08
    • 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 2024-09-08

    hotfix update

    • fixed page-cache-limit compatibility mapping
  • v0.4.1 2024-09-08
    • 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 2024-09-08
    • 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 2024-09-06
    • fixed a really bad memory leak from infinite while loop
  • v0.3.4 2024-09-06

    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 2024-09-06
    • fixed deleting page cache not working properly
    • backend code improvements
  • v0.3.2 2024-09-04

    hotfix update

    • fixed cache deletion not working properly
  • v0.3.1 2024-09-04
    • 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 2024-08-31
    • 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 2024-08-18
    • backend code improvements
  • v0.2.3 2024-08-17
    • 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 2024-08-11
    • 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 2024-08-10
    • 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 2024-08-10
    • 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 2024-06-30
    • removed 'all rights reserved' as its uses gm_fetch library from trim21
    • no source code changes
  • v0.1.3 2024-06-30
    • 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 2024-06-29
    • 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 2024-06-29
    • hotfix of previous still-error hotfix >-<"
  • v0.1.1 2024-06-29
    • hotfix: fixed getPersistentCache reference error
  • v0.1.1 2024-06-29
    • fixed wrong version on the settings popup
    • fixed saved cache limit doesn't work
  • v0.1.0 2024-06-28
    • 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 2024-01-29
    • modified greasyfork description and userscript description, trying to differentiate "downloading" and "preloading"
    • added owowed sign-off
  • v0.0.2 2024-01-28
    • 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 2024-01-28