Docs

Modules

enuff/v1

Enuff library code, v1.

getPost

Script for checking to see if there is additional content that related to a specific step of the process, and, if so, fetching it from the server and rendering it out as modal content.

enuff/v1

Enuff library code, v1.

enuff/v1.toggleVisibility(el)

Hide or show an element.

Kind: static method of enuff/v1

Param Type Description
el Element Element to show or hide

enuff/v1.hide(el)

Hide an element

Kind: static method of enuff/v1

Param Type Description
el Element Element to hide

enuff/v1.show(el)

Show an element

Kind: static method of enuff/v1

Param Type Description
el Element Element to show

enuff/v1.makeDo(selector, code) ⇒ Element

Make an element do something when clicked.

Kind: static method of enuff/v1
Returns: Element - Targeted element

Param Type Description
selector string Selector for target element
code string Code to execute on click

enuff/v1.moveElement(element, deestination, [position])

Move an element to a destination.

Kind: static method of enuff/v1

Param Type Default Description
element Element The element to move
deestination Element The target destination
[position] string "beforeend" Optional position indicator

enuff/v1.remove(el)

Remove an element or a list of elements from the document.

Kind: static method of enuff/v1

Param Type Description
el Element | NodeList A single element or a NodeList of elements to remove

enuff/v1.removeAllOf(els)

Remove a set of elements.

Kind: static method of enuff/v1

Param Type Description
els NodeList NodeList of elements to remove

enuff/v1.removeElement(el)

Remove a single element.

Kind: static method of enuff/v1

Param Type Description
el Element Element to remove

enuff/v1.makeElementFromString(input) ⇒ Element

Take a template literal or a string and convert it into an element.

Kind: static method of enuff/v1
Returns: Element - Element

Param Type Description
input string Template literal to convert to an element

enuff/v1.getFromPage(el) ⇒ Element

querySelector convenience function.

Kind: static method of enuff/v1
Returns: Element - Element

Param Type Description
el string Element selector

enuff/v1.getAllFromPage(el) ⇒ NodeList

querySelectorAll convenience function.

Kind: static method of enuff/v1
Returns: NodeList - NodeList

Param Type Description
el string Element selector

enuff/v1.log(content)

Console log conenience function. Sends strings via .log and objects via .dir.

Kind: static method of enuff/v1

Param Type Description
content * Stuff to send to the console

enuff/v1.group(label, code, collapsed)

console.group convenience function.

Kind: static method of enuff/v1

Param Type Description
label string Label for the group
code string Code to execute
collapsed boolean Whether to initially collapse the group.

enuff/v1.addItemFromTeplate(template, destination, updates) ⇒ Element

Take the content of a template and add it to the destination. Accepts nodes or selectors for template and destination. The updates parameter is an object matching selectors to the content that should populate the selected element.

Kind: static method of enuff/v1
Returns: Element - The appended element.

Param Type
template string | Element
destination string | Element
updates Object

enuff/v1.getJson(path, options) ⇒ Object | array

Get a JSON response via a POST request to a specified URL/path.

Kind: static method of enuff/v1
Returns: Object | array - Response data as object or array

Param Type Description
path string Endpoint to request
options Object Key-value pairs to be stringified as json into the body parameter of the request.

enuff/v1~requestOptions(opts) ⇒ Object

Create a POST method request options object for a fetch request.

Kind: inner method of enuff/v1
Returns: Object - Fetch request options object.

Param Type Description
opts Object Options to stringify as JSON data into the body parameter of a POST request.

getPost

Script for checking to see if there is additional content that related to a specific step of the process, and, if so, fetching it from the server and rendering it out as modal content.

getPost.init()

Runs the script.

Kind: static method of getPost

getPost~getPost() ⇒ Boolean | Object

Get post text (HTML) from the server.

Kind: inner method of getPost
Returns: Boolean | Object - Post object if present, otherwise false

getPost~cloneTemplate(selector) ⇒ Node

Clone the content of a template element.

Kind: inner method of getPost
Returns: Node - Clone of template content

Param Type Description
selector string Selector for template element.

getPost~createModal(post)

Create dialog modal element containing post content.

Kind: inner method of getPost

Param Type Description
post Object Post content

getPost~parsePostContent(text) ⇒ Element

Initialize the DOM parser, parse the text, and return the contents.

Kind: inner method of getPost
Returns: Element - HTML body element

Param Type Description
text string String content to convert to HTML.

getPost~getPostButton()

Add a "get post" button.

Kind: inner method of getPost

getPost~checkPathFor(dir) ⇒ Boolean

Check current path for a specific path component.

Kind: inner method of getPost
Returns: Boolean - Boolean

Param Type Description
dir string Path component to check for