sehuatang

直接把帖子列表转成图片浏览,点击图片可以进入帖子.

Ajankohdalta 16.3.2024. Katso uusin versio.

You will need to install an extension such as Tampermonkey, Greasemonkey or Violentmonkey to install this script.

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

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

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

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

You will need to install a user script manager extension to install this script.

(I already have a user script manager, let me install it!)

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.

(I already have a user style manager, let me install it!)

// ==UserScript==
// @name         sehuatang
// @description  直接把帖子列表转成图片浏览,点击图片可以进入帖子.
// @version      1.0.8
// @author       armyant
// @namespace    https://sleazyfork.org/zh-CN/scripts/489232-sehuatang
// @include      https://www.sehuatang.net/forum-*
// @include      *://*.sehuatang.org/*
// @include      *://*.sehuatang.net/*
// @include      *://*.5aylp.com/*
// @include      *://*.jq2t4.com/*
// @include      *://*.www.0krgb.com/*
// @include      *://*.1qyqs.app/*
// @include      *://*.ds5hk.app/*
// @match        *://*.sehuatang.net/*
// @match        *://*.sehuatang.org/*
// @match        *://*.sehuatang.*/*
// @match        *://*.jq2t4.com/*
// @match        *://*.0krgb.com/*
// @match        *://*.xxjsnc.co/*
// @match        *://*.o4vag.com/*
// @match        *://*.weterytrtrr.*/*
// @match        *://*.qweqwtret.*/*
// @match        *://*.retreytryuyt.*/*
// @match        *://*.qwerwrrt.*/*
// @match        *://*.ds5hk.app/*
// @match        *://*.30fjp.com/*
// @match        *://*.18stm.cn/*
// @match        *://*.xo6c5.com/*
// @match        *://*.mzjvl.com/*
// @match        *://*.9xr2.app/*
// @match        *://*.kzs1w.com/*
// @match        *://*.nwurc.com/*
// @match        *://*.zbkz6.app/*
// @match        *://*.ql75t.cn/*
// @match        *://*.0uzb0.app/*
// @match        *://*.d2wpb.com/*
// @match        *://*.5aylp.com/*
// @match        *://*.8otvk.app/*
// @include      https://www.sehuatang.net/forum.php?mod=forumdisplay&fid=103&page=*
// @require      https://code.jquery.com/jquery-3.4.1.min.js
// @grant        GM_xmlhttpRequest
// @license 	 GNU GPLv3
// ==/UserScript==
$(document).ready(function () {
    $("tbody[id*='normalthread']").each(function () {
        // 获取当前域名 https://www.sehuatang.net/forum-95-9.html   www.sehuatang.net
        // let urls = "https://www.sehuatang.net/";
        let urls = `https://${document.domain}/`;
        // 获取详情页地址
        urls += $(this).find(".icn a").attr("href");
        // 删除所有子元素
        // $(this).children().remove()
        $(this).find(".tps").remove()
        // 标记当前节点
        let icn_td = $(this);
        console.log(urls);
        let href = document.location.href;

        GM_xmlhttpRequest({
            method: "GET",
            url: urls,
            headers: {
                "User-agent": window.navigator.userAgent,
                Accept:
                    "text/html,application/xhtml+xml,application/xml;q=0.9,image/avif,image/webp,image/apng,*/*;q=0.8,application/signed-exchange;v=b3;q=0.9",
                cookie: document.cookie,
                referer: href,
            },
            onerror: function (e) {
                console.log(e);
            },
            onload: function (result) {
                let doc = result.responseText;
                // console.log(doc);

                // 获取标题
                let title = $(doc).find("#thread_subject").html();
                // console.log(title);

                let temp_imges = [];
                // 获取所有的图片
                $.each($(doc).find(".zoom"), function (index, value) {
                    let temp_image_url = $(value).attr("file");
                    if (temp_image_url == undefined || temp_image_url.toString().indexOf("static") > -1) {
                        // return 实现continue功能
                        // return false 实现break功能
                        return;
                    }
                    temp_imges.push(temp_image_url);
                });
                // console.log(temp_imges)

                // 获取ed2k
                let magnet = [];
                $.each($(doc).find(".blockcode li"), function (index, value) {
                    let temp_magnet = $(value).text();
                    magnet.push(temp_magnet)
                });
                // console.log(magnet);

                // 获取附件
                let temp_tattl_str = "";
                $.each($(doc).find(".pattl .tattl dd"), function (index, value) {
                    let temp_file_name = $($(value).find("a")[0]).html();
                    if ((temp_file_name.toString().indexOf("zip") == -1) &&
                        (temp_file_name.toString().indexOf("rar") == -1) &&
                        (temp_file_name.toString().indexOf("torrent") == -1)) {
                        return;
                    }
                    temp_tattl_str += `
                    <div style="background:url(static/image/filetype/rar.gif) no-repeat left center;display: inline-block;margin-left: 10px;" border="0" class="vm" alt="">
                        <div style="font-size:14px;padding-left:40px;}"><a href='${$($(value).find("a")[0]).attr("href")}' id="aid8294944" target="_blank" initialized="true">${temp_file_name}</a></div>
                        <div style="font-size:12px;padding-left:40px;color: royalblue">${$($(value).find("p:nth-child(4)")[0]).html()}</div>
                    </div>
                    `
                });

                // 附件的另一种方式
                let temp_attach_str = "";
                $.each($(doc).find("span[id*='attach']"), function (index, value) {
                    let temp_file_name = $($(value).find("a")[0]).html();
                    if ((temp_file_name.toString().indexOf("zip") == -1) &&
                        (temp_file_name.toString().indexOf("rar") == -1) &&
                        (temp_file_name.toString().indexOf("txt") == -1) &&
                        (temp_file_name.toString().indexOf("torrent") == -1)) {
                        return;
                    }
                    temp_tattl_str += `
                    <div style="background:url(static/image/filetype/rar.gif) no-repeat left center;display: inline-block;margin-left: 10px;" border="0" class="vm" alt="">
                        <div style="font-size:14px;padding-left:40px;}"><a href='${$($(value).find("a")[0]).attr("href")}' id="aid8294944" target="_blank" initialized="true">${temp_file_name}</a></div>
                        <div style="font-size:12px;padding-left:40px;color: royalblue">${$($(value).find("em")[0]).html()}</div>
                    </div>
                    `
                });

                let temp_html = "";
                temp_html += `<tr><td width="100%" colspan="5">`
                for (let i = 0; i < temp_imges.length; i++) {
                    if (i >= 8) {
                        break;
                    }
                    temp_html += `<img src="${temp_imges[i]}" height="150" style="margin: 2px;"/>`
                }
                temp_html += `</td></tr>`

                if (magnet.length > 0) {
                    temp_html += `<tr><td width="100%" colspan="5"`
                    if (temp_tattl_str.length == 0) {
                        temp_html += `style="border-bottom: blueviolet 4px solid"`;
                    }
                    temp_html += `>`
                    temp_html += `
                        <div class="blockcode" style="padding: 5px 0 5px 20px;border: 1px solid #CCC;background: #F7F7F7 url(/static/image/common/codebg.gif) repeat-y 0 0;overflow: hidden;">
                             <div id="code_BN2" style="padding-left: 20px">
                                <ol>`;
                    for (const temp_magnet of magnet) {
                        temp_html += `<li style="list-style-type:decimal-leading-zero;font-family:Monaco,Consolas,'Lucida Console','Courier New',serif;font-size:12px;line-height:1.8em">
                            <div style="padding-left: 20px">${temp_magnet}</div>
                        </li>`
                    }
                    temp_html += `</ol></div><div style="padding-left: 40px"><em onclick="let temp_magnet_str_01='${magnet.toString().replace(/(\n|\r|\r\n|↵)/g, '')}';setCopy(temp_magnet_str_01.replace(/(,)/g, '\\r\\n'), '复制成功');return false;">复制代码</em></div></div>`
                    temp_html += `</td></tr>`
                }
                // temp_html += `<script type="application/javascript">code_BN2_1=magnet;</script>`;
                // temp_html += `<tr><td colspan="5" style="background: blue"></td></tr>`;

                if (temp_tattl_str.length > 0) {
                    temp_html += `<tr><td width="100%" colspan="5" style="border-bottom: blueviolet 4px solid">`
                    temp_html += temp_tattl_str;
                    temp_html += `</td></tr>`;
                }

                if (temp_attach_str.length > 0) {
                    temp_html += `<tr><td width="100%" colspan="5" style="border-bottom: blueviolet 4px solid">`
                    temp_html += temp_attach_str;
                    temp_html += `</td></tr>`;
                }

                $(icn_td).append(temp_html);
            },
        });
    });
});