Sleazy Fork is available in English.

yimuhe

1.去除javlibrary详情页面中下载url的重定向;高亮yimuhe的下载链接;添加 在javdb中查询 链接

Od 24.07.2021.. Pogledajte najnovija verzija.

// ==UserScript==
// @name         yimuhe
// @namespace    https://greasyfork.org/zh-CN/scripts/38740-yimuhe
// @version      1.6
// @description  1.去除javlibrary详情页面中下载url的重定向;高亮yimuhe的下载链接;添加 在javdb中查询 链接
//               2.破坏torrentkitty的脚本变量引用. 原先l8l1X变量是引用window,然后给加定时器,不停地添加页面的mousedown事件,导致鼠标点击任何地方都会跳转到广告页面
//               3.给141jav每个车牌号后面加上复制按钮;添加 在JavLib中查询 链接
//               4.给javdb每个车牌号后面添加 在JavLib中查询 链接, 每个查询链接都添加可下载条件
//               5.javbus详情页面加上的车牌号后面添加 在JavLib中查询

// @author       You
// @include      http://*.javlib.com/*
// @include      http*:/*.torrentkitty.*/*
// @include      http*://*.n53i.com/*
// @include      http*://*.f50q.com/*
// @include      http*://*.141jav.com/*
// @include      http*://javdb9.com/*
// @include      http*://*.dmmbus.blog/*
// @include      http*://*.javbus.com/*
// @include      http*://*.buscdn.bar/*

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


(function () {
    console.info('========= yimuhe ');
    var javLibDomain="n53i";
    var javLibUrl="https://www."+javLibDomain+".com";

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

    let jav141Domain="141jav";

    let javbusDomain="dmmbus";



    execute(javLibDomain+"|javlib.com",function(location){
        console.info("1.去除javlibrary详情页面中下载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);
            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;';
            }
        });
    });
    execute(/(javlibrary|n53i|b49t).*\?v=.*/,function(location){
        let chepai = document.querySelector("#video_id > table > tbody > tr > td.text").innerText;
        let trTag=document.querySelector("#video_id > table > tbody > tr");
        let javdbQueryId = "javdbQueryId";
        trTag.innerHTML = [trTag.innerHTML,'<td><a id="', javdbQueryId,'"href="',javdbUrl,'/search?q=',chepai,'&f=download">在javdb中查询</a></td>'].join('');

        GM_xmlhttpRequest({
            method: "GET",
            responseType: "json",
            url: javdbUrl+"/videos/search_autocomplete.json?q="+chepai,
            onload: function(response) {
                //debugger;
                let jsonArray = response.response;
                if (jsonArray.length!=0) {
                    let first =jsonArray[0];
                    let uid=first.uid;
                    if(first.number===chepai){
                        document.getElementById(javdbQueryId).href=javdbUrl+"/v/"+uid;
                    }
                }
//                 debugger;
//                 console.log([
//                     response.status,
//                     response.statusText
//                 ].join("\n"));
            }
        });

    });



    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);
        });

    });

    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.panel-block 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")){
                element.href = href+"?f=download";
            }else if(href.includes("actors")){
                element.href = href+"?t=d";
            }else if(href.includes("tags")){
                element.href = href+"&c10=1";
            }
        });
    });

    execute(javbusDomain,function(location){
        console.info("5.给javbus每个车牌号后面加上复制按钮;添加 在JavLib中查询 链接.");

        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);

    });

    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);
        }
    }

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

//////////////////////////////////////////////////////////////////////////////////////////////
/////////////////// 公共方法
/////////////////////////////////////////////////////////////////////////////////////////////
    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.appendChild(document.createTextNode('复 制'));
        toAppendElement.appendChild(copyButton);
        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 copyToClipboard (text) {
        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);
    }

}) ();