您需要先安装一个扩展,例如 篡改猴、Greasemonkey 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 Userscripts ,之后才能安装此脚本。
您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey,才能安装此脚本。
您需要先安装用户脚本管理器扩展后才能安装此脚本。
增加页面顶部底部按钮和一键下种按钮
// ==UserScript== // @name javdb auto open // @namespace websiteEnhancement // @author jimmly // @version 2024.9.3 // @description 增加页面顶部底部按钮和一键下种按钮 // @create 2023-9-21 // @include *javdb* // @grant GM_getValue // @grant GM_setValue // @grant GM.getValue // @grant GM.setValue // @license MIT // @run-at document-idle // ==/UserScript== /** * source of GM_config https://raw.githubusercontent.com/niubilityfrontend/GM_config/v20230928/gm_config.js * @typedef { import('jquery') } $ * @typedef { import('jQuery') } jQuery */; ; (async function (loadJS) { ["https://cdn.jsdelivr.net/gh/sodiray/radash@master/cdn/radash.min.js", "https://update.greasyfork.org/scripts/483173/1301961/GM_config_cnjames.js", "https://update.sleazyfork.org/scripts/476583/common_libs_of_array.js" ].reduce((p, url) => { return p.then(() => loadJS(url)) }, Promise.resolve()) .then(v => { withJQuery(function ($, win) { // 替换这些值为你的实际设置 const baseUrl = 'https://192.168.8.249:30024'; // 例如 http://localhost:8080 const username = 'admin'; const password = 'adminadmin'; // 登录到qBittorrent Web UI async function login() { const response = await fetch(`${baseUrl}/api/v2/auth/login`, { method: 'POST', headers: { 'Content-Type': 'application/x-www-form-urlencoded' }, body: `username=${encodeURIComponent(username)}&password=${encodeURIComponent(password)}` }); if (response.ok) { console.log('Logged in successfully.'); } else { console.error('Failed to log in.'); } return response } // 添加新的torrent下载任务 async function addTorrent(url) { const response = await fetch(`${baseUrl}/api/v2/torrents/add`, { method: 'POST', headers: { 'Content-Type': 'application/x-www-form-urlencoded' }, body: `urls=${encodeURIComponent(url)}` }); if (response.ok) { console.log('added successfully.'); } else { console.log('Failed to add.', response.body); } return response } win.funcDownload = function () { (async () => { login() .then(v => { let torrentUrl = $('div.magnet-name.column.is-four-fifths>a').first().prop('href') return addTorrent(torrentUrl) }) .then(res => { if (res.ok) { window.close(); window.open("about:blank", "_self").close(); } else { console.log('Failed to add.', response); alert('add error') } }).catch(err => console.log(err)) })(); } // win.funcList = function () { } // win.funcDetail = function () { } // const reg = /.*thread-(\d+)-.*/ // win.__compareKey = function (cache, curr) { // if (cache === curr) // return true // ///thread-6638382- // if (reg.test(cache)) // return cache.replace(reg, "$1") === curr // return false // } // win.fixValue = function (value) { // if (reg.test(value)) // return value.replace(reg, "$1") // return value // } $('table a').removeAttr('style') autoFind(() => ['/', '/tags', '/tags/uncensored'].includes(window.location.pathname), 'javdb', '.item a', el => el.attr('title'), $, {}, win); }) }) })(function (FILE_URL, async = true) { return new Promise((resolve, reject) => { let scriptEle = document.createElement("script"); scriptEle.setAttribute("src", FILE_URL); scriptEle.setAttribute("type", "text/javascript"); scriptEle.setAttribute("async", async); // success event scriptEle.addEventListener("load", () => { resolve(FILE_URL) }); // error event scriptEle.addEventListener("error", (ev) => { reject(ev); }); if (document.currentScript) document.currentScript.insertBefore(scriptEle) else (document.head || document.getElementsByTagName('head')[0]).appendChild(scriptEle); }) });