Constructor
new TextTarget(doc, text)
TextTarget constructor
| Name | Type | Description |
|---|---|---|
doc | module:activities/text/TextActivityDocument. | The document to which this target belongs. |
text | string | Main text of this target. |
Members
$comboList :external:jQuery
The drop-down list associated to this target
$p :external:jQuery
The paragraph element where $span is currently located
$popup :external:jQuery
The span element containing the popup
$span :external:jQuery
The span element associated to this target
answers :Array.<string>
Array of valid answers
- Array.<string>
attr :object
A set of optional attributes for text
- object
currentText :string
Current text in the $span element
- string
doc :module:activities/text/TextActivityDocument.TextActivityDocument
The TextActivityDocument to which this target belongs
flagModified :boolean
Flag to control if the initial content of this TextTarget has been modified
- boolean
infoMode :string
Type of additional information offered to the user. Possible values are: no_info, always,onError and onDemand.
- string
iniChar :string
Character used to fill-in the text field
- string
iniText :string
Text displayed by the target when the activity begins
- string
isList :boolean
true when the target is a drop-down list
- boolean
maxLenResp :number
Maximum length of the answer
- number
num :number
Ordinal number of this target in the collection of targets
- number
numIniChars :number
Number of characters initially displayed on the text field
- number
onlyPlay :boolean
When this flag is true and popupContent contains audio, no visual feedback will be
provided (meaning that audio will be just played)
- boolean
options :object
Set of specific options
- object
parentPane :module:activities/text/TextActivityBase.TextActivityBasePanel
Pointer to the activity panel containing this TextTarget
popupContent :module:boxes/ActiveBoxContent.ActiveBoxContent
An optional ActiveBoxContent with information about this TextTarget
popupDelay :number
Time (seconds) to wait before showing the additional information
- number
popupKey :string
Key that triggers the associated popup when infoMode is onDemand
- string
popupMaxTime :number
Maximum amount of time (seconds) that the additional information will be shown
- number
pos :number
Current ordinal position of this target in the document
(used in OrderText activities)
- number
targetStatus :string
Current status of the target. Valid values are: NOT_EDITED, EDITED, SOLVED, WITH_ERROR and HIDDEN
- string
text :string
The current text displayed by this TextTarget
- string
Methods
checkColors()
Sets specific colors to the target jQuery element, based on its targetStatus value. Red
color usually means error.
getAnswers() → {string}
Gets a string with all valid answers of this TextTarget. Useful for reporting users' activity.
- Type:
- string
getAttributes() → {object}
Gets a object with the basic attributes needed to rebuild this instance excluding functions,
parent references, constants and also attributes retaining the default value.
The resulting object is commonly usued to serialize elements in JSON format.
- The resulting object, with minimal attrributes
- Type:
- object
readCurrentText() → {string}
Fills the currentText member with the text currently hosted in $span or selected in $comboList
- The current text of this target
- Type:
- string
reset(statusopt)
Resets the TextTarget status
| Name | Type | Attributes | Description |
|---|---|---|---|
status | string | <optional> | The |
setAttributes(data) → {module:activities/text/TextActivityDocument.TextTarget}
Reads the properties of this TextTarget from a data object
| Name | Type | Description |
|---|---|---|
data | object | The data object to be parsed, or just the text content |
setProperties($xml, mediaBag)
Loads the text target settings from a specific JQuery XML element
| Name | Type | Description |
|---|---|---|
$xml | external:jQuery | The XML element to parse |
mediaBag | module:bags/MediaBag. | The media bag used to load images and media content |