sehuatang

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

Versão de: 08/03/2024. Veja: a última versão.

// ==UserScript==
// @name         sehuatang
// @description  直接把帖子列表转成图片浏览,点击图片可以进入帖子.
// @version      1.0.6
// @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_html = "";
                // temp_html += `<tr><td colspan="5" style="font-weight: bold;font-size: 15px"><a href="${urls}">${title}</a> </td></tr>`;

                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>`

                temp_html += `<tr><td width="100%" colspan="5" style="border-bottom: blueviolet 4px solid">`
                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>`;

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