Namespace $sf.vend
$sf.vend The vendor / client API for functionality inside a SafeFrame
Method Summary
Method Detail
-
<static> $sf.vend.collapse()Collapse the SafeFrame container after having called to expand. If no previous call to expand has been made, this call will do nothing.
-
<static> {Boolean} $sf.vend.expand(deltaXorDesc, deltaY)Make a request to expand the SafeFrame container to a certain size. Note that you may only call $sf.vend.expand to expand to the largest size needed, followed by calling collapse (and then repeat the same process if needed). Tweening or animation done, should be reserved for your own content, and you cannot make multiple calls to expand without a corresponding collapse.
- Parameters:
- {Number|Object} deltaXorDesc
- If a number is specifed, SafeFrame will grow in size by this amount in pixels along the horizontal axis. Specifiy a negative value to grow to the left, and a postive value to grow to the right.
If an object is specified, it should contain "t","l","r","b" properties (top,left,bottom,right) for the amount in pixels to grow the container in each dimension - {Number} deltaXorDesc.t
- Specifies to shift the top position of the SafeFrame container by the number of pixels specified. A negative value will shift the top higher on the screen, positive value shifts the top lower on the screen
- {Number} deltaXorDesc.l
- Specifies to shift the left position of the SafeFrame container by the number of pixels specified.
- {Number} deltaXorDesc.b
- Specifies to shift the bottom position of the SafeFrame container by the number of pixels specified. A negative value will shift the bottom higher on the screen, positive value shifts the bottom lower on the screen.
Can be used in conjuction with deltaXorDesc.t, to effectively make the overall height of the SafeFrame taller or shorter. - {Number} deltaXorDesc.r
- Specifies to shift the left position of the SafeFrame container by the number of pixels specified.
Can be used in conjuction with deltaXorDesc.l to effectively make the overall width of the SafeFrame wider or narrower. - {Number} deltaY
- If a number is specifed, SafeFrame will grow in size by this amount in pixels along the vertical axis. Specifiy a negative value to grow to the top, and a postive value to grow to the bottom.
Note that this value is ignored if deltaXorDesc is passed in as an object.
- Returns:
- {Boolean} true/false if the request to expand the container was sent. This does not mean that expansion is complete as expansion is an asynchronous process. Pass in a callback function to $sf.vend.register to get status updates.
-
<static> {Object} $sf.vend.geom()Return geometric information about the SafeFrame container and it's status within a page
- Returns:
- {Object} geom_info
-
<static> {String} $sf.vend.hostURL()Return the known good publisher host URL, stripped of query string / hash values
- Returns:
- {String}
-
<static> {Number} $sf.vend.inView()Return the percentage that the SafeFrame container is viewable within the browser window
- Returns:
- {Number}
-
<static> {String} $sf.vend.meta(propName, owner_key)Return meta-data information that may have been specified by the publisher / host.
- Parameters:
- {String} propName
- the key name of the meta-data value to be retrieved
- {String} owner_key Optional
- the super key name of the data to be retrieved
- Returns:
- {String} The value of some meta-data that may have been specified by the publisher / host or "".
-
<static> $sf.vend.register(initWidth, initHeight, notify)Intialize the SafeFrame vendor/client API, so that other features may be used This method MUST be called prior to using any other rich-media functionality (like expansion).
- Parameters:
- {Number} initWidth
- The initial width (in pixels) expected of the content within the SafeFrame container
- {Number} initHeight
- The initial height (in pixels) expected of the content within the SafeFrame container
- {Function} notify Optional
- A callback function that content can specify to be notified of status updates
-
<static> {String} $sf.vend.status()Return the current status of the SafeFrame container, in cases where a command may be pending. If an empty string is returned ("") container is idle.
- Returns:
- {String} of any pending status, otherwise empty string.
-
<static> {Boolean|Object} $sf.vend.supports(key)Return whether or not a particular feature is supported, or an object containing key/value pairs denoting all features and whether or not they are supported By default SafeFrames version 1 supports the following feature: "exp-ovr": Expansion of the container by overlaying on top of other content Later in other versions there are expexted to be more feature with their own string name, that can be checked by the content in the SafeFrame, so that it knows what things can be done.
- Parameters:
- {String} key Optional
- If specifed, checks to see if that specific feature has been enabled
- Returns:
- {Boolean|Object}