Module: elements_js

Methods

(inner) btnWaiting(btn, waiting) → {void}

Adds a waiting animation to a button
Parameters:
Name Type Description
btn Node id of the button
waiting boolean true = add animation, false = remove animation
Source:
Returns:
Type
void

(inner) btnWaitingId(id, waiting) → {void}

Adds a waiting animation to a button
Parameters:
Name Type Description
id string id of the button
waiting boolean true = add animation, false = remove animation
Source:
Returns:
Type
void

(inner) elClear(el) → {void}

Clears the element
Parameters:
Name Type Description
el Element | ChildNode element to clear
Source:
Returns:
Type
void

(inner) elClearId(id) → {void}

Clears the element with the given id
Parameters:
Name Type Description
id string element id to clear
Source:
Returns:
Type
void

(inner) elCreateChkBtn(value) → {HTMLElement}

Creates a Check Button
Parameters:
Name Type Description
value boolean Checked?
Source:
Returns:
created dom node
Type
HTMLElement

(inner) elCreateEmpty(tagName, attributes) → {HTMLElement}

Creates an empty html element
Parameters:
Name Type Description
tagName string name of the tag
attributes object tag attributes
Source:
Returns:
created dom node
Type
HTMLElement

(inner) elCreateNode(tagName, attributes, node) → {HTMLElement}

Creates a html element with a child node
Parameters:
Name Type Description
tagName string name of the tag
attributes object tag attributes
node Element | Node node to add as child
Source:
Returns:
created dom node
Type
HTMLElement

(inner) elCreateNodes(tagName, attributes, nodes) → {HTMLElement}

Creates a html element with child nodes
Parameters:
Name Type Description
tagName string name of the tag
attributes object tag attributes
nodes object array of nodes to add as childs
Source:
Returns:
created dom node
Type
HTMLElement

(inner) elCreateText(tagName, attributes, text) → {HTMLElement}

Creates a html element with text content
Parameters:
Name Type Description
tagName string name of the tag
attributes object tag attributes
text string text for the elements, respects \n for newlines
Source:
Returns:
created dom node
Type
HTMLElement

(inner) elCreateTextTn(tagName, attributes, text, dataopt) → {HTMLElement}

Creates a html element and translates the text
Parameters:
Name Type Attributes Description
tagName string name of the tag to create
attributes object tag attributes
text string text phrase to translate
data object <optional>
object to resolve variables from the phrase
Source:
Returns:
created dom node
Type
HTMLElement

(inner) elCreateTextTnNr(tagName, attributes, text, smartCount) → {HTMLElement}

Shortcut for elCreateTextTn for smartCount only
Parameters:
Name Type Description
tagName string name of the tag to create
attributes object attributes to set
text string phrase to translate
smartCount number smart number for translation
Source:
Returns:
created dom node
Type
HTMLElement

(inner) elDisable(el) → {void}

Disables the element
Parameters:
Name Type Description
el Node element to disable
Source:
Returns:
Type
void

(inner) elDisableBtnGroup(el) → {void}

Disables all button in a btn-group
Parameters:
Name Type Description
el Element Button group
Source:
Returns:
Type
void

(inner) elDisableId(id) → {void}

Disables the element with the given id
Parameters:
Name Type Description
id string element id
Source:
Returns:
Type
void

(inner) elEnable(el) → {void}

Enables the element
Parameters:
Name Type Description
el Element | Node element to enable
Source:
Returns:
Type
void

(inner) elEnableBtnGroup(el) → {void}

Enables all button in a btn-group
Parameters:
Name Type Description
el Element Button group
Source:
Returns:
Type
void

(inner) elEnableId(id) → {void}

Enables the element with the given id
Parameters:
Name Type Description
id string element id
Source:
Returns:
Type
void

(inner) elGetById(id) → {HTMLElement}

Shortcut for elGetById
Parameters:
Name Type Description
id string element id
Source:
Returns:
found element
Type
HTMLElement

(inner) elGetIndex(el) → {number}

Gets the index of the element in the parent html collection
Parameters:
Name Type Description
el HTMLElement element to get the index
Source:
Returns:
the index
Type
number

(inner) elHide(el) → {void}

Hides the element
Parameters:
Name Type Description
el Element | EventTarget element to hide
Source:
Returns:
Type
void

(inner) elHideId(id) → {void}

Hides the element with the given id
Parameters:
Name Type Description
id string element id
Source:
Returns:
Type
void

(inner) elReflow(el) → {number}

Triggers a layout reflow
Parameters:
Name Type Description
el Element element to trigger the reflow
Source:
Returns:
element height
Type
number

(inner) elReplaceChild(el, child) → {void}

Clears the given element and appends the new child
Parameters:
Name Type Description
el Element id of the parent element
child Element | Node element to add
Source:
Returns:
Type
void

(inner) elReplaceChildId(id, child) → {void}

Clears the element with given id and appends the new child
Parameters:
Name Type Description
id string id of the parent element
child Element | Node element to add
Source:
Returns:
Type
void

(inner) elShow(el) → {void}

Shows the element
Parameters:
Name Type Description
el Element element to show
Source:
Returns:
Type
void

(inner) elShowId(id) → {void}

Shows the element with the given id
Parameters:
Name Type Description
id string element id
Source:
Returns:
Type
void

(inner) findData(el, attribute, depth) → {object}

Gets the attributes value from the element or it's parent elements
Parameters:
Name Type Description
el Element | EventTarget Element
attribute string Attribute name
depth number Search depth
Source:
Returns:
Attribute value or undefined
Type
object

(inner) findDataId(id, attribute, depth) → {object}

Gets the attributes value from the element or it's parent elements
Parameters:
Name Type Description
id string element id
attribute string Attribute name
depth number Search depth
Source:
Returns:
Attribute value or undefined
Type
object

(inner) getBtnChkValue(btn) → {boolean}

Gets the enabled state of a check button
Parameters:
Name Type Description
btn HTMLElement | EventTarget check button id
Source:
Returns:
enabled = true, disabled = false
Type
boolean

(inner) getBtnChkValueId(id) → {boolean}

Gets the enabled state of a check button
Parameters:
Name Type Description
id string check button id
Source:
Returns:
enabled = true, disabled = false
Type
boolean

(inner) getBtnGroupValueId(id) → {object}

Gets the value from the active button in a button group
Parameters:
Name Type Description
id string id of the button group
Source:
Returns:
value the value of the active button
Type
object

(inner) getData(el, attribute) → {object}

Gets the attributes value from the element
Parameters:
Name Type Description
el Element | EventTarget element
attribute string attribute name
Source:
Returns:
attribute value or undefined
Type
object

(inner) getDataId(id, attribute) → {object}

Gets the attributes value from the element given by id.
Parameters:
Name Type Description
id string element id
attribute string attribute name
Source:
Returns:
attribute value
Type
object

(inner) getRadioBoxValue(el) → {string}

Gets the value of the checked radio box
Parameters:
Name Type Description
el Element element
Source:
Returns:
radio box value
Type
string

(inner) getRadioBoxValueId(id) → {string}

Gets the value of the checked radio box
Parameters:
Name Type Description
id string element id
Source:
Returns:
radio box value
Type
string

(inner) getScrollPosY(elopt) → {number}

Gets the y-scrolling position
Parameters:
Name Type Attributes Description
el HTMLElement | Element <optional>
element
Source:
Returns:
the vertical scrolling position
Type
number

(inner) getSelectValue(el) → {string}

Gets the value of the selected option of a select element or undefined if no option is selected
Parameters:
Name Type Description
el Element | EventTarget element
Source:
Returns:
selected option value
Type
string

(inner) getSelectValueId(id) → {string}

Gets the value of the selected option of a select element
Parameters:
Name Type Description
id string element id
Source:
Returns:
selected option value
Type
string

(inner) getSelectedOptionData(el, attribute) → {object}

Gets the attribute value of the selected option of a select element
Parameters:
Name Type Description
el Element element
attribute string attribute name
Source:
Returns:
selected option data value
Type
object

(inner) getSelectedOptionDataId(id, attribute) → {object}

Gets the attribute value of the selected option of a select element
Parameters:
Name Type Description
id string element id
attribute string attribute name
Source:
Returns:
selected option data value
Type
object

(inner) getXpos(el) → {number}

Gets the x-position of the given element
Parameters:
Name Type Description
el Element element
Source:
Returns:
x-position
Type
number

(inner) getYpos(el) → {number}

Gets the y-position of the given element
Parameters:
Name Type Description
el Element | ParentNode element
Source:
Returns:
y-position
Type
number

(inner) mirrorBtn(btn, mirror) → {void}

Mirrors the button horizontal
Parameters:
Name Type Description
btn HTMLElement | EventTarget button to mirror
mirror boolean true = mirror, false = not
Source:
Returns:
Type
void

(inner) mirrorBtnId(id, mirror) → {void}

Mirrors the button horizontal
Parameters:
Name Type Description
id string button id to mirror
mirror boolean true = mirror, false = not
Source:
Returns:
Type
void

(inner) rmData(el, attribute) → {void}

Removes an attribute on the given element.
Parameters:
Name Type Description
el Element | Node element
attribute string attribute name
Source:
Returns:
Type
void

(inner) rmDataId(id, attribute) → {void}

Removes an attribute on the element given by id.
Parameters:
Name Type Description
id string element id
attribute string attribute name
Source:
Returns:
Type
void

(inner) scrollToPosY(container, pos) → {void}

Scrolls the container or the window to the y-position
Parameters:
Name Type Description
container Element | ParentNode or null
pos number position to scroll to
Source:
Returns:
Type
void

(inner) selectElHasOptionValue(el, value) → {boolean}

Checks if html select element has an option with specified value.
Parameters:
Name Type Description
el HTMLSelectElement | HTMLElement Select element
value string Value to search for
Source:
Returns:
true on success, else false
Type
boolean

(inner) setData(el, attribute, value) → {void}

Sets an attribute on the given element.
Parameters:
Name Type Description
el Element | Node | EventTarget element
attribute string attribute name
value object could be any type
Source:
Returns:
Type
void

(inner) setDataId(id, attribute, value) → {void}

Sets an attribute on the element given by id.
Parameters:
Name Type Description
id string element id
attribute string attribute name
value object could be any type
Source:
Returns:
Type
void

(inner) setFocus(el) → {void}

Set the focus on the given element for desktop view.
Parameters:
Name Type Description
el HTMLElement element to focus
Source:
Returns:
Type
void

(inner) setFocusId(id) → {void}

Sets the focus on the element with given id for desktop view.
Parameters:
Name Type Description
id string element id
Source:
Returns:
Type
void

(inner) toggleBtn(btn, state) → {void}

Toggles the active state of a button
Parameters:
Name Type Description
btn HTMLElement | EventTarget button to toggle
state boolean | number true, 1 = active; false, 0 = inactive
Source:
Returns:
Type
void

(inner) toggleBtnChk(btn, state) → {boolean}

Toggles a check button
Parameters:
Name Type Description
btn HTMLElement | EventTarget the button to toggle
state boolean | number true, 1 = active; false, 0 = inactive
Source:
Returns:
true if button is checked, else false
Type
boolean

(inner) toggleBtnChkCollapse(btn, collapseId, state) → {void}

Toggles a check button and an assigned collapse
Parameters:
Name Type Description
btn HTMLElement triggering button
collapseId string id of element to collapse
state boolean | number true = active, false = inactive
Source:
Returns:
Type
void

(inner) toggleBtnChkCollapseId(id, collapseId, state) → {void}

Toggles a check button and an assigned collapse
Parameters:
Name Type Description
id string the id of the triggering button
collapseId string id of element to collapse
state boolean | number true = active, false = inactive
Source:
Returns:
Type
void

(inner) toggleBtnChkId(id, state) → {void}

Toggles a check button
Parameters:
Name Type Description
id string id of the button to toggle
state boolean true, 1 = active; false, 0 = inactive
Source:
Returns:
Type
void

(inner) toggleBtnGroup(btn) → {HTMLElement|EventTarget}

Toggles a button group by triggering element
Parameters:
Name Type Description
btn HTMLElement | EventTarget triggered button
Source:
Returns:
active button
Type
HTMLElement | EventTarget

(inner) toggleBtnGroupCollapse(el, collapseId) → {void}

Toggles a button group by triggering element and toggle a collapse
Parameters:
Name Type Description
el HTMLElement triggering button
collapseId string id of element to collapse
Source:
Returns:
Type
void

(inner) toggleBtnGroupId(id) → {HTMLElement|EventTarget}

Toggles a button group by triggering element
Parameters:
Name Type Description
id string id of triggered button
Source:
Returns:
active button
Type
HTMLElement | EventTarget

(inner) toggleBtnGroupValue(btngrp, value) → {HTMLElement}

Toggles a button group by value
Parameters:
Name Type Description
btngrp Element button group to toggle
value string | number value to select
Source:
Returns:
selected button
Type
HTMLElement

(inner) toggleBtnGroupValueCollapse(btngrp, collapseId, value) → {void}

Toggles a button group by value and toggle a collapse
Parameters:
Name Type Description
btngrp Element button group to toggle
collapseId string id of element to collapse
value string | number value to select
Source:
Returns:
Type
void

(inner) toggleBtnGroupValueId(id, value) → {HTMLElement}

Toggles a button group by value
Parameters:
Name Type Description
id string button group id
value string | number value to select
Source:
Returns:
selected button
Type
HTMLElement

(inner) toggleBtnId(id, state) → {void}

Toggles the active state of a button
Parameters:
Name Type Description
id string id of button to toggle
state boolean | number true, 1 = active; false, 0 = inactive
Source:
Returns:
Type
void