Adobe Extending Dreamweaver CS4 Bedienungsanleitung Seite 204

  • Herunterladen
  • Zu meinen Handbüchern hinzufügen
  • Drucken
  • Seite
    / 387
  • Inhaltsverzeichnis
  • LESEZEICHEN
  • Bewertet. / 5. Basierend auf Kundenbewertungen
Seitenansicht 203
198
EXTENDING DREAMWEAVER CS4
Reports
function stdaloneresultwin()
{
var curDOM = dw.getDocumentDOM("document");
var tagList = curDOM.getElementsByTagName('img');
var imgfilename;
var iOffset = 0;
var iLineNumber = 0;
var resWin = dw.createResultsWindow("Images in File", ["Line", "Image"]);
for (var i=0; i < tagList.length; i++)
{
// Get the name of the source file.
imgfilename = tagList[i].getAttribute('src');
// Get the character offset from the start of the file
// to the start of the img tag.
iOffset = curDOM.nodeToOffsets(curDOM.images[i]);
// Based on the offset, figure out what line in the file
// the img tag is on.
iLineNumber = curDOM.getLineFromOffset(iOffset[0]);
// As long as the src attribute specifies a file name,
if (imgfilename != null)
{ // display the line number, and image path.
resWin.addItem(resWin, "0", "Images in Current File", null, ¬
null, null, [iLineNumber, imgfilename]);
}
}
return;
}
// add buttons to dialog
function commandButtons()
{
return new Array("OK", "stdaloneresultwin()", "Cancel", "window.close()");
}
2 Save the file as Listimages.js in the Configuration/Commands folder.
The reports API functions
The only required function for the reports API is the processFile() function. All other functions are optional.
processFile()
Availability
Dreamweaver 4.
Description
This function is called when there is a file to process. The Report command should process the file without modifying
it and use the
dw.ResultsPalette.SiteReports() function, the addResultItem() function, or the
resWin.addItem() function to return information about the file. Dreamweaver automatically releases each file’s
DOM when it finishes.
Seitenansicht 203
1 2 ... 199 200 201 202 203 204 205 206 207 208 209 ... 386 387

Kommentare zu diesen Handbüchern

Keine Kommentare