Class tsUI
Giovanni Capalbo <gcapalbo@users.sourceforge.net>
This source file is subject to the LGPL license, which is available online at this address: http://www.gnu.org/copyleft/lesser.html
This class handles creating all of the components of the user interface that are not keyboards. For keyboard components, see the tsKeyboard class. All attributes and methods in this class are static so that they can be referenced globally without instantiating new objects.
Attribute Summary
Name | Description |
navBar | The HTMLElement representing the navigation bar at the top of the page. |
body | A reference to the HTMLElement representing the element of the current HTML document. |
bodyScroll | A reference to the tsScroll object representing the scroll bound to the element of the current HTML document. |
inputs | An Array of HTMLElements representing all of the inputs that can be switched between by tabbing. |
currentInputTarget | The HTMLElement of the input that receives all of the input from the currently selected keyboard. |
caps | True to convert all keyboard input to uppercase, false to convert all keyboard input to lowercase. |
bodyMarginTop | The number of pixels from the top of the HTML document to skip before the element. Pushing the element down is necessary to display the navBar and still have the element and its contents be completely visible. |
loadingBox | The loading box displayed before anything is shown. |
loadingBoxDisplayed | True if the loading box is currently displayed, false otherwise. |
Method Summary
Attribute Details
navBar
NOTE: This attribute is static, so it is referenced as tsUI.navBar
HTMLElement
The HTMLElement representing the navigation bar at the top of the page.
public
body
NOTE: This attribute is static, so it is referenced as tsUI.body
HTMLElement
A reference to the HTMLElement representing the element of the current HTML document.
public
bodyScroll
NOTE: This attribute is static, so it is referenced as tsUI.bodyScroll
tsScroll
A reference to the tsScroll object representing the scroll bound to the element of the current HTML document.
public
NOTE: This attribute is static, so it is referenced as tsUI.inputs
Array
An Array of HTMLElements representing all of the inputs that can be switched between by tabbing.
public
NOTE: This attribute is static, so it is referenced as tsUI.currentInputTarget
HTMLElement
The HTMLElement of the input that receives all of the input from the currently selected keyboard.
public
caps
NOTE: This attribute is static, so it is referenced as tsUI.caps
boolean
True to convert all keyboard input to uppercase, false to convert all keyboard input to lowercase.
public
bodyMarginTop
NOTE: This attribute is static, so it is referenced as tsUI.bodyMarginTop
number
The number of pixels from the top of the HTML document to skip before the element. Pushing the element down is necessary to display the navBar and still have the element and its contents be completely visible.
public
loadingBox
NOTE: This attribute is static, so it is referenced as tsUI.loadingBox
HTMLElement
The loading box displayed before anything is shown.
public
loadingBoxDisplayed
NOTE: This attribute is static, so it is referenced as tsUI.loadingBoxDisplayed
boolean
True if the loading box is currently displayed, false otherwise.
public
Method Details
addAcuteAccent
NOTE: This method is static, so it is referenced as tsUI.addAcuteAccent
Adds an acute accent to the last character in the tsUI.currentInputTarget if applicable, and fires a key event on it.
(none)
void
public
addCircumflex
NOTE: This method is static, so it is referenced as tsUI.addCircumflex
Adds a circumflex to the last character in the tsUI.currentInputTarget if applicable, and fires a key event on it.
(none)
void
public
addGraveAccent
NOTE: This method is static, so it is referenced as tsUI.addGraveAccent
Adds a grave accent to the last character in the tsUI.currentInputTarget if applicable, and fires a key event on it.
(none)
void
public
addNavigationBar
NOTE: This method is static, so it is referenced as tsUI.addNavigationBar
Creates and adds the navigation bar and appends it to the body element.
(none)
void
public
addTilde
NOTE: This method is static, so it is referenced as tsUI.addTilde
Adds a tilde to the last character in the tsUI.currentInputTarget if applicable, and fires a key event on it.
(none)
void
public
backspace
NOTE: This method is static, so it is referenced as tsUI.backspace
Removes the last character at the end of the currentInputTarget and fires a backspace key event to it.
(none)
void
public
containsTextInput
NOTE: This method is static, so it is referenced as tsUI.containsTextInput
Searches the given HTMLElement and its child elements recursively to see if any node in the tree is a text-based input.
Type | Name | Description |
HTMLElement | node | The HTMLElement to begin searching from. |
boolean; True if the given HTMLElement is the parent of any text-based input.
public
createLoadingBox
NOTE: This method is static, so it is referenced as tsUI.createLoadingBox
Creates the loading box.
(none)
void
public
enlargeLinkChildren
NOTE: This method is static, so it is referenced as tsUI.enlargeLinkChildren
Searches the given HTMLElement and its child elements recursively to see if any node in the tree is a link. If so, the link(s) are replaced with a clickable-style link.
Type | Name | Description |
HTMLElement | node | The HTMLElement to begin searching from. |
void
public
enlargeLinks
NOTE: This method is static, so it is referenced as tsUI.enlargeLinks
Enlarges the links on the page by putting them in buttons. The onClick property of each link is preserved.
(none)
void
public
enlargeSingleLink
NOTE: This method is static, so it is referenced as tsUI.enlargeSingleLink
Enlarges a link by putting it in a button. The onClick property of each link is preserved.
Type | Name | Description |
HTMLElement | link | The link to enlarge. |
void
public
handleElementInsertion
NOTE: This method is static, so it is referenced as tsUI.handleElementInsertion
Handles a dynamic event caused by inserting a new HTMLElement into the document.
Type | Name | Description |
Event | e | The event that was fired to signify the element insertion. |
void
public
handleEnlargedLinkClick
NOTE: This method is static, so it is referenced as tsUI.handleEnlargedLinkClick
Handles a click event fired upon an enlarged link.
Type | Name | Description |
Event | e | The event that was fired. |
void
public
NOTE: This method is static, so it is referenced as tsUI.handleInputClick
Handles the event caused by a user clicking on any text field input.
Type | Name | Description |
Event | e | The click event that was fired. |
void
public
isVersionOf
NOTE: This method is static, so it is referenced as tsUI.isVersionOf
Tells whether or not the first given character is a version of the second. Used for telling when a vowel with a diacritic mark is a vowel. Currently supports acute, grave, and circumflex.
Type | Name | Description |
string | first | The first character, the one with the possible diacritic. |
string | seconds | The second character, the one without the diacritic. |
boolean true if the first given character is a version of the second; false otherwise
public
NOTE: This method is static, so it is referenced as tsUI.listenOnInputs
Adds event listeners to all text and password inputs to allow the currently selected keyboard to popup when clicked on.
(none)
void
public
load
NOTE: This method is static, so it is referenced as tsUI.load
Creates the entire touchscreen user interface.
(none)
void
public
NOTE: This method is static, so it is referenced as tsUI.nextInputTarget
Switches focus to the next input target in the Array of tsUI.inputs.
(none)
void
public
pressChar
NOTE: This method is static, so it is referenced as tsUI.pressChar
Appends the given character to the currentInputTarget, and imitates a key being pressed and then released on it.
Type | Name | Description |
string | value | The single character to press. |
void
public
NOTE: This method is static, so it is referenced as tsUI.recolorCapsButtons
Recolors all CAPS buttons to reflect any changes in the CAPS lock state.
(none)
void
public
NOTE: This method is static, so it is referenced as tsUI.removeListenersFromInputs
Removes event listeners to all text and password inputs.
(none)
void
public
NOTE: This method is static, so it is referenced as tsUI.switchInputTarget
Switches focus to the given input, so that it may receive input from the currently selected keyboard.
Type | Name | Description |
HTMLElement | node | The HTMLElement to give focus. |
void
public
toggleCaps
NOTE: This method is static, so it is referenced as tsUI.toggleCaps
Toggles the tsUI.caps state and recolors all CAPS buttons to reflect the changes.
(none)
void
public
toggleLoadingBoxDisplay
NOTE: This method is static, so it is referenced as tsUI.toggleLoadingBoxDisplay
Toggles the display of the loading box.
(none)
void
public