Skip to main content

listManager

pb.listManager(listType)

Return the manager object for the specified list type on the current page.

Returns: ListManager - ListManager

ParamTypeDescription
listTypestringThe type of list manager to return

ListManager

A listManager contains functions for handling lists throughout the forum. These can be lists of threads, posts, conversations, messages, or members.

Methods

bindEvent

listManagerInstance.bindEvent(params)

Bind an event to a selector

ParamTypeDefaultDescription
paramsObjectEvent Parameters
[params.selector]stringSelector to bind to, defaults to selector in settings
[params.events]string"CLICK_TOUCH_EVENTS"Events to bind, defaults to "click"
[params.callback]functionfunction(listManager, event, domItem, params) {}Callback function

initBindEvents

listManagerInstance.initBindEvents()

Binds default events on init

registerEventCallback

listManagerInstance.registerEventCallback(event, callback)

Register a callback to an event. The event will be chained and the function immediately executed

Returns: ListManager - listManager

ParamTypeDescription
eventstringThe event name
callbackstringThe function to execute when the event is called

onListChange

listManagerInstance.onListChange()

A function automatically called upon changes being made to the list that executes the default events bound to the listManager

getFirstIdOnPage

listManagerInstance.getFirstIdOnPage()

Returns the ID of the first item in the list

Returns: string - Item ID

createSelectionHash

listManagerInstance.createSelectionHash()

Creates an empty object for storing selections of this type

getSelection

listManagerInstance.getSelection()

Get the entire selection

Returns: Array.<ListManager.Selection> - Selected Objects

getSelectionItems

listManagerInstance.getSelectionItems()

Get the selection of the current type

Returns: Array.<ListManager.Selection> - Selected Object

getSelectionIds

listManagerInstance.getSelectionIds()

Get selection IDs

Returns: Array - Array of selected IDs.

getSelectionObjects

listManagerInstance.getSelectionObjects()

Get selection Objects

Returns: Object - Hash of selected objects.

getSelectionDomItems

listManagerInstance.getSelectionDomItems()

Get selection items

Returns: Array - Array of selected DOM elements.

selectItemsByFilter

listManagerInstance.selectItemsByFilter(params)

Filter and select items by specific parameters

Returns: Array.<ListManager.Selection> - New selection after the filtering

ParamTypeDescription
paramsObjectParameters to filter by
params.filterstringThe property to filter by
[params.value]*The value the property must have. Defaults to non-zero.

addSelection

listManagerInstance.addSelection(selectionObject, params)

Add an item to the selection

Returns: ListManager - ListManager

ParamTypeDescription
selectionObjectListManager.SelectionA single selection item object
paramsObjectAny additional parameters

countSelection

listManagerInstance.countSelection()

Returns a count of all selected items of this type

Returns: number - Total selection count

countItems

listManagerInstance.countItems()

Counts the number of all items currently on the page

Returns: number - Total number of items on the page right now

updateItems

listManagerInstance.updateItems()

Updates items of this type in the ListManager cache

Returns: ListManager - ListManager

updateDomItems

listManagerInstance.updateDomItems()

Updates already selected items in the DOM

Returns: ListManager - ListManager

selectAll

listManagerInstance.selectAll()

Select all items on the page

Returns: ListManager - ListManager

selectDomItems

listManagerInstance.selectDomItems([domItems])

Selects all items in the DOM

Returns: ListManager - ListManager

ParamTypeDescription
[domItems]JQueryDOM items; leave empty for selecting all

selectDomItem

listManagerInstance.selectDomItem(domItem)

Select a single element in the DOM

Returns: ListManager - ListManager

ParamTypeDescription
domItemJQueryDOM item to select

selectItemById

listManagerInstance.selectItemById(id, [params])

Select an item by ID

Returns: ListManager - ListManager

ParamTypeDescription
idintID of item to select
[params]ObjectOptional parameters

selectItemsById

listManagerInstance.selectItemsById(ids, [params])

Selects items by many IDs

Returns: ListManager - ListManager

ParamTypeDescription
idsArray.<int>Array of IDs of item to select
[params]ObjectOptional parameters

deselectDomItem

listManagerInstance.deselectDomItem(domItem, [params])

Deselect a single element in the DOM

Returns: ListManager - ListManager

ParamTypeDescription
domItemjQueryDOM item to deselect
[params]JSONAdditional parameters

deselectDomItems

listManagerInstance.deselectDomItems([domItems], [params])

Deselects all items in the DOM

Returns: ListManager - ListManager

ParamTypeDescription
[domItems]JQueryDOM items to deselect
[params]JSONAdditional parameters

deselectItemById

listManagerInstance.deselectItemById(id, [params])

Deselects item by ID

Returns: ListManager - ListManager

ParamTypeDescription
idArray.<number>Array of IDs to deselect
[params]ObjectAdditional parameters

deselectItemsById

listManagerInstance.deselectItemsById(ids, [params])

Deselects items by ID

Returns: ListManager - ListManager

ParamTypeDescription
idsArray.<number>Array of IDs
[params]JSONAdditional parameters

deselectAll

listManagerInstance.deselectAll()

Deselects all items in selection

Returns: ListManager - ListManager

toggleSelectDomItem

listManagerInstance.toggleSelectDomItem($domItem)

Selects (if not selected) or deselects (if already selected) an item

Returns: ListManager - ListManager

ParamTypeDescription
$domItemjQueryItem to toggle selection

buildItemParams

listManagerInstance.buildItemParams(domItem)

Builds a hash with required item parameters

Returns: ListManager.Selection - A single selection item object

ParamTypeDescription
domItemJQueryDOM item

getDomItemId

listManagerInstance.getDomItemId(domItem)

Get ID of DOM object

Returns: int - Selected item ID

ParamTypeDescription
domItemjQueryDOM item to select

onSelectionUpdated

listManagerInstance.onSelectionUpdated()

Runs after a change in selection happens

onSelectionItemRemoved

listManagerInstance.onSelectionItemRemoved()

Runs after an item in selection is removed

onItemSelected

listManagerInstance.onItemSelected()

Runs when an item is selected

onItemDeselected

listManagerInstance.onItemDeselected()

Runs when an item is deselected

onItemRemoved

listManagerInstance.onItemRemoved()

Runs when an item is removed

removeSelectedItems

listManagerInstance.removeSelectedItems()

Removes selected items from the DOM and selection

Returns: ListManager - ListManager

removeDomItem

listManagerInstance.removeDomItem($domItem)

Removes item from the page and selection by its DOM element

Returns: ListManager - ListManager

ParamTypeDescription
$domItemJQueryItem to remove

removeItemById

listManagerInstance.removeItemById(id)

Removes item from the page and selection by its ID

Returns: ListManager - ListManager

ParamTypeDescription
idintID of item to remove

isDomItemSelected

listManagerInstance.isDomItemSelected(domItem, [type])

Check if an item is in selection by its DOM element

ParamTypeDescription
domItemJQueryDOM item
[type]stringType of item to find, defaults to the current manager's type

isIdSelected

listManagerInstance.isIdSelected(id, [type])

Check if an item is in selection by its ID

ParamTypeDescription
idintID of item to find
[type]stringType of item to find, defaults to the current manager's type

getSelectionStats

listManagerInstance.getSelectionStats()

Gets the properties of all currently selected items

Returns: Object - _stats

getThreadStats

listManagerInstance.getThreadStats(threadId)

Gets the properties of the specified thread ID

Returns: Object - _stats

ParamTypeDescription
threadIdintThe numerical ID of a forum thread

onMouseEnter

listManagerInstance.onMouseEnter(event, domItem)

Runs when an item is hovered over

ParamTypeDescription
eventObjectEvent object
domItemjQueryDOM item

onMouseLeave

listManagerInstance.onMouseLeave(event, domItem)

Runs when an item is no longer hovered over

ParamTypeDescription
eventObjectEvent object
domItemjQueryDOM item
listManagerInstance.goToClickableLink(domItem, linkSelector, newWindow)

Navigates to the location found in the item's specified link selector

ParamTypeDescription
domItemjQueryDOM item
linkSelectorstringCSS selector for the link to target
newWindowbooleanBoolean indicating whether to open the link in a new window

handleClickablePaths

listManagerInstance.handleClickablePaths(event, domItem)

Checks the listManager settings for all clickableElements bindings that are set and handles the redirection for those elements when they are clicked.

ParamTypeDescription
eventObjectThe event forwarded by the callback
domItemjQueryDOM item

scrollToTopOfListing

listManagerInstance.scrollToTopOfListing()

Scrolls the window upward until the first item of the listing is in view.

selectRead

listManagerInstance.selectRead()

Selects all read items in the conversation list

selectUnread

listManagerInstance.selectUnread()

Selects all unread items in the conversation list

selectReadThreads

listManagerInstance.selectReadThreads()

Selects all read items in the thread list

selectUnreadThreads

listManagerInstance.selectUnreadThreads()

Selects all unread items in the thread list