Appendix

Keyboard Shortcuts

KeysFeatures
Navigator Window
Alt + S Open StyleSheets menu
Alt + O Open Outline menu
Alt + N Open Site Navigations menu
Alt + A Open Open with Applications menu
Alt + C Open Custom Scripts menu
S Go to Next Heading
W Go to Previous Heading
A or Ctrl(Command)+Up Focus to the next link
Q or Ctrl(Command)+Down Focus to the previous link
Ctrl(Command) + J Copy Links List
Alt + Back Space Up
T Site Navigations:Top
U Site Navigations:Up
F Site Navigations:First page
P Site Navigations:Previous page
N Site Navigations:Next page
L Site Navigations:Last page
C Site Navigations:Contents
1 Site Navigations:Chapters
2 Site Navigations:Sections
3 Site Navigations:Subsections
X Site Navigations:Appendixes
G Site Navigations:Glossary
I Site Navigations:Index
? Site Navigations:Help
H Site Navigations:Search
@ Site Navigations:Author
R Site Navigations:Copyright information
B Site Navigations:Bookmark
O Site Navigations:Other versions
JavaScript Panel
Ctrl(Command) + W Close
Ctrl(Command) + Q
Ctrl(Command) + R Run
Custom User Style Editor
Ctrl(Command) + S Save
Ctrl(Command) + W Close
Ctrl(Command) + Q
Ctrl(Command) + R Reload
StyleSheets Manager
Ctrl(Command) + W Close
Ctrl(Command) + Q
Ctrl(Command) + R Reload
Ctrl(Command) + E Edit

Short Expressions for Custom Scripts

In Custom Scripts and JavaScript Panel, predefined values and functions to use cross platform features of Netscape/Mozilla are available. Even if you don't know about internal specifications of Netscape/Mozilla, they will help you to make scripts easily.

Defined Values, References

XHTMLNS
XLinkNS
XULNS

Are strings of namespace URIs for XHTML 1.0/1.1, XLink 1.0, and XUL.

_window

Is the reference to the global object (Window object) of the current page (or frame).

_window.document.navigations

Is the array of navigation items, and they have following properties:

length

Is the number of navigations.

[n].elemType

Is the type of the navigation item. When the navigation is provided as a LINK element, navigation. If an A element, anchor.

[n].href

Is the URI of the navigation.

[n].substance

Is the element node of the navigation.

_window.document.headings

Is the array of headings, and they have following properties.

length

Is the number of headings.

[n].id

Is the id of the heading. If there is no id, this is indicates a value of the NAME atrribute of the first children of it or null.

[n].level

Is the level of the heading.

[n].label

Is the content text of the heading.

[n].substance

Is the element node of the heading.

_contextualURI

Is the URI of the link which the context menu is opened on, or the URI of the page (frame).

_popupNode

Is the reference to the node which the context menu is opened on. If the context menu is not opened, this is null.

_selection

Is the selection text. If there is no selection, this is nullstring.

_selectionSource

Is the HTML source of the selection. Opening and closing tags are made up if the element is selected partially.

_selectionNodes

Is the flat array of nodes contained in the selection.

_focusedElement

Is the reference to the focused node.

_profileURI
_profilePath
_installedURI
_installedPath
_temporaryURI
_temporaryPath
_homeURI
_homePath

Are strings indicate directories: the profile directory of the current user, the directory Mozilla/Netscape is installed in, the system directory temporary filres are put in, and the home directory (like desktop).

"...URI" is formatted as a URI like "file:///...". "...Path" is as a file path for the platform, for example, it is like "c:\..." in Windows.

_isOnline

Is true if Netscape/Mozilla is in online mode.

_inFrame

Is true if the context menu is opened on a frame.

Functions

_getTopWindowOf(aWindowType)

Returns the XUL window which has the specified window type, recently selected.

_getWindowsOf(aWindowType)

Returns the array of XUL windows which have the specified window type.

_loadURI(aURI[, aReferrerURI])

Loads the URI in the current window (tab). This returns the browser which the URI is loaded in.

_openNewWindow(aURI[, aReferrerURI])

Opens the URI in a new window. This returns the new XULWindow.

_openNewTab(aURI[, aReferrerURI])

Opens the URI in a new tab. This returns the tab.

_loadURIAndDo(aURI[, aReferrerURI[, aCallBackFunc1[, aCallBackFunc2[, ...]]]])

Loads the URI in the current window (tab), and executes given functions after the page is loaded. This returns the browser which the URI is loaded in.

Given functions will be able to get the Window object of the loaded page or frame, as a first argument. And you can use these short expressions in them.

_openNewWindowAndDo(aURI[, aReferrerURI[, aCallBackFunc1[, aCallBackFunc2[, ...]]]])

Opens the URI in a new window, and executes given functions after the page is loaded. This returns the new XULWindow.

Given functions will be able to get the Window object of the loaded page or frame, as a first argument. And you can use these short expressions in them.

_openNewTabAndDo(aURI[, aReferrerURI[, aCallBackFunc1[, aCallBackFunc2[, ...]]]])

Opens the URI in a new tab, and executes given functions after the page is loaded. This returns the tab.

Given functions will be able to get the Window object of the loaded page or frame, as a first argument. And you can use these short expressions in them.

_selectButton(aMessage, aButtons)

Shows a dialog box which has multiple buttons until three, built from the specified labels. This returns the index of the pressed button (0-3).

_selectButtonWithTitle(aTitle, aMessage, aButtons)

Is a variation of the _selectButton(), and you can specify the title of the dialog.

_selectList(aMessage, aListItems)

Shows a dialog box which has a list box, built from the specified labels. This returns the index of the selected item (0-n-1).

_selectListWithTitle(aTitle, aMessage, aListItems)

Is a variation of the _selectList(), and you can specify the title of the dialog.

_getClipBoard()

Gets and returns a string from the clipboard. If the content of the clipboard is not a string, this returns null.

_setClipBoard(aString)

Copies the string to the clipboard. This returns no value.

_getInnerText(aElementNode)

Returns the inner text of the element node. If there are images, they are replaced to alternate texts.

_convertCharset(aString, aInputCharset, aOutputCharset)
_convertCharset(aString, aOutputCharset)

Return strings with the specified encoding. If you don't specify input-encoding, this regards the string as a Unicode string.

_addStyleSheet(aURI[, aMIMEType[, aMedia[, aTargetWindow]]])

Applies the stylesheet. If you don't specify the MIME type, the sheet is operated as "text/css". And if there is no media, operated as "all". When an Window object or frame is given as the fourth argument, this works for the frame. This returns no value.

_run(aAppPath[, aOptions])

Runs the external applications specified by the local file path. You can hand options as a space-separated string or an array. This returns no value.

File I/O

_include(aFilePathOrURI)

Loads the external JavaScript and execute it. This returns no value.

_readFrom(aFilePathOrFile)

Returns the content of the file as a string.

_writeTo(aString, aFilePath[, aFlags])

Save the string as a text file. If the file exists, it is replaced to new one without warning. This function doesn't convert encoding of strings, so you have to convert it by _convertCharset().

You can give following flags as the third argument, like "flag1=yes,flag2=no".

CreateDirectory
If you don't use this flag, a dialog to confirm (to create new directory(s)) will be shown when the directory doesn't exist. yes skips the dialog with Yes, no skips with No.
Overwrite
If you don't use this flag, a dialog to confirm (to overwrite the file with the new one) will be shown when the file exists. yes skips the dialog with OK, no skips with Cancel.

This returns the nsILocalFile object of the saved file (if you canceled, null).

_saveURIAs(aURI[, aFilePath[, aFlags]])

Download and save a remote resource pointed by the URI, as a file. When the second argument isn't given, a dialog to choose file is shown. You can hand the third argument like _writeTo(). This returns the nsIWebBrowserPersist object which is downloading the file (if you canceled before starting the download, null).

_saveURIInBackgroundAs(aURI[, aFilePath[, aFlags]])

Download and save a remote resource pointed by the URI, as a file. This doesn't show the dialog to indicate progress of downloading. When the second argument isn't given, a dialog to choose file is shown. You can hand the third argument like _writeTo(). This returns the nsIWebBrowserPersist object which is downloading the file (if you canceled before starting the download, null).

_chooseFile(aTitle[, aDefault[, aFilter]])

Opens a common dialog to choose a file. You can specify the default filename and filter to show files like *.txt;*.doc. This returns the nsIFile object of the choosen file.

_chooseFileToSave(aTitle[, aDefault[, aFilter]])

Is a variation of the _chooseFile(), and this opens the common dialog to save a file.

Features of ContextMenu Extensions

_cancelStyles([aTargetWindow])

Kills all styles in the page. When an Window object or frame is given, this works for the frame. This returns no value.

_switchStyleTo(aStyleName[, aTargetWindow])

Switches the appearance of the page to the specified style. If the page doesn't have the style or you handed null, only the permanent styles are enabled. When an Window object or frame is given as the second argument, this works for the frame. This returns no value.

_openStyleSheetSource(aStyleName[, aTargetWindow])

Opens the source file of the specified style of the page. If the style has multiple sources, each resources are opened in new windows or tabs. When an Window object or frame is given as the second argument, this works for the frame. This returns no value.

_editGlobalUserStyleSheet()

Opens the Global UserStylesheet Editor. This returns no value.

_editCustomUserStyle([aTargetWindow])

Opens the custom userstyle editor for the page. When an Window object or frame is given, this works for the frame. This returns no value.

_addOptionalStyleSheet(aStyleIndexOrName[, aTargetWindow])
_removeOptionalStyleSheet(aStyleIndexOrName[, aTargetWindow])

Enables or disables the userdefined stylesheet. You can specify the stylesheet by it's name or the index (0-n-1). When an Window object or frame is given as the second argument, this works for the frame. This returns no value.

_getLinks([aRegExp[, aShouldCopyResultToClipBoard[, aTargetWindow]]])

Collects whole link URIs of the page (, frame, or selection) and returns the result as a flat array. If the second argument is true, this copies the result to the clipboard. When an Window object or frame is given as the third argument, this works for the frame.

_getLinksWithNode([aRegExp[, aTargetWindow]])

Collects whole links of the page (, frame, or selection) and returns the result as a flat array. Elements of the returned array is objects which have two properties: uri is the URI of the link, node is the element node of the link. When an Window object or frame is given as the second argument, this works for the frame.

_SendURITo(aURI, aReceiverIndexOrName)

Sends a URI to the specified web service. You can specify the service by it's name or the index (0-n-1). This returns no value.

_SendStringTo(aString, aReceiverIndexOrName)

Sends a string to the specified web service. You can specify the service by it's name or the index (0-n-1). This returns no value.

_OpenWithApp(aURI, aString, aAppIndexOrName)

Sends a URI and a string to the specified application. You can specify the application by it's name or the index (0-n-1). This returns no value.

_runCustomScript(aScriptIndexOrName[, aTargetWindow])
_CustomScript(aScriptIndexOrName[, aTargetWindow])

Executes an custom script and returns a value returned from the script. You can specify the script by it's name or the index (0-n-1). When an Window object or frame is given as the second argument, this works for the frame.

_up([aTargetWindow])
_goNextHeading([aTargetWindow])
_goPrevHeading([aTargetWindow])
_goJSPanel([aTargetWindow])
_showComments([aTargetWindow])
_showLinks([aTargetWindow])
_showIDs([aTargetWindow])
_showCites([aTargetWindow])
_showTitles([aTargetWindow])
_showEvents([aTargetWindow])
_showAll([aTargetWindow])

Executes features of ContextMenu Extensions. When an Window object or frame is given, they works for the frame. They return no value.

Save/Load Preferences

_getPref(aPrefString)

Loads preferences and returns it's value as a string, number, or boolean. If the specified preference is not saved, this returns null.

_setPref(aPrefString, aValue)

Saves the specified preference. This returns no value. The type of the value is discriminated as boolean, an integral number, or a string automatically. For example, if you would like to save a nubmer as a string, hand value.toString() to this.

_clearPref(aPrefString)

Clears the specified preference to the default. If the preference is not saved, this does no action.

_getCookie(aName)

Gets the specified cookie and returns it's value. If the cookie isn't saved, this returns a nullstring.

_putCookie(aName, aValue [, aExpires[, aPath]])

Saves the specified cookie. The term of validity (days) and the path are optional.

Sample Scripts

There are sample scripts for Custom Scripts, following. They will help you to make new scripts.

  1. Create Link to the Current Page

    Create a link to the current page as <a href="URI" title="title of the page">title of the page</a>, and copies to the clipboard.

  2. Quote Selection as HTML

    Creates a quotation as <q title="title of the page" cite="URI">selection</q> with original markups, and copies to the clipboard. If the selection contains block level elements, uses the format following: <qblockquote title="title of the page" cite="URI"><p>selection text</p></blockquote>.

  3. Create Outline List

    Collects whole headings in the pages, creates an list like an outline, and copies it to the clipboard. You can use this for make a contents of pages, and so on.

  4. Encode a text file to UTF-8

    Converts the encoding of the file to UTF-8. This is useful if you have no application which can operate UTF-8, when you would like to create localized .dtd files.

  5. Escape strings to Unicode for JavaScript

    Escapes inputted string for JavaScript in Unicode format, like \ucharcode. This is useful to create localized .properties files in Japanese, Chinese, and so on.

  6. Escape strings for CSS

    Escapes inputted string to CSS format, like \charcode  (last letter is a space). This is useful to write CSS rules only for IE6, Netscape 7/Mozilla, and so on.

  7. Convert strings to XML numeric character references (in decimal)

    Converts inputted string to XML numeric character reference, like &#charcode(in decimal);.

  8. Convert strings to XML numeric character references (in hexadecimal)

    Converts inputted string to XML numeric character reference, like &#xcharcode(in hexadecimal);.

  9. Show Content of NOFRAMES

    Shows the content of the <noframes> in the page which has frames. This may be used to check accessibility of pages for browsers without supporting of frames.

  10. Get Properties List of JS Object

    Analyses whole properties of the JavaScript object, and copies the result to the clipboard.

  11. Get Properties List of JS Object(2)

    Analyses whole properties of the JavaScript object, and copies the result to the clipboard. This is a variation of Get Properties List of JS Object, and this analyses properties reflexively.

  12. Create Download List for Iria

    Collects whole links in the page and creates a download cue file for Iria.

  13. Uninstall Package

    Uninstalls the package. This is an exapmle for the library, exUnregisterer.js.

  14. Resize images automatically (MSIE6 compatible)

    Fits the size of the image to the window, when Navigator opens images directly and they are larger than the window. To view the image as it's original size, click Full Size button.

  15. Add Page to Sidebar

    Adds the current page or the link to the sidebar as a panel.

  16. Add Page to Sidebar(2)

    Adds the current page or the link to the sidebar as a panel. Please use this if Add Page to Sidebar fails to register new panels.

  17. Custom Scripts Launcher

    Is an example of combination of custom scripts.

  18. Toggle XUL Cache

    Is an example to toggle a boolean preference setting.

  19. Remove Duplicated Emtries from installed-chrome.txt

    Netscape/Mozilla adds duplicated entries to the file, installed-chrome.txt, if you overwrite new versions with installer packages. This sample script removes duplicated entries and cleans up installed-chrome.txt. This is for idlers like me ;-)

  20. Find and Highlight Links which refers to the inputted site

    May be useful to find "the real entrance" of pages, links to your website, or others.

Tips

© 2001-2004 Piro(SHIMODA Hiroshi):http://piro.sakura.ne.jp/