SIS001 TXTDOWN

SIS001 小说下载

K instalaci tototo skriptu si budete muset nainstalovat rozšíření jako Tampermonkey, Greasemonkey nebo Violentmonkey.

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

K instalaci tohoto skriptu si budete muset nainstalovat rozšíření jako Tampermonkey nebo Violentmonkey.

K instalaci tohoto skriptu si budete muset nainstalovat rozšíření jako Tampermonkey nebo Userscripts.

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

K instalaci tohoto skriptu si budete muset nainstalovat manažer uživatelských skriptů.

(Už mám manažer uživatelských skriptů, nechte mě ho nainstalovat!)

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.

(Už mám manažer uživatelských stylů, nechte mě ho nainstalovat!)

// ==UserScript==
// @name         SIS001 TXTDOWN
// @namespace    http://tampermonkey.net/
// @version      2.0
// @description  SIS001 小说下载
// @author       brackrock12
// @match        http://38.103.161.134/forum/viewthread.php?tid=*
// @require      https://cdn.jsdelivr.net/npm/[email protected]/FileSaver.min.js
// ==/UserScript==

(function () {
    'use strict';




    function down() {
        const h1 = document.querySelector('.mainbox > h1:nth-child(2)')
        console.log(h1)
        let ce = document.createElement('a');
        ce.id = 'CDownBtn';
        ce.textContent = '单章下载';
        ce.style.color = 'blue';
        ce.style.textDecoration = "underline";
        // ce.href='javascript:void(0)'
        ce.onclick = function () { downtext(document); };
        h1.append(ce);


        function removeElement(doc, ele) {
            var elelist = doc.querySelectorAll(ele);
            for (const e of elelist) {
                e.remove()
            }
        }

        function downtext() {
            const con = document.querySelector('div.t_msgfont:nth-child(1)')
            console.log(con)
            removeElement(con, 'strong')
            removeElement(con, 'table')
            removeElement(con, 'strong')


            let btitle = h1.innerText.replace('[同人衍生]', '').replace('单章下载', '')
            let str = con.innerText
            let blob = new Blob([btitle + '\r\n', str], { type: "text/plain;charset=utf-8" });
            saveAs(blob, btitle + ".txt");
            ce.style.color = 'red';
        }



        setTimeout(downtext, 600);

    }


    down()


})();