Library: gadgets001.js
Overview
This library augments gadgets.window with functionality to change the height of a gadget dynamically.
Constructors
gadgets.Prefs(
opt_moduleId)
Creates a new Prefs object.
parameters
| String, Number |
opt_moduleId |
An optional parameter specifying the module id to create prefs for; if not provided, the default module id is used |
methods
Namespaces
Provides general-purpose utility functions.
methods
Provides remote content retrieval functions.
methods
Provides operations for translating objects to and from JSON.
methods
Provides operations for getting information about and modifying the window the gadget is placed in.
methods
Functions
Gets the feature parameters.
parameters
| String |
feature |
The feature to get parameters for |
returns
| Object |
The parameters for the given feature, or null |
Returns whether the current feature is supported.
parameters
| String |
feature |
The feature to test for |
returns
| Boolean |
True if the feature is supported |
Registers an onload handler.
parameters
| Function |
callback |
The handler to run |
Fetches content from the provided URL and feeds that content into the callback function. Example:
gadgets.io.makeRequest(url, fn,
{contentType: gadgets.io.ContentType.FEED});
parameters
| String |
url |
The URL where the content is located |
| Function |
callback |
The function to call with the data from the URL once it is fetched |
| Map.<gadgets.io.RequestParameters, Object> |
opt_params |
Additional parameters to pass to the request |
Converts an input object into a URL-encoded data string. (key=value&...)
parameters
| Object |
fields |
The post fields you wish to encode |
returns
| String |
The processed post data in www-form-urlencoded format. |
Gets the proxy version of the passed-in URL.
parameters
| String |
url |
The URL to get the proxy URL for |
returns
| String |
The proxied version of the URL |
Retrieves a preference as a string.
parameters
| String |
key |
The preference to fetch |
returns
| String |
The preference; if not set, an empty string |
Retrieves a preference as an integer.
parameters
| String |
key |
The preference to fetch |
returns
| Number |
The preference; if not set, 0 |
Retrieves a preference as a floating-point value.
parameters
| String |
key |
The preference to fetch |
returns
| Number |
The preference; if not set, 0 |
Retrieves a preference as a boolean.
parameters
| String |
key |
The preference to fetch |
returns
| Boolean |
The preference; if not set, false |
Stores a preference. To use this call, the gadget must require the feature setprefs.
Note: If the gadget needs to store an Array it should use setArray instead of this call.
parameters
| String |
key |
The pref to store |
| Object |
val |
The values to store |
Retrieves a preference as an array. UserPref values that were not declared as lists are treated as one-element arrays.
parameters
| String |
key |
The preference to fetch |
returns
| Array.<String> |
The preference; if not set, an empty array |
Stores an array preference. To use this call, the gadget must require the feature setprefs.
parameters
| String |
key |
The pref to store |
| Array |
val |
The values to store |
Fetches an unformatted message.
parameters
| String |
key |
The message to fetch |
returns
Gets the current country, returned as ISO 3166-1 alpha-2 code.
returns
| String |
The country for this module instance |
Gets the current language the gadget should use when rendering, returned as a ISO 639-1 language code.
returns
| String |
The language for this module instance |
Gets the module id for the current instance.
returns
| String, Number |
The module id for this module instance |
Converts a JavaScript value to a JSON string.
parameters
| Object |
v |
The object to convert |
returns
| String |
The JSON equivalent |
Parses a JSON string, producing a JavaScript value.
parameters
| String |
text |
The string to transform into an object — usually the result of a previous stringify call |
returns
| Object |
The object parsed from the passed in text; false if an error occurred |
Detects the inner dimensions of a frame. See: http://www.quirksmode.org/viewport/compatibility.html for more information.
returns
| Object |
An object with width and height properties. |
Adjusts the gadget height
parameters
| Number |
opt_height |
An optional preferred height in pixels. If not specified, will attempt to fit the gadget to its content. |
Objects
Implements the gadgets.views API spec. See http://code.google.com/apis/gadgets/docs/reference/gadgets.views.html