E-H Colour Conversion

Gives E-Hentai the Exhentai colour scheme.

As of 2018-12-01. See the latest version.

// ==UserScript==
// @name           E-H Colour Conversion
// @description    Gives E-Hentai the Exhentai colour scheme.
// @author         Hen Tie
// @homepage       https://hen-tie.tumblr.com/
// @namespace      https://greasyfork.org/en/users/8336
// @include        /https://(.*\.)?e-hentai.org.*/
// @grant          none
// @icon           https://i.imgur.com/pMMVGRx.png
// @version        1.1
// ==/UserScript==

var ehCss = ['https://e-hentai.org/z/0339/g.css', 'https://e-hentai.org/z/0338/g.css'];
var exCss = 'https://exhentai.org/z/0338/x.css';
if (document.querySelector('link[href="'+ehCss[0]+'"]')) {
	removeCss(ehCss[0]);
	addCss(exCss);
} else if (document.querySelector('link[href="'+ehCss[1]+'"]')) {
	removeCss(ehCss[1]);
	addCss(exCss);
}
function addCss(fileName) {
	var link = document.createElement("link");
	link.type = "text/css";
	link.rel = "stylesheet";
	link.href = fileName;
	link.setAttribute('data-name','E-H Colour Conversion');
	document.head.appendChild(link);
}
function removeCss(filename) {
	document.querySelectorAll('link[href="'+filename+'"]')[0].disabled = true;
}