Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.
Comment: Reverted from v. 1

...

The public JavaScript events are placed on the RefinedWiki API namespace: RWA.

This is divided into sub-namespaces based depending on functionality. The available namespaces 

RWA.Category 

ui-expand
titlehideUserCategory

/**

 * Hides the user category link located in the category menu.

 * Also removes all User category dropdowns

 * @return void - no return value

 */

RWA.Category.hideUserCategory = function();


ui-expand
titlehideInlineUserCategoryDialogs

/**

 * Hides all inline user category inline dialogs. Note that this won't hide users associated with a top level

 * category, only open dialogs refering to subcategories.

 */

RWA.Category.hideInlineUserCategoryDialogs = function();


expand
ui-expand
titlehideCategory
Expand

/**

 * Hides any open category by closing the category dropdown and any open

 * user category dialogs. This function will trigger a 

 * 'rw-categories:category-dropdown-closed' event.

 *

 * @return the ID selector for the DOM element representing the closed 

 * category. On the form rw_category_key_{categoryKey}

 */

RWA.Category.hideCategory = function();

Expand

Expand
Ui expand
titlehideCategory


Ui expand
titleshowCategory

/**

 * Shows the requested top level category by opening its category 

 * dropdown. Will trigger 'rw-categories:category-dropdown-open' event.

 * @param key - nameKey of the category to open.

 * @param expandAll - True or false depending on if the containing 

 * subcategories in the dropdown should be expanded or collapsed. Usable 

 * if collapsed mode is used.

 * @param callback - Callback function for when the dropdown content has

 * been rendered. If supplied this will be called with two parameters:

 *

 * $el - the category dropdown wrapper as jQuery object.

 * category - JSON object representing the category just opened - with 

 * any fetched data populated as well.

 *

 * @return boolean - True if the category with the specified key was 

 * found - false otherwise. Use the callback function to get relevant values.

 */

RWA.Category.showCategory = function(key, expandAll, callback);




Ui expand
titletoggleSubCategory

/**

 * Toggles the requested subcategory by collapsing/expanding it.

 * @param subCategory - Either the key of the subcategory e.g. 'subKey' 

 * or the entire jQuery selector string e.g. 'rw_sub_category_key_subKey', 

 * or the jQuery object itself e.g. $('#rw_sub_category_key_subKey')

 *

 * Will trigger a 'rw-categories:category-opened' or a 

 * 'rw-categories:category-closed' event depending on the result of the 

 * toggle.

 * @returns void - no return value

 */

RWA.Category.toggleSubCategory(subCategory);


Ui expand
titlegetActiveCategoryKey

/**

 * Returns the key of the active top level category. A category is active

 * if a user is viewing any content placed in that top level category. This 

 * includes subcategories, category dashboards, or content placed in that 

 * category or any subcategory, such as a space or a blog. The category 

 * doesn't have to be open - i.e. showing a dropdown to be concidered 

 * 'active'.

 *

 * @return string representation of the active category key. The element for

 * that category can then be reached at #rw_category_key_{categoryKey}

 */

RWA.Category.getActiveCategoryKey();


Ui expand
titlesettings

From version 5.0.2


/**

 * Returns the settings associated to the categories and category menu. 

 * This will be an object with keys and associated values. Some examples are

 * collapsedSubCategories - boolean flag for if collapsed categories are used.

 * showSpaceLogo - true if space logos are shown.

*/

RWA.Category.settings;

RWA.Page

Ui expand
titleisFullscreen

From version 5.0.5

/**

 * Returns true if we are currently in fullscreen mode.

 */

RWA.Page.isFullscreen();


...

Ui expand
titleCategory menu loaded

// Triggered when the top navigation has been populated with the top-level categories.

AJS.bind('rw-categories:menu-loaded', function(e, $el, categories){ });


$el -
jQuery object representing the DOM element containing the category menu. This also includes the first 'Dashboard' item if present.e - jQuery Event

categories - JSON Array containing all categories loaded in the navigation menu. See other category events for category attributes.

...

Ui expand
titleCollapsed category opened

// Triggered when a collapsable (sub)category is opened within the category dropdown.

// Opening a subcategory will load and render it's content. If the category previously

// has loaded the content is just showed as it's already present in the DOM.

AJS.bind('rw-categories:category-opened', function(e, $el, category){ });


$el -
jQuery object representing the DOM element containing the category that has been opened.e - jQuery Event

category - JSON object representing the category in question. Some useful attributes include:

  • canEdit: boolean boolean
  • children:
  •  Array
  •  Array
  • link:
  •  Object
  •  Object
  • name: string
  • nameKey: string string
  • parentKey: string string
  • subCategories:
  •  Array
  •  Array
  • themeId: int
  • type: string string


Ui expand
titleCollapsed category closed

// Triggered when a collapsable (sub)category is closed within the category dropdown.

// Closing a subcategory will just hide its content rather than delete it - in order to

// be able to re-render without having to re-fetch the content.

AJS.bind('rw-categories:category-closed', function(e, $el, category){ });


$el -
jQuery object representing the DOM element containing the category that has been closed.e - jQuery Event

category - JSON object representing the category in question. Some useful attributes include:

  • canEdit: boolean boolean
  • children:
  •  Array
  •  Array
  • link:
  •  Object
  •  Object
  • name: string
  • nameKey: string string
  • parentKey: string string
  • subCategories:
  •  Array
  •  Array
  • themeId: int
  • type: string string


Ui expand
titleCategory dropdown open

// Triggers when the category dropdown is opened. At this stage the $el will contain all category elements that will be populated with data.

// If the user is using collapsed subcategories, these elements will only contain the expandable header of the category. In those cases you

// could listen to rw-categories:category-opened and rw-categories:category-closed to get info on when the collapsed categories are toggled.

AJS.bind('rw-categories:category-dropdown-open', function(e, $el, category){ });  


e - jQuery Event

$el - jQuery object representing the DOM element containing the dropdown wrapper that has been opened.

category - JSON object representing the category in question. Some useful attributes include:

  • canEdit: boolean boolean
  • children:
  •  Array
  •  Array
  • link:
  •  Object
  •  Object
  • name: string
  • nameKey: string string
  • parentKey: string string
  • subCategories:
  •  Array
  •  Array
  • themeId: int
  • type: string string


Ui expand
titleCategory dropdown closed

// Triggered when the category dropdown is hidden

// selector == rw_category_key_{categoryKey}

// Denotes the id-attribute of the element that has been hidden.

AJS.bind('rw-categories:category-dropdown-closed', function(e, $el, category){ });


e - jQuery Event

$el - jQuery object representing the DOM element containing the dropdown wrapper that has been closed.

category - JSON object representing the category in question. Some useful attributes include:

  • canEdit: boolean boolean
  • children:
  •  Array
  •  Array
  • link:
  •  Object
  •  Object
  • name: string
  • nameKey: string string
  • parentKey: string string
  • subCategories:
  •  Array
  •  Array
  • themeId: int
  • type: string string

 

rw-page events

 

Ui expand
titleFullscreen toggle

// Triggered when the fullscreen feature is opened or closed

AJS.bind('rw-page:fullscreen-toggle', function(e, $el, isFullscreen) {  });


$el -
jQuery object representing the DOM element containing the page. div#rw_main_column.e - jQuery Event

isFullscreen - true if the page is currently in fullscreen

...