listManager
pb.listManager(listType)
Return the manager object for the specified list type on the current page.
Returns: ListManager
- ListManager
Param | Type | Description |
---|---|---|
listType | string | The 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
- initBindEvents
- registerEventCallback
- onListChange
- getFirstIdOnPage
- createSelectionHash
- getSelection
- getSelectionItems
- getSelectionIds
- getSelectionObjects
- getSelectionDomItems
- selectItemsByFilter
- addSelection
- countSelection
- countItems
- updateItems
- updateDomItems
- selectAll
- selectDomItems
- selectDomItem
- selectItemById
- selectItemsById
- deselectDomItem
- deselectDomItems
- deselectItemById
- deselectItemsById
- deselectAll
- toggleSelectDomItem
- buildItemParams
- getDomItemId
- onSelectionUpdated
- onSelectionItemRemoved
- onItemSelected
- onItemDeselected
- onItemRemoved
- removeSelectedItems
- removeDomItem
- removeItemById
- isDomItemSelected
- isIdSelected
- getSelectionStats
- getThreadStats
- onMouseEnter
- onMouseLeave
- goToClickableLink
- handleClickablePaths
- scrollToTopOfListing
- selectRead
- selectUnread
- selectReadThreads
- selectUnreadThreads
bindEvent
listManagerInstance.bindEvent(params)
Bind an event to a selector
Param | Type | Default | Description |
---|---|---|---|
params | Object | Event Parameters | |
[params.selector] | string | Selector to bind to, defaults to selector in settings | |
[params.events] | string | "CLICK_TOUCH_EVENTS" | Events to bind, defaults to "click" |
[params.callback] | function | function(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
Param | Type | Description |
---|---|---|
event | string | The event name |
callback | string | The 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
Param | Type | Description |
---|---|---|
params | Object | Parameters to filter by |
params.filter | string | The 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
Param | Type | Description |
---|---|---|
selectionObject | ListManager.Selection | A single selection item object |
params | Object | Any 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
Param | Type | Description |
---|---|---|
[domItems] | JQuery | DOM items; leave empty for selecting all |
selectDomItem
listManagerInstance.selectDomItem(domItem)
Select a single element in the DOM
Returns: ListManager
- ListManager
Param | Type | Description |
---|---|---|
domItem | JQuery | DOM item to select |
selectItemById
listManagerInstance.selectItemById(id, [params])
Select an item by ID
Returns: ListManager
- ListManager
Param | Type | Description |
---|---|---|
id | int | ID of item to select |
[params] | Object | Optional parameters |
selectItemsById
listManagerInstance.selectItemsById(ids, [params])
Selects items by many IDs
Returns: ListManager
- ListManager
Param | Type | Description |
---|---|---|
ids | Array.<int> | Array of IDs of item to select |
[params] | Object | Optional parameters |
deselectDomItem
listManagerInstance.deselectDomItem(domItem, [params])
Deselect a single element in the DOM
Returns: ListManager
- ListManager
Param | Type | Description |
---|---|---|
domItem | jQuery | DOM item to deselect |
[params] | JSON | Additional parameters |
deselectDomItems
listManagerInstance.deselectDomItems([domItems], [params])
Deselects all items in the DOM
Returns: ListManager
- ListManager
Param | Type | Description |
---|---|---|
[domItems] | JQuery | DOM items to deselect |
[params] | JSON | Additional parameters |
deselectItemById
listManagerInstance.deselectItemById(id, [params])
Deselects item by ID
Returns: ListManager
- ListManager
Param | Type | Description |
---|---|---|
id | Array.<number> | Array of IDs to deselect |
[params] | Object | Additional parameters |
deselectItemsById
listManagerInstance.deselectItemsById(ids, [params])
Deselects items by ID
Returns: ListManager
- ListManager
Param | Type | Description |
---|---|---|
ids | Array.<number> | Array of IDs |
[params] | JSON | Additional 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
Param | Type | Description |
---|---|---|
$domItem | jQuery | Item to toggle selection |
buildItemParams
listManagerInstance.buildItemParams(domItem)
Builds a hash with required item parameters
Returns: ListManager.Selection
- A single selection item object
Param | Type | Description |
---|---|---|
domItem | JQuery | DOM item |
getDomItemId
listManagerInstance.getDomItemId(domItem)
Get ID of DOM object
Returns: int
- Selected item ID
Param | Type | Description |
---|---|---|
domItem | jQuery | DOM 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
Param | Type | Description |
---|---|---|
$domItem | JQuery | Item to remove |
removeItemById
listManagerInstance.removeItemById(id)
Removes item from the page and selection by its ID
Returns: ListManager
- ListManager
Param | Type | Description |
---|---|---|
id | int | ID of item to remove |
isDomItemSelected
listManagerInstance.isDomItemSelected(domItem, [type])
Check if an item is in selection by its DOM element
Param | Type | Description |
---|---|---|
domItem | JQuery | DOM item |
[type] | string | Type 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
Param | Type | Description |
---|---|---|
id | int | ID of item to find |
[type] | string | Type 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
Param | Type | Description |
---|---|---|
threadId | int | The numerical ID of a forum thread |
onMouseEnter
listManagerInstance.onMouseEnter(event, domItem)
Runs when an item is hovered over
Param | Type | Description |
---|---|---|
event | Object | Event object |
domItem | jQuery | DOM item |
onMouseLeave
listManagerInstance.onMouseLeave(event, domItem)
Runs when an item is no longer hovered over
Param | Type | Description |
---|---|---|
event | Object | Event object |
domItem | jQuery | DOM item |
goToClickableLink
listManagerInstance.goToClickableLink(domItem, linkSelector, newWindow)
Navigates to the location found in the item's specified link selector
Param | Type | Description |
---|---|---|
domItem | jQuery | DOM item |
linkSelector | string | CSS selector for the link to target |
newWindow | boolean | Boolean 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.
Param | Type | Description |
---|---|---|
event | Object | The event forwarded by the callback |
domItem | jQuery | DOM 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