您需要先安装一个扩展,例如 篡改猴、Greasemonkey 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 Userscripts ,之后才能安装此脚本。
您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey,才能安装此脚本。
您需要先安装用户脚本管理器扩展后才能安装此脚本。
各种开车网站的优化
当前为
// ==UserScript== // @name tianteng // @namespace https://greasyfork.org/xmlspy // @version 1.7.5 // @description 各种开车网站的优化 // @author xmlspy // @license MIT // @require https://cdn.jsdelivr.net/npm/[email protected]/dist/jquery.min.js // @require https://cdn.jsdelivr.net/npm/@adguard/[email protected]/dist/extended-css.umd.min.js // @require https://cdn.jsdelivr.net/npm/[email protected]/jquery.simulate.min.js // @resource ldbutton https://cdn.jsdelivr.net/gh/loadingio/ldbutton@latest/dist/index.min.css // @resource ldloader https://cdn.jsdelivr.net/gh/loadingio/[email protected]/dist/ldld.min.css // @include * // @connect * // @run-at document-start // @grant GM_xmlhttpRequest // @grant GM.setClipboard // @grant GM_setClipboard // @grant GM.xmlhttpRequest // @grant GM_openInTab // @grant GM_addStyle // @grant GM_getResourceText // @grant GM.getResourceText // @grant unsafeWindow // @grant GM_log // @grant GM_info // @grant GM_getValue // @grant GM_setValue // @grant GM_deleteValue // ==/UserScript== /* 1. 以下开车的网站经常换域名,本程序使用特征识别,不使用网址进行判断, 即使域名换了也能识别并进入本程序 * skrbt, * javbus, * 紳士漫畫, * JAVLibrary, * BTSOW, * 松鼠症倉庫 * 禁漫天堂 2. javbus, * 所有页面,搜索按钮后面都添加"粘贴&搜索"按钮,点击后复制剪贴板的内容到搜索框并自动点击搜索按钮 * 所有页面,添加"打开skrbt"的链接 * 所有页面,添加"打开今日新帖"按钮,一键打开老司机福利讨论区的今日新帖,最多30个 * 影片明细页面,添加复制车牌号按钮,删除磁链的onclick事件(否则会执行两次打开磁链事件),添加 在javlibrary中打开 * 论坛明细页面,为每个磁力链后面添加"复制磁链"和"打开磁链"按钮,为每个回复添加"复制所有磁链","打开所有磁链","复制所有磁链(不含点评)"和"打开所有磁链(不含点评) 4个按钮(气死各种课代表) * 论坛明细页面,调整样式,更紧凑 3. 松鼠症倉庫, * 去除点击广告 4. 紳士漫畫, * 明细页面,添加搜索框 * 下拉阅读页面,图片由一列改为两列 * 所有页面, 为搜索框后面添加 粘贴&搜索 按钮 5. JAVLibrary, * 所有页面,添加 打开skrbt 链接 * 所有页面,添加 粘贴&搜索 按钮 * 所有页面,删除 url重定向 * 详情页面,添加 复制车牌 按钮 * 详情页面,添加 javbus中查询 链接 * 详情页面,删除 名称中的链接,否则很容易误点,又不容易复制文字 6. BTSOW, * 所有页面,添加 粘贴&搜索 按钮 * 搜索结果列表页面,每条结果后面添加"复制磁链"和"打开磁链"按钮,不用进入明细页面 7. skrbt, * 所有页面,添加 粘贴&搜索 按钮 * 首页,通过别的网站直接访问,比如(https://skrbtqx.top/search?keyword=abp133),会直接跳转到首页. 解决办法,在别的地方进来之前,先把要查询的关键字保存起来,然后进入到skrbt后获取,赋值到输入框,然后查询. 如果,在skrbt首页中没有找到保存的关键字,就从剪贴板获取. 如果,剪贴板没有任何内容,则啥也不做. * 搜索结果列表页面,每条结果后面添加"复制磁链"和"点击磁链"按钮,不用进入明细页面 8. 知乎, * 添加 粘贴&搜索 按钮 9. 百度, * 添加 粘贴&搜索 按钮 10. 禁漫天堂 * 删除广告 ====================更新记录 * 2024-7-24 1.7.5 * javbus * 所有页面,"打开今日新帖"按钮, 增加点击后提示 * 2024-7-22 1.7.4 * javbus * 更新url * btsow * 搜索结果列表页面,每条结果后面添加"复制磁链"和"打开磁链"按钮,不用进入明细页面 * skrbt * 首页,通过别的网站直接访问,比如(https://skrbtqx.top/search?keyword=abp133),会直接跳转到首页. 解决办法,在别的地方进来之前,先把要查询的关键字保存起来,然后进入到skrbt后获取,赋值到输入框,然后查询. 如果,在skrbt首页中没有找到保存的关键字,就从剪贴板获取. 如果,剪贴板没有任何内容,则啥也不做. * 2024-7-20 1.6.4 * javbus * 论坛明细页面,调整样式,更紧凑 * 2024-7-19 * 禁漫天堂 * 删除广告 * 2024-7-18 * javbus * 所有页面,添加"打开今日新帖"按钮,一键打开老司机福利讨论区的今日新帖,最多30个 * 2024-7-16 * javbus * 影片明细页面添加 在javlibrary中打开; * 论坛明细页面,为每个回复添加"复制所有磁链","打开所有磁链","复制所有磁链(不含点评)"和"打开所有磁链(不含点评) 4个按钮 */ // https://cdn.jsdelivr.net/gh/loadingio/[email protected]/dist/ldld.min.js // prettier-ignore (function(){var ldLoader;ldLoader=function(opt){var this$=this;opt==null&&(opt={});this.opt=import$({activeClass:"running",baseZ:4e3,autoZ:false,className:"",atomic:true},opt);["root","container"].map(function(n){if(opt[n]){return this$[n]=(Array.isArray(opt[n])?opt[n]:[opt[n]]).map(function(it){var ret;ret=typeof it==="string"?document.querySelector(it):it;if(!ret){console.warn("[ldLoader] warning: no node found for "+it)}return ret})}});if(!this.container){this.container=this.root?this.root.map(function(it){return it.parentNode}):[document.body]}if(!this.root){this.root=this.container.map(function(it){var node;node=document.createElement("div");it.appendChild(node);return node})}this.root.map(function(it){it.classList.add.apply(it.classList,(this$.opt.className||"").split(" ").filter(function(it){return it}));it.classList.remove(opt.activeClass);if(opt.inactiveClass){return it.classList.add(opt.inactiveClass)}});this.running=false;this.count=0;return this};ldLoader.prototype=import$(Object.create(Object.prototype),{isOn:function(){return this.running},on:function(delay){delay==null&&(delay=0);return this.toggle(true,delay)},off:function(delay,force){delay==null&&(delay=0);force==null&&(force=false);return this.toggle(false,delay,force)},flash:function(dur,delay){var this$=this;dur==null&&(dur=1e3);delay==null&&(delay=0);return this.toggle(true,delay).then(function(){return this$.toggle(false,dur+delay)})},render:function(){var runid,_,ret,this$=this;if(!(this.running&&this.opt.ctrl&&this.opt.ctrl.step)){return this.render.runid=-1}this.render.runid=runid=Math.random();this.render.start=0;if(this.opt.ctrl.init){this.root.map(function(it){return this$.opt.ctrl.init.call(it)})}_=function(t){if(!this$.render.start){this$.render.start=t}this$.root.map(function(it){return this$.opt.ctrl.step.call(it,t-this$.render.start)});if(this$.render.runid===runid){return requestAnimationFrame(function(it){return _(it)})}else if(this$.opt.ctrl.done){return this$.root.map(function(it){return this$.opt.ctrl.done.call(it,t-this$.render.start)})}};return ret=requestAnimationFrame(function(it){return _(it)})},toggle:function(v,delay,force){var d,this$=this;delay==null&&(delay=0);force==null&&(force=false);d=!(v!=null)?this.root[0].classList.contains(this.opt.activeClass)?-1:1:v?1:-1;if(delay){return new Promise(function(res,rej){if(d>0){return this$.toggle(v).then(function(){return setTimeout(function(){return res()},delay)})}else{return setTimeout(function(){return this$.toggle(v).then(function(){return res()})},delay)}})}return new Promise(function(res,rej){var running,z,ref$,idx;this$.count+=d;if(!force&&!this$.opt.atomic&&(this$.count>=2||this$.count===1&&d<0)){return res()}this$.root.map(function(it){it.classList.toggle(this$.opt.activeClass,d>0);if(this$.opt.inactiveClass){return it.classList.toggle(this$.opt.inactiveClass,d<0)}});this$.running=running=this$.root[0].classList.contains(this$.opt.activeClass);if(this$.opt.ctrl){this$.render()}if(!this$.opt.autoZ){return res()}if(running){this$.z=z=((ref$=ldLoader.zstack)[ref$.length-1]||0)+this$.opt.baseZ;this$.root.map(function(it){return it.style.zIndex=z});ldLoader.zstack.push(z)}else{if((idx=ldLoader.zstack.indexOf(this$.z))<0){return res()}this$.root.map(function(it){return it.style.zIndex=""});ldLoader.zstack.splice(idx,1)}return res()})}});import$(ldLoader,{zstack:[]});return window.ldLoader=ldLoader})();function import$(obj,src){var own={}.hasOwnProperty;for(var key in src)if(own.call(src,key))obj[key]=src[key];return obj} (function () { "use strict"; // #region 开头 /** * skrbt */ const skrbtDomain = "skrbtqx"; const skrbtHost = skrbtDomain + ".top"; const skrbtUrl = "https://" + skrbtHost; /** * javbus */ const javbusDomain = "fanbus"; const javabusUrl = `https://www.${javbusDomain}.help`; /** * javLibrary */ var javLibDomain = "y78k"; var javLibUrl = "https://www." + javLibDomain + ".com"; let javLibRegx = "(" + javLibDomain + "|javlib|javlibrary)"; const enableDebug = true; let seq = 0; // function (){} // // 获取 HTMLElement 构造函数 // const HTMLElementConstructor = HTMLElement; // // 创建一个代理对象来拦截 HTMLElement 的构造函数 // const HTMLElementProxy = new Proxy(HTMLElementConstructor, { // construct(target, args, newTarget) { // console.log("Creating a new HTMLElement instance"); // // 创建一个新的 HTMLElement 实例 // const instance = new target(...args); // // 返回一个新的代理对象来拦截实例的属性和方法 // return new Proxy(instance, { // get(target, prop, receiver) { // console.log(`Accessing property: ${prop}`); // return Reflect.get(target, prop, receiver); // }, // set(target, prop, value, receiver) { // console.log(`Setting property: ${prop} to ${value}`); // return Reflect.set(target, prop, value, receiver); // }, // has(target, prop) { // console.log(`Checking if property exists: ${prop}`); // return Reflect.has(target, prop); // }, // deleteProperty(target, prop) { // console.log(`Deleting property: ${prop}`); // return Reflect.deleteProperty(target, prop); // }, // ownKeys(target) { // console.log(`Enumerating properties`); // return Reflect.ownKeys(target); // }, // getOwnPropertyDescriptor(target, prop) { // console.log(`Getting property descriptor for: ${prop}`); // return Reflect.getOwnPropertyDescriptor(target, prop); // }, // defineProperty(target, prop, descriptor) { // console.log(`Defining property: ${prop}`); // return Reflect.defineProperty(target, prop, descriptor); // }, // }); // }, // }); // // 替换全局的 HTMLElement 构造函数 // Object.defineProperty(window, "HTMLElement", { // value: HTMLElementProxy, // writable: false, // configurable: false, // }); // // 测试 // const div = document.createElement("div"); // div.innerHTML = "Hello, World!"; // console.log(div.innerHTML); // div.innerHTML = "Hello, Proxy!"; // console.log(div.innerHTML); ///////////////////////////////////////////////////////////////////////////// // 事件拦截 ///////////////////////////////////////////////////////////////////////////// debug(document.querySelector("title")); //松鼠症倉庫 地址发布页 https://ahrilist.top/ const ep = EventTarget.prototype; if (!ep.addEventListenerOriginal) { ep.addEventListenerOriginal = ep.addEventListener; ep.addEventListener = function (type, callback, options) { // if (/ahri8\.top/.test(window.location.href)) { // debug(`添加事件监听器:target: ${this} type: ${type} callback: ${callback} options: ${options}`); if (this) { ///////////////////////////////////////////////////////////////////////////// // 松鼠症倉庫 ///////////////////////////////////////////////////////////////////////////// if ( this.className && this.className.includes && this.className.includes("apo") ) { debug("禁止点击广告", "松鼠症倉庫"); return; } // } this.allListeners = this.allListeners || []; this.allListeners.push({ type, callback, options }); // this.addEventListenerOriginal(type, callback, options); this.addEventListenerOriginal.apply(this, arguments); } else { debug( `[this] is bad. type: ${type} callback: ${callback} options: ${options}`, "addEventListenerHook" ); } }; } if (!ep.removeEventListenerOriginal) { ep.removeEventListenerOriginal = ep.removeEventListener; ep.removeEventListener = function (type, callback, options) { if (this) { this.removeEventListenerOriginal.apply(this, arguments); this.allListeners = this.allListeners || []; const index = this.allListeners.indexOf({ type, callback, options }); if (index != -1) { this.allListeners.splice(index, 1); } } else { debug( `[this] is bad. type: ${type} callback: ${callback} options: ${options}`, "removeEventListenerHook" ); } }; } ///////////////////////////////////////////////////////////////////////////// // 节点变化监控 ///////////////////////////////////////////////////////////////////////////// new MutationObserver(function (mutationsList, observer) { 禁漫天堂(); }).observe(document, { childList: true, subtree: true, // attributes: true, //attributeFilter: [], // attributeOldValue: true, // characterData: false, // characterDataOldValue: false, }); /////////////////////////////////////////////////////////////////////////// // 禁漫天堂 发布页: https://jmcomicltd.xyz/ // // 國際通用網域 不支援日本/韓國路線 // 18comic.vip // 18comic.org // 東南亞路線建議使用 // jmcomic.me // jmcomic1.me // // =內地網域= 請使用Chrome瀏覽器開啟 // 18-comicblade.vip // // 分流1 // 18-comic-minions.club // // 分流2 // https://18comic-erdtree.org // // APP軟件下載 // jm365.work/ZNPJam // // 如果地址無法打開,歡迎發送郵件告知 // re18comic@gmail.com // // 或是直接到DC群找管理員處理問題 // discord.gg/V74p7HM /////////////////////////////////////////////////////////////////////////// function 禁漫天堂() { execute("禁漫天堂", $(`head>title`)[0].text.endsWith("禁漫天堂"), () => { // 删除广告 $(".top-nav, .div-bf-pv").remove(); $("#Comic_Top_Nav").css("top", "-1px"); $("div.e8c78e-4_b").remove(); if (location.pathname === "/albums") { const childNodes = document.querySelector( "#wrapper > div.container" ).childNodes; var forEach = Array.prototype.forEach; forEach.call(childNodes, function (node) { if ( node.nodeName === "#text" && node.nodeValue.includes("中間廣告") ) { node.nodeValue = ""; } }); } }); } // #endregion // execute(()=>{},()=>{}); // #region jquery.ready /////////////////////////////////////////////////////////////////////////// // jquery.ready /////////////////////////////////////////////////////////////////////////// $(function () { /////////////////////////////////////////////////////////////////////////// // oschina /////////////////////////////////////////////////////////////////////////// execute("开源中国", /oschina\.net/, () => { debug("修改首页某些链接无法中键点击问题.", "开源中国"); $(`[data-href]`).each(function () { const $this = $(this); const href = $this.attr("data-href"); const classCss = $this.attr("class"); const title = $this.attr("title"); const innerHtml = this.innerHTML; const html = `<a target="_blank" title="${title}" href="${href}" class="${classCss}">${innerHtml}</a>`; $this.replaceWith(html); }); debug("删除url中的重定向.", "开源中国"); $('a[href*="/action/GoToLink?url"]').each(function (index) { // https://www.oschina.net/action/GoToLink?url=https%3A%2F%2Fcode.visualstudio.com%2Fupdates%2Fv1_91 var url = getQueryVariable(this, "url"); this.href = decodeURIComponent(url); }); }); /////////////////////////////////////////////////////////////////////////// // gitee.com /////////////////////////////////////////////////////////////////////////// execute("gitee", /gitee\.com/, () => { debug("删除url中的重定向.", "gitee"); $('a[href*="/link?target"]').each(function (index) { var url = getQueryVariable(this, "target"); this.href = decodeURIComponent(url); }); }); /////////////////////////////////////////////////////////////////////////// // 紳士漫畫 永久域名: wnacg.com 紳士漫畫永久地址發佈頁: wnacg.date /////////////////////////////////////////////////////////////////////////// execute("紳士漫畫", $('head>title:contains("紳士漫畫")'), () => { if (location.href.includes("photos-index-aid")) { debug("明细页面添加搜索框", "紳士漫畫"); const searchInput = ` <div class="search" style="float:right;"> <form id="album_search q-form" action="/search/" method="get" _lpchecked="1"> <div class="input-append" id="q-input"> <input type="text" class="search-query ui-autocomplete-input tips" name="q" value="" title="搜索漫畫" autocomplete="off" role="textbox" aria-autocomplete="list" aria-haspopup="true"> <input style="display:none" type="radio" name="f" value="_all" checked=""> <input style="display:none" name="s" value="create_time_DESC"> <input style="display:none" name="syn" value="yes"> <button type="" name=""></button> </div> </form> </div> `; $("#bodywrap").prepend(searchInput); } if (location.href.includes("photos-slide-aid")) { debug("下拉阅读页面,图片由一列改为两列", "紳士漫畫"); const nodeToObserve = document.querySelector("#img_list"); $(nodeToObserve).css({ width: "100%", display: "flex", "flex-wrap": "wrap", "justify-content": "flex-start", "overflow-x": "hidden", }); const imgWidth = document.documentElement.clientWidth / 2 - 10; const imgHeight = document.documentElement.clientHeight - 50; new MutationObserver((mutations, observer) => { $("#img_list>div").css({ flex: "1", "background-color": "#cacaca", margin: "0 5px 5px 0", width: "calc((100% - 10px) / 2)", "min-width": "calc((100% - 10px) / 2)", "max-width": "calc((100% - 10px) / 2)", }); $("#img_list>div>img").on("load", (e) => { drawImage(e.target, imgWidth, imgHeight); }); }).observe(nodeToObserve, { childList: true }); } if ($("input.search-query").length > 0) { debug("为搜索框后面添加 粘贴&搜索 按钮", "紳士漫畫"); const $pasteAndSearchButton = $( `<button style="float:right;height:30px;">粘贴&搜索</button>` ); $("#bodywrap").prepend($pasteAndSearchButton); $pasteAndSearchButton.on("click", () => { navigator.clipboard.readText().then((clipText) => { if (clipText != null && $.trim(clipText) != "") { $("[name=q]").val($.trim(clipText)); $("#q-input > button").click(); } }); }); } }); /////////////////////////////////////////////////////////////////////////// // JAVLibrary github.com/javlibcom 会有最新的网址 // 我们的入口 javlib.com zlibz.com [email protected] /////////////////////////////////////////////////////////////////////////// execute("JAVLibrary", $('head>title:contains("JAVLibrary")'), () => { // ---- 所有页面 // 删除广告 $(".socialmedia,#bottombanner13,#topbanner11,#sidebanner11").remove(); $("#leftmenu>div>ul:nth-child(2)>li:nth-child(2)").remove(); // 调节UI $("#content").css("padding-top", "10px"); $("#toplogo").css("height", "50px"); $("#toplogo").find('img[src*="logo-top"]').attr("height", "40"); // 添加 粘贴&搜索 按钮 const styleMap = {}; $("#idsearchbutton")[0] && $("#idsearchbutton")[0] .computedStyleMap() .forEach((value, key) => { styleMap[key] = value; }); const $pasteAndSearchButton = $( `<input type="button" value="粘贴&搜索" id="pasteAndSearch"></input>` ); $pasteAndSearchButton.css(styleMap); $pasteAndSearchButton.click(() => { navigator.clipboard.readText().then((clipText) => { if (clipText != null && $.trim(clipText) != "") { $("#idsearchbox").val(clipText); $("#idsearchbutton").click(); } }); }); $("#idsearchbutton").parent().append($pasteAndSearchButton); // 添加 打开skrbt 连接 $(".advsearch").append( ` <a href="${skrbtUrl}" target="_blank" class="tianteng-search-anchor" title="打开后自动搜索剪贴板中的内容">打开skrbt</a>` ); // 恢复原始url,删除重定向 $.each($("a[href^='redirect.php?url']"), function (index, a) { 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:20px;"; } else { a.style = "font-size:20px;"; } }); // ---- 详情页面 if (/.*\?v=.*/.test(location.href)) { // 添加 复制车牌 按钮 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); // 添加 javbus中查询 链接 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(""); // 添加 用SkrBt搜索 链接 $(trTag).append(` <td> <a class="tianteng-search-anchor" href="${skrbtUrl}/search?keyword=${chePai}" data-tianteng-keyword="${chePai}"> 用SkrBt搜索 </a> </td> `); // 删除名称中的链接,否则很容易误点,又不容易复制文字 const videoTitleNode = document.querySelector("#video_title > h3 > a"); if (videoTitleNode) { const videoTitle = videoTitleNode.getInnerHTML(); videoTitleNode.parentNode.innerText = videoTitle; } } // $(".tianteng-search-anchor").on("click mouseup", function () { const keyword = $(this).data("tiantengKeyword"); if (keyword) { GM_setValue("tiantengKeyword", keyword); } }); }); /////////////////////////////////////////////////////////////////////////// // javbus 永久域名:https://www.javbus.com 防屏蔽地址:https://www.fanbus.help // 防屏蔽地址:https://www.javsee.help 防屏蔽地址:https://www.buscdn.help /////////////////////////////////////////////////////////////////////////// execute( "javbus", [ $('head>title:contains("JavBus")'), // /genre/hd , /genre/sub $("body > nav > div > div.navbar-header.mh50 > a > img[alt='JavBus']"), // 论坛 "#toptb.jav-nav", ], () => { // #region 所有页面 debug("添加 粘贴&搜索 按钮", "javbus"); const searchButton = $( "button[onclick=\"searchs('search-input')\"]:first" ); const searchInput = $("#search-input:first"); addPasteAndSearchButton(searchButton, searchInput); // 调整样式 $(".nav>li>a").attr("style", "padding-left:8px;padding-right:8px;"); debug("添加 打开skrbt 链接", "javbus"); //添加skrbt链接 $(".nav-title.nav-inactive:last,ul.nav.navbar-nav:first").append(` <li class="hidden-md hidden-sm"> <a href="${skrbtUrl}" target="_blank">打开skrbt</a> </li> `); debug("添加 打开今日新帖 按钮", "javbus"); // function showTip(message) { // let tipBox = $("#tiantengTipBox"); // if (tipBox.length === 0) { // const html = ` // <div class="alert alert-info alert-dismissable alert-common text-center" // style="position:relative;"> // <button type="button" // class="close" // style="position:absolute; right:8px; top:3px;" // data-dismiss="alert">×</button> // <strong id="tiantengTipBox"></strong> // </div>`; // // $("div.container-fluid>div.row").prepend(html); // $('nav').append(html); // $('#toptb').after(html); // } // tipBox = $("#tiantengTipBox"); // tipBox.text(message); // } // showTip("xxxxxxxxxxxxxxxxxx"); let todayNewButton = $( `<button id="tiantengNewButton" class="jav-button btn btn-default ld-ext-right" title="打开老司机福利讨论区的今日新帖,最多30个" style="margin-top:7px;"> <span>打开今日新帖</span> <div class="ld ldld bare" style="width:1em;height:1em"> </div> </button>` ); const ldbuttonCss = GM_getResourceText("ldbutton"); GM_addStyle(ldbuttonCss); const ldloaderCss = GM_getResourceText("ldloader"); GM_addStyle(ldloaderCss); // prettier-ignore $(".nav-title.nav-inactive:last,ul.nav.navbar-nav:first") .append(todayNewButton); let ldloader = new ldLoader({ root: "#tiantengNewButton" }); todayNewButton.click(function () { if (ldloader.running) { debug("正在加载数据,忽略点击...", "javbus"); return; } ldloader.toggle(); todayNewButton.attr("disabled", "true"); const origin = location.origin; // 老司机福利讨论区 const talkUrl = `${origin}/forum/forum.php?mod=forumdisplay&fid=2&filter=author&orderby=dateline&dateline=86400`; // 求福利带带我 const askUrl = `${origin}/forum/forum.php?mod=forumdisplay&fid=36&filter=author&orderby=dateline&dateline=86400`; const now = new Date(); // prettier-ignore const today = `${now.getFullYear()}-${now.getMonth() + 1}-${now.getDate()}`; async function getPostData(url, date, pageNum) { // pageNum= pageNum ?? 1; // url = url+'&page='+'pageNum' const r = await GM.xmlHttpRequest({ url: url, 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", }, }).catch((e) => { ldloader.off(); todayNewButton.attr("disabled", false); console.error(e); debug(e,'javbus'); alert('获取数据出现错误!!'); }); const data = $(r.responseXML); const result = []; $(".post_inforight", data).each(function (index) { const date = $("span.dateline>span", $(this)).attr("title"); if (date === today) { let postUrl = $("a.s", $(this)).attr("href"); result.push(`${origin}/forum/${postUrl}`); } }); return result; } getPostData(talkUrl).then(function (urlArray) { if (urlArray.length === 0) { debug("没有新的帖子", "javbus"); alert('没有新的帖子.'); } $(urlArray).each(function () { GM_openInTab(this, true); }); ldloader.off(); todayNewButton.attr("disabled", false); }); }); // #endregion // #region 明细页面 let chePaiNode = document.querySelector( "body > div.container > div.row.movie > div.col-md-3.info > p:nth-child(1) > span:nth-child(2)" ); if (chePaiNode) { debug("添加复制车牌号按钮", "javbus"); const chePai = chePaiNode.innerText.trim(); const toAppendElement = document.querySelector( "body > div.container > div.row.movie > div.col-md-3.info > p:nth-child(1)" ); appendCopyButton( chePai, toAppendElement, (copyButton) => (copyButton.className = "jav-button btn btn-default") ); debug("删除磁力链接中的onclick事件", "javbus"); setInterval(() => $("#magnet-table td").removeAttr("onclick"), 1000); debug("添加 在javlibrary中打开", "javabus"); //https://www.y78k.com/cn/vl_searchbyid.php?keyword=SUJI-241 const javLibLink = `<a href="${javLibUrl}/cn/vl_searchbyid.php?keyword=${chePai}">在javlib中打开</a>`; $(toAppendElement).append(javLibLink); } // #endregion // #region 论坛明细页面 if (location.href.includes("mod=viewthread")) { // #region 调整样式 debug("调整样式", "论坛明细页面"); GM_addStyle(` #p_btn { padding:0; } .mtw { margin-top: 0px !important; } .mbm { margin-bottom: 10px !important; } .pi { overflow: hidden; margin-bottom: 0; padding: 0; height: 16px; border-bottom: 1px dashed #CDCDCD; } .pct { padding-bottom: 0; } .t_fsz { min-height: auto; } .nthread_postinfo { margin: 0 -16px; border-top: 10px solid #f5f5f5; padding: 10px 40px; } .pcb .cm .psth { margin-bottom: 0px; } .pcb .psth { width: 100%; font-size: 17px !important; line-height: 28px; font-weight: normal; color: #454545; background: none; border-bottom: 1px solid #CECECE; padding: 0; margin: 10px 0 0; } .pstl { clear: left; padding: 0em 0; } hin .pob { padding-bottom: 0px !important; } .plc{padding-top:14px} `); // #endregion // #region 为磁链添加按钮 debug("为磁链添加按钮", "论坛明细页面"); function toAlienMagnet(magnet, alien) { alien = alien ? alien : "-"; let part1 = magnet.slice(0, 21); let part2 = magnet.slice(21); return `${part1}${alien}${part2}`; } function toNormalMagnet(magnet, alien) { alien = alien ? alien : "-"; return magnet.replace(alien, ""); } function getMagnetRegExp(alien) { if (alien) { return new RegExp( `(?:magnet:\\?xt=urn:btih:)?(?:(?:[0-9a-f]{1}${alien}[0-9a-f]{39})|(?:[2-7a-zA-Z]${alien}[2-7a-zA-Z]{31}))`, "gim" ); } else { return /(?:magnet:\?xt=urn:btih:)?(?:[0-9a-fA-F]{40}|[2-7a-zA-Z]{32})/gim; } } function completeMagnet(magnet) { if (!magnet) { return magnet; } if (magnet.length === 32 || magnet.length === 40) { return `magnet:?xt=urn:btih:${magnet}`; } return magnet; } // 所有按钮的点击事件处理 $(document).on( "click", 'button[class*="tianteng-button"]', function (e) { let button = $(e.target); let buttonType = button.data("tiantengButton"); // 复制磁链 if (buttonType === "copy") { let magnet = button.data("tiantengMagnet"); GM.setClipboard(toNormalMagnet(magnet), "text"); return; } // 打开磁链 if (buttonType === "click") { let magnet = button.data("tiantengMagnet"); setTimeout(() => window.open(toNormalMagnet(magnet)), 500); return; } // 复制所有磁链 if (buttonType === "copyAll") { let postId = button.data("tiantengPostId"); let magnets = ""; $(`[data-tianteng-button="copy"]`, $(`#${postId}`)).each( function () { let magnet = $(this).data("tiantengMagnet"); magnets = magnets + toNormalMagnet(magnet) + "\n"; } ); GM.setClipboard(magnets, "text"); return; } // 打开所有磁链 if (buttonType === "clickAll") { let postId = button.data("tiantengPostId"); $(`[data-tianteng-button="copy"]`, $(`#${postId}`)).each( function () { let magnet = $(this).data("tiantengMagnet"); magnet = toNormalMagnet(magnet); setTimeout(() => window.open(toNormalMagnet(magnet)), 500); } ); return; } // 复制所有磁链(不含点评) if (buttonType === "copyAllNot") { let postId = button.data("tiantengPostMessageId"); let magnets = ""; $(`[data-tianteng-button="copy"]`, $(`#${postId}`)).each( function () { let magnet = $(this).data("tiantengMagnet"); magnets = magnets + toNormalMagnet(magnet) + "\n"; } ); GM.setClipboard(magnets, "text"); return; } // 打开所有磁链(不含点评) if (buttonType === "clickAllNot") { let postId = button.data("tiantengPostMessageId"); $(`[data-tianteng-button="copy"]`, $(`#${postId}`)).each( function () { let magnet = $(this).data("tiantengMagnet"); magnet = toNormalMagnet(magnet); setTimeout(() => window.open(toNormalMagnet(magnet)), 500); } ); return; } } ); // end 所有按钮事件 let magnetRegExp = getMagnetRegExp(); // 先处理a标签元素中的磁链,加上标记 $(`div[id^="post_"] a[href^="magnet:?xt=urn:btih:"]`).each( function () { let magnetAlien = completeMagnet($(this).attr("href")); magnetAlien = toAlienMagnet(magnetAlien); // $(this).data('tiantengStatus','@'); let html = this.outerHTML.replace( magnetRegExp, (match, offset, str) => toAlienMagnet(completeMagnet(match), "@") ); html = html.replace("href", `data-tianteng-status="ok" href`); html = `${html} <button style="margin:0;padding:3px;" class="jav-button tianteng-button" data-tianteng-button="copy" data-tianteng-magnet="${magnetAlien}" type="button">复制磁链 </button> <button style="margin:0;padding:3px;" class="jav-button tianteng-button" data-tianteng-button="click" data-tianteng-magnet="${magnetAlien}" type="button">打开磁链 </button>`; this.outerHTML = html; } ); // 再处理所有文本节点,加上标记 $('div[id^="post_"]').each(function () { const treeWalker = document.createTreeWalker( this, NodeFilter.SHOW_TEXT ); while (treeWalker.nextNode()) { const node = treeWalker.currentNode; if (node.nodeValue && magnetRegExp.test(node.nodeValue)) { node.nodeValue = node.nodeValue.replace( magnetRegExp, (match, offset, str) => toAlienMagnet(completeMagnet(match), "tianteng") ); } } }); // 去除标记 $('div[id^="post_"]').each(function () { // 去除文本节点中磁链的标记 let magnetAlienRegExp = getMagnetRegExp("tianteng"); let html = this.innerHTML; html = html.replace(magnetAlienRegExp, function (match) { match = toNormalMagnet(match, "tianteng"); let magnetAlien = toAlienMagnet(match); return ` <a href="${match}" data-tianteng-status="ok">${match}</a> <button style="margin:0;padding:3px;" class="jav-button tianteng-button" data-tianteng-button="copy" data-tianteng-magnet="${magnetAlien}" type="button">复制磁链 </button> <button style="margin:0;padding:3px;" class="jav-button tianteng-button" data-tianteng-button="click" data-tianteng-magnet="${magnetAlien}" type="button">打开磁链 </button>`; }); // 去除A标签中磁链的标记 magnetAlienRegExp = getMagnetRegExp("@"); html = html.replace(magnetAlienRegExp, function (match) { return toNormalMagnet(match, "@"); }); this.innerHTML = html; const postId = $(this).attr("id"); const id = postId.replace("post_", ""); const postMessageId = `postmessage_${id}`; // 添加 4个 "所有" 按钮,在每个回复的开头和结尾,共8个 if ( $(`[data-tianteng-button="copy"]`, $(`#${postId}`)).length > 0 ) { let allButtonHtml = ` <button style="margin:0;padding:5px;" class="jav-button tianteng-button" data-tianteng-button="copyAll" data-tianteng-post-id="${postId}" data-tianteng-post-message-id="${postMessageId}" type="button">复制所有磁链 </button> <button style="margin:0;padding:5px;" class="jav-button tianteng-button" data-tianteng-button="clickAll" data-tianteng-post-id="${postId}" data-tianteng-post-message-id="${postMessageId}" type="button">打开所有磁链 </button> <button style="margin:0;padding:5px;margin-left:10px;" class="jav-button tianteng-button" data-tianteng-button="copyAllNot" data-tianteng-post-id="${postId}" data-tianteng-post-message-id="${postMessageId}" type="button">复制所有磁链(不含点评) </button> <button style="margin:0;padding:5px;" class="jav-button tianteng-button" data-tianteng-button="clickAllNot" data-tianteng-post-id="${postId}" data-tianteng-post-message-id="${postMessageId}" type="button">打开所有磁链(不含点评) </button>`; $(`#${postMessageId}`).prepend(allButtonHtml + "<br><br>"); $(`#${postMessageId}`).append("<br><br>" + allButtonHtml); } }); // 自动分页插件兼容 const nodeToObserve = document.querySelectorAll(".nthread_postbox")[14]; new MutationObserver((mutationRecords, observer) => { // $('div[id^="post_"]').each(function () { // if ($(this).data("tiantengStatus") !== "ok") { // handleMagnet(); // } // }); }).observe(nodeToObserve, { childList: true }); // #endregion } // end if 论坛明细页面 // # endregion } // end callback ); // #region BT搜索网站 /////////////////////////////////////////////////////////////////////////// // BTSOW https://btsow.motorcycles https://btsow.com /////////////////////////////////////////////////////////////////////////// execute("btsow", $('head>title:contains("BTSOW")'), () => { function allPages() { const form = $("form.fullsearch-form"); form.each(function () { const me = $(this); if ($(".tianteng-paste-search", me).length === 0) { const searchButton = $(`:submit`, me); const pasteAndSearchButton = $(` <button type="button" class="btn btn-default tianteng-paste-search"> 粘贴&搜索 </button>`); searchButton.after(pasteAndSearchButton); } }); } function searchPage() { if (location.pathname.startsWith("/search")) { debug("添加 复制磁链,打开磁链 按钮", "btsow-搜索结果列表"); let buttonsHtml = ` <button class="btn btn-danger copy" type="button">复制磁链</button> <button class="btn btn-danger click" type="button">打开磁链</button>`; $("div.data-list>div.row>a>div.file").each((index, el) => { if ($(el).find("button.copy").length === 0) { $(el).append(buttonsHtml); } }); } } debug("添加 粘贴&搜索 按钮", "btsow-所有页面"); allPages(); $(document).on("click", "button.tianteng-paste-search", function (e) { const me = $(this); navigator.clipboard.readText().then((text) => { if (text != null && $.trim(text) != "") { me.parent().prev().val($.trim(text)); me.parentsUntil(".container")[2].submit(); } }); }); searchPage(); if (location.pathname.startsWith("/search")) { debug("添加 复制磁链,打开磁链 按钮", "btsow-搜索结果列表"); $(document).on("click", "button.copy, button.click", function (e) { let magnet = $(this).parent().parent().attr("href").split("/")[6]; magnet = `magnet:?xt=urn:btih:${magnet}`; if ($(this).attr("class").includes("copy")) { GM_setClipboard(magnet, "text", () => debug("ok")); } else if ($(this).attr("class").includes("click")) { GM_openInTab(magnet); } e.preventDefault(); e.stopImmediatePropagation(); e.stopPropagation(); }); } // 自动分页插件兼容 const nodeToObserve = document.querySelector("body"); new MutationObserver((mutationRecords, observer) => { allPages(); searchPage(); }).observe(nodeToObserve, { childList: true }); }); /////////////////////////////////////////////////////////////////////////// // skrbt https://skrbtqx.top 永久地址: skrfabu.top skrso.link /////////////////////////////////////////////////////////////////////////// execute("skrbt", $(`head>link[rel='shortcut icon'][href*='skrbt']`), () => { debug("添加 粘贴&搜索 按钮", "skrbt"); const $searchButton = $("button.search-btn"); const $searchInput = $(`input.search-input[name='keyword']`); const $pasteAndSearchButton = addPasteAndSearchButton( $searchButton, $searchInput ); // 调整'粘贴&搜索'按钮样式 $pasteAndSearchButton.removeAttr("style"); $pasteAndSearchButton.css("margin-left", "3px"); $pasteAndSearchButton.attr("class", $searchButton.attr("class")); // 通过别的网站直接访问,比如(https://skrbtqx.top/search?keyword=abp133),会直接跳转到首页 // 解决办法,在别的地方进来之前,先把要查询的关键字保存起来,然后进入到skrbt后获取,赋值到输入框,然后查询. // 如果,在skrbt首页中没有找到保存的关键字,就从剪贴板获取. // 如果,剪贴板没有任何内容,则啥也不做. if (location.pathname === "/") { const keyword = GM_getValue("tiantengKeyword", null); if (keyword) { debug("搜索存储的内容", "skrbt-首页"); GM_deleteValue("tiantengKeyword"); $searchInput.val(keyword); $searchButton.click(); } else { debug("搜索剪贴板中的内容", "skrbt-首页"); $pasteAndSearchButton.click(); } } debug("删除广告", "skrbt"); // 删除广告 function removeAd() { const $container = $(".col-md-6:eq(2)"); $container.remove(".label.label-primary"); $container .find('a.rrt.common-link[href^="http"]') .parent() .parent() .remove(); } removeAd(); // 搜索结果列表页面 if (location.href.includes("search")) { debug("添加 复制磁链和打开磁链 按钮", "skrbt-搜索结果列表页面"); let buttonsHtml = ` <span class="rrmiv"><button class="btn btn-danger copy" type="button">复制磁链</button></span> <span class="rrmiv"><button class="btn btn-danger click" type="button">打开磁链</button></span>`; addButtonsForSkrbt(buttonsHtml, $(".col-md-6:eq(2)"), (el) => { const classValue = $(el).attr("class"); if (classValue && classValue.includes("copy")) { return "copy"; } if (classValue && classValue.includes("click")) { return "click"; } return "other"; }); // 自动分页插件兼容,删除广告 const nodeToObserve = document.querySelectorAll(".col-md-6")[2]; new MutationObserver((mutationRecords, observer) => { $("a.rrt.common-link").each((index, el) => { if ($(el).parent().find(".btn.btn-danger.copy").length === 0) { $(el).after(buttonsHtml); } }); removeAd(); }).observe(nodeToObserve, { childList: true }); } // end if }); // #endregion /////////////////////////////////////////////////////////////////////////// // 知乎 /////////////////////////////////////////////////////////////////////////// execute("知乎", /zhihu\.com/, () => { const searchButton = $(`button[class*="SearchBar-searchButton"]`); const searchInput = $(`#Popover1-toggle`); addPasteAndSearchButton(searchButton, searchInput); }); /////////////////////////////////////////////////////////////////////////// // 百度 /////////////////////////////////////////////////////////////////////////// execute("百度", /baidu\.com/, () => { const searchButton = $(`#su`); const searchInput = $(`#kw`); addPasteAndSearchButton(searchButton, searchInput); }); }); // #endregion // #region 公共方法 ///////////////////////////////////////////////////////////////////////////// // 公共方法 ///////////////////////////////////////////////////////////////////////////// function execute(title, condition, callback) { if (checkCondition(condition) === true) { if (callback) { debug(condition.toString(), title); callback(title, condition); } } } /** * * @param {RegExp|Function|Boolean|String|jQuery} condition * @returns {Boolean} */ function checkCondition(condition) { if ($.type(condition) === "regexp") { return condition.test(window.location.href); } if ($.isFunction(condition)) { return condition() === true; } if ($.type(condition) === "boolean") { return condition === true; } if ($.type(condition) === "string") { return document.querySelector(condition) != null; } if (condition instanceof jQuery) { return condition.length > 0; } if ($.isArray(condition)) { for (let c of condition) { if (checkCondition(c)) { return true; } } } return false; } function addPasteAndSearchButton($searchButton, $searchInput, callback) { const styleMap = { "margin-left": "5px" }; $searchButton[0] && $searchButton[0].computedStyleMap().forEach((value, key) => { styleMap[key] = value; }); let $pasteAndSearchButton = $( `<input type="button" value="粘贴&搜索" id="pasteAndSearch"></input>` ); $pasteAndSearchButton.css(styleMap); $searchButton.after($pasteAndSearchButton); $pasteAndSearchButton.click(() => { navigator.clipboard.readText().then((clipText) => { if (clipText != null && $.trim(clipText) != "") { $searchInput.val($.trim(clipText)); $searchButton.click(); } }); }); callback && callback($searchButton, $searchInput, $pasteAndSearchButton); return $pasteAndSearchButton; } function addPasteAndSearchButton1( searchButton, searchInput, pasteSearchButton ) { const styleMap = { "margin-left": "5px" }; $searchButton[0] && $searchButton[0].computedStyleMap().forEach((value, key) => { styleMap[key] = value; }); let $pasteAndSearchButton = $( `<input type="button" value="粘贴&搜索" id="pasteAndSearch"></input>` ); $pasteAndSearchButton.css(styleMap); $searchButton.after($pasteAndSearchButton); $pasteAndSearchButton.click(() => { navigator.clipboard.readText().then((clipText) => { if (clipText != null && $.trim(clipText) != "") { $searchInput.val($.trim(clipText)); $searchButton.click(); } }); }); callback && callback($searchButton, $searchInput, $pasteAndSearchButton); return $pasteAndSearchButton; } function appendCopyButton(chePai, toAppendElement, callback) { var copyButton = document.createElement("button"); copyButton.innerHTML = "复 制"; copyButton.setAttribute("id", "copyButton"); toAppendElement.appendChild(copyButton); document.addEventListener("click", (e) => { if (e.target.getAttribute("id") === "copyButton") { GM.setClipboard(chePai, "text"); } }); callback && callback(copyButton, chePai, toAppendElement); } function debug(str, title) { if (enableDebug) { if (!str) { str = ""; } if (!Array.isArray(str)) { str = [str]; } seq++; console.log( `%c【tianteng ${GM_info.script.version}】 ${title ? title : "debug"}:`, "color: yellow;font-size: large;font-weight: bold;background-color: darkblue;", seq, ...str ); } } function isNativeCode(obj) { const nativeCodeTag = "[native code]"; return obj && obj.toString && obj.toString().includes(nativeCodeTag); } 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; } /** * 图片按宽高比例进行自动缩放 * @param ImgObj * 缩放图片源对象 * @param maxWidth * 允许缩放的最大宽度 * @param maxHeight * 允许缩放的最大高度 * @usage * 调用:<img src="图片" onload="javascript:drawImage(this,300,200)"> */ function drawImage(ImgObj, maxWidth, maxHeight) { var image = new Image(); //原图片原始地址(用于获取原图片的真实宽高,当<img>标签指定了宽、高时不受影响) image.src = ImgObj.src; // 用于设定图片的宽度和高度 var tempWidth; var tempHeight; if (image.width > 0 && image.height > 0) { //原图片宽高比例 大于 指定的宽高比例,这就说明了原图片的宽度必然 > 高度 if (image.width / image.height >= maxWidth / maxHeight) { if (image.width > maxWidth) { tempWidth = maxWidth; // 按原图片的比例进行缩放 tempHeight = (image.height * maxWidth) / image.width; } else { // 按原图片的大小进行缩放 tempWidth = image.width; tempHeight = image.height; } } else { // 原图片的高度必然 > 宽度 if (image.height > maxHeight) { tempHeight = maxHeight; // 按原图片的比例进行缩放 tempWidth = (image.width * maxHeight) / image.height; } else { // 按原图片的大小进行缩放 tempWidth = image.width; tempHeight = image.height; } } // 设置页面图片的宽和高 ImgObj.height = tempHeight; ImgObj.width = tempWidth; // 提示图片的原来大小 ImgObj.alt = image.width + "×" + image.height; } } /** * * @param {EventTarget|NodeList|Array|jQuery} elements * @param {undefined|null|String|Array} events */ function removeEvents(elements, events) { if (!elements) return; if (elements instanceof EventTarget) { elements = [elements]; } if (elements instanceof jQuery) { elements = elements.toArray(); } if (!events) { elements.forEach((element) => { for (let t in element) { if (t.startsWith("on") && element[t] != null) { element[t] = null; console.log("cleanup removed listener from " + element.nodeName, t); } } for (let t of element.allListeners || []) { element.removeEventListener(t.type, t.callback, t.options); console.log( "cleanup removed listener from " + element.nodeName, t.type ); } element.allListeners = []; }); } else { if (typeof events === "string") { events = [events]; } if (!Array.isArray(events)) { return; } events.forEach((event) => { const onEvent = "on" + event; elements.forEach((element) => { for (let t in element) { if (t.startsWith(onEvent) && element[t] != null) { element[t] = null; console.log( "cleanup removed listener from " + element.nodeName, t ); } } // const toRemoved = []; element.allListeners = element.allListeners || []; let allListenersNew; element.allListeners.forEach((t, i) => { if (t.type === event) { element.removeEventListener(t.type, t.callback, t.options); allListenersNew = element.allListeners.slice(i, 1); // toRemoved.push(i); console.log( "cleanup removed listener from " + element.nodeName, t.type ); } }); // toRemoved.forEach((item, index) => { // element.allListeners = element.allListeners.slice(item, 1); // }); if (allListenersNew) { element.allListeners = allListenersNew; } }); }); } } function addButtonsForSkrbt( buttonsHtml, delegateElement, buttonTypeCallback ) { delegateElement.find("a.rrt.common-link").after(buttonsHtml); delegateElement.click((event) => { const buttonType = buttonTypeCallback(event.target); if ("copy" !== buttonType && "click" !== buttonType) { return; } let liNode = $(event.target).parent().parent(); const exeButtonClick = () => { if ("copy" === buttonType) { 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 = `${skrbtUrl}${detailUrl}`; $.get(detailUrl, function (data, textStatus, jqXHR) { liNode.find("#errorTip").remove(); //成功后在页面添加磁链 const magnet = $(data).find("#magnet").attr("href"); if (magnet) { const aHtml = '<a class="magnet" href="' + magnet + '">' + magnet + "</a>"; liNode.append(aHtml); exeButtonClick(); } else { liNode.append( '<span id="errorTip">1.获取磁链失败,等会儿再试一试! 若仍然有问题请刷新网页.</span>' ); } }).fail(function (e) { //失败后在页面提示 liNode.append( '<span id="errorTip">2.获取磁链失败,等会儿再试一试! 若仍然有问题请刷新网页.</span>' ); console.log(e); }); }); } // #endregion })();