您需要先安装一个扩展,例如 篡改猴、Greasemonkey 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 Userscripts ,之后才能安装此脚本。
您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey,才能安装此脚本。
您需要先安装用户脚本管理器扩展后才能安装此脚本。
Allows users to configure scripts
当前为
此脚本不应直接安装。它是供其他脚本使用的外部库,要使用该库请加入元指令 // @require https://update.gf.qytechs.cn/scripts/446506/1537897/%24Config.js
Example instance hosted here. Source code available here.
// Define a config
const $config = new $Config(
'STORAGE_KEY',
{
get: (_, configs) => ({data: Object.assign(...configs)}),
children: [
{label: 'a', value: 0, get: ({value: a}) => ({a})},
{label: 'b', value: 1, get: ({value: b}) => ({b})},
{label: 'c', value: 2, get: ({value: c}) => ({c})}
]
},
);
// Await config load & handle problems
try {
await $config.ready;
} catch (error) {
if (!$config.reset) {
// There's a problem with the arguments passed to the $Config constructor
throw error;
}
// There's a problem with the user's data (could be from manual editing or a script update)
if (!window.confirm(`${error.message}\n\nWould you like to erase your data?`)) {
return;
}
$config.reset();
}
// Apply the user's config
function useConfig() {
const {a, b, c} = $config.get().data;
// Use the config...
}
useConfig();
// Set up config editing
const button = document.createElement('button');
button.addEventListener('click', async () => {
await $config.edit();
useConfig();
});
Constructor arguments (* = optional):
QingJ © 2025
镜像随时可能失效,请加Q群300939539或关注我们的公众号极客氢云获取最新地址