Sleazy Fork is available in English.

yimuhe

1.去除javlibrary详情页面中下载url的重定向;高亮yimuhe的下载链接,去除名称中的链接,方便复制;添加 在javbus中查询 链接;添加磁力链

Version au 08/03/2024. Voir la dernière version.

// ==UserScript==
// @name         yimuhe
// @namespace    https://greasyfork.org/zh-CN/scripts/38740-yimuhe
// @version      2.11.2
// @description  1.去除javlibrary详情页面中下载url的重定向;高亮yimuhe的下载链接,去除名称中的链接,方便复制;添加 在javbus中查询 链接;添加磁力链
//               2.破坏torrentkitty的脚本变量引用. 原先l8l1X变量是引用window,然后给加定时器,不停地添加页面的mousedown事件,导致鼠标点击任何地方都会跳转到广告页面
//               3.给141jav每个车牌号后面加上复制按钮;添加 在JavLib中查询 链接
//               4.给javdb每个车牌号后面添加 在JavLib中查询 链接, 所有链接都添加可下载条件
//               5.javbus详情页面加上的车牌号后面添加 在JavLib中查询; 删除磁力链中的onclick事件.
//               6.去掉get.datapps.org网页点击链接后弹出广告窗口
//               7.去掉https://www.77file.com 的弹出广告
//               8.给skrbt网站添加 粘贴并搜索 按钮; 删除搜索结果页中的第一条广告;搜索结果页添加 复制磁链 和 点击磁链 按钮 
// @author       xmlspy

// @require      https://cdn.bootcdn.net/ajax/libs/jquery/3.6.0/jquery.min.js

// @include      http://*.javlib.com/*
// @include      http*://*.i71t.com/*

// @include      http*:/*.torrentkitty.*/*

// @include      http*://*.141jav.com/*

// @include      http*://javdb003.com/*
// @include      http*://javdb004.com/*

// @include      http*://*.seejav.men/*
// @include      http*://*.javbus.com/*
// @include      http*://*.busfan.shop/*

// @include      http*://get.datapps.org/*
// @include      http*://www.77file.com/down/*

// @include     http*://skrbtqx.top/*

// @run-at       document-end
// @grant        GM_xmlhttpRequest
// @connect      *
// ==/UserScript==

(function () {
    'use strict';

    console.info('========= yimuhe ');

    // var jq = $.noConflict();

    var javLibDomain = "i71t";
    var javLibUrl = "https://www." + javLibDomain + ".com";
    let javLibRegx = "(" + javLibDomain + "|javlib|javlibrary)";

    let javdbDomain = "javdb003";
    let javdbUrl = "https://" + javdbDomain + ".com";

    let jav141Domain = "141jav";

    let javbusDomain = "busfan";
    const javabusUrl = "https://www." + javbusDomain + ".shop";

    const datappsDomain = "datapps";
    //const datappsUrl="https://get.datapps.org";

    const file77Domain = "77file";

    const skrbtDomain = "skrbtqx";
    const skrbtUrl = "https://" + skrbtDomain + ".top";

    // javlibrary, xxx所发表的文章 页面
    execute(javLibRegx, function (location) {
        console.info("====yimuhe====去除javlibrary [xxx所发表的文章] 页面中下载url的重定向;高亮yimuhe的下载链接");
        $.each($("a[href^='redirect.php?url']"), function (index, a) {
            //var origin = location.origin;
            //a.href = decodeURIComponent(a.href.replace(origin+"/cn/redirect.php?url=",""));

            var url = getQueryVariable(a, 'url');
            a.href = decodeURIComponent(url);
            if (!a.href.startsWith('https')) {
                a.href = a.href.replace("http", "https");
            }
            a.text = a.text + "    " + a.href + "      ";
            if (a.href.includes("yimuhe")) {
                $(a).parentsUntil("tr").closest('.t').css('background-color', '#6B6C83');
                a.style = 'font-size:40px;';
            } else {
                a.style = 'font-size:20px;';
            }
        });
    });

    // javlibrary, 详情 页面
    execute(javLibRegx + ".*\?v=.*", function (location) {
        console.info("====yimuhe====javlibrary详情页面中添加 在javbus中查询 链接;添加磁力链");
        let chePai = document.querySelector("#video_id > table > tbody > tr > td.text").innerText;
        let toAppendElement = document.querySelector("#video_id > table > tbody > tr > td.text");
        appendCopyButton(chePai, toAppendElement);

        let trTag = document.querySelector("#video_id > table > tbody > tr");
        let javdbQueryId = "javdbQueryId";
        trTag.innerHTML = [trTag.innerHTML, '<td><a id="', javdbQueryId, '"href="', javabusUrl,
            '/', chePai, '">javbus中查询</a></td>'].join('');

        $(trTag).append(['<td><a target="_blank" ', 'href="', skrbtUrl, '/search?keyword=',
            chePai, '">打开SkrBT</a></td>'].join(''));
        // 删除名称中的链接
        const videoTitleNode = document.querySelector("#video_title > h3 > a");

        if (videoTitleNode) {
            const videoTitle = videoTitleNode.getInnerHTML();
            videoTitleNode.parentNode.innerText = videoTitle;
        }

    });

    //javbus
    execute(javbusDomain, (location) => {
        console.info("5.给javbus每个车牌号后面加上复制按钮;添加 在JavLib中查询 链接; 删除磁力链中的onclick事件.");

        var chePai = document.querySelector("body > div.container > div.row.movie > div.col-md-3.info > p:nth-child(1) > span:nth-child(2)").innerText.trim();
        var toAppendElement = document.querySelector("body > div.container > div.row.movie > div.col-md-3.info > p:nth-child(1)");

        appendCopyButton(chePai, toAppendElement);
        appendHrefJavLib(chePai, toAppendElement);

        // 删除磁力链中的onclick事件
        $("#magnet-table").one("DOMNodeInserted", (e) => {
            $('td[onclick]').each((index, element) => {
                element.removeAttribute('onclick');
            });
        });
    });

    // skrbt
    execute(skrbtDomain, (location) => {
        // 给所有页面添加 粘贴并搜索 按钮
        const html = '<span>&nbsp;</span><span class="input-group-btn"> <button class="btn btn-danger search-btn" type="button"> <span class="glyphicon glyphicon-search"> 粘贴并搜索</span></button> </span>';
        $('.input-group-btn').last().after(html);
        const submitButton = $('button').first();
        const searchInput = $('input[name="keyword"]')
        $('button').last().click(() => {
            let clipPromise = navigator.clipboard.readText();
            clipPromise.then((clipText) => {
                if (clipText != null && $.trim(clipText) != '') {
                    searchInput.val(clipText);
                    submitButton.click();
                }
            });
        });

        //搜索结果列表页面,每条结果添加 复制磁链 和 点击磁链 按钮
        if (location.href.includes("search")) {
            //删除首行的广告
            if (!$('a.rrt.common-link').first().attr("href").includes(location.origin)) {
                $('a.rrt.common-link').first().parent().parent().remove();
            }

            let buttonHtml = '<span class="rrmiv"><button class="btn btn-danger copy" type="button">复制磁链</button></span>';
            buttonHtml += '<span class="rrmiv"><button class="btn btn-danger click" type="button">点击磁链</button></span>'

            $('a.rrt.common-link').after(buttonHtml);


            $('.col-md-6:eq(2)').click((event) => {
                if (event && event.target && $(event.target).attr('class')) {
                    var classValue = $(event.target).attr('class');
                    const isCopyButton = classValue.includes("copy");
                    if (isCopyButton || classValue.includes("click")) {
                        let liNode = $(event.target).parent().parent();

                        const exeButtonClick = () => {
                            if (isCopyButton) {
                                navigator.clipboard.writeText(liNode.find('.magnet').attr('href'));
                            } else {
                                // liNode.find('.magnet').trigger('click'); //不好使
                                liNode.find('.magnet')[0].click();
                            }
                        };

                        if (liNode.find('.magnet').length != 0) { // 磁链已经添加过
                            exeButtonClick();
                            return;
                        }
                        let detailUrl = liNode.find('a.rrt.common-link').attr('href');
                        detailUrl = location.origin + detailUrl;
                        //请求获取磁链
                        GM_xmlhttpRequest({
                            method: "get",
                            headers: {
                                "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.7",
                                "Accept-Encoding": "gzip, deflate, br",
                                "Accept-Language": "zh-CN,zh;q=0.9",
                                "Cache-Control": "max-age=0",
                                "Cookie": document.cookie,
                                "Referer": location.href,
                                "Sec-Ch-Ua": '"Chromium";v="119", "Not?A_Brand";v="24"',
                                "Sec-Ch-Ua-Mobile": "?0",
                                "Sec-Ch-Ua-Platform": "Windows",
                                "Sec-Fetch-Dest": "document",
                                "Sec-Fetch-Mode": "navigate",
                                "Sec-Fetch-Site": "same-origin",
                                "Sec-Fetch-User": "?1",
                                "Upgrade-Insecure-Requests": "1",
                                "User-Agent": "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/119.0.6045.160 Safari/537.36"
                            },
                            url: detailUrl,
                            onerror: function (e) {
                                //失败后在页面提示
                                liNode.append('<span id="errorTip">获取磁链失败,等会儿再试一试! 若仍然有问题请刷新网页.</span>');
                                console.log(e);
                            },
                            onload: function (response) {
                                liNode.find('#errorTip').remove();
                                //成功后在页面添加磁链
                                const magnet = $(response.responseText).find('#magnet').attr('href');
                                console.log(response);
                                if (magnet) {
                                    const aHtml = '<a class="magnet" href="' + magnet + '">' + magnet + '</a>';
                                    liNode.append(aHtml);
                                    exeButtonClick();
                                } else {
                                    liNode.append('<span id="errorTip">获取磁链失败,等会儿再试一试! 若仍然有问题请刷新网页.</span>');
                                }
                            }
                        });// end GM_xmlhttpRequest
                    }
                }
            });

            // 自动分页插件兼容

            const nodeToObserve = document.querySelectorAll('.col-md-6')[2];
            const observer = new MutationObserver((mutationRecords, observer) => {
                $('a.rrt.common-link').each((index, element) => {
                    if ($(element).parent().find('.btn.btn-danger.copy').length === 0) {
                        $(element).after(buttonHtml);
                    }
                });
                console.log(mutationRecords);
            });
            observer.observe(nodeToObserve, {
                childList: true,
                attributes: false,
                //attributeFilter: false,
                attributeOldValue: false,
                characterData: false,
                characterDataOldValue: false,
                subtree: false
            });


        }
    });

    execute(jav141Domain, function (location) {
        console.info("3.给141jav每个车牌号后面加上复制按钮;添加 在JavLib中查询 链接.");
        document.querySelectorAll('h5.title.is-4.is-spaced > a').forEach(function (element, index) {
            var chePai = element.innerText.trim();

            appendCopyButton(chePai, element.parentElement);
            appendHrefJavLib(chePai, element.parentElement);

            let markAsOwnerButton = document.createElement('button');
            markAsOwnerButton.dataset.type = 2;
            markAsOwnerButton.dataset.chePai = chePai;
            markAsOwnerButton.appendChild(document.createTextNode('设置为已拥有(javlib)'));
            element.parentElement.appendChild(markAsOwnerButton);
            markAsOwnerButton.onclick = function (event) {
                //debugger;
                GM_xmlhttpRequest({
                    method: "GET",
                    //responseType: "json",
                    url: javLibUrl + "/cn/vl_searchbyid.php?keyword=" + event.target.dataset.chePai,
                    onerror: function (e) {
                        console.log(e);
                    },
                    onload: function (response) {
                        if (response.status != 200) {
                            console.log("失败。。。")
                            return;
                        }

                        let finalUrl = response.finalUrl;
                        if (finalUrl.includes('vl_searchbyid.php')) {
                            console.log("有多个结果或者没有结果")
                            //有多个结果或者没有结果

                        } else {
                            // 明细页面
                            let patternAjaxid = /^var[ ]\$ajaxid.*;/m;
                            let result = patternAjaxid.exec(response.responseText);
                            let ajaxid = result[0].split('"')[1];
                            let data = "type=" + event.target.dataset.type + "&targetid=" + ajaxid;
                            //debugger;

                            GM_xmlhttpRequest({
                                method: "POST",
                                responseType: "json",
                                headers: { "Content-Type": "application/x-www-form-urlencoded; charset=UTF-8" },
                                url: javLibUrl + "/ajax/ajax_cv_favoriteadd.php",
                                data: data,
                                onerror: function (e) {
                                    console.log(e);
                                },
                                onload: function (response) {
                                    if (response.status != 200) {
                                        return;
                                    }
                                    let responseJson = JSON.parse(response.responseText);
                                    if (responseJson.ERROR != 1) {
                                        // 失败
                                        console.log("失败。" + response.responseText);
                                    }
                                }
                            });// end GM_xmlhttpRequest
                        }// end else
                    } // end onload
                });// end GM_xmlhttpRequest
            };
        });
    });

    execute(javdbDomain, function (location) {
        console.info("4.给javdb添加 在JavLib中查询 链接.");
        document.querySelectorAll("a.button.is-white.copy-to-clipboard").forEach(function (element, index) {
            var chePai = element.getAttribute('data-clipboard-text');
            appendHrefJavLib(chePai, element.parentElement);
        });

        console.info("javdb 每个查询链接都添加 可下载 条件");
        //document.querySelectorAll('div.tabs.is-boxed a').forEach(function(element,index){
        document.querySelectorAll('a').forEach(function (element, index) {
            console.info(index + element);
            let href = element.href;
            if (href.includes("video_codes")
                || href.includes("directors")
                || href.includes("makers")
                || href.includes("series")
                || href.includes("publishers")
                || href.includes("search")) {
                //element.href = href+"?f=download";
                element.href = appendUrlParam(href, "f=download")
            } else if (href.includes("actors")) {
                //element.href = href+"?t=d";
                element.href = appendUrlParam(href, "t=d")
            } else if (href.includes("tags")) {
                element.href = appendUrlParam(href, "c10=1")
            }
        });

        document.querySelectorAll("div.tabs.is-boxed a").forEach((element, index) => {
            let href = element.href;
            element.href = href.replace('&f=download', '');
        });
    });



    execute(datappsDomain, function (location) {
        console.info("6.去掉get.datapps.org网页点击链接后弹出广告窗口.");
        document.querySelectorAll('a[onclick="setpos();"]').forEach((element, index) => {
            element.removeAttribute("onclick");
        });
    });

    execute(file77Domain, function (location) {
        console.info("7.去掉77file网页点击链接后弹出广告窗口.");
        document.querySelectorAll('input[value="验证下载"]').forEach((element, index) => {
            element.setAttribute("onclick", "check_code();");
        });
    });



    execute("torrentkitty", (location) => {
        console.info("2.破坏torrentkitty的脚本变量引用. 原先l8l1X变量是引用window,然后给加定时器,不停地添加页面的mousedown事件,导致鼠标点击任何地方都会跳转到广告页面.");
        window.l8l1X = 1;
    });




    //////////////////////////////////////////////////////////////////////////////////////////////
    /////////////////// 公共方法
    /////////////////////////////////////////////////////////////////////////////////////////////
    function execute(regExpString, callback) {
        var href = window.location.href;
        var pattern = new RegExp(regExpString);
        if (pattern.test(href)) {
            callback(window.location);
        } else {
            console.info("输入的参数 %s 与 %s 不匹配", regExpString, href);
        }
    }
    function appendHrefJavLib(chePai, toAppendElement) {
        var openHref = document.createElement('a');
        openHref.href = javLibUrl + "/cn/vl_searchbyid.php?keyword=" + chePai;
        openHref.target = "_blank";
        openHref.innerText = "JavLib中查询";
        toAppendElement.appendChild(openHref);
    }
    function appendCopyButton(chePai, toAppendElement) {
        var copyButton = document.createElement('button');
        copyButton.innerHTML = "复 制";
        copyButton.setAttribute('id', 'copyButton');
        toAppendElement.appendChild(copyButton);
        document.addEventListener('click', (e) => {
            if (e.srcElement.getAttribute('id') === 'copyButton') {
                //console.log(e);
                copyToClipboard(chePai);
            }

        });
        //copyButton.onclick=function(){
        //    copyToClipboard(chePai);
        //};
    }

    function getQueryVariable(anchor, variable) {
        var query = anchor.search.substring(1);
        var vars = query.split("&");
        for (var i = 0; i < vars.length; i++) {
            var pair = vars[i].split("=");
            if (pair[0] == variable) { return pair[1]; }
        }
        return false;
    }
    function appendUrlParam(url, param) {
        if (url.includes("?")) {
            return url + "&" + param;
        }
        return url + "?" + param;
    }


    function copyToClipboard(text) {
        try {
            navigator.clipboard.writeText(text).then(() => {
                console.log('复制成功')
            });
        } catch {
            var textArea = document.createElement("textarea");
            textArea.style.position = 'fixed';
            textArea.style.top = '0';
            textArea.style.left = '0';
            textArea.style.width = '2em';
            textArea.style.height = '2em';
            textArea.style.padding = '0';
            textArea.style.border = 'none';
            textArea.style.outline = 'none';
            textArea.style.boxShadow = 'none';
            textArea.style.background = 'transparent';
            textArea.value = text;
            document.body.appendChild(textArea);
            textArea.select();

            try {
                var successful = document.execCommand('copy');
                var msg = successful ? '成功复制到剪贴板' : '该浏览器不支持点击复制到剪贴板';
                //alert(msg);
            } catch (err) {
                alert('该浏览器不支持点击复制到剪贴板');
            }

            document.body.removeChild(textArea);
        }
    }
})();