new Button(name, text, parent, bgColor, txtColor, hazard)
- Source:
Constructs a new Button
Parameters:
Name | Type | Description |
---|---|---|
name |
String | Button shortname |
text |
String | Button text |
parent |
HTMLElement | HTML Parent of Button |
bgColor |
String | Background Color |
txtColor |
String | Text Color |
hazard |
Boolean | Is the action the Button triggers hazardous? |
Methods
(static) setModalTemplate(template)
- Source:
Sets the confirmation modal template to copy
Parameters:
Name | Type | Description |
---|---|---|
template |
HTMLElement | The modal to set as the template |
(static) toggleConfirmationModal(modal)
- Source:
Toggles showing/hiding a modal
Parameters:
Name | Type | Description |
---|---|---|
modal |
HTMLElement | The modal to toggle |
activate()
- Source:
Sets the button to the active state
colorize()
- Source:
Recolors the button to signal human input required
confirmActive()
- Source:
Displays a confirmation window before transitioning to state
createNewElement()
- Source:
Creates the actual DOM Element of the button
deactivate()
- Source:
Sets the button to the inactive state
greyOut()
- Source:
Greys out the background of the button to signal no human input
onClick(fcn)
- Source:
Sets the action that this button will trigger on click,hazardous
if it is hazardus it will trigger confirmation
Parameters:
Name | Type | Description |
---|---|---|
fcn |
function | The action that this button will trigger on click |
setParent(parent)
- Source:
Sets the HTML Parent of the button
Parameters:
Name | Type | Description |
---|---|---|
parent |
HTMLElement | The HTML parent of the button |
setText(text)
- Source:
Sets the button text
Parameters:
Name | Type | Description |
---|---|---|
text |
String | The button text |
setTextColor(color)
- Source:
Sets the text color of the button
Parameters:
Name | Type | Description |
---|---|---|
color |
String | Text Color |