E(x)-Hentai One-Click DL

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

Fra og med 05.06.2015. Se den nyeste version.

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 or Violentmonkey 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         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);