Adobe Extending Dreamweaver CS4 Instrukcja Użytkownika Strona 166

  • Pobierz
  • Dodaj do moich podręczników
  • Drukuj
  • Strona
    / 387
  • Spis treści
  • BOOKMARKI
  • Oceniono. / 5. Na podstawie oceny klientów
Przeglądanie stron 165
160
EXTENDING DREAMWEAVER CS4
Menus and menu commands
receiveArguments()
Dreamweaver calls the receiveArguments() function to let the command process any arguments that pass from the
menu item. For the Preview in Browsers menu, the
receiveArguments() function invokes the browser that the user
selects. The
receiveArguments() function looks like the following example:
function receiveArguments()
{
var whichBrowser = arguments[0];
var theBrowser = null;
var i=0;
var browserList = null;
var result = false;
if (havePreviewTarget())
{
// Code to check if we were called from a shortcut key
if (whichBrowser == 'primary' || whichBrowser == 'secondary')
{
// get the path of the selected browser
if (whichBrowser == 'primary')
{
theBrowser = dw.getPrimaryBrowser();
}
else if (whichBrowser == 'secondary')
{
theBrowser = dw.getSecondaryBrowser();
}
// Match the path with the name of the corresponding browser
// that appears in the menu.
browserList = dw.getBrowserList();
while(i < browserList.length)
{
if (browserList[i+1] == theBrowser)
theBrowser = browserList[i];
i+=2;
}
}
else
theBrowser = whichBrowser;
// Only launch the browser if we have a valid browser selected.
if (theBrowser != "file:///" && typeof(theBrowser) != "undefined" &&
theBrowser.length > 0)
{
if (dw.getFocus(true) == 'site')
{
// Only get the first item of the selection because
// browseDocument() can't take an array.
//dw.browseDocument(site.getSelection()[0],theBrowser);
site.browseDocument(theBrowser);
}
else
dw.browseDocument(dw.getDocumentPath('document'),theBrowser);
Przeglądanie stron 165
1 2 ... 161 162 163 164 165 166 167 168 169 170 171 ... 386 387

Komentarze do niniejszej Instrukcji

Brak uwag