您需要先安装一个扩展,例如 篡改猴、Greasemonkey 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 Userscripts ,之后才能安装此脚本。
您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey,才能安装此脚本。
您需要先安装用户脚本管理器扩展后才能安装此脚本。
Greasy Fork is available in English.
A script for interfacing with my Key-Based Config UI.
当前为
此脚本不应直接安装。它是供其他脚本使用的外部库,要使用该库请加入元指令 // @require https://update.greasyfork.icu/scripts/419978/889561/Key-Based%20Config.js
// ==UserScript== // @name Key-Based Config // @author Callum Latham <[email protected]> (https://github.com/ctl2/key-based-config) // @exclude * // @description A script for interfacing with my Key-Based Config UI. // ==/UserScript== let iframeExists = false; function openKbc(title, metaTree, valueForest, changeCallback, closeCallback) { if (iframeExists) throw new Error("A key-based-config iFrame already exists."); if (typeof changeCallback !== "function" && typeof closeCallback !== "function") throw new Error("A callback function is required"); iframeExists = true; const kbcSrc = "http://ctl-bucket-1.s3-website.eu-west-2.amazonaws.com/key-based-config"; let iframe = document.createElement("iframe"); iframe.src = kbcSrc; iframe.style.position = "fixed"; iframe.style.height = "100vh"; iframe.style.width = "100vw"; window.addEventListener("message", (message) => { switch (message.data.event) { case "open": iframe.contentWindow.postMessage({ title: title, metaTree: metaTree, valueForest: valueForest }, "*"); break; case "change": if (typeof changeCallback === "function") changeCallback(message.data.valueForest); break; case "close": iframeExists = false; iframe.remove(); if (typeof closeCallback === "function") closeCallback(message.data.valueForest); break; default: console.error("unrecognised message type '" + message.data.type + "'"); } }); }