您需要先安装一个扩展,例如 篡改猴、Greasemonkey 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 Userscripts ,之后才能安装此脚本。
您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey,才能安装此脚本。
您需要先安装用户脚本管理器扩展后才能安装此脚本。
第一版主网站增强,已增强的功能:1. 自动填充 CF 人机验证;2. 自动填充网站人机验证;3. 预加载下一页;
当前为
// ==UserScript== // @name 第一版主网站增强 // @namespace https://diyibanzhu.org/better // @version 0.3 // @description 第一版主网站增强,已增强的功能:1. 自动填充 CF 人机验证;2. 自动填充网站人机验证;3. 预加载下一页; // @author Essence // @match https://*/* // @icon https://www.google.com/s2/favicons?sz=64&domain=diyibanzhu.org // @run-at document-end // @license MIT // ==/UserScript== // 站点名。域名经常变动,没有更好的判断方法 const SITE_NAME = "歪歪蒂艾斯"; const TAG = "[第一版主]"; // 等待 const sleep = ms => new Promise(resolve => setTimeout(resolve, ms)); // 等待指定元素出现后,执行回调 const waitElem = (selector, callback) =>{ const observer = new MutationObserver(() => { const element = document.querySelector(selector); if (element) { callback(element); observer.disconnect(); } }); observer.observe(document.body, { childList: true, subtree: true, }); } // 脚本页面:预加载下一页 const nextPage = ()=>{ // 依次找到"下一页"的元素:优先“下一页”,其次“下一章” const nextLink = document.querySelector("a.curr")?.nextElementSibling || document.querySelector("a.next"); console.log(TAG, "脚本将预加载下一页", nextLink, nextLink?.href); // If we found a matching link if (nextLink && nextLink.href) { // 通过"link prefetching"实现预加载下一页 const link = document.createElement("link"); // 注意:最后第一版主网站的章中最后的一页的 URL 的 href 是以"javascript:"开头,其它页是正常的 URL let href = nextLink.href; if(href.startsWith("javascript:")){ const params = href.match(/\d+/g) href = "/" + params.slice(0, -1).join("/") + "_" + params.slice(-1) + ".html"; } link.href = href; link.rel = "prefetch"; document.head.appendChild(link); } } // 脚本页面:自动填充网站人机验证 const verifyPage = ()=>{ document.querySelector("input#password").value="1234"; document.querySelector("div.login a").click(); } // 脚本页面:自动填充 CF 人机验证 const cfPage = ()=>{ waitElem("div#challenge-stage input[type='checkbox']", (elem)=> { console.log(TAG,"CF 人机验证的选择框", elem); elem.click(); }) } (function() { 'use strict'; // Your code here... // CF 验证页面需要放在最前面。避免因为不是目标网站而跳过 // 脚本页面:自动填充 CF 人机验证 // 注意 CF 验证是通过 iframe 嵌入实现的,所以在指定 URL 的 iframe 中运行该函数 if(location.href.startsWith("https://challenges.cloudflare.com/cdn-cgi/challenge-platform/")){ console.log(TAG, "自动填充 CF 人机验证"); cfPage(); } // 不是目标小说网站 if(!document.title.includes(SITE_NAME)){ console.log(TAG, "不是目标小说网站,停止运行:",document.title, location.href ); return; } // 脚本页面:预加载下一页 if(document.querySelector("h1.page-title")?.textContent?.trim()){ console.log(TAG, "预加载下一页"); nextPage(); } // 脚本页面:自动填充网站人机验证 if(document.querySelector("div.title")?.textContent?.includes("为防止恶意访问")){ console.log(TAG, "自动填充网站人机验证"); verifyPage(); } })();