你正在訪問的內容是外部程式的映像位址,僅用於使用者加速訪問,本站無法保證其可靠性。當前的連結位址(單點即可複製)為 https://greasyfork.org.cn/zh-CN/scripts/475041-furaffinity-custom-settings,源站連結 點此以跳轉。
Helper Script to create Custom settings on Furaffinitiy
当前为
此脚本不应直接安装。它是供其他脚本使用的外部库,要使用该库请加入元指令 // @require https://update.greasyfork.org.cn/scripts/475041/1248839/Furaffinity-Custom-Settings.js
Helper Script to create Custom settings on Furaffinitiy
@require this scriptjavascript
CustomSettings.Name = "Extension Settings";
javascript
CustomSettings.Provider = "Midori's Script Settings";
javascript
CustomSettings.HeaderName = "My Script Settings";
javascript
const setting = new Setting("Setting Name", "Setting Description", SettingType, "Type Description", DefaultValue, Action);
javascript
CustomSettings.loadSettings();
The Setting class contains following Properties:
id - Can only be set once. Defines the Setting elements html id. Is set to setting Name, if not set manually.name - Name of the Setting. (Also defines Settings Header name)description - Description of the Setting.type - Type of the Setting. (See SettingTypes for more info)typeDescription - Description of the Setting element itself. (Doesn't apply on SettingTypes.Number)defaultValue - Default value for the Setting. (Is ignored on SettingTypes.Action)action - Action that is executed when the Setting changes. (See Action for more info)value - Current value of the Setting.SettingTypes can have the following values:
SettingTypes.Number - A TextField that only accepts Numbers (Type Description doesn't aplly here)SettingTypes.Boolean - A Checkbox with a descriptionSettingTypes.Action - A Button with a certain ActionThe Action Parameter defines a Function that is executed when the Setting changed. It receives the Settings Element as a Parameter. Example:
new Setting("Name", "Description", SettingTypes.Boolean, "Checkbox Description", false, (target) => {
console.log(target.checked); // In this case target is a Checkbox
});
Here every time the Checkbox is clicked the program prints out wether it is checked or not.