SimileAjax/API

From SIMILE Widgets
Jump to: navigation, search

Contents

SimileAjax

This set of methods bootstraps the bootstraps, providing methods to parse URL based parameters and to set up further loading of scripts and styling over the network.

Code: http://api.simile-widgets.org/ajax/2.2.1/simile-ajax-api.js

Back to SimileAjax.

Attributes

SimileAjax.loaded

Type: boolean
Default: false
Description: Internal flag for whether all sub-components have been loaded.

SimileAjax.loadingScriptsCount

Type: int
Default: 0
Description: Internal counter for how many scripts have been loaded.

SimileAjax.error

Type: string
Default: undefined
Values: throw
Description: If set to throw, SimileAjax debugging uses the built-in error handling environment. If anything else, SimileAjax takes over all error handling.

SimileAjax.params

Type: array
Default: { bundle: 'true', error: undefined }
Description: Defaults for public interface to changing SimileAjax settings through the URL by which it was called. URL parameters matching the keys can be appended to the script that calls SimileAjax.

SimileAjax.version

Set in SimileAjax/Platform

Type: string
Default: 2.2.2
Description: Advertises version number of SimileAjax.

SimileAjax.jQuery

Set in SimileAjax/Platform

Type: object
Default: jQuery object
Description: Given jQuery is loaded, assigns it here and takes over window context jQuery if not already defined.

SimileAjax.urlPrefix

Set by SimileAjax_urlPrefix

SimileAjax_urlPrefix

The underscore is correct.

Type: string
Default: undefined
Description: If set in calling context, predetermines the HTTP host and path where SimileAjax is found.

SimileAjax_onLoad

The underscore is correct. Used in SimileAjax/Signal

Type: string or function
Default: undefined
Description: A function to be run after all SimileAjax Javascript files have been loaded.

Methods

getHead

This method is not inside the SimileAjax namespace.

Arguments:
doc: Document
Returns: Node
Description: Locates the head element using DOM interaction.

SimileAjax.findScript

Arguments:
doc: Document
substring: string, the name of the script
Returns: string, or null
Description: Returns the full URL of any script element in the head that partially matches the substring.

SimileAjax.includeJavascriptFile

Arguments:
doc: Document
url: string, The absolute URL of the file to include
onerror: string, A function definition for what to do if there's an error in loading the script
charset: string, The character set of the file
Returns: Node, The added script node
Description: Includes one Javascript file in a document.

SimileAjax.includeJavascriptFiles

Arguments:
doc: Document
urlPrefix: string, The URL host and path to prefix to each filename
filenames: array, A list of strings of relative filenames
Returns: Nothing; side effect modifies document
Description: Includes several Javascript files at once, making use of the signalling apparatus for judging when all have been loaded.

SimileAjax.includeCssFile

Arguments:
doc: Document
url: string, The absolute URL of the CSS file to include
Returns: Node, The added link node
Description: Includes on CSS file in a document.

SimileAjax.includeCssFiles

Arguments:
doc: Document
urlPrefix: string, The URL host and path to prefix to each filename
filenames: array, A list of strings of relative filenames
Returns: Nothing; side effect modifies document
Description: Includes several CSS files at once.

SimileAjax.prefixURLs

Arguments:
urls: array
urlPrefix: string
suffixes: array
Returns: Nothing; side effect modifies urls argument
Description: Append into urls each string in suffixes after prefixing it with urlPrefix.

SimileAjax.parseURLParameters

Arguments:
url: string, The URL to parse, or location.href if undefined
to: object (optional), Object to extend with parsed parameters
types: object (optional), Object mapping keys to value types (String, Number, Boolean, or Array; String by default)
Returns: object, A key/value object whose keys are the query parameter names
Description: Parse out the query parameters from a URL.

Back to SimileAjax.

Personal tools
Namespaces
Variants
Actions
Navigation
Toolbox