Adobe 38040334 - Dreamweaver CS3 User Manual page 196

Extending dreamweaver
Hide thumbs Also See for 38040334 - Dreamweaver CS3:
Table of Contents

Advertisement

<html>
<head>
<title>List Images</title>
3
At the end of the file, add the
<script src="../Reports.js"></script>
At the end of the file, add another
4
attribute.
src
<html>
<head>
<title>List Images</title>
<script src="../Reports.js"></script>
<script src="List Images.js"></script>
Close the
tag, include opening and closing
5
head
</head>
<body>
</body>
</html>
Save the file as List Images.js in the Configuration/Reports/HTML Reports folder.
6
Writing the JavaScript code
Dreamweaver includes the Reports.js file. You can call any of the functions in Reports.js. However, you also have to
create the JavaScript file that contains any functions that are specific to your custom site report.
To create the JavaScript file:
Create the file Configuration/Reports/HTML Reports/List Images.js, with the following content:
1
// Function: configureSettings
// Description: Standard report API, used to initialize and load
//the default values. Does not initialize the UI.
//
function configureSettings() {
return false;
}
// Function: processFile
// Description: Report command API called during file processing.
//
function processFile (fileURL) {
if (!isHTMLType(fileURL)) //If the file isn't an HTML file
return;
var curDOM = dw.getDocumentDOM(fileURL);
var tagList = curDOM.getElementsByTagName('img'); // Variable for img tags
var imgfilename; // Variable for file name specified in img tag
for (var i=0; i < tagList.length; i++) { // For img tag list
imgfilename = tagList[i].getAttribute('src'); // Get image filename
if (imgfilename != null) { // If a filename is specified
// Print the appropriate icon, HTML filename,
// image filename, and line number
tag and specify the Reports.js file in the
script
tag and specify the List Images.js file, which you will create next, in the
script
tags, and close the
body
//skip it.
attribute.
src
tag.
html
// Variable for DOM
DREAMWEAVER CS3
190
Extending Dreamweaver

Advertisement

Table of Contents
loading

This manual is also suitable for:

Dreamweaver cs3

Table of Contents