SearchPanel

A class handling everything associated with the search panel.

Parameters

nameThe name of the global variable that will be storing this instance.  Is needed to be able to set timeouts.
modeThe mode the search is going to work in.  Pass NaturalDocs::Builder::Base->CommandLineOption(), so the value will be something like “HTML” or “FramedHTML”.
Summary
SearchPanelA class handling everything associated with the search panel.
Variables
nameThe name of the global variable that will be storing this instance of the class.
modeThe mode the search is going to work in, such as “HTML” or “FramedHTML”.
resultsPathThe relative path from the current HTML page to the results page directory.
keyTimeoutThe timeout used between a keystroke and when a search is performed.
keyTimeoutLengthThe length of keyTimeout in thousandths of a second.
lastSearchValueThe last search string executed, or an empty string if none.
lastResultsPageThe last results page.
deactivateTimeoutThe timeout used between when a control is deactivated and when the entire panel is deactivated.
deactivateTimeoutLengthThe length of deactivateTimeout in thousandths of a second.
DOM Elements
DOMSearchField
DOMSearchType
DOMPopupSearchResults
DOMPopupSearchResultsWindow
DOMSearchPanel
Event Handlers
OnSearchFieldFocusCalled when focus is added or removed from the search field.
OnSearchFieldChangeCalled when the content of the search field is changed.
OnSearchTypeFocusCalled when focus is added or removed from the search type.
OnSearchTypeChangeCalled when the search type is changed.
Action Functions
CloseResultsWindowCloses the results window.
SearchPerforms a search.
Activation FunctionsFunctions that handle whether the entire panel is active or not.
ActivateActivates or deactivates the search panel, resetting things to their default values if necessary.
InactivateAfterTimeoutCalled by <inactivateTimeout>, which is set by Activate().
SearchResultsThe class that handles everything on the search results page.
Variables
modeThe mode the search is going to work in, such as “HTML” or “FramedHTML”.
lastMatchCountThe number of matches from the last run of Search().
Functions
ToggleToggles the visibility of the passed element ID.
SearchSearches for the passed string.

Variables

name

this.name

The name of the global variable that will be storing this instance of the class.

mode

this.mode

The mode the search is going to work in, such as “HTML” or “FramedHTML”.

resultsPath

this.resultsPath

The relative path from the current HTML page to the results page directory.

keyTimeout

this.keyTimeout

The timeout used between a keystroke and when a search is performed.

keyTimeoutLength

this.keyTimeoutLength

The length of keyTimeout in thousandths of a second.

lastSearchValue

this.lastSearchValue

The last search string executed, or an empty string if none.

lastResultsPage

this.lastResultsPage

The last results page.  The value is only relevant if lastSearchValue is set.

deactivateTimeout

The timeout used between when a control is deactivated and when the entire panel is deactivated.  Is necessary because a control may be deactivated in favor of another control in the same panel, in which case it should stay active.

deactivateTimeoutLength

this.deactivateTimeoutLength

The length of deactivateTimeout in thousandths of a second.

DOM Elements

DOMSearchField

this.DOMSearchField = function()

DOMSearchType

this.DOMSearchType = function()

DOMPopupSearchResults

this.DOMPopupSearchResults = function()

DOMPopupSearchResultsWindow

this.DOMPopupSearchResultsWindow = function()

DOMSearchPanel

this.DOMSearchPanel = function()

Event Handlers

OnSearchFieldFocus

this.OnSearchFieldFocus = function(isActive)

Called when focus is added or removed from the search field.

OnSearchFieldChange

this.OnSearchFieldChange = function()

Called when the content of the search field is changed.

OnSearchTypeFocus

this.OnSearchTypeFocus = function(isActive)

Called when focus is added or removed from the search type.

OnSearchTypeChange

this.OnSearchTypeChange = function()

Called when the search type is changed.

Action Functions

CloseResultsWindow

this.CloseResultsWindow = function()

Closes the results window.

Search

this.Search = function()

Performs a search.

Activation Functions

Functions that handle whether the entire panel is active or not.

Activate

this.Activate = function(isActive,
ignoreDeactivateDelay)

Activates or deactivates the search panel, resetting things to their default values if necessary.  You can call this on every control’s OnBlur() and it will handle not deactivating the entire panel when focus is just switching between them transparently.

Parameters

isActiveWhether you’re activating or deactivating the panel.
ignoreDeactivateDelaySet if you’re positive the action will deactivate the panel and thus want to skip the delay.

InactivateAfterTimeout

this.InactivateAfterTimeout = function()

Called by <inactivateTimeout>, which is set by Activate().  Inactivation occurs on a timeout because a control may receive OnBlur() when focus is really transferring to another control in the search panel.  In this case we don’t want to actually deactivate the panel because not only would that cause a visible flicker but it could also reset the search value.  So by doing it on a timeout instead, there’s a short period where the second control’s OnFocus() can cancel the deactivation.

SearchResults

The class that handles everything on the search results page.

Summary
Variables
modeThe mode the search is going to work in, such as “HTML” or “FramedHTML”.
lastMatchCountThe number of matches from the last run of Search().
Functions
ToggleToggles the visibility of the passed element ID.
SearchSearches for the passed string.

Variables

mode

this.mode

The mode the search is going to work in, such as “HTML” or “FramedHTML”.

lastMatchCount

this.lastMatchCount

The number of matches from the last run of Search().

Functions

Toggle

this.Toggle = function(id)

Toggles the visibility of the passed element ID.

Search

this.Search = function(search)

Searches for the passed string.  If there is no parameter, it takes it from the URL query.

Always returns true, since other documents may try to call it and that may or may not be possible.

this.name
The name of the global variable that will be storing this instance of the class.
this.mode
The mode the search is going to work in, such as “HTML” or “FramedHTML”.
this.resultsPath
The relative path from the current HTML page to the results page directory.
this.keyTimeout
The timeout used between a keystroke and when a search is performed.
this.keyTimeoutLength
The length of keyTimeout in thousandths of a second.
this.lastSearchValue
The last search string executed, or an empty string if none.
this.lastResultsPage
The last results page.
this.deactivateTimeoutLength
The length of deactivateTimeout in thousandths of a second.
The timeout used between when a control is deactivated and when the entire panel is deactivated.
this.DOMSearchField = function()
this.DOMSearchType = function()
this.DOMPopupSearchResults = function()
this.DOMPopupSearchResultsWindow = function()
this.DOMSearchPanel = function()
this.OnSearchFieldFocus = function(isActive)
Called when focus is added or removed from the search field.
this.OnSearchFieldChange = function()
Called when the content of the search field is changed.
this.OnSearchTypeFocus = function(isActive)
Called when focus is added or removed from the search type.
this.OnSearchTypeChange = function()
Called when the search type is changed.
this.CloseResultsWindow = function()
Closes the results window.
this.Search = function()
Performs a search.
this.Activate = function(isActive,
ignoreDeactivateDelay)
Activates or deactivates the search panel, resetting things to their default values if necessary.
this.InactivateAfterTimeout = function()
Called by inactivateTimeout, which is set by Activate().
this.mode
The mode the search is going to work in, such as “HTML” or “FramedHTML”.
this.lastMatchCount
The number of matches from the last run of Search().
this.Search = function(search)
Searches for the passed string.
this.Toggle = function(id)
Toggles the visibility of the passed element ID.
sub CommandLineOption
Define this function to return the text that should be put in the command line after -o to use this package.
Close