Dom.copyassets() – Adobe Dreamweaver API Reference CS5 User Manual
Page 341

336
DREAMWEAVER API REFERENCE
Page content
Last updated 8/27/2013
Example
function objectTag()
{
.
.
.
var dom = dw.getDocumentDOM();
var id = dwscripts.getUniqueId("accordion");
var code = "new Accordion('" + id + "',250,{duration:200,step:20})";
dom.addJavaScript(code, false);
return retVal;
}
dom.copyAssets()
Availability
Dreamweaver CS3, and updated in CS4.
Description
An extension author can use this API to copy external dependent files to the site of the user. The author can also add
the necessary file references into the head of the page.
Arguments
assetArray
An array of JavaScript objects. Each JavaScript object has
srcURL
,
destURL
,
referenceType
,
useDefaultFolder
,
and
documentRelative
fields.
•
The
srcURL
argument is a path to the asset, expressed as a
file://URL
.
•
The destURL
argument is a relative path specifying the location to copy the asset to. What
destURL
is relative to
depends on the value of
useDefaultFolder
. If
useDefaultFolder
is
true
, the path is relative to the default Asset
folder. If
useDefaultFolder
is
false
, the path is relative to the site root. If the site is not defined, the path is
relative to the document. See the
useDefaultFolder
description.
•
The referenceType
argument is necessary for the extension author to insert a file reference into the head. The
valid values for
referenceType
are as follows:
•
link
to insert a
LINK
tag for an external CSS file
•
import
to insert a
STYLE
tag with
@import
•
javascript
to insert a
SCRIPT
tag with
type=text/javascript
•
vbscript
to insert a
SCRIPT
tag with
type=text/vbscript
•
""
not to insert a reference in the head
•
The useDefaultFolder
argument is a Boolean value that indicates whether the path specified in
destURL
is
relative to the default Assets folder. When the value is
false
, meaning that this property is not set,
destURL
is
assumed to be relative to the site root. If the site is not defined,
destURL
is assumed to be relative to the document.
The default value of this argument is
false
.
•
The documentRelative
argument is a Boolean value. The default value is
false
. When this parameter is
false
,
the assets are copied to the folder specified in
destURL
relative to the site root, when the file is saved in a site. If the
value is
true,
then the assets are copied to the path specified in
destURL
relative to the document.