Sleazy Fork is available in English.

Improved EH Reader

Inspired by Handy ExHentai and ExHentai - Preload next page. Simplifies the reader layout and preloads the next image. Preloading improved to not use an iframe.

Verzia zo dňa 11.02.2022. Pozri najnovšiu verziu.

  1. // ==UserScript==
  2. // @name Improved EH Reader
  3. // @namespace karoo
  4. // @version 2022.02.11
  5. // @description Inspired by Handy ExHentai and ExHentai - Preload next page. Simplifies the reader layout and preloads the next image. Preloading improved to not use an iframe.
  6. // @match *://e-hentai.org/s/*
  7. // @match *://exhentai.org/s/*
  8. // @run-at document-end
  9. // @grant unsafeWindow
  10. // @noframes
  11. // ==/UserScript==
  12.  
  13. function id(id) {return document.getElementById(id);}
  14. if (typeof unsafeWindow === "undefined"){unsafeWindow = window;}
  15. if (window.top !== window.self) {return;}
  16.  
  17. // hide top panel and front page link
  18. id("i1").firstElementChild.style.display = "none";
  19. id("i2").style.display = "none";
  20. document.getElementsByClassName("dp")[0].style.display = "none";
  21.  
  22. // hide frame and fix margins
  23. id("i1").style.background = "none";
  24. id("i1").style.border = "none";
  25. id("i1").style.margin = "0px auto 0px";
  26. id("i7").style.margin = "-5px auto 0px";
  27.  
  28. // preload next image without iframe
  29. var preload = new Image();
  30. function preloadNext() {
  31. if (history.length <= 1 || id("next").href == window.location.href) {return;} // don't preload if on last page or new tab
  32. var lookahead = new XMLHttpRequest();
  33. lookahead.open("GET", id("next").href, false);
  34. lookahead.send();
  35. var doc = document.implementation.createHTMLDocument('lookahead');
  36. doc.documentElement.innerHTML = lookahead.responseText;
  37. var nextImage = doc.getElementById("img").src;
  38. preload.src = nextImage;
  39. }
  40. unsafeWindow.preloadNext = preloadNext;
  41.  
  42. // preload next image after navigation
  43. var script = document.createElement("script");
  44. script.type = "text/javascript";
  45. script.innerHTML =
  46. "var uweo = update_window_extents;" +
  47. "update_window_extents = function() {" +
  48. " uweo();" +
  49. " document.getElementById('img').addEventListener('load', function() {" +
  50. " preloadNext()" +
  51. " });" +
  52. "}";
  53. document.head.appendChild(script);