Thread

Thread

Class representing a comment thread object.

Constructor

new Thread(rootComment)

Source:

Create a comment thread object.

Parameters:
Name Type Description
rootComment Comment

Root comment of the thread.

Members

$expandNote :external:jQuery|undefined

Source:

Note in place of a collapsed thread that has a button to expand the thread.

Type:

isCollapsed :boolean

Source:

Is the thread collapsed.

Type:
  • boolean

Methods

(static) init(autocollapseopt)

Source:

Create threads. Can be re-run if DOM elements are replaced.

Parameters:
Name Type Attributes Default Description
autocollapse boolean <optional>
true

Autocollapse threads according to the settings and restore collapsed threads from the local storage.

(static) initPrototypes()

Source:

For internal use. Create element prototypes to reuse them instead of creating new elements from scratch (which is more expensive).

(static) updateLines()

Source:

For internal use. Calculate the offset and (if needed) add the thread lines to the container.

collapse(loadUserGendersPromiseopt, autoopt)

Source:

Collapse the thread.

Parameters:
Name Type Attributes Default Description
loadUserGendersPromise Promise.<undefined> <optional>
auto boolean <optional>
false

Automatic collapse - don't scroll anywhere and don't save collapsed threads.

expand(autoopt)

Source:

Expand the thread.

Parameters:
Name Type Attributes Default Description
auto boolean <optional>
false

Automatic expand - don't save collapsed threads.

getComments() → {Array.<Comment>}

Source:

Get all comments in the thread.

Returns:
Type
Array.<Comment>

hasMouseMoved(e) → {boolean}

Source:

Has the mouse moved enough to consider it a navigation gesture and not a click with an insignificant mouse movement between pressing and releasing a button.

Parameters:
Name Type Description
e MouseEvent
Returns:
Type
boolean