Updated references and added LICENSE.

This commit is contained in:
Keanu Timmermans 2021-03-05 17:25:16 +01:00
parent 0e9d900311
commit e0c8a39d67
Signed by: keanucode
GPG key ID: A7431C0D513CA93B
3 changed files with 71 additions and 28 deletions

21
LICENSE Normal file
View file

@ -0,0 +1,21 @@
MIT License
Copyright (c) 2021 NovaGM Members
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.

View file

@ -2,7 +2,7 @@
User-made documentation for [GooseMod](https://goosemod.com). User-made documentation for [GooseMod](https://goosemod.com).
[View the documentation](https://keanugoosemod.github.io/Documentation). [View the documentation](https://novagm.github.io/Documentation).
## Adding content ## Adding content
@ -15,38 +15,44 @@ To add a page, add a MarkDown `.md` file to one of the categories
You can also add your own category by adding a directory with a `README.md` You can also add your own category by adding a directory with a `README.md`
file inside, that describes what your category is about and lists the file inside, that describes what your category is about and lists the
category's files by adding this line: category's files by adding this line:
``` ```
{% include list.liquid all=true %} {% include list.liquid all=true %}
``` ```
By default Jekyll will pull the first title as the page's title, but that can By default Jekyll will pull the first title as the page's title, but that can
be overwritten with front matter at the top of your page: be overwritten with front matter at the top of your page:
```yaml ```yaml
--- ---
title: Your title title: Your title
# other front matter definitions # other front matter definitions
--- ---
``` ```
To sort a category's pages, add a `sort` property to the pages' front matter To sort a category's pages, add a `sort` property to the pages' front matter
section: section:
```yaml ```yaml
--- ---
# other front matter definitions # other front matter definitions
sort: <number> sort: <number>
--- ---
``` ```
## Updating the documentation website ## Updating the documentation website
Before pushing your edits to the documentation, you may want to see what they Before pushing your edits to the documentation, you may want to see what they
look like. To do so, you need to: look like. To do so, you need to:
- have a local [Ruby](https://www.ruby-lang.org) environment - have a local [Ruby](https://www.ruby-lang.org) environment
- install the `bundler` and `jekyll` gems - install the `bundler` and `jekyll` gems
`gem install bundler jekyll` `gem install bundler jekyll`
- install this project's specific requirements: - install this project's specific requirements:
`bundle install` (or `bundle update` if you already built it before) `bundle install` (or `bundle update` if you already built it before)
- run Jekyll: - run Jekyll:
`bundle exec jekyll serve` `bundle exec jekyll serve`
- open the address that is returned on the terminal in your browser - open the address that is returned on the terminal in your browser
(usually `http://127.0.0.1:4000/`) (usually `http://127.0.0.1:4000/`)
@ -63,4 +69,5 @@ repo.
- GH Pages: [Github Pages docs](https://docs.github.com/en/github/working-with-github-pages/setting-up-a-github-pages-site-with-jekyll) - GH Pages: [Github Pages docs](https://docs.github.com/en/github/working-with-github-pages/setting-up-a-github-pages-site-with-jekyll)
- Generator: [Jekyll docs](https://jekyllrb.com/docs/) - Generator: [Jekyll docs](https://jekyllrb.com/docs/)
- Theme: [jekyll-rtd-theme](https://jekyll-rtd-theme.rundocs.io/) and - Theme: [jekyll-rtd-theme](https://jekyll-rtd-theme.rundocs.io/) and
[rundocs.io](https://rundocs.io/) [rundocs.io](https://rundocs.io/)

View file

@ -11,7 +11,6 @@ The GooseMod settings interface can be accessed in your modules by importing
`@goosemod/settings`. You can extend Discord's settings with more categories, `@goosemod/settings`. You can extend Discord's settings with more categories,
pages, and other elements by importing the right procedures. pages, and other elements by importing the right procedures.
## Adding a new settings page ## Adding a new settings page
When GooseMod loads all modules, it first creates a new category called When GooseMod loads all modules, it first creates a new category called
@ -26,14 +25,16 @@ Do remember to remove the settings pages you add when your module gets disabled
though. though.
First import `createItem`: First import `createItem`:
```js ```js
import { createItem } from '@goosemod/settings'; import { createItem } from '@goosemod/settings';
``` ```
Then in your module's `onLoadingFinished`, call to `createItem` like this: Then in your module's `onLoadingFinished`, call to `createItem` like this:
```js ```js
createItem("Page name", [ createItem('Page name', [
"version", 'version',
// field objects // field objects
]); ]);
``` ```
@ -47,15 +48,16 @@ restore the state of Discord prior to when it was enabled.
removing one is even easier. removing one is even easier.
First add `removeItem` to your imports from `@goosemod/settings`: First add `removeItem` to your imports from `@goosemod/settings`:
```js ```js
import { createItem, removeItem } from '@goosemod/settings'; import { createItem, removeItem } from '@goosemod/settings';
``` ```
Then in your module's `onRemove`, call to `removeItem` like so: Then in your module's `onRemove`, call to `removeItem` like so:
```js
removeItem("Page name");
```
```js
removeItem('Page name');
```
## Types of settings fields ## Types of settings fields
@ -65,6 +67,7 @@ a `text` property defining the field's text.
Most fields also have a `subtext` property to add additional information if Most fields also have a `subtext` property to add additional information if
needed, for example: precising the default values of your settings. The way needed, for example: precising the default values of your settings. The way
you would define a fields subtext is like so: you would define a fields subtext is like so:
```js ```js
{ {
// field definition elements // field definition elements
@ -77,19 +80,20 @@ you would define a fields subtext is like so:
A simple divider to separate your fields. Most other fields already add a A simple divider to separate your fields. Most other fields already add a
divider, so needing one is a more specific use case. They are defined like so: divider, so needing one is a more specific use case. They are defined like so:
```js ```js
{ {
type: "divider" type: 'divider';
} }
``` ```
```note ```note
Divider fields **do not** use the `subtext` property. However they have a Divider fields **do not** use the `subtext` property. However they have a
`text` property. `text` property.
``` ```
```warning ```warning
The divider field's `text` property has not yet been experimented with The divider field's `text` property has not yet been experimented with
and documented. and documented.
``` ```
@ -97,6 +101,7 @@ and documented.
Header fields let you make categories in your settings page, they are defined Header fields let you make categories in your settings page, they are defined
like so: like so:
```js ```js
{ {
type: "header", type: "header",
@ -111,6 +116,7 @@ Header fields do not use the `subtext` property.
### Text field ### Text field
Text fields let you write text without user controls, they are defined like so: Text fields let you write text without user controls, they are defined like so:
```js ```js
{ {
type: "text", type: "text",
@ -122,6 +128,7 @@ Text fields let you write text without user controls, they are defined like so:
Button fields let you add simple buttons to launch actions, they are defined Button fields let you add simple buttons to launch actions, they are defined
like so: like so:
```js ```js
{ {
type: "button", type: "button",
@ -137,9 +144,9 @@ Buttons do not use the `subtext` property.
``` ```
```note ```note
Button fields are pretty bare and only simple buttons. If you use them, you may Button fields are pretty bare and only simple buttons. If you use them, you may
want to add a [text field](#text-field) before to explain their function and a want to add a [text field](#text-field) before to explain their function and a
[divider field](#divider-field) afterwards to properly separate them from the [divider field](#divider-field) afterwards to properly separate them from the
following fields. following fields.
``` ```
@ -151,7 +158,8 @@ Given that button fields are so bare, I'd recommend using
#### Text-Button field #### Text-Button field
A regular [text field](#text-field) with a smaller [button](#button-field). A regular [text field](#text-field) with a smaller [button](#button-field).
They are defined like so: They are defined like so:
```js ```js
{ {
type: "text-and-button", type: "text-and-button",
@ -164,7 +172,7 @@ They are defined like so:
``` ```
```note ```note
Unlike [button fields](#button-field), text-button fields include a Unlike [button fields](#button-field), text-button fields include a
[divider field](#divider-field), so you don't need to add one after. [divider field](#divider-field), so you don't need to add one after.
``` ```
@ -172,6 +180,7 @@ Unlike [button fields](#button-field), text-button fields include a
Exactly like the [text-button field](#text-button-field), but the button has Exactly like the [text-button field](#text-button-field), but the button has
the danger styling (red). They are defined like so: the danger styling (red). They are defined like so:
```js ```js
{ {
type: "text-and-danger-button", type: "text-and-danger-button",
@ -184,7 +193,7 @@ the danger styling (red). They are defined like so:
``` ```
```note ```note
Due to the design language surrounding them, you should only use these if the Due to the design language surrounding them, you should only use these if the
action could have impactful consequences. action could have impactful consequences.
``` ```
@ -192,6 +201,7 @@ action could have impactful consequences.
Toggle fields let you make on/off switches for your basic settings, they are Toggle fields let you make on/off switches for your basic settings, they are
defined like so: defined like so:
```js ```js
{ {
type: "toggle", type: "toggle",
@ -211,6 +221,7 @@ defined like so:
A [toggle field](#toggle-field) with a small [button](#button-field), or a A [toggle field](#toggle-field) with a small [button](#button-field), or a
[text-button field](#text-button-field) with a [toggle switch](#toggle-field). [text-button field](#text-button-field) with a [toggle switch](#toggle-field).
They are defined like so: They are defined like so:
```js ```js
{ {
type: "toggle-text-button", type: "toggle-text-button",
@ -229,10 +240,11 @@ They are defined like so:
} }
``` ```
#### Toggle-Text-Button-Danger #### Toggle-Text-Button-Danger
Exactly like the [toggle-text-button field](#toggle-text-button-field), but Exactly like the [toggle-text-button field](#toggle-text-button-field), but
the button has the danger styling (red). They are defined like so: the button has the danger styling (red). They are defined like so:
```js ```js
{ {
type: "toggle-text-danger-button", type: "toggle-text-danger-button",
@ -252,7 +264,7 @@ the button has the danger styling (red). They are defined like so:
``` ```
```note ```note
Due to the design language surrounding them, you should only use these if the Due to the design language surrounding them, you should only use these if the
action could have impactful consequences. action could have impactful consequences.
``` ```
@ -260,6 +272,7 @@ action could have impactful consequences.
Colour fields let you make colour pickers for your settings, they are defined Colour fields let you make colour pickers for your settings, they are defined
like so: like so:
```js ```js
{ {
type: "text-and-color", type: "text-and-color",
@ -281,25 +294,26 @@ The colour picker doesn't support alpha channel (opacity) yet.
### Card field ### Card field
```warning ```warning
Not yet experimented with or documented. Not yet experimented with or documented.
``` ```
### Search field ### Search field
```warning ```warning
Not yet experimented with or documented. Not yet experimented with or documented.
``` ```
### Sidebar field ### Sidebar field
```warning ```warning
Not yet experimented with or documented. Not yet experimented with or documented.
``` ```
### Custom field ### Custom field
Custom fields only support a single property: `element`. They are defined like Custom fields only support a single property: `element`. They are defined like
so: so:
```js ```js
{ {
type: "custom", type: "custom",
@ -313,6 +327,7 @@ so:
``` ```
```note ```note
Custom fields can be used to make any kind of field that is not built into Custom fields can be used to make any kind of field that is not built into
GooseMod. For example, [here is a procedure building a text input field](https://github.com/KeanuGooseMod/Modules/blob/master/settings-experiment/custom-settings.js#L1-L57). GooseMod. For example, [here is a procedure building a text input field](https://github.com/NovaGM/Modules/blob/master/settings-experiment/custom-settings.js#L1-L57).
``` ```