Sleazy Fork is available in English.

m-team大图浏览

种子列表/详情/演员列表 大图浏览,标题翻译。

// ==UserScript==
// @name         m-team大图浏览
// @namespace    mteam
// @version      0.6.0-beta.8
// @description  种子列表/详情/演员列表 大图浏览,标题翻译。
// @author       AfAn
// @license      MIT
// @match        https://*.m-team.cc/*
// @connect      translate.google.com
// @connect      api.avgle.com
// @grant        GM_xmlhttpRequest

// ==/UserScript==

(function () {
    "use strict";
    const t = window.location.host;
    var e, n;
    (e = window.history),
        (n = e.pushState),
        (e.pushState = function (t) {
            return (
                "function" == typeof e.onpushstate && e.onpushstate({ state: t }),
                n.apply(e, arguments)
            );
        }),
        (window.history.onpushstate = function (t) {
            setTimeout(function () { }, 0);
        });
    var o = {
        "/api/torrent/search": function (e) {
            !(async function (e) {
                if (0 !== window.location.href.indexOf(`https://${t}/browse/adult`))
                    return;
                let n = JSON.parse(e);
                if (!n || !("code" in n) || "0" != n.code) return !1;
                (document.querySelector(
                    "div.ant-spin-container table thead tr th:nth-of-type(2)"
                ).style.width = window.innerWidth >= 1400 ? "700px" : "500px"),
                    (document.querySelector(
                        "div.app-content__inner div.mx-auto"
                    ).style.maxWidth = "100%");
                let o = [];
                for (let t = 0; t < 30; t++) {
                    await r(1e3),
                        (o = document.querySelectorAll(
                            "div.ant-spin-container table tbody tr"
                        ));
                    let t = +n.data.pageSize,
                        e = +n.data.total;
                    if (o.length == t) break;
                    if (e < t && o.length == e) break;
                }
                document
                    .querySelectorAll(
                        "div.ant-spin-container table div.trans-container"
                    )
                    .forEach((t) => {
                        t.remove();
                    }),
                    o.forEach(async (e, o) => {
                        (e.querySelector(
                            "td:nth-of-type(2) img.torrent-list__thumbnail"
                        ).style.height = "auto"),
                            e
                                .querySelector(
                                    "td:nth-of-type(2) img.torrent-list__thumbnail"
                                )
                                .addEventListener("click", function (e) {
                                    e.stopPropagation(),
                                        window.open(
                                            `https://${t}.cc/detail/${n.data.data[o].id}`,
                                            "_blank"
                                        );
                                }),
                            e.querySelector("td:nth-of-type(2) div.ant-image-mask") &&
                            e
                                .querySelector("td:nth-of-type(2) div.ant-image-mask")
                                .remove();
                        const i = e.querySelector("td:nth-of-type(3)");
                        let a = i.querySelectorAll(
                            "span.ant-typography-ellipsis-single-line"
                        );
                        async function s(t, e) {
                            t.disabled = !0;
                            let n = a[0].querySelector("strong").innerText;
                            a.length > 1 && (n += " ||| " + a[1].innerText);
                            let o = await (function (t) {
                                return new Promise((e, n) => {
                                    (t = t.replace("#", "")),
                                        GM_xmlhttpRequest({
                                            method: "GET",
                                            url:
                                                "https://translate.google.com/translate_a/single?client=gtx&dt=t&dt=bd&dj=1&source=input&hl=zh-CN&sl=auto&tl=zh-CN&q=" +
                                                t,
                                            headers: { cookie: "" },
                                            onload: function (t) {
                                                for (
                                                    var n = JSON.parse(t.responseText), o = "", i = 0;
                                                    i < n.sentences.length;
                                                    i++
                                                )
                                                    o += n.sentences[i].trans;
                                                e(o);
                                            },
                                            onerror: function (t) {
                                                n();
                                            },
                                        });
                                });
                            })(n);
                            (o = o.replace("|||", "<br />")), (e.innerHTML = o);
                        }
                        (a[0].style.whiteSpace = "normal"),
                            (a[0].style.overflow = "unset"),
                            (a[0].style.textOverflow = "unset"),
                            a.length > 1 &&
                            ((a[1].style.whiteSpace = "normal"),
                                (a[1].style.overflow = "unset"),
                                (a[1].style.textOverflow = "unset")),
                            (a[0].closest("a > div").style.display = "block"),
                            (a[0].style.display = "block"),
                            i.querySelector("br") && i.querySelector("br").remove(),
                            (() => {
                                let t = document.createElement("div"),
                                    e = document.createElement("button");
                                (e.innerText = "翻 译"),
                                    e.classList.add(
                                        "ant-btn",
                                        "css-n9csir",
                                        "ant-btn-default",
                                        "ant-btn-sm"
                                    ),
                                    (e.onclick = () => {
                                        s(e, t);
                                    }),
                                    (t.style.marginTop = "2rem"),
                                    t.appendChild(e),
                                    t.classList.add("trans-container"),
                                    a[0].closest("a").parentNode.appendChild(t);
                            })(),
                            30 === o && (await r(1e3));
                    });
            })(e);
        },
        "/api/dmm/showcase/fetchList": function (e) {
            !(async function (e) {
                if (
                    0 !==
                    window.location.href.indexOf(`https://${t}/showcaseDetail?id=`)
                )
                    return;
                let n = JSON.parse(e);
                if (!n || !("code" in n) || "0" != n.code) return !1;
                (document.querySelector(
                    "div.ant-spin-container table thead tr th:nth-of-type(2)"
                ).style.width = window.innerWidth >= 1400 ? "700px" : "500px"),
                    (document.querySelector(
                        "div.app-content__inner div.mx-auto"
                    ).style.maxWidth = "100%");
                let o = [];
                for (
                    let t = 0;
                    t < 30 &&
                    (await r(1e3),
                        (o = document.querySelectorAll(
                            "div.ant-spin-container table tbody tr"
                        )),
                        o.length != n.data.list.length);
                    t++
                );
                o.forEach((e, o) => {
                    (e.querySelector(
                        "td:nth-of-type(2) img.torrent-list__thumbnail"
                    ).style.height = "auto"),
                        e
                            .querySelector("td:nth-of-type(2) img.torrent-list__thumbnail")
                            .addEventListener("click", function (e) {
                                e.stopPropagation(),
                                    window.open(
                                        `https://${t}/detail/${n.data.list[o].id}`,
                                        "_blank"
                                    );
                            }),
                        e.querySelector("td:nth-of-type(2) div.ant-image-mask").remove();
                });
            })(e);
        },
        "/api/dmm/dmmInfo": function (e) {
            !(async function (e) {
                if (0 !== window.location.href.indexOf(`https://${t}/detail/`))
                    return;
                let n = JSON.parse(e);
                if (!n || !("code" in n) || "0" != n.code) return !1;
                await r(1e3),
                    document
                        .querySelectorAll(".ant-image-img.\\!max-w-600")
                        .forEach((t) => {
                            t.classList.remove("!max-w-600");
                        });
                const o =
                    "picData" in n.data && n.data.picData
                        ? n.data.picData.split(",")
                        : [];
                let i = !1;
                function a(t) {
                    return t.replace(
                        /([^\/]+?)(-)(\d+\.\w+)$/,
                        (t, e, n, o) => `${e}jp${n}${o}`
                    );
                }
                o.forEach((t) => {
                    const e = document.querySelector(`img[src="${t}"]`);
                    if (e) {
                        i || (e.closest(".grid").classList.remove("grid"), (i = !0)),
                            (e.src = a(t)),
                            e.parentElement.querySelector(".ant-image-mask").remove();
                        e.closest(".ant-image").style.pointerEvents = "none";
                    }
                });
            })(e);
        },
    },
        i = XMLHttpRequest.prototype.send,
        a = XMLHttpRequest.prototype.open;
    function r(t) {
        return new Promise((e) => setTimeout(e, t));
    }
    (XMLHttpRequest.prototype.open = function (t, e) {
        return (this.url = e), a.apply(this, arguments);
    }),
        (XMLHttpRequest.prototype.send = function () {
            return (
                this.addEventListener("load", function () {
                    4 === this.readyState &&
                        200 === this.status &&
                        Object.keys(o).forEach((t) => {
                            this.url.includes(t) && o[t](this.response);
                        });
                }),
                i.apply(this, arguments)
            );
        });
})();