HentaiCookie2QRCode

Convert your e(x)hentai cookie to QRCode.

ही स्क्रिप्ट इंस्टॉल करण्यासाठी तुम्हाला Tampermonkey, Greasemonkey किंवा Violentmonkey यासारखे एक्स्टेंशन इंस्टॉल करावे लागेल.

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

ही स्क्रिप्ट इंस्टॉल करण्यासाठी तुम्हाला Tampermonkey किंवा Violentmonkey यासारखे एक्स्टेंशन इंस्टॉल करावे लागेल..

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

ही स्क्रिप्ट इंस्टॉल करण्यासाठी तुम्हाला Tampermonkey यासारखे एक्स्टेंशन इंस्टॉल करावे लागेल..

ही स्क्रिप्ट इंस्टॉल करण्यासाठी तुम्हाला एक युझर स्क्रिप्ट व्यवस्थापक एक्स्टेंशन इंस्टॉल करावे लागेल.

(माझ्याकडे आधीच युझर स्क्रिप्ट व्यवस्थापक आहे, मला इंस्टॉल करू द्या!)

ही स्टाईल इंस्टॉल करण्यासाठी तुम्हाला Stylus सारखे एक्स्टेंशन इंस्टॉल करावे लागेल.

ही स्टाईल इंस्टॉल करण्यासाठी तुम्हाला Stylus सारखे एक्स्टेंशन इंस्टॉल करावे लागेल.

ही स्टाईल इंस्टॉल करण्यासाठी तुम्हाला Stylus सारखे एक्स्टेंशन इंस्टॉल करावे लागेल.

ही स्टाईल इंस्टॉल करण्यासाठी तुम्हाला एक युझर स्टाईल व्यवस्थापक इंस्टॉल करावे लागेल.

ही स्टाईल इंस्टॉल करण्यासाठी तुम्हाला एक युझर स्टाईल व्यवस्थापक इंस्टॉल करावे लागेल.

ही स्टाईल इंस्टॉल करण्यासाठी तुम्हाला एक युझर स्टाईल व्यवस्थापक इंस्टॉल करावे लागेल.

(माझ्याकडे आधीच युझर स्टाईल व्यवस्थापक आहे, मला इंस्टॉल करू द्या!)

// ==UserScript==
// @name         HentaiCookie2QRCode
// @name:zh-CN   E站Cookie二维码生成器
// @namespace    http://tampermonkey.net/
// @version      0.1
// @description  Convert your e(x)hentai cookie to QRCode.
// @description:zh-cn  将E站Cookie转换为二维码。
// @author       pboymt
// @match        https://exhentai.org/*
// @match        https://e-hentai.org/*
// @require      https://cdn.jsdelivr.net/npm/[email protected]/src/js.cookie.min.js
// @require      https://cdn.jsdelivr.net/npm/[email protected]/qrcode.min.js
// @grant        GM_addStyle
// ==/UserScript==

(function () {
    'use strict';

    // Your code here...
    GM_addStyle('#login_qrcode img { width: 100%; height: 100% }');

    let openQRCode = false;

    const ipb_member_id = Cookies.get("ipb_member_id") || '';
    const ipb_pass_hash = Cookies.get("ipb_pass_hash") || '';
    const igneous = Cookies.get("igneous") || '';

    const floatMenu = document.createElement('div');
    const floatButton = document.createElement('div');
    const floatQRCode = document.createElement('div');

    floatMenu.style.display = 'flex';
    floatMenu.style.flexDirection = 'row';
    floatMenu.style.position = 'fixed';
    floatMenu.style.right = '0';
    floatMenu.style.bottom = '10%';
    floatMenu.style.justifyContent = 'flex-end';
    floatMenu.style.zIndex = '9999';
    floatMenu.style.transform = 'translateX(8rem)';
    floatMenu.style.transitionDuration = '.3s';

    floatButton.style.display = 'flex';
    floatButton.style.flex = 'none';
    floatButton.style.width = '1rem';
    floatButton.style.height = '8rem';
    floatButton.style.backgroundColor = 'rgba(255,255,255,0.2)';
    floatButton.style.border = '#555 solid 1px';
    floatButton.style.borderRight = 'none';
    floatButton.style.textAlign = 'center';
    floatButton.style.alignItems = 'center';
    floatButton.style.justifyContent = 'center';
    floatButton.innerText = '<';

    floatQRCode.id = 'login_qrcode';
    floatQRCode.style.display = 'flex';
    floatQRCode.style.position = 'relative';
    floatQRCode.style.flex = 'none';
    floatQRCode.style.height = '8rem';
    floatQRCode.style.width = '8rem';
    floatQRCode.style.overflow = 'hidden';
    floatQRCode.style.backgroundColor = 'rgba(255,255,255,0.2)';
    floatQRCode.style.borderTop = '#555 solid 1px';
    floatQRCode.style.borderBottom = '#555 solid 1px';


    floatMenu.appendChild(floatButton);
    floatMenu.appendChild(floatQRCode);

    document.body.appendChild(floatMenu);

    floatMenu.addEventListener('click', () => {
        openQRCode = !openQRCode;
        if (openQRCode) {
            floatButton.innerText = '>';
            floatMenu.style.transform = 'translateX(0)';
        } else {
            floatButton.innerText = '<';
            floatMenu.style.transform = 'translateX(8rem)';
        }
    });

    new QRCode(floatQRCode, {
        text: JSON.stringify({
            ipb_member_id,
            ipb_pass_hash,
            igneous
        }),
        width: 256,
        height: 256
    });


})();