E-Hitomi

Adds a button to E-Hentai to open a supported gallery on Hitomi.la

26.06.2024 itibariyledir. En son verisyonu görün.

Bu betiği kurabilmeniz için Tampermonkey, Greasemonkey ya da Violentmonkey gibi bir kullanıcı betiği eklentisini kurmanız gerekmektedir.

Bu betiği kurabilmeniz için Tampermonkey ya da Violentmonkey gibi bir kullanıcı betiği eklentisini kurmanız gerekmektedir.

Bu betiği kurabilmeniz için Tampermonkey ya da Violentmonkey gibi bir kullanıcı betiği eklentisini kurmanız gerekmektedir.

Bu betiği kurabilmeniz için Tampermonkey ya da Userscripts gibi bir kullanıcı betiği eklentisini kurmanız gerekmektedir.

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

Bu komut dosyasını yüklemek için bir kullanıcı komut dosyası yöneticisi uzantısı yüklemeniz gerekecek.

(Zaten bir kullanıcı komut dosyası yöneticim var, kurmama izin verin!)

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.

(Zateb bir user-style yöneticim var, yükleyeyim!)

// ==UserScript==
// @name         E-Hitomi
// @namespace    http://linktr.ee/GanbatGAN
// @version      2.0
// @description  Adds a button to E-Hentai to open a supported gallery on Hitomi.la
// @author       Ganbat
// @match        http*://exhentai.org/g/*
// @match        http*://e-hentai.org/g/*
// @match        http*://*.e-hentai.org/g/*
// @grant        GM.xmlHttpRequest
// @icon         data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAADAAAAAwCAYAAABXAvmHAAAABmJLR0QA/wD/AP+gvaeTAAAACXBIWXMAAAsTAAALEwEAmpwYAAAAB3RJTUUH4gQaCi4QRludjAAAAB1pVFh0Q29tbWVudAAAAAAAQ3JlYXRlZCB3aXRoIEdJTVBkLmUHAAADiUlEQVRo3u2aT2gcVRzHP+/NvOyk3XT/NHY3kI3akFqKhqIg9BCpf/FSaLW1ioeCIgha8CR68KD05kHwIPZS8CSia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Ecx6nxv7/8+htSCET0qUEEEAF0dvwDDzk3GVuBpGoAAAAASUVORK5CYII=
// ==/UserScript==

const pathsarray = window.location.pathname.split('/');
const verbose = 0;
let mricon;
if ( window.location.hostname == "exhentai.org" ) {
    mricon = "exhentai.org/img";
} else {
    mricon = "ehgt.org/g";
}

function hitomiLink(g){
    const siteContent = document.getElementById("gd5");
    let hitLinkP = document.createElement('p');
    hitLinkP.setAttribute('class', 'g2');
    hitLinkP.innerHTML = `<img src="https://${mricon}/mr.gif"> <a id="hitomilink" href="https://hitomi.la${g["galleryurl"]}">Open on Himtomi.la</a>`
    siteContent.appendChild(hitLinkP);
};

(()=>{
    // Note: This JS file contains nothing but a single variable containing JSON, a confusing choice on behalf of Hitomi.
    // We don't want to eval this script. Instead, we strip the (minor) JS from it and parse the JSON to get what we need.
    // Hopefully, this won't run afoul of Greasyfork's rules, but if it does, we can always change this to a HEAD request,
    // change the resultant link back to the E-Hentai redirect and remove the 'blocked' detection entirely.
    GM.xmlHttpRequest({
        method: "GET",
        url: "https://ltn.hitomi.la/galleries/"+pathsarray[2]+".js",
        onload: function(response) {
            if (verbose) console.log("Hitomi response status: " + String(response.status));
            if (response.status != 200) return;
            const hitGalInfo = JSON.parse(response.responseText.slice(18));
            if (verbose) console.log(hitGalInfo);
            if (hitGalInfo["blocked"]) return;
            hitomiLink(hitGalInfo);
        }
    });
})();