Global

Members

endnode :DOM Node

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

Source:

startnode :DOM Node

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

Source:

Methods

addCommand

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

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

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

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 of 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

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 Node

the node to operate on

sep String

the separator between elements

Source:

currentTextPretty

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 Node

the node to operate on

sep String

the separator between elements

Source:

displayError

Display an error message in the Annotald UI.

Parameters:
Name Type Description
html String

the html code of the error to display

Source:

displayInfo

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

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

Indicate that a node matches a search

Parameters:
Name Type Description
node DOM node

the node to flag

Source:

getCase

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 Node
Source:
Returns:

the case on the node, or "" if none

Type
String

getIndex

Return the movement index associated with a node.

Parameters:
Name Type Description
node JQuery Node

the node to operate on

Source:

getIndexType

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

Parameters:
Name Type Description
node JQuery Node

the node to operate on

Source:

getLabel

Get the label of a node.

Parameters:
Name Type Description
node JQuery Node

the node to operate on

Source:

getLemma

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

Parameters:
Name Type Description
node JQuery Node
Source:
Returns:
Type
String

getTokenRoot

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

Parameters:
Name Type Description
node JQuery Node

the node to operate on

Source:

guessLeafNode

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 DOM node

the node to operate on

Source:

hasCase

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 Node
Source:
Returns:
Type
Boolean

hasDashTag

Test whether a node has a certain dash tag.

Parameters:
Name Type Description
node JQuery Node

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

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

Test whether a label can bear case.

Respects the caseTags configuration variable.

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

isCaseNode

Test whether a node can bear case.

See isCaseLabel.

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

isCasePhrase

Test whether a node label corresponds to a case phrase.

Based on the casePhrases configuration variable.

Parameters:
Name Type Description
nodeLabel JQuery Node
Source:
Returns:
Type
Boolean

isEmpty

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

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

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

isLeafNode

Test whether a node is a purely structural leaf.

Parameters:
Name Type Description
node DOM node

the node to operate on

Source:

isPossibleTarget

Test whether a node is a possible target for movement.

Parameters:
Name Type Description
node DOM node

the node to operate on

Source:

isRootNode

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

Parameters:
Name Type Description
node JQuery Node

the node to operate on

Source:

labelGetCase

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

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

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

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 DOM Node

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

Source:

makeNode

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 Argument Description
label String <optional>

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

Source:

maxIndex

Get the highest index attested in a token.

Parameters:
Name Type Description
token DOM node

the token to work on

Source:

moveNode

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 DOM Node

the parent node to move selection under

Source:
Returns:

whether the operation was successful

Type
Boolean

moveNodes

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 DOM 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

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

Parameters:
Name Type Description
tree JQuery Node

the tree being removed

Source:

registerNewRootTree

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

Parameters:
Name Type Description
tree JQuery Node

the tree being added

Source:

removeCase

Remove the case from a node.

Does not record undo information.

Parameters:
Name Type Description
node JQuery Node
Source:

scrollToNext

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 Node

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

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

Parameters:
Name Type Description
node DOM 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

Set the case on a node.

Removes any previous case. Does not record undo information.

Parameters:
Name Type Description
node JQuery Node
Source:

setLabel

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

Sets the label of a node

Contains none of the heuristics of setLabel.

Parameters:
Name Type Description
node JQuery Node

the target node

label String

the new label

noUndo Boolean

whether to record this operation for later undo

Source:

shouldIndexLeaf

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

Parameters:
Name Type Description
node JQuery Node

the node to operate on

Source:

showDialogBox

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

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

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

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

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 Argument Description
extension String

the dash tag to toggle

extensionList Array of String <optional>

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

Source:

toggleLemmata

Toggle display of lemmata.

Source:

touchTree

Inform the undo system that changes are being made.

Parameters:
Name Type Description
node JQuery Node

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

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

Parameters:
Name Type Description
node JQuery Node
oldlabel String

(optional) the former label of this node

Source:

wnodeString

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

Parameters:
Name Type Description
node DOM node

the node to operate on

Source: