
A dynamic menu example 203
for (i=0; i<PIB.length; i=i+2)
{
browsers[j] = new String(PIB[i]);
if (dw.getPrimaryBrowser() == PIB[i+1])
browsers[j] += "\tF12";
else if (dw.getSecondaryBrowser() == PIB[i+1])
browsers[j] += "\tCmd+F12";
browsers[j] += ";id='"+escQuotes(PIB[i])+"'";
if (itemID == "DWPopup_PIB_Default")
browsers[j] = MENU_strPreviewIn + browsers[j];
j = j+1;
}
return browsers;
}
The getDynamicContent() function calls the dw.getBrowserList() function to obtain an
array of the browser names that have been specified in the Preview in Browser section of
Dreamweaver Preferences. This array contains the name of each browser and the path to the
executable file. Next, for each item in the array
(i=0; i<PIB.length; i=i+2), the
getDynamicContents() function moves the name of the browser (PIB[i]) into a second
array called
browsers (browsers[j] = new String(PIB[i]);). If the browser has been
designated as the primary or secondary browser, the function appends the names of the
keyboard shortcut keys that invoke them. Next it appends the string
";id=" followed by the
name of the browser in single quotes (for example,
;id=’iexplore’). If the itemID
argument is "
DWPopup_PIB_Default", the function prefixes the array item with the string
Preview in. After it constructs an entry for each browser listed in Preferences, the
getDynamicContent() function returns the array browsers to Dreamweaver. If no browsers
have been selected in Preferences, the function returns the value
null, and Dreamweaver
displays No Browsers Selected in the menu.
canAcceptCommand()
Dreamweaver next calls the canAcceptCommand() function for each menuitem tag that
references a command file with the
file attribute. If the canAcceptCommand() function
returns the value
false, the menu item is dimmed. If the canAcceptCommand() function
returns the value
true, Dreamweaver enables the item on the menu. If the function returns
true or is not defined, Dreamweaver calls the isCommandChecked() function to determine
whether to display a check mark next to the menu item. If the
isCommandChecked() function
is not defined, no check mark appears.
Komentáře k této Příručce