ExHentai.org自动登录

看本子更简单一点。

您需要先安裝使用者腳本管理器擴展,如 TampermonkeyGreasemonkeyViolentmonkey 之後才能安裝該腳本。

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

您需要先安裝使用者腳本管理器擴充功能,如 TampermonkeyViolentmonkey 後才能安裝該腳本。

您需要先安裝使用者腳本管理器擴充功能,如 TampermonkeyUserscripts 後才能安裝該腳本。

你需要先安裝一款使用者腳本管理器擴展,比如 Tampermonkey,才能安裝此腳本

您需要先安裝使用者腳本管理器擴充功能後才能安裝該腳本。

(我已經安裝了使用者腳本管理器,讓我安裝!)

你需要先安裝一款使用者樣式管理器擴展,比如 Stylus,才能安裝此樣式

你需要先安裝一款使用者樣式管理器擴展,比如 Stylus,才能安裝此樣式

你需要先安裝一款使用者樣式管理器擴展,比如 Stylus,才能安裝此樣式

你需要先安裝一款使用者樣式管理器擴展後才能安裝此樣式

你需要先安裝一款使用者樣式管理器擴展後才能安裝此樣式

你需要先安裝一款使用者樣式管理器擴展後才能安裝此樣式

(我已經安裝了使用者樣式管理器,讓我安裝!)

// ==UserScript==
// @name           ExHentai.org自动登录
// @namespace    http://TouHou.DieMoe.net/
// @version        0.3
// @description  看本子更简单一点。
// @author       DieMoe
// @run-at       document-start
// @include        *://*.exhentai.org/*
// @include        *://exhentai.org/*
// @grant          unsafeWindow
// @compatible firefox
// @compatible chrome
// @compatible edge
// ==/UserScript==

(function() {
    'use strict';
    var igneous,ipb_member_id,ipb_pass_hash,sl;
    igneous='322abe39d';
    ipb_member_id='3512590';
    ipb_pass_hash='cfb712ea2633f9894c5dae23146f78d0';
    sl='dm_1';
    if (location.host == 'exhentai.org' && document.cookie.split(';') .length < 2) {
        alert('您尚未登录私有账号,脚本将自动登录一个公共账号。');
        autoCookie();
        window.location = '';
    }else{
        igneous=getCookie('igneous');
        ipb_member_id=getCookie('ipb_member_id');
        ipb_pass_hash=getCookie('ipb_pass_hash');
        sl=getCookie('sl');
        autoCookie();
    }

    function setCookie(c_name,value,expiredays){
        var exdate=new Date();
        exdate.setDate(exdate.getDate()+expiredays);
        document.cookie=c_name+ "=" +escape(value)+((expiredays==null) ? "" : "; expires="+exdate.toGMTString());
    }

    function getCookie(c_name)
    {
        if (document.cookie.length>0){ 
            var c_start=document.cookie.indexOf(c_name + "=");
            if (c_start!=-1) { 
                c_start=c_start + c_name.length+1;
                var c_end=document.cookie.indexOf(";",c_start);
                if (c_end==-1) c_end=document.cookie.length;
                return unescape(document.cookie.substring(c_start,c_end));
            } 
        }
        return "";
    }
    function autoCookie(){
        setCookie('igneous',igneous,365);
        setCookie('ipb_member_id',ipb_member_id,365);
        setCookie('ipb_pass_hash',ipb_pass_hash,365);
        setCookie('sl',sl,365);
    }
})();