Furaffinity-Custom-Settings

Helper Script to create Custom settings on Furaffinitiy

当前为 2023-09-12 提交的版本,查看 最新版本

此脚本不应直接安装。它是供其他脚本使用的外部库,要使用该库请加入元指令 // @require https://updategf.qytechs.cn/scripts/475041/1249083/Furaffinity-Custom-Settings.js

您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey 篡改猴Greasemonkey 油猴子Violentmonkey 暴力猴,才能安装此脚本。

您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey 篡改猴,才能安装此脚本。

您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey 篡改猴Violentmonkey 暴力猴,才能安装此脚本。

您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey 篡改猴Userscripts ,才能安装此脚本。

您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey 篡改猴,才能安装此脚本。

您需要先安装一款用户脚本管理器扩展后才能安装此脚本。

(我已经安装了用户脚本管理器,让我安装!)

您需要先安装一款用户样式管理器扩展,比如 Stylus,才能安装此样式。

您需要先安装一款用户样式管理器扩展,比如 Stylus,才能安装此样式。

您需要先安装一款用户样式管理器扩展,比如 Stylus,才能安装此样式。

您需要先安装一款用户样式管理器扩展后才能安装此样式。

您需要先安装一款用户样式管理器扩展后才能安装此样式。

您需要先安装一款用户样式管理器扩展后才能安装此样式。

(我已经安装了用户样式管理器,让我安装!)

作者
Midori Dragon
版本
3.3.0
创建于
2023-09-11
更新于
2023-09-12
大小
12.2 KB
许可证
MIT

Furaffinity Custom Settings

Helper Script to create Custom settings on Furaffinitiy

How to use

  • @require this script
  • Optional: Change Extension Settings Header Name at any Point in your Code: javascript CustomSettings.Name = "Extension Settings";
  • Optional: Change Extension Settings Name at any Point in your Code: javascript CustomSettings.Provider = "Midori's Script Settings";
  • Optional: Change the Settings Header Name: javascript CustomSettings.HeaderName = "My Script Settings";
  • Create a new Setting: javascript const setting = new Setting("Setting Name", "Setting Description", SettingType, "Type Description", DefaultValue, Action);
    See Setting for more info
  • Trigger when settings should be loaded: javascript CustomSettings.loadSettings();

Features

  • Create new Settings and easily access Settings change
  • Have different Setting Types
    • Number (TextField that only allowes Numbers)
    • Text (TextField that allows any Character)
    • Boolean (Checkbox with a description)
    • Action (Button with a description)
  • Change Settings Page Name and Header Name
  • Have multiple different Setting Pages

Documentation

Setting

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

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 description
  • SettingTypes.Action - A Button with a certain Action

Action

The 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.