您需要先安装一个扩展,例如 篡改猴、Greasemonkey 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 Userscripts ,之后才能安装此脚本。
您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey,才能安装此脚本。
您需要先安装用户脚本管理器扩展后才能安装此脚本。
Observe, inspect and perhaps modify a React tree through the React DevTools Hook
此脚本不应直接安装。它是供其他脚本使用的外部库,要使用该库请加入元指令 // @require https://update.gf.qytechs.cn/scripts/473998/1246974/Itsnotlupus%27%20React%20Tools.js
A scrappy little library that plugs into React and tries to get useful bits user scripts can leverage.
const stuff = new ReactTools();
stuff.observe(root => {
console.log("A react tree was updated, and here's the fiber tree for it:", root);
});
// If the site you're targeting uses Redux and wasn't written by psychopaths, this will usually work.
// (The tree will need to get rendered first. You can use observe() to wait for it.)
const reduxStore = stuff.getProp("store");
findNodesWithProp()
and updateNodeProps()
are a bit trickier to use.
You'll want to install the React Dev Tools to see what props are actually available on each node.
See https://gf.qytechs.cn/en/scripts/444804-crunchyroll-watchlist-userscript/code for an example use in tweakPlayer()
That crunchyroll script no longer works, but the code shows how to make this stuff work:
Mutating react props from outside of React is almost futile, since they get overwritten almost immediately.
But "almost" is the operative word there. You can effectively control React component props by:
findNodesWithProp()
updateNodeProps()
This library doesn't use the React DevTools Hook correctly.
There are almost certainly better way to use the hook APIs to do the things it does.
And yet it works (for me.)
QingJ © 2025
镜像随时可能失效,请加Q群300939539或关注我们的公众号极客氢云获取最新地址