Global

Members

endnode :Node

This variable holds the "end" node if multiple selection is in effect. Otherwise undefined.

Type:
  • Node
Source:

startnode :Node

This variable holds the selected node, or "start" node if multiple selection is in effect. Otherwise undefined.

Type:
  • Node
Source:

Methods

addCommand(dict, fn)

Add a keybinding command.

Calls to this function should be in the settings.js file, grouped in a function called customCommands

Parameters:
Name Type Description
dict Object

a mapping of properties of the keybinding. Can contain:

  • keycode: the numeric keycode for the binding (mandatory)
  • shift: true if this is a binding with shift pressed (optional)
  • ctrl: true if this is a binding with control pressed (optional)
fn function

the function to associate with the keybinding. Any further arguments to the addCommand function are passed to fn on each invocation.

Source:

addConLeafAfter(phrase, terminal)

Add a terminal node to the context menu.

Add a terminal node that the context menu will allow inserting in the tree after the sleected node.

Parameters:
Name Type Description
phrase String

the label of the leaf

terminal String

the text of the leaf

Source:

addConLeafBefore(phrase, terminal)

Add a terminal node to the context menu.

Add a terminal node that the context menu will allow inserting in the tree.

Parameters:
Name Type Description
phrase String

the label of the leaf

terminal String

the text of the leaf

Source:

addConMenuGroup(group)

Add a group of labels to the context menu.

When activating the context menu, if the label of the targeted node belongs to one of these groups, the other entries in the group will be suggested as new labels.

Parameters:
Name Type Description
group Array.<String>
Source:

clearSearchMatches()

Clear the highlighting from search matches.

Source:

clearSelection()

Remove any selection of nodes.

Source:

coIndex()

Coindex nodes.

Coindex the two selected nodes. If they are already coindexed, toggle types of coindexation (normal -> gapping -> backwards gapping -> double gapping -> no indices). If only one node is selected, remove its index.

Source:

currentText(root, sep)

Get the ur-text dominated by a node.

This function removes any empty material (traces, comments, etc.) It does not rejoin words which have been split. It also does not add spaces. TODO: the previous is now inaccurate. Do we still need sep argument now that currentTextPretty exists?

Parameters:
Name Type Description
root jQuery

the node to operate on

sep String

the separator between elements

Source:

currentTextPretty(root, sep)

Get the ur-text dominated by a node.

This function removes any empty material (traces, comments, CODE nodes, etc.) It does rejoins words which have been split and adds spaces. Compare to currentText.

Parameters:
Name Type Description
root jQuery

the node to operate on

sep String

the separator between elements

Source:

displayError(html)

Display an error message in the Annotald UI.

Parameters:
Name Type Description
html String

the html code of the error to display

Source:

displayInfo(html)

Display an informational message in the Annotald UI.

Parameters:
Name Type Description
html String

the html code of the information to display

Source:

displayRename()

Edit the selected node

If the selected node is a terminal, edit its label, and lemma. The text is available for editing if it is an empty node (trace, comment, etc.). If a non-terminal, edit the node label.

Source:

displayWarning(html)

Display a warning message in the Annotald UI.

Parameters:
Name Type Description
html String

the html code of the warning to display

Source:

editLemma()

Edit the lemma of a terminal node.

Source:

editNode()

Perform an appropriate editing operation on the selected node.

Source:

flagSearchMatch(node)

Indicate that a node matches a search

Parameters:
Name Type Description
node Node

the node to flag

Source:

getCase(node) → {String}

Find the case associated with a node.

This function respects the case-related variable caseMarkers. It does not check if a node is in caseTags.

Parameters:
Name Type Description
node jQuery
Source:
Returns:

the case on the node, or "" if none

Type
String

getIndex(node)

Return the movement index associated with a node.

Parameters:
Name Type Description
node jQuery

the node to operate on

Source:

getIndexType(node)

Return the type of index associated with a node, either "-" or "=".

Parameters:
Name Type Description
node jQuery

the node to operate on

Source:

getLabel(node)

Get the label of a node.

Parameters:
Name Type Description
node jQuery

the node to operate on

Source:

getLemma(node) → {String}

Return the lemma of a node, or undefined if none.

Parameters:
Name Type Description
node jQuery
Source:
Returns:
Type
String

getTokenRoot(node)

Get the root of the tree that a node belongs to.

Parameters:
Name Type Description
node jQuery

the node to operate on

Source:

guessLeafNode(node)

Test whether a node is a leaf using heuristics.

This function respects the results of the testValidLeafLabel and testValidPhraseLabel functions, if these are defined.

Parameters:
Name Type Description
node Node

the node to operate on

Source:

hasCase(node) → {Boolean}

Test if a node has case.

This function tests whether a node is in caseTags, and then whether it has case.

Parameters:
Name Type Description
node jQuery
Source:
Returns:
Type
Boolean

hasDashTag(node, tag)

Test whether a node has a certain dash tag.

Parameters:
Name Type Description
node jQuery

the node to operate on

tag String

the dash tag to look for, without any dashes

Source:

hideDialogBox()

Hide the displayed dialog box.

Source:

ignoringUndo(fn)

Execute a function, discarding whatever effects it has on the undo system.

Parameters:
Name Type Description
fn function

a function to execute

Source:
Returns:

the result of fn

isCaseLabel(label) → {Boolean}

Test whether a label can bear case.

Respects the caseTags configuration variable.

Parameters:
Name Type Description
label String
Source:
Returns:
Type
Boolean

isCaseNode(node) → {Boolean}

Test whether a node can bear case.

See isCaseLabel.

Parameters:
Name Type Description
node jQuery
Source:
Returns:
Type
Boolean

isCasePhrase(nodeLabel) → {Boolean}

Test whether a node label corresponds to a case phrase.

Based on the casePhrases configuration variable.

Parameters:
Name Type Description
nodeLabel jQuery
Source:
Returns:
Type
Boolean

isEmpty(text) → {Boolean}

Test whether a string is empty, i.e. a trace, comment, or other empty category.

Parameters:
Name Type Description
text String

the text to test

Source:
Returns:
Type
Boolean

isEmptyNode(node) → {Boolean}

Test whether a given node is empty, i.e. a trace, comment, or other empty category.

Parameters:
Name Type Description
node Node
Source:
Returns:
Type
Boolean

isLeafNode(node)

Test whether a node is a purely structural leaf.

Parameters:
Name Type Description
node Node

the node to operate on

Source:

isPossibleTarget(node)

Test whether a node is a possible target for movement.

Parameters:
Name Type Description
node Node

the node to operate on

Source:

isRootNode(node)

Test whether a node is the root node of a tree.

Parameters:
Name Type Description
node jQuery

the node to operate on

Source:

labelGetCase(label) → {String}

Find the case associated with a label.

This function respects the case-related variable caseMarkers.

Parameters:
Name Type Description
label String
Source:
Returns:

the case on the label, or "" if none.

Type
String

labelHasCase(label) → {Boolean}

Test if a label has case.

This function tests whether a label is in caseTags, and then whether it has case.

Parameters:
Name Type Description
label String
Source:
Returns:
Type
Boolean

labelRemoveCase(label) → {String}

Remove the case from a string label.

Parameters:
Name Type Description
label String
Source:
Returns:

the label without case

Type
String

leafAfter()

Create a leaf node after the selected node.

Uses heuristic to determine whether the new leaf is to be a trace, empty subject, etc.

Source:

leafBefore()

Create a leaf node before the selected node.

Uses heuristic to determine whether the new leaf is to be a trace, empty subject, etc.

Source:

makeLeaf(before, label, word, target)

Create a leaf node adjacent to the selection, or a given target.

Parameters:
Name Type Description
before Boolean

whether to create the node before or after selection

label String

the label to give the new node

word String

the text to give the new node

target Node

where to put the new node (default: selected node)

Source:

makeNode(labelopt)

Create a phrasal node.

The node will dominate the selected node or (if two sisters are selected) the selection and all intervening sisters.

Parameters:
Name Type Attributes Description
label String <optional>

the label to give the new node (default: XP)

Source:

maxIndex(token)

Get the highest index attested in a token.

Parameters:
Name Type Description
token Node

the token to work on

Source:

moveNode(parent) → {Boolean}

Move the selected node(s) to a new position.

The movement operation must not change the text of the token.

Empty categories are not allowed to be moved as a leaf. However, a non-terminal containing only empty categories can be moved.

Parameters:
Name Type Description
parent Node

the parent node to move selection under

Source:
Returns:

whether the operation was successful

Type
Boolean

moveNodes(parent)

Move several nodes.

The two selected nodes must be sisters, and they and all intervening sisters will be moved as a unit. Calls moveNode to do the heavy lifting.

Parameters:
Name Type Description
parent Node

the parent to move the selection under

Source:

nextSearchMatch()

Scroll down to the next node that matched a search.

Source:

nukeUndo()

Reset the undo system entirely.

This function zeroes out any undo history.

Source:

pruneNode()

Delete a node.

The node can only be deleted if doing so does not affect the text, i.e. it directly dominates no non-empty terminals.

Source:

redo()

Perform redo.

Source:

registerDeletedRootTree(tree)

Inform the undo system of a tree's removal at the root level

Parameters:
Name Type Description
tree jQuery

the tree being removed

Source:

registerNewRootTree(tree)

Inform the undo system of the addition of a new tree at the root level.

Parameters:
Name Type Description
tree jQuery

the tree being added

Source:

removeCase(node)

Remove the case from a node.

Does not record undo information.

Parameters:
Name Type Description
node jQuery
Source:

scrollToNext() → {jQuery}

Scroll to display the next place in the document matching a selector.

If no matches, do nothing.

Source:
Returns:

the node scrolled to, or undefined if none.

Type
jQuery

scrollToShowSel()

Scroll the page so that the first selected node is visible.

Source:

Display a search dialog.

Source:

searchNodePostAdd()

Hook up event handlers after adding a node to the search dialog

Source:

selectNode(node, force)

Select a node, and update the GUI to reflect that.

Parameters:
Name Type Description
node Node

the node to be selected

force Boolean

if true, force this node to be a secondary selection, even if it wouldn't otherwise be.

Source:

setCase(node)

Set the case on a node.

Removes any previous case. Does not record undo information.

Parameters:
Name Type Description
node jQuery
Source:

setLabel(labels)

Set the label of a node intelligently

Given a list of labels, this function will attempt to find the node's current label in the list. If it is successful, it sets the node's label to the next label in the list (or the first, if the node's current label is the last in the list). If not, it sets the label to the first label in the list.

Parameters:
Name Type Description
labels

a list of labels. This can also be an object -- if so, the base label (without any dash tags) of the target node is looked up as a key, and its corresponding value is used as the list. If there is no value for that key, the first value specified in the object is the default.

Source:

setNodeLabel(node, label, noUndo)

Sets the label of a node

Contains none of the heuristics of setLabel.

Parameters:
Name Type Description
node jQuery

the target node

label String

the new label

noUndo Boolean

whether to record this operation for later undo

Source:

shouldIndexLeaf(node)

Determine whether to place a movement index on the node label or the text.

Parameters:
Name Type Description
node jQuery

the node to operate on

Source:

showDialogBox(title, html, returnFn, hideHook)

Show a dialog box.

This function creates keybindings for the escape (to close dialog box) and return (caller-specified behavior) keys.

Parameters:
Name Type Description
title String

the title of the dialog box

html String

the html to display in the dialog box

returnFn function

a function to call when return is pressed

hideHook function

a function to run when hiding the dialog box

Source:

showMessageHistory()

Show the message history.

Source:

styleDashTag(tagName, css)

Add a css style for a certain dash tag.

Parameters:
Name Type Description
tagName String

The tag which to style. Will match any node with this dash tag. Should not itself have leading or trailing dashes.

css String

The css style declarations to associate with the tag.

Source:

styleTag(tagName, css)

Add a css style for a certain tag.

Parameters:
Name Type Description
tagName String

The tag which to style. Will match instances of the given tag with additional trailing dash tags.

css String

The css style declarations to associate with the tag.

Source:

styleTags(tagNames, css)

A convenience function to wrap styleTag.

Parameters:
Name Type Description
tagNames Array

Tags to style.

css String

The css style declarations to associate with the tags.

Source:

toggleCollapsed()

Toggle collapsing of a node.

When a node is collapsed, its contents are displayed as continuous text, without labels. The node itself still functions normally with respect to movement operations etc., but its contents are inaccessible.

Source:

toggleExtension(extension, extensionListopt)

Toggle a dash tag on a node

If the node bears the given dash tag, remove it. If not, add it. This function attempts to put multiple dash tags in the proper order, according to the configuration in the leaf_extensions, extensions, and clause_extensions variables in the settings.js file.

Parameters:
Name Type Attributes Description
extension String

the dash tag to toggle

extensionList Array.<String> <optional>

override the guess as to the appropriate ordered list of possible extensions.

Source:

toggleLemmata()

Toggle display of lemmata.

Source:

touchTree(node)

Inform the undo system that changes are being made.

Parameters:
Name Type Description
node jQuery

the node in which changes are being made

Source:

undo()

Perform undo.

Source:

undoAbortTransaction()

End an undo transaction, discarding its changes

Source:

undoBeginTransaction()

Begin an undo transaction.

This function MUST be matched by a call to either undoEndTransaction (which keeps all intermediate steps since the start call) or undoAbortTransaction (which discards said steps).

Source:

undoEndTransaction()

End an undo transaction, keeping its changes

Source:

updateCssClass(node, oldlabel)

Update the CSS class of a node to reflect its label.

Parameters:
Name Type Description
node jQuery
oldlabel String

(optional) the former label of this node

Source:

wnodeString(node)

Get the text dominated by a given node, without removing empty material.

Parameters:
Name Type Description
node Node

the node to operate on

Source: