A config library powered by webext-pref.
当前为
此脚本不应直接安装。它是供其他脚本使用的外部库,要使用该库请加入元指令 // @require https://update.cn-greasyfork.org/scripts/371339/621769/GM_webextPref.js
Use webext-pref in userscripts. This library includes createPref, createView, a storage object implemented with GM API, and a dialog service.
https://rawgit.com/eight04/GM_webextPref/master/demo/demo.html
const pref = GM_webextPref({
default: {
useImage: true,
excludeElements: "code, .highlight"
},
body: [
{
key: "useImage",
type: "checkbox",
label: "Use image"
},
{
key: "excludeElements",
type: "text",
label: "Exclude elements"
}
]
});
pref.ready()
.then(() => {
console.log(pref.get("useImage")); // true
});
This module exports a single function.
const pref = GM_webextPref({
default: Object,
body: Array,
translate?: Object,
getNewScope?: () => newScopeName: String
});
Create a pref object. pref inherits all methods from the pref object returned by createPref.
default would be sent to createPref; body, translate, and getNewScope would be sent to createView.
If GM_registerMenuCommand exists, the function would register a menu command like:
GM_registerMenuCommand(GM_info.script.name + " - Configure", pref.openDialog);
So that users can open the config dialog through monkey menu.
pref.openDialog();
Open the config dialog.
0.1.2 (Aug 19, 2018)
0.1.1 (Aug 19, 2018)
0.1.0 (Aug 19, 2018)