JavaScript API

Table of Contents

Component Recite
Method: Recite.GetUrl
Method: Recite.HasCss
Method: Recite.LoadCss
Method: Recite.LoadScript
Component Recite_Ajax
Method: Recite_Ajax.Ajax
Method: Recite_Ajax.Error
Method: Recite_Ajax.Get
Method: Recite_Ajax.Post
Method: Recite_Ajax.Success
Component Recite_Dialog
Method: Recite_Dialog.Alert
Method: Recite_Dialog.Confirm
Method: Recite_Dialog.ConfirmFromUrl
Method: Recite_Dialog.FromAjax
Method: Recite_Dialog.SelectorFromJSON
Component Recite_DragDrop
Method: Recite_DragDrop.BuildDragContainer
Method: Recite_DragDrop.GetDragInfo
Component Recite_Form
Method: Recite_Form.ClearErrors
Method: Recite_Form.CreateWysiwyg
Method: Recite_Form.PopulateErrors
Method: Recite_Form.SerializeToObject
Method: Recite_Form.ShowFormSuccess
Method: Recite_Form.SubmitViaAjax
Component Recite_Tree
Method: Recite_Tree.GetDefaultOptions
Method: Recite_Tree.GetId
Method: Recite_Tree.SetId
Component Recite_Util
Method: Recite_Util.GetHighlightMessage
Method: Recite_Util.UrlGenerator
Method: Recite_Util.Urlize

This section documents the various JavaScript components that are available to widget developers.

Component Recite

This components contains a number of useful helper functions core to the operation of Recite CMS widgets. There are additional utility methods that can be used in Recite_Util.

Method: Recite.GetUrl

<static> {String} Recite.GetUrl(target)

Get a real Recite CMS URL based on a string in module:controller:action syntax

var url = Recite.GetUrl('assets:asset:upload');
  • Parameters:

    • String target - The URL in module:controller:action syntax

  • Returns:

    • String The real URL that can be used for links or Ajax requests

Method: Recite.HasCss

<static> {Bool} Recite.HasCss(path)

Check if the CSS file with the given path has been loaded

if (Recite.HasCss('/path/to/styles.css')) { ... }
  • Parameters:

    • String path - The path of the CSS script to check for

  • Returns:

    • Bool Returns true if the CSS file has previously been loaded, false if not.

Method: Recite.LoadCss

<static> Recite.LoadCss(path)

Loads a CSS file. If the file has already been loaded it will not be loaded again.

Recite.LoadCss('path/to/styles.css');
  • Parameters:

    • String path - The path of the CSS file to load

  • Returns: Void

Method: Recite.LoadScript

<static> Recite.LoadScript(path, fn)

Load a JavaScript script based on the specified path. If the script has already dynamically been loaded with this function it will not be loaded again but the callback function will be called again.

Recite.LoadScript('/path/to/script.js, function() {
    alert('script is loaded!');
});
  • Parameters:

    • String path - The path to the script to load

    • Function fn - Optional - The function to call when the script has loaded. Accepts no arguments

  • Returns: Void