您需要先安装一个扩展,例如 篡改猴、Greasemonkey 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 Userscripts ,之后才能安装此脚本。
您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey,才能安装此脚本。
您需要先安装用户脚本管理器扩展后才能安装此脚本。
访问分享链接时自动跳转至下载页面或验证页面
当前为
// ==UserScript== // @name 链接自动跳转 // @author billypon // @description 访问分享链接时自动跳转至下载页面或验证页面 // @version 1.0.0 // @namespace http://www.canaansky.com/ // @match http://158pan.cn/file-*.html // @match http://66yp.cc/file-*.html // @run-at document-idle // @grant none // ==/UserScript== function ajax(url, callback) { console.info("ajax request:", url); var request = new XMLHttpRequest(); request.onreadystatechange = function (event) { var target = event.currentTarget; if (target.readyState != 4) return; if (target.status == 200) callback(target.responseText); else console.error("ajax response:", target.status, target.responseText); }; request.open("GET", url); request.send(); } function link(url) { var body = document.body, a = document.createElement("a"); a.textContent = "download"; a.href = url; body.insertBefore(a, body.children[0]); return a; } function jump(x, y, z) { if (!x && x !== null) x = "download"; if (!y) y = "down"; if (!z) z = "file"; var url = location.pathname; if (x) { ajax(url.replace(z, y), function() { var a = link(url.replace(z, x)); a.click(); }); } else { var a = link(url.replace(z, y)); a.click(); } } var hostname = location.hostname; console.info("hostname:", hostname); switch (hostname) { case "158pan.cn": jump(); break; case "66yp.cc": jump(null); break; }