您需要先安装一个扩展,例如 篡改猴、Greasemonkey 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 Userscripts ,之后才能安装此脚本。
您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey,才能安装此脚本。
您需要先安装用户脚本管理器扩展后才能安装此脚本。
simple toolkit to help me
当前为
此脚本不应直接安装。它是供其他脚本使用的外部库,要使用该库请加入元指令 // @require https://updategreasyfork.deno.dev/scripts/526417/1540623/USToolkit.js
// ==UserScript== // @name USToolkit // @namespace https://gf.zukizuki.org/pt-BR/users/821661 // @version 0.0.3 // @run-at document-start // @author hdyzen // @description simple toolkit to help me // @license MIT // ==/UserScript== /** * Asynchronously queries the DOM for an element matching the given selector. * If the element is not found immediately, it will observe the DOM for changes * and resolve once the element is found or reject after a timeout. * * @param {string} selector - The CSS selector to query for. * @param {number} [timeoutSeconds=10] - The maximum time to wait for the element, in seconds. * @returns {Promise<Element>} A promise that resolves with the found element or rejects with a timeout error. */ function asyncQuerySelector(selector, timeoutSeconds = 10) { return new Promise((resolve, reject) => { const element = document.querySelector(selector); if (element) { resolve(element); } const mutationsHandler = () => { const target = document.querySelector(selector); if (target) { observer.disconnect(); resolve(target); } }; const observer = new MutationObserver(mutationsHandler); observer.observe(document.body || document.documentElement || document, { childList: true, subtree: true }); setTimeout(() => { observer.disconnect(); reject("Timeout 10 seconds"); }, timeoutSeconds * 1000); }); }