Adobe Extending Dreamweaver CS4 Manual de usuario Pagina 164

  • Descarga
  • Añadir a mis manuales
  • Imprimir
  • Pagina
    / 387
  • Tabla de contenidos
  • MARCADORES
  • Valorado. / 5. Basado en revisión del cliente
Vista de pagina 163
158
EXTENDING DREAMWEAVER CS4
Menus and menu commands
function canAcceptCommand()
{
var PIB = dw.getBrowserList();
if (arguments[0] == 'primary' || arguments[0] == 'secondary')
return havePreviewTarget();
return havePreviewTarget() && (PIB.length > 0);
}
The canAcceptCommand() function in the PIB_Dynamic.js file again retrieves the browser list that was created in the
Preferences dialog box. Then it checks whether the first argument (
arguments[0]) is primary or secondary. If so, it
returns the value returned by the
havePreviewTarget() function. If not, it tests the call to the
havePreviewTarget() function and tests whether any browsers have been specified (PIB.length > 0). If both tests
are true, the function returns the value
true. If either or both of the tests are false, the function returns the value
false.
havePreviewTarget()
The havePreviewTarget() function is a user-defined function that returns the value true if Dreamweaver has a valid
target to display in the browser. A valid target is a document or a selected group of files in the Site panel. The
havePreviewTarget() function looks like the following example:
function havePreviewTarget()
{
var bHavePreviewTarget = false;
if (dw.getFocus(true) == 'site')
{
if (site.getFocus() == 'remote')
{
bHavePreviewTarget = site.getRemoteSelection().length > 0 &&
site.canBrowseDocument();
}
else if (site.getFocus() != 'none')
{
var selFiles = site.getSelection();
if (selFiles.length > 0)
{
var i;
bHavePreviewTarget = true;
for (i = 0; i < selFiles.length; i++)
{
var selFile = selFiles[i];
// For server connections, the files will
// already be remote URLs.
if (selFile.indexOf("://") == (-1))
{
var urlPrefix = "file:///";
var strTemp = selFile.substr(urlPrefix.length);
if (selFile.indexOf(urlPrefix) == -1)
Vista de pagina 163
1 2 ... 159 160 161 162 163 164 165 166 167 168 169 ... 386 387

Comentarios a estos manuales

Sin comentarios