MACROMEDIA DREAMWEAVER MX 2004-EXTENDING DREAMWEAVER Specifikace Strana 206

  • Stažení
  • Přidat do mých příruček
  • Tisk
  • Strana
    / 504
  • Tabulka s obsahem
  • KNIHY
  • Hodnocené. / 5. Na základě hodnocení zákazníků
Zobrazit stránku 205
206 Menus and Menu Commands
The havePreviewTarget() function sets the value bHavePreviewTarget to false as the
default return value. The function performs two basic tests calling the
dw.getFocus()
function to determine what part of the application currently has input focus. The first test
checks whether the site panel has focus (
if (dw.getFocus(true) == 'site')). If the site
panel does not have focus, the second test checks to see if a document (
dw.getFocus() ==
'document'
), Text view (dw.getFocus() == 'textView'), or the Code inspector
(
dw.getFocus("true") == 'html') has focus. If neither test is true, the function returns the
value
false.
If the site panel has focus, the function checks whether the view setting is Remote view. If it is,
the function sets
bHavePreviewTarget to true if there are remote files
(
site.getRemoteSelection().length > 0) and the files can be opened in a browser
(
site.canBrowseDocument()). If the view setting is not Remote view, and if the view is not
None, the function gets a list of the selected files (
var selFiles = site.getSelection();)
in the form of
file:/// URLs.
For each item in the selected list, the function tests for the presence of the character string
"
://". If it is not found, the code performs a series of tests on the list item. If the item is not
in the form of a
file:/// URL (if (selFile.indexOf(urlPrefix) == -1)), it sets the
return value to
false. If the remainder of the string following the file:/// prefix does not
contain a slash (/) (
if (strTemp.indexOf("/") == -1)), it sets the return value to false. If
the file does not exist (
else if (!DWfile.exists(selFile))), it sets the return value to
false. Last, it checks to see if the specified file is a folder (else if
(DWfile.getAttributes(selFile).indexOf("D") != -1)
). If selfile is a folder, the
function returns the value
false. Otherwise, if the target is a file, the function sets
bHavePreviewTarget to the value true.
If a document, Text view, or the Code inspector has input focus (
else if (dw.getFocus()
== 'document' || dw.getFocus() == 'textView' || dw.getFocus("true") ==
'html' )
), the function gets the DOM and checks to see if the document is an HTML or an
XML document. If so, the function sets
bHavePreviewTarget to true. Finally, the function
returns the value stored in
bHavePreviewTarget.
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];
Zobrazit stránku 205
1 2 ... 201 202 203 204 205 206 207 208 209 210 211 ... 503 504

Komentáře k této Příručce

Žádné komentáře