activities/text/TextActivityDocument. TextTarget

This class contains the properties and methods of the document elements that are the real
targets of user actions in text activities.

Constructor

new TextTarget(doc, text)

TextTarget constructor

Parameters:
NameTypeDescription
docmodule:activities/text/TextActivityDocument.TextActivityDocument

The document to which this target belongs.

textstring

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

Type:
  • Array.<string>

attr :object

A set of optional attributes for text

Type:
  • object

currentText :string

Current text in the $span element

Type:
  • 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

Type:
  • boolean

infoMode :string

Type of additional information offered to the user. Possible values are: no_info, always,
onError and onDemand.

Type:
  • string

iniChar :string

Character used to fill-in the text field

Type:
  • string

iniText :string

Text displayed by the target when the activity begins

Type:
  • string

isList :boolean

true when the target is a drop-down list

Type:
  • boolean

maxLenResp :number

Maximum length of the answer

Type:
  • number

num :number

Ordinal number of this target in the collection of targets

Type:
  • number

numIniChars :number

Number of characters initially displayed on the text field

Type:
  • 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)

Type:
  • boolean

options :object

Set of specific options

Type:
  • 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

Type:
  • number

popupKey :string

Key that triggers the associated popup when infoMode is onDemand

Type:
  • string

popupMaxTime :number

Maximum amount of time (seconds) that the additional information will be shown

Type:
  • number

pos :number

Current ordinal position of this target in the document
(used in OrderText activities)

Type:
  • number

targetStatus :string

Current status of the target. Valid values are: NOT_EDITED, EDITED, SOLVED, WITH_ERROR and HIDDEN

Type:
  • string

text :string

The current text displayed by this TextTarget

Type:
  • 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.

Returns:
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.

Returns:
  • 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

Returns:
  • The current text of this target
Type: 
string

reset(statusopt)

Resets the TextTarget status

Parameters:
NameTypeAttributesDescription
statusstring<optional>

The targetStatus to be established. Default is NOT_EDITED

setAttributes(data) → {module:activities/text/TextActivityDocument.TextTarget}

Reads the properties of this TextTarget from a data object

Parameters:
NameTypeDescription
dataobject

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

Parameters:
NameTypeDescription
$xmlexternal:jQuery

The XML element to parse

mediaBagmodule:bags/MediaBag.MediaBag

The media bag used to load images and media content