nhentai preloader

Preload images on nhentai for faster loading

Ekde 2015/05/17. Vidu La ĝisdata versio.

You will need to install an extension such as Tampermonkey, Greasemonkey or Violentmonkey to install this script.

You will need to install an extension such as Tampermonkey to install this script.

You will need to install an extension such as Tampermonkey or Violentmonkey to install this script.

You will need to install an extension such as Tampermonkey or Userscripts to install this script.

You will need to install an extension such as Tampermonkey to install this script.

You will need to install a user script manager extension to install this script.

(I already have a user script manager, let me install it!)

You will need to install an extension such as Stylus to install this style.

You will need to install an extension such as Stylus to install this style.

You will need to install an extension such as Stylus to install this style.

You will need to install a user style manager extension to install this style.

You will need to install a user style manager extension to install this style.

You will need to install a user style manager extension to install this style.

(I already have a user style manager, let me install it!)

// ==UserScript==
// @name         nhentai preloader
// @description  Preload images on nhentai for faster loading
// @version      0.1
// @author       blazeu
// @match        http://nhentai.net/g/*/*/
// @grant        none
// @namespace https://greasyfork.org/users/11422
// ==/UserScript==

(function () {
  function preload (url) {
    document.createElement('img').src = url
  }

  function mediaUrl (media, page) {
    return '//i.nhentai.net/galleries/'.replace(/^https?:/, '') + media + '/' + page
  }

  var stock = switch_page
  switch_page = function () {
    stock.apply(this, arguments)
    preload(mediaUrl(media_id, +current_page + 1))
  }
  preload(mediaUrl(media_id, +current_page + 1))
})()