E(x)-Hentai One-Click DL

Enables one-click DL archive downloading (GP/Credits are still required). Supports E-Hentai & EXHentai.

Versione datata 05/06/2015. Vedi la nuova versione l'ultima versione.

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         E(x)-Hentai One-Click DL
// @namespace    https://github.com/DakuTree/userscripts
// @author       Daku ([email protected])
// @description  Enables one-click DL archive downloading (GP/Credits are still required). Supports E-Hentai & EXHentai.
// @homepageURL  https://github.com/DakuTree/userscripts
// @supportURL   https://github.com/DakuTree/userscripts/issues
// @include      /^http[s]?:\/\/(g\.e-|ex)hentai\.org\/g\/.*$/
// @updated      2013-07-29
// @version      1.0.3
// ==/UserScript==

var a = document.getElementsByClassName('g2')[0].getElementsByTagName('a')[0];
var xs = a.getAttributeNode('onclick').nodeValue.split('?')[1].split("'")[0];
a.removeAttribute('onclick');


a.addEventListener('click', function() {
	var http = new XMLHttpRequest();
	var params = "dlcheck=Download Archive";
	http.open("POST", location.origin+'/archiver.php?'+xs, true); //TODO: Check if location.origin is correct
	http.setRequestHeader("Content-type", "application/x-www-form-urlencoded");

	http.onreadystatechange = function() {
		if(http.readyState == 4 && http.status == 200) {
			if(http.responseText.indexOf("Please wait...") !== -1){ //Check if pop-up opened.
				var match = /<a href="(http.*?)"/g.exec(http.responseText);
				window.location.href = match[1] + "?start=1";
			}
		}
	}
	http.send(params);

	return false
}, false);