Jinxin Novel Fallen Ark

下载堕落方舟中的小说

此腳本不應該直接安裝,它是一個供其他腳本使用的函式庫。欲使用本函式庫,請在腳本 metadata 寫上: // @require https://update.sleazyfork.org/scripts/487103/1330371/Jinxin%20Novel%20Fallen%20Ark.js

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

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

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

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

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

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

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

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

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

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

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

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

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

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

// ==UserScript==
// @name         Jinxin Novel Fallen Ark
// @namespace    https://gitee.com/jinxin11112/tampermonkey
// @version      0.1.7
// @description  下载堕落方舟中的小说
// @author       jinxin
// @match        https://bbs.fallenark.com/*
// @grant        none
// @license MIT
// ==/UserScript==

class FallenArk {
    'use strict';

    getContent() {
        let messages = document.getElementsByClassName("t_f");
        let contentList = [];
        for (let message of messages) {
            let content = message.innerHTML;
            content = this.removeGarbled(content);
            if (content) contentList.push(content);
        }
        return contentList;
    }

    removeGarbled(str) {
        if (!str) return str;
        // str = str.replace(/<div class="quote"><blockquote>([.\n]*)<\/blockquote><\/div>/g, ''); // 互动内容直接去除(先不去除了)
        // 乱码内容直接去除
        str = str.replace(/<span style="display:none">(.*)<\/span>/g, '');
        str = str.replace(/<font class="jammer">(.*)<\/font>/g, '');
        str = str.replace(/(&nbsp;)/g, ' ');
        str = str.replace(/<br>/g, '');
        return str;
    }

    getTitle() {
        let title = document.title;
        title = title.replace(' - 转载文章', '');
        title = title.replace(' - 原创图书馆', '');
        title = title.replace(' - 底层:破碎梦呓', '');
        title = title.replace(' - 第一层:残缺殿堂', '');
        title = title.replace(' - 第二层:愤恨之塔', '');
        title = title.replace(' - 第三层:复仇之地', '');
        title = title.replace(' - 顶层:神圣天堂', '');
        title = title.replace(' - Fallen Ark【堕落方舟】', '');
        title = title.replace(' - Powered by Discuz!', '');
        title = title.replace(' - 手机版', '');
        return title;
    }
}