ExHentai - Preload next page

Loosely inspired by "Handy ExHentai" script. Now loads more pages by nesting iFrames.

Dovrai installare un'estensione come Tampermonkey, Greasemonkey o Violentmonkey per installare questo script.

Dovrai installare un'estensione come Tampermonkey o Violentmonkey per installare questo script.

Dovrai installare un'estensione come Tampermonkey o Violentmonkey per installare questo script.

Dovrai installare un'estensione come Tampermonkey o Userscripts per installare questo script.

Dovrai installare un'estensione come ad esempio Tampermonkey per installare questo script.

Dovrai installare un gestore di script utente per installare questo script.

(Ho già un gestore di script utente, lasciamelo installare!)

Dovrai installare un'estensione come ad esempio Stylus per installare questo stile.

Dovrai installare un'estensione come ad esempio Stylus per installare questo stile.

Dovrai installare un'estensione come ad esempio Stylus per installare questo stile.

Dovrai installare un'estensione per la gestione degli stili utente per installare questo stile.

Dovrai installare un'estensione per la gestione degli stili utente per installare questo stile.

Dovrai installare un'estensione per la gestione degli stili utente per installare questo stile.

(Ho già un gestore di stile utente, lasciamelo installare!)

// ==UserScript==
// @name		ExHentai - Preload next page
// @version	1.1
// @namespace	exhentai-preload-page
// @author	BlindJoker
// @homepage	https://github.com/BlindJoker
// @description	Loosely inspired by "Handy ExHentai" script. Now loads more pages by nesting iFrames.
// @match		http://exhentai.org/s/*
// @match		http://g.e-hentai.org/s/*
// @run-at		document-end
// @grant		none
// ==/UserScript==
/*
* Let the user scripts or content scripts running in an annoymous function.
*/
(function (window) {
	"use strict";

	var pnext = document.getElementById("next").href;

	// Prevents possible infinite loadings
	if(window.self !== window.top && window.location.href == pnext) {
		console.log("finished loading everything");
		return;
	}

	var nframe = document.createElement("iframe");
	nframe.src = pnext;
	nframe.id = "nframe";
	nframe.style.width = "1px";
	nframe.style.height = "1px";
	nframe.style.border = "none";

	document.getElementById("img").addEventListener('load', function() {
		document.body.appendChild(nframe);
	});

	var script = document.createElement('script');

	script.type = "text/javascript";
	script.innerHTML =  	"var uweo = update_window_extents;" +
			"update_window_extents = function() {" +
			"	uweo();" +
			"	document.getElementById('img').addEventListener('load', function() {" +
			"		document.getElementById('nframe').src = document.getElementById('next').href;" +
			"	});" +
			"}";

	document.head.appendChild(script);
}) (window);