Elegant Config

Modern configuration modal with all native field types & custom field extensibility

สคริปต์นี้ไม่ควรถูกติดตั้งโดยตรง มันเป็นคลังสำหรับสคริปต์อื่น ๆ เพื่อบรรจุด้วยคำสั่งเมทา // @require https://update.greasyfork.org/scripts/592069/1907152/Elegant%20Config.js

คุณจะต้องติดตั้งส่วนขยาย เช่น Tampermonkey, Greasemonkey หรือ Violentmonkey เพื่อติดตั้งสคริปต์นี้

You will need to install an extension such as Tampermonkey or Violentmonkey to install this script.

คุณจะต้องติดตั้งส่วนขยาย เช่น Tampermonkey หรือ Violentmonkey เพื่อติดตั้งสคริปต์นี้

You will need to install an extension such as Tampermonkey or Userscripts to install this script.

You will need to install an extension such as Tampermonkey to install this script.

You will need to install a user script manager extension to install this script.

(I already have a user script manager, let me install it!)

You will need to install an extension such as Stylus to install this style.

You will need to install an extension such as Stylus to install this style.

You will need to install an extension such as Stylus to install this style.

You will need to install a user style manager extension to install this style.

You will need to install a user style manager extension to install this style.

You will need to install a user style manager extension to install this style.

(I already have a user style manager, let me install it!)

ผู้เขียน
Paesss
เวอร์ชัน
1.0.0
สร้างเมื่อ
19-08-2026
อัปเดตเมื่อ
19-08-2026
Size
233 กิโลไบต์
สัญญาอนุญาต
ไม่มี


⚠️ Remember to grant the following directives:
// @grant GM_getValue
// @grant GM_setValue
// @grant GM_addElement


// --- Implementation Example ---
// ==UserScript==
// @name New Userscript
// @version 0.1.0
// @author You
// @match https://*/*
// @grant GM_getValue
// @grant GM_setValue
// @grant GM_addElement
// @noframes
// ==/UserScript==

(function () {
  "use strict";

  // --- Implementation Example ---
  const languages = {
    de: { name: "German", flag: "DE" },
    en: { name: "English", flag: "GB" },
    fr: { name: "French", flag: "FR" },
  };

  function getFlag(code) {
    if (!code || code === "UN") return "🌐";
    return code
      .toUpperCase()
      .split("")
      .map((char) => String.fromCodePoint(0x1f1e6 + char.charCodeAt(0) - 65))
      .join("");
  }

  const languageOptions = Object.entries(languages).map(([code, lang]) => ({
    value: code,
    label: `${getFlag(lang.flag)} ${lang.name}`,
  }));

  const config = new ScriptConfig({
    title: "Script settings",
    storageKey: "translateOptions",
    theme: {
      accent: "#1d9bf0",
      hover: "#1a8cd8",
    },
    fields: {
      targetLanguage: {
        type: "select",
        label: "Target language",
        default: "en",
        options: languageOptions,
        searchable: true,
      },
      autoTranslate: {
        type: "boolean",
        label: "Autotranslate",
        default: true,
      },
      ignoredLanguages: {
        type: "multiselect",
        label: "Ignored languages",
        default: [],
        options: languageOptions,
      },
      translationService: {
        type: "select",
        label: "Translation service",
        default: "google",
        searchable: true,
        options: [
          { value: "google", label: "Google" },
          { value: "deepl", label: "DeepL" },
          { value: "deeplFree", label: "DeepL Free" },
        ],
      },
      translationDelay: {
        type: "range",
        label: "Translation delay",
        default: 50,
        min: 0,
        max: 100,
        step: 5,
      },
    },
    onSave: (newSettings) => {
      console.log("Settings updated:", newSettings);
    },
  });

  config.open();
})();