sizzlemctwizzle / GM_config

A lightweight, reusable, cross-browser graphical settings framework for inclusion in user scripts.
https://github.com/sizzlemctwizzle/GM_config/wiki
GNU Lesser General Public License v3.0
205 stars 48 forks source link

Dynamically creating fields #105

Closed chlorophylls closed 1 year ago

chlorophylls commented 2 years ago

I've scoured the wiki and can't seem to find documentation or an example on how to programmatically create a new field.

For instance, clicking a button to create a new text field, with certain default text, in a specific section such that it shows up underneath the other already-created fields in the config panel. Have I missed something?

sizzlemctwizzle commented 2 years ago

I actually ran into this use case myself and had to use a hack to get it working. This functionality will be included.

sizzlemctwizzle commented 1 year ago

How I'm going to implement this: GM_config.init will append new fields to the frame if open. ~Add an onload event to fields so you can move these new fields to where you want them in the frame.~ Pass onInit callback to init along with the new fields to access them in the frame.

sizzlemctwizzle commented 1 year ago

Does not create new sections. Appends all new fields to the last section in the open frame. Use close and then open to do a full refresh of the frame.

airtonix commented 9 months ago

@sizzlemctwizzle can we get an example of what you're talking about?