pb


Methods:

active_ajax_calls
data
help_icon
item
loading
size
unsaved_changes

Direct Link

active_ajax_calls

( )
Returns the number of AJAX calls that are currently in progress.

Returns

Number
The number of active AJAX calls.

Direct Link

data

( key, [value] )
Retrieve or set key/value pairs of arbitrary data. You can store a single key/value pair or multiple key/value pairs. When using the multiple pair form, omitting the value of any item will delete the existing data in that item.

Example:
// Single
pb.data(key, value);

// Multiple
pb.data([ [key,value], [key,value] ]);

Parameters

  • key String|Array
    The identifying string with which this data is stored and can be retrieved, or if using the multiple syntax, an array of key/value pairs.
  • [value] String|Number|Array|Object Optional
    The value to store under the given key. (if value is not supplied, the existing value in the key, if any, will be returned)

Returns

Object|null
If value is supplied, nothing will be returned. If value is not supplied, the existing value will be returned. If the existing value cannot be found, null will be returned.

Direct Link

help_icon

( text )
Returns a help icon with the given text. The icon is returned as a jQuery element, which can be directly inserted into the DOM.

Parameters

  • text String
    The text for this help icon.

Returns

JQuery Object
A jQuery element help icon ready for DOM insertion.

Direct Link

item

( type, ID, [key], [value] )
Returns a handle to the ProBoards item object with the given ID.

Parameters

  • type String
    The item's type, e.g., thread, post, user, etc.
  • ID String
    The item's ID.
  • [key] String Optional
    The key of the value you want to overwrite. If left out, the value in this item will be returned.
  • [value] String Optional
    The value to which you want to set this item. If key is set and this isn't set, this function will overwrite the entire item object.

Returns

Object|null
If only type and id are passed in, this function will return a proboards item object or null if it doesn't exist.

Direct Link

loading

( [element], flag )
Creates a loading overlay or dialog on a specific element.

Parameters

  • [element] String Optional
    A jQuery selector string defining the element(s) you want to have covered by the overlay. If nothing is supplied, a loading dialog will be generated as well.
  • flag Boolean
    If true, turns the overlay or dialog on. If false, turns the overlay or dialog off.

Direct Link

size

( object )
Calculates the number of elements in an object. This utility function is preferred over manually looping, since it automatically handles the exclusion of properties, which can lead to unexpected results in certain browsers.

Parameters

  • object Object
    The object whose size you are interested in.

Returns

Number
The size of the object.

Direct Link

unsaved_changes

( )
Returns a flag for determining whether or not there are unsaved changes on this page.

Returns

Boolean
True means there are unsaved changes, false means there are no unsaved changes.