您需要先安装一个扩展,例如 篡改猴、Greasemonkey 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 Userscripts ,之后才能安装此脚本。
您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey,才能安装此脚本。
您需要先安装用户脚本管理器扩展后才能安装此脚本。
2/12/2024, 2:44:50 AM
当前为
// ==UserScript== // @name civitai.com fast react // @namespace Violentmonkey Scripts // @match https://civitai.com/posts/* // @match https://civitai.com/search/images // @grant none // @version 1.0 // @author tryitandsee // @license MIT // @description 2/12/2024, 2:44:50 AM // ==/UserScript== // Should I use elementFromPoint or keep track of IMG tags as the mouseenter/mouseexit them? // mousemove seems inefficient but it works and works with infinite scroll let mouseX, mouseY; document.addEventListener('mousemove', function(event) { mouseX = event.clientX; mouseY = event.clientY; }); document.addEventListener('keydown', function(event) { if (!['1', '2', '3', '4'].includes(event.key)) { console.log('ZZ wrong keydown', event.key); return; } const $img = document.elementFromPoint(mouseX, mouseY); // Check if the found element is an <img> tag if ($img.tagName.toLowerCase() === 'img') { console.log('ZZ Found <img> tag:', $img); } else { console.log('ZZ No <img> tag found under the cursor.', $img); return; } const $control = $img.nextElementSibling; if ($control.childNodes.length != 6) { $control.childNodes[0].click(); return; } const numberPressed = parseInt(event.key, 10); $control.childNodes[numberPressed].click(); });