Adobe Extending Dreamweaver CS4 Manual de usuario Pagina 204

  • Descarga
  • Añadir a mis manuales
  • Imprimir
  • Pagina
    / 387
  • Tabla de contenidos
  • MARCADORES
  • Valorado. / 5. Basado en revisión del cliente
Vista de pagina 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.
Vista de pagina 203
1 2 ... 199 200 201 202 203 204 205 206 207 208 209 ... 386 387

Comentarios a estos manuales

Sin comentarios