This repository was archived by the owner on Feb 13, 2023. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 38
Making a userscript
Mixaz edited this page Mar 3, 2021
·
4 revisions
Userscripts are loaded with Node's require() from a renderer process.
-
nameString (optional) - Name of the script. -
descriptionString (optional) - Description of the script. -
versionString (optional) - Version of the script. -
AuthorString (optional) - Name of the author. -
locationsString[] (optional)- Types of windows the script should run. Valid string values are'all' | 'docs' | 'game' | 'social' | 'viewer' | 'editor'. Defaults to['all']. -
platformsString[] (optional) - Platforms the script should run on. Seeprocess.platformfor valid values.['all']is also accepted. Defaults to['all']. -
settingsObject (optional) - Additional setting entries. Settings will be added under "idkr" tab.-
[key: String]Object - Setting entry.-
nameString - Name of the setting. -
idString - ID of the setting. -
catString - Category of the setting entry. Adjacent settings with the same category will be grouped. -
typeString - Type of setting. Valid values are:-
checkbox- Toggle switch.valwill be Boolean. -
slider- Slider. Requiresminandmaxproperties.valwill be String. -
select- Drop-down selector. Requiresoptionsproperty.valwill be String. -
text- Text input.valwill be String.
-
-
val- Default value of the setting. -
minNumber (optional) - Minimum value for slider. Required iftypeisslider. -
maxNumber (optional) - Maximum value for slider. Required iftypeisslider. -
stepNumber (optional) - Granularity that the slider value must adhere to. -
optionsObject (optional) - Options for drop-down selector type. Required iftypeisselect.-
[key: String]String - Option entry. Key will be used asval, and value will be visible to users as a label of the option.
-
-
placeholderString (optional) - Placeholder text for text input type. -
htmlFunction - Function that returnsDOMString. You can set this tofunction () { return window.clientUtil.genCSettingsHTML(this) }for a basic behavior. -
setFunction (optional) - Function that gets called when new value is set. Also called when initiating the setting.-
value- New value. -
initBoolean - Indicates if this function is called when initiating the settings.
-
-
needsRestartBoolean (optional) - Set totrueif the settings need the page to be refreshed or the client to be restarted. -
infoString (optional) - Tooltip text that appears when the user hovers over the setting entry.
-
-
-
runFunction (optional) - Function that gets called if loaded with matchinglocationsandplatforms. You should write your main code here.-
configStore - electron-store instance object. Can be used to get and set option values.
-
You can join idkr Discord to find userscripts in the #userscripts channel.
https://github.com/Mixaz017/idkr/blob/master/app/exports/settings.js