Greasy Fork

Greasy Fork is available in English.

2023获取ss号

获取SS号

您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey 篡改猴Greasemonkey 油猴子Violentmonkey 暴力猴,才能安装此脚本。

您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey 篡改猴,才能安装此脚本。

您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey 篡改猴Violentmonkey 暴力猴,才能安装此脚本。

您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey 篡改猴Userscripts ,才能安装此脚本。

您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey 篡改猴,才能安装此脚本。

您需要先安装一款用户脚本管理器扩展后才能安装此脚本。

(我已经安装了用户脚本管理器,让我安装!)

您需要先安装一款用户样式管理器扩展,比如 Stylus,才能安装此样式。

您需要先安装一款用户样式管理器扩展,比如 Stylus,才能安装此样式。

您需要先安装一款用户样式管理器扩展,比如 Stylus,才能安装此样式。

您需要先安装一款用户样式管理器扩展后才能安装此样式。

您需要先安装一款用户样式管理器扩展后才能安装此样式。

您需要先安装一款用户样式管理器扩展后才能安装此样式。

(我已经安装了用户样式管理器,让我安装!)

// ==UserScript==
// @name         2023获取ss号
// @namespace    http://tampermonkey.net/
// @version      0.1
// @description  获取SS号
// @author
// @match        http://book.gzlib.org/views/*
// @match        http://www.ucdrs.superlib.net/*
// @match        http://book.ucdrs.superlib.net/views/*
// @match        https://book.duxiu.com/bookDetail.jsp?*
// @grant        GM_xmlhttpRequest
// @license      吾爱破解
// ==/UserScript==


setTimeout(function () {
    var lt_url = window.location.href;
    var img_herf;
    try {
        img_herf = document.getElementsByClassName('testimg')[0].getElementsByTagName('a')[0].getAttribute('href');
    } catch {
        try{
            img_herf = document.getElementsByClassName('link')[0].getElementsByTagName('a')[0].getAttribute('href');
        }
        catch {
            img_herf = document.getElementsByClassName('bnt_content')[0].getElementsByTagName('a')[0].getAttribute('href');
        }
    }
    var reg = /\/.*?(?=')/;
    var url;
    if (lt_url.indexOf("ucdrs") !== -1) {
        url = "http://book.ucdrs.superlib.net/" + img_herf.match(reg);
    } else if (lt_url.indexOf("gzlib") !== -1) {
        url = "http://book.gzlib.org/" + img_herf.match(reg);
    } else if (lt_url.indexOf("duxiu") !== -1) {
        img_herf = document.getElementsByClassName('bnt_content')[0].getElementsByTagName('a')[0].getAttribute('href');
        url = "http://book.duxiu.com/" + img_herf.match(reg);
    }
    GM_xmlhttpRequest({
        url: url,
        method: "GET",
        onload: function (xhr) {
            var ssurl = xhr.finalUrl;
            var ssreg = /\d{8}(?=\/)/;
            var ssno = ssurl.match(ssreg);
            window.bookssno = ssno;
            sentback(ssno);
        }
    });

    function sentback(ssno) {
        const online = document.getElementsByClassName("tubookimg")[0];
        const ss_div = document.createElement('div');
        ss_div.className = 'ssno';
        ss_div.innerHTML = '<span><font color="blue" size="16">SS:' + window.bookssno + '</font></span>';

        if (online==undefined){
            const online1 = document.getElementsByClassName("card_pic leftF")[0];
            online1.insertAdjacentElement('afterend', ss_div);
        }else{
            online.insertAdjacentElement('afterend', ss_div);
        }
    }
    // Your code here...
}, 1000);