Sleazy Fork is available in English.

Exhentai MPV Auto Load

Auto load all image from exhentai at mpv mode

질문, 리뷰하거나, 이 스크립트를 신고하세요.
  1. // ==UserScript==
  2. // @name Exhentai MPV Auto Load
  3. // @namespace http://mhycy.me/
  4. // @version 0.1
  5. // @description Auto load all image from exhentai at mpv mode
  6. // @author mhycy
  7. // @match *://exhentai.org/mpv/*/*
  8. // @icon https://e-hentai.org/favicon.ico
  9. // @grant none
  10. // @license MIT
  11. // ==/UserScript==
  12.  
  13. (function() {
  14. 'use strict';
  15.  
  16. var MAX_REQUEST_PER_SECOND = 20;
  17.  
  18. var hook_load_image = function(max_request_per_second) {
  19. var old_function = window.load_image;
  20.  
  21. window.load_image = function(c) {
  22. console.log(c);
  23. console.log(imagelist[c - 1]);
  24. if (imagelist[c - 1].i != undefined) {
  25. var d = '<a href="#page' + (c + 1) + '"><img id="imgsrc_' + c + '" src="' + imagelist[c - 1].i + '" title="' + imagelist[c - 1].n + '" style="margin:0; width:' + imagelist[c - 1].xres + "px; height:" + imagelist[c - 1].yres + 'px"' + (imagelist[c - 1].reloaded == undefined ? ' onerror="this.onerror=null; action_reload(' + c + ')"' : "") + ' /></a> <div class="mi1"> <div class="mi2"> ' + (imagelist[c - 1].o == "org" ? '<img style="cursor:default; opacity:0.5" title="Original Image" src="' + img_url + 'mpvd.png" />' : '<img title="' + imagelist[c - 1].o + '" onclick="action_fullimg(' + c + ')" src="' + img_url + 'mpvd.png" />') + ' <img title="Reload broken image" onclick="action_reload(' + c + ')" src="' + img_url + 'mpvr.png" /> </div> <div class="mi3"> <a href="' + base_url + imagelist[c - 1].lo + '" target="_ehshow_' + gid + "_" + c + '"><img title="Open image in normal viewer" onclick="action_open(' + c + ')" src="' + img_url + 'mpvn.png" /></a> <img title="Show galleries with this image" onclick="action_search(' + c + ')" src="' + img_url + 'mpvs.png" /> <img title="Get forum link to image" onclick="action_link(' + c + ')" src="' + img_url + 'mpvl.png" /> </div> <div class="mi4">' + imagelist[c - 1].d + " :: " + imagelist[c - 1].n + '</div> <div style="clear:both"></div> </div>';
  26. document.getElementById("image_" + c).innerHTML = d;
  27. rescale_image(c, document.getElementById("imgsrc_" + c))
  28. } else {
  29. if (imagelist[c - 1].xhr != undefined) {
  30. return
  31. }
  32. imagelist[c - 1].xhr = new XMLHttpRequest();
  33. var b = Date.now();
  34. if (b < next_possible_request) {
  35. var a = next_possible_request - b;
  36. setTimeout(function() {
  37. preload_image(c)
  38. }, a)
  39. } else {
  40. preload_image(c)
  41. }
  42. next_possible_request = Math.max(b, next_possible_request) + Math.floor(1000 / max_request_per_second)
  43. }
  44. }.bind(window)
  45. }.bind(window);
  46.  
  47. var hook_load_all = function () {
  48. for (let i = 1; i < imagelist.length; i++) {
  49. load_image(i);
  50. }
  51. }.bind(window);
  52.  
  53. var hook_test = function() {
  54. console.log(imagelist.length);
  55. }.bind(window);
  56.  
  57. hook_load_image(MAX_REQUEST_PER_SECOND);
  58. setTimeout(hook_load_all, 0);
  59.  
  60. })();