Greasy Fork

Greasy Fork is available in English.

ImmediateGUI

An IMGUI inspired GUI Framework for javascript thats designed to be as simple to use as IMGUI.

当前为 2025-05-18 提交的版本,查看 最新版本

此脚本不应直接安装。它是供其他脚本使用的外部库,要使用该库请加入元指令 // @require https://update.greasyfork.icu/scripts/535798/1591214/ImmediateGUI.js

作者
TetteDev
版本
0.0.1.20250518080043
创建于
2025-05-12
更新于
2025-05-18
大小
45.5 KB
许可证
暂无

About ImmediateGUI

An IMGUI inspired GUI Framework for javascript thats designed to be as simple to use as IMGUI. Its actively developed, which means stuff might change and bugs (most definitely) will occur when using this

Supports most of the default controls one could need, can drag the gui around with the mouse, toggle between light/dark mode etc.

For how to use it, check the example code down below (and look at the code of the library)

Example Images (and pseudo code how they were made)

Example 1, Dark Mode

Example 1, Light Mode

const gui = new ImmediateGUI({
    theme: 'dark', /* or 'light' depending on what you want */
    position: 'right', /* what side of the screen the form should display at by default */
    width: 400, 
    draggable: true, /* true by default, so this can be omitted */
});

gui.Header("Image Downloader", 5);
gui.Separator();

gui.BeginSection("Filename Options");
    const cbPreserveOriginalFilename = gui.Checkbox("Preserve original filename", false);
    const txtNamePrefix = gui.Textbox("Filename Prefix");
    const txtNameSuffix = gui.Textbox("Filename Suffix");
gui.EndSection();

gui.BeginSection("Advanced Options");
    const cbHumanize = gui.Checkbox("Humanize Downloads", true);
    const cbRequestlessDownload = gui.Checkbox("Attempt a requestless download for images", true);
    gui.BeginIndentation();
        const cbRequestLessParallel = gui.Checkbox("Use parallelism for requestless downloads", cbRequestlessDownload.checked);
    gui.EndIndentation();

    gui.BeginIndentation(2); // Custom indentation levels supported, this is 2 levels deep which is calculated as 2 * this.indentationSize (which defaults to 10 pixels)
        const inputParallelChunkCount = gui.NumberInput("Parallel Chunk Count", 3, 1, (25 / 3) + 1);
    gui.EndIndentation();
    const cbRequestLessParallelModeCompability = gui.Checkbox("Parallel Compability Mode", true);
    cbRequestLessParallelModeCompability.disabled = true;
    gui.BeginIndentation();
        const cbPreferWebpIfSupported = gui.Checkbox("Prefer WEBP images (if supported)", true);
    gui.EndIndentation();
gui.EndSection();

gui.BeginSection();
    const numFilenameIndexStart = gui.NumberInput("Start filename index at", -1, -1, 9999);
    gui.Separator();

    const inpStart = gui.NumberInput("Download Start Range", 1, 1, 25);
    const inpEnd = gui.NumberInput("Download End Range", 25, 1, 25);

    const btnDownload = gui.Button(`Download 25 Images`, async () => { 
        // Your button click event here
    });
    const btnDownloadRange = gui.Button(`Download Range (25 Images)`, async () => { 
        // Your button click event here
    }); 
gui.EndSection();
gui.BeginIndentation();
    gui.Checkbox("Play sound when downloads are done", true);
gui.EndIndentation();

// This shows the GUI to the user
gui.Show();

Supported Controls in ImmediateGUI Framework

Container Controls

  • Sections - Create collapsible content areas with headers
  • Indentation - Hierarchical layout with customizable levels

Basic UI Elements

  • Button - Standard clickable button with callback support
  • Textbox - Single-line text input field
  • TextArea - Multi-line text input with customizable rows
  • Label - Text display element
  • Header - Section titles with customizable heading levels (h1-h6)
  • Separator - Horizontal dividing line

Form Inputs

  • Checkbox - Boolean toggle with label
  • Radiobox - Group of radio boxes
  • Dropdown - Selection from predefined options
  • Slider - Range input with visual value display
  • NumberInput - Numeric input with min/max constraints
  • DatePicker - Calendar date selection
  • ColorPicker - Visual color selection tool
  • ProgressBar - Visual progress indicator with percentage

Layout Utilities

  • LabelControlPair - Combines a label with any control
  • Section Management - Organized grouping of controls

Dialog Systems

  • Modal - Customizable popup dialogs with various button options

Appearance

  • Themes - Light and dark mode support
  • Draggable Interface - Repositionable UI panel

General Functions

  • Show/Hide/Remove - Control panel visibility
  • GetControlContainer - Access to the main container element
  • GetControls - Retrieve all control elements