// ==UserScript== // @name 追新番复制所有磁力链接 // @include *zhuixinfan.com/viewtvplay* // @namespace http://tampermonkey.net/ // @version 1.0 // @description 追新番快捷复制所有磁力链接 // @author leeyang1990@gmail.com // @grant GM_xmlhttpRequest // @downloadURL none // ==/UserScript== (function() { "use strict"; // Your code here... injectMyScript(); })(); function injectMyScript() { var filterTabEle = document.querySelectorAll(".filter-tab"); if (filterTabEle && filterTabEle[0]) { var span = document.createElement("span"); span.className = "a y"; span.setAttribute("style", `margin:auto 2px;cursor:pointer`); var a = document.createElement("a"); a.textContent = "复制全部连接"; span.appendChild(a); span.addEventListener( "click", function() { CallBack(Result); }, false ); filterTabEle[0].appendChild(span); } } function CallBack(callback) { var list = getUrls(); var all = []; function doFunc(counter) { if (counter < list.length) { var link = list[counter]; setTimeout(() => { getMU(link, stream => { all.push(stream); doFunc(counter + 1); }); }, 10); } else { console.log("done"); callback(all.join("\n")); } } doFunc(0); } function Result(murl) { window.Clipboard.copy(murl); } function getUrls() { var urls = []; var list = document.getElementById("ajax_tbody").querySelectorAll(".td2"); for (var i = 0; i < list.length; i++) { urls.push(list[i].children[0].href); } return urls; } function getMU(_url, callback) { GM_xmlhttpRequest({ method: "GET", url: _url, onload: function(response) { var content = response.responseText; var from = content.indexOf(`