Class tsUI

Author
Giovanni Capalbo <gcapalbo@users.sourceforge.net>
License
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


NameDescription
navBarThe HTMLElement representing the navigation bar at the top of the page.
bodyA reference to the HTMLElement representing the element of the current HTML document.
bodyScrollA reference to the tsScroll object representing the scroll bound to the element of the current HTML document.
inputsAn Array of HTMLElements representing all of the inputs that can be switched between by tabbing.
currentInputTargetThe HTMLElement of the input that receives all of the input from the currently selected keyboard.
capsTrue to convert all keyboard input to uppercase, false to convert all keyboard input to lowercase.
bodyMarginTopThe 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.
loadingBoxThe loading box displayed before anything is shown.
loadingBoxDisplayedTrue if the loading box is currently displayed, false otherwise.


Method Summary


Return TypeSignature
voidaddAcuteAccent()
voidaddCircumflex()
voidaddGraveAccent()
voidaddNavigationBar()
voidaddTilde()
voidbackspace()
booleancontainsTextInput(node)
voidcreateLoadingBox()
voidenlargeLinkChildren(node)
voidenlargeLinks()
voidenlargeSingleLink(link)
voidhandleElementInsertion(e)
voidhandleEnlargedLinkClick(e)
voidhandleInputClick(e)
boolean true if the first given character is a version of the secondisVersionOf(first, seconds)
voidlistenOnInputs()
voidload()
voidnextInputTarget()
voidpressChar(value)
voidrecolorCapsButtons()
voidremoveListenersFromInputs()
voidswitchInputTarget(node)
voidtoggleCaps()
voidtoggleLoadingBoxDisplay()


Attribute Details

navBar

NOTE: This attribute is static, so it is referenced as tsUI.navBar
Type
HTMLElement
Description
The HTMLElement representing the navigation bar at the top of the page.
Access
public



body

NOTE: This attribute is static, so it is referenced as tsUI.body
Type
HTMLElement
Description
A reference to the HTMLElement representing the element of the current HTML document.
Access
public



bodyScroll

NOTE: This attribute is static, so it is referenced as tsUI.bodyScroll
Type
tsScroll
Description
A reference to the tsScroll object representing the scroll bound to the element of the current HTML document.
Access
public



inputs

NOTE: This attribute is static, so it is referenced as tsUI.inputs
Type
Array
Description
An Array of HTMLElements representing all of the inputs that can be switched between by tabbing.
Access
public



currentInputTarget

NOTE: This attribute is static, so it is referenced as tsUI.currentInputTarget
Type
HTMLElement
Description
The HTMLElement of the input that receives all of the input from the currently selected keyboard.
Access
public



caps

NOTE: This attribute is static, so it is referenced as tsUI.caps
Type
boolean
Description
True to convert all keyboard input to uppercase, false to convert all keyboard input to lowercase.
Access
public



bodyMarginTop

NOTE: This attribute is static, so it is referenced as tsUI.bodyMarginTop
Type
number
Description
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.
Access
public



loadingBox

NOTE: This attribute is static, so it is referenced as tsUI.loadingBox
Type
HTMLElement
Description
The loading box displayed before anything is shown.
Access
public



loadingBoxDisplayed

NOTE: This attribute is static, so it is referenced as tsUI.loadingBoxDisplayed
Type
boolean
Description
True if the loading box is currently displayed, false otherwise.
Access
public


Method Details

addAcuteAccent

NOTE: This method is static, so it is referenced as tsUI.addAcuteAccent
Description
Adds an acute accent to the last character in the tsUI.currentInputTarget if applicable, and fires a key event on it.
Parameters
(none)
Return
void
Access
public



addCircumflex

NOTE: This method is static, so it is referenced as tsUI.addCircumflex
Description
Adds a circumflex to the last character in the tsUI.currentInputTarget if applicable, and fires a key event on it.
Parameters
(none)
Return
void
Access
public



addGraveAccent

NOTE: This method is static, so it is referenced as tsUI.addGraveAccent
Description
Adds a grave accent to the last character in the tsUI.currentInputTarget if applicable, and fires a key event on it.
Parameters
(none)
Return
void
Access
public



addNavigationBar

NOTE: This method is static, so it is referenced as tsUI.addNavigationBar
Description
Creates and adds the navigation bar and appends it to the body element.
Parameters
(none)
Return
void
Access
public



addTilde

NOTE: This method is static, so it is referenced as tsUI.addTilde
Description
Adds a tilde to the last character in the tsUI.currentInputTarget if applicable, and fires a key event on it.
Parameters
(none)
Return
void
Access
public



backspace

NOTE: This method is static, so it is referenced as tsUI.backspace
Description
Removes the last character at the end of the currentInputTarget and fires a backspace key event to it.
Parameters
(none)
Return
void
Access
public



containsTextInput

NOTE: This method is static, so it is referenced as tsUI.containsTextInput
Description
Searches the given HTMLElement and its child elements recursively to see if any node in the tree is a text-based input.
Parameters
TypeNameDescription
HTMLElementnodeThe HTMLElement to begin searching from.
Return
boolean; True if the given HTMLElement is the parent of any text-based input.
Access
public



createLoadingBox

NOTE: This method is static, so it is referenced as tsUI.createLoadingBox
Description
Creates the loading box.
Parameters
(none)
Return
void
Access
public



enlargeLinkChildren

NOTE: This method is static, so it is referenced as tsUI.enlargeLinkChildren
Description
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.
Parameters
TypeNameDescription
HTMLElementnodeThe HTMLElement to begin searching from.
Return
void
Access
public



NOTE: This method is static, so it is referenced as tsUI.enlargeLinks
Description
Enlarges the links on the page by putting them in buttons. The onClick property of each link is preserved.
Parameters
(none)
Return
void
Access
public



NOTE: This method is static, so it is referenced as tsUI.enlargeSingleLink
Description
Enlarges a link by putting it in a button. The onClick property of each link is preserved.
Parameters
TypeNameDescription
HTMLElementlinkThe link to enlarge.
Return
void
Access
public



handleElementInsertion

NOTE: This method is static, so it is referenced as tsUI.handleElementInsertion
Description
Handles a dynamic event caused by inserting a new HTMLElement into the document.
Parameters
TypeNameDescription
EventeThe event that was fired to signify the element insertion.
Return
void
Access
public



handleEnlargedLinkClick

NOTE: This method is static, so it is referenced as tsUI.handleEnlargedLinkClick
Description
Handles a click event fired upon an enlarged link.
Parameters
TypeNameDescription
EventeThe event that was fired.
Return
void
Access
public



handleInputClick

NOTE: This method is static, so it is referenced as tsUI.handleInputClick
Description
Handles the event caused by a user clicking on any text field input.
Parameters
TypeNameDescription
EventeThe click event that was fired.
Return
void
Access
public



isVersionOf

NOTE: This method is static, so it is referenced as tsUI.isVersionOf
Description
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.
Parameters
TypeNameDescription
stringfirstThe first character, the one with the possible diacritic.
stringsecondsThe second character, the one without the diacritic.
Return
boolean true if the first given character is a version of the second; false otherwise
Access
public



listenOnInputs

NOTE: This method is static, so it is referenced as tsUI.listenOnInputs
Description
Adds event listeners to all text and password inputs to allow the currently selected keyboard to popup when clicked on.
Parameters
(none)
Return
void
Access
public



load

NOTE: This method is static, so it is referenced as tsUI.load
Description
Creates the entire touchscreen user interface.
Parameters
(none)
Return
void
Access
public



nextInputTarget

NOTE: This method is static, so it is referenced as tsUI.nextInputTarget
Description
Switches focus to the next input target in the Array of tsUI.inputs.
Parameters
(none)
Return
void
Access
public



pressChar

NOTE: This method is static, so it is referenced as tsUI.pressChar
Description
Appends the given character to the currentInputTarget, and imitates a key being pressed and then released on it.
Parameters
TypeNameDescription
stringvalueThe single character to press.
Return
void
Access
public



recolorCapsButtons

NOTE: This method is static, so it is referenced as tsUI.recolorCapsButtons
Description
Recolors all CAPS buttons to reflect any changes in the CAPS lock state.
Parameters
(none)
Return
void
Access
public



removeListenersFromInputs

NOTE: This method is static, so it is referenced as tsUI.removeListenersFromInputs
Description
Removes event listeners to all text and password inputs.
Parameters
(none)
Return
void
Access
public



switchInputTarget

NOTE: This method is static, so it is referenced as tsUI.switchInputTarget
Description
Switches focus to the given input, so that it may receive input from the currently selected keyboard.
Parameters
TypeNameDescription
HTMLElementnodeThe HTMLElement to give focus.
Return
void
Access
public



toggleCaps

NOTE: This method is static, so it is referenced as tsUI.toggleCaps
Description
Toggles the tsUI.caps state and recolors all CAPS buttons to reflect the changes.
Parameters
(none)
Return
void
Access
public



toggleLoadingBoxDisplay

NOTE: This method is static, so it is referenced as tsUI.toggleLoadingBoxDisplay
Description
Toggles the display of the loading box.
Parameters
(none)
Return
void
Access
public