你正在訪問的內容是外部程式的映像位址,僅用於使用者加速訪問,本站無法保證其可靠性。當前的連結位址(單點即可複製)為 https://greasyfork.org.cn/zh-CN/scripts/472956-userutils,源站連結 點此以跳轉。
General purpose DOM/GreaseMonkey library: register listeners for when CSS selectors exist, intercept events, create persistent & synchronous data stores, modify the DOM more easily and much more
当前为
此脚本不应直接安装。它是供其他脚本使用的外部库,要使用该库请加入元指令 // @require https://update.greasyfork.org.cn/scripts/472956/1234455/UserUtils.js
Library with various utilities for userscripts - register listeners for when CSS selectors exist, intercept events, modify the DOM more easily and more.
Contains builtin TypeScript declarations. Webpack compatible and supports ESM and CJS.
If you like using this library, please consider supporting the development ❤️
If you are using a bundler like webpack, you can install this package using npm:
npm i @sv443-network/userutils
Then, import it in your script as usual:
import { addGlobalStyle } from "@sv443-network/userutils";
// or
import * as userUtils from "@sv443-network/userutils";
Shameless plug: I also have a webpack-based template for userscripts in TypeScript that you can use to get started quickly.
If you are not using a bundler, you can include the latest release from GreasyFork by adding this directive to the userscript header:
// @require https://greasyfork.org.cn/scripts/472956-userutils/code/UserUtils.js
Then, access the functions on the global variable UserUtils:
UserUtils.addGlobalStyle("body { background-color: red; }");
onSelector()addEventListener() on any given EventTarget objectaddEventListener() on the window object