home *** CD-ROM | disk | FTP | other *** search
- <HTML id=dlgFind STYLE="font-family: 'ms sans serif'; font-size: '8pt';
- width: '32.7em'; height: '11em'">
- <HEAD>
- <TITLE id=dialogTitle>
- Find
- </TITLE>
-
- <SCRIPT LANGUAGE="JavaScript" defer>
-
- //+-------------------------------------------------------------------------
- //
- // This section contains code to be moved into a GLOBAL MODULE outside
- // of this particular dialog.
- //
- //--------------------------------------------------------------------------
-
-
- //+--------------------------------------------------------------------------
- //
- // This section contains variables that need to be LOCALIZED
- //
- //---------------------------------------------------------------------------
-
-
-
- //+-------------------------------------------------------------------------
- //
- // This section contains code LOCAL to this particular dilaog.
- //
- //--------------------------------------------------------------------------
-
- //+--------------------------------------------------------------------
- //
- // Synopsis: Opens the help file with the appropriate helpid
- //
- // Arguments: none
- //
- // Returns: nothing
- //
- //---------------------------------------------------------------------
-
- function callHelp()
- {
- var L_NoHelp_Text = "No help topic available.";
- var elm = window.event.srcElement;
- if (null != elm.helpid)
- {
- if ("btnCancel" != elm.id)
- {
- window.showHelp("iexplore.hlp", parseInt(elm.helpid));
- }
- else
- {
- // BUGBUG (19759) Once we get help for cancel, this
- // function will have to change.
- alert(L_NoHelp_Text);
- }
- }
- } // callHelp
-
-
- //+--------------------------------------------------------------------
- //
- // Synopsis: Closes the dialog doing nothing.
- //
- // Arguments: none
- //
- // Returns: nothing
- //
- //---------------------------------------------------------------------
-
- function btnCancelClick()
- {
- window.close();
- } // btnCancelClick
-
-
- //+---------------------------------------------------------------------
- //
- // Synopsis: Checks the status of the appropriate checkboxes and
- // sets the flags for the rangeFromText method.
- //
- // Arguments: none
- //
- // returns: a number representing the flags for the rangeFromText
- // method. (See OM spec for more info.)
- //
- //----------------------------------------------------------------------
-
- function findFlags()
- {
- var htmlMatchWord = 2;
- var htmlMatchCase = 4;
-
- return (htmlMatchWord * document.all.chkWholeWord.checked)
- | (htmlMatchCase * document.all.chkMatchCase.checked)
- } // findFlags
-
-
- //+---------------------------------------------------------------------
- //
- // Synopsis: Three steps:
- // 1. Make sure there's something to find.
- // 2. Determine the direction and how far to search.
- // 3. Find and select the text.
- //
- // Arguments: none
- //
- // Returns: nothing
- //
- //-----------------------------------------------------------------------
-
- function btnFindClick()
- {
- var L_FinishedDocument_Text = "Finished searching the document.";
- var docSearch = window.dialogArgs.document; // The document we're
- // searching
- var intDirection; // What direction to search and
- // how far to search
- var rngCurrent = docSearch.selection.createRange(); // The current
- // selection in
- // the document
- var rngWorking = docSearch.body.createTextRange(); // The range we're
- // going to search
- var rngFoundText; // The found text
- var fFoundText = false; // If the text has already been found
-
- //
- // If the current selection == the text in txtFindText,
- // we've found the text at least once. (At least we can
- // act as if we have.)
- //
- if ((docSearch.selection.type == "Text") ||
- (docSearch.selection.type == "None"))
- {
- fFoundText = (rngCurrent.text.toLowerCase()
- == txtFindText.value.toLowerCase());
- }
-
- //
- // rngWorking starts as the entire body, and is then narrowed
- // down by the 'set direction' code.
- //
-
- //
- // Set direction
- //
- if (radDirection[0].checked) // Search backwards
- {
- //
- // set range to search
- //
- if (!fFoundText)
- {
- //
- // Search from the end of the current selection
- // to the beginning of document
- //
- rngWorking.end = rngCurrent.end;
- }
- else
- {
- //
- // Search from the end of the current selection
- // minus 1 so we don't find the text we just found
- //
- rngWorking.end = rngCurrent.end - 1;
- }
- intDirection = rngWorking.start - rngWorking.end // Should
- // be negative or 0
- }
- else // Search forwards
- {
- //
- // set range to search
- //
- if (!fFoundText)
- {
- //
- // Search from start of the current selection to the end
- // of document
- //
- rngWorking.start = rngCurrent.start;
- }
- else
- {
- //
- // Search from the start of the current selection plus
- // one so we don't find the text we just found
- //
- rngWorking.start = rngCurrent.start + 1;
- }
- intDirection = rngWorking.end - rngWorking.start // Should
- // be positive or 0
- }
-
- //
- // Here's where we do the dirty work (step 3) ...
- //
- rngFoundText = docSearch.rangeFromText(txtFindText.value,
- intDirection, findFlags(), rngWorking);
-
- if (null == rngFoundText) // Text was not found
- {
- alert(L_FinishedDocument_Text);
- }
- else // Text was found
- {
- rngFoundText.select();
- rngFoundText.scrollIntoView(true);
- }
- } // btnFindClick
-
-
- //+---------------------------------------------------------------------
- //
- // Synopsis: Looks for the ENTER and ESC keypresses and runs the
- // appropriate action.
- //
- // Arguments: none
- //
- // Returns: nothing
- //
- //-----------------------------------------------------------------------
-
- function defaultActions()
- {
- var htmlKeyReturn = 13;
- var htmlKeyEscape = 27;
-
- if ((event.keyCode) == htmlKeyReturn) // Enter
- {
- if (!btnFind.disabled)
- {
- btnFindClick();
- btnFind.focus();
- }
- }
- else if ((event.keyCode) == htmlKeyEscape) // Esc
- {
- btnCancelClick();
- }
- } // defaultActions
-
-
- //+---------------------------------------------------------------------
- //
- // Synopsis: Disables or enables the find button depending in
- // whether there is text in txtFindText.
- //
- // Arguments: none
- //
- // Returns: nothing
- //
- //----------------------------------------------------------------------
-
- function setFindState()
- {
- if ("" == txtFindText.value)
- {
- btnFind.disabled = true;
- }
- else
- {
- btnFind.disabled = false;
- }
- } // setFindState
-
-
- //+---------------------------------------------------------------------
- //
- // Synopsis: Sets the focus to the find button. Also determines
- // whether something is selected in the document.
- //
- // Arguments: none
- //
- // Returns: nothing
- //
- //-----------------------------------------------------------------------
-
- function loadBdy()
- {
- var docSearch = window.dialogArgs.document;
- var rng = docSearch.selection.createRange();
-
- // EXPANDO SHOULD BE OFF EXCEPT WHEN CREATING/MODIFYING
- // EXPANDO PROPERTIES. This will save hours debugging
- // accidentally created expando properties.
- document.expando = false;
-
- //
- // Bind events to controls
- //
- btnFind.onclick = new Function("btnFindClick()");
- btnCancel.onclick = new Function("btnCancelClick()");
-
- document.onhelp = new Function("callHelp()");
- document.onkeypress = new Function("defaultActions()");
-
- txtFindText.onkeyup = new Function("setFindState()");
- txtFindText.onfocus = new Function("txtFindText.select()");
-
- //
- // If the selection is less than 16 characters, populate
- // txtFind with the selection
- //
- if ("Text" == docSearch.selection.type)
- {
- if (16 > rng.text.length)
- {
- txtFindText.value = rng.text;
- txtFindText.select();
- }
- }
-
- setFindState();
- } // loadBdy
-
- </SCRIPT>
-
- </HEAD>
- <BODY ID=bdy onLoad="loadBdy()" style="font-family: 'ms sans serif';
- font-size: '8pt'; background: buttonface;" topmargin=0>
-
- <BUTTON id=btnFind ACCESSKEY=f DISABLED=1 tabIndex=55
- style="font-family: 'ms sans serif'; font-size: '8pt'; position: absolute;
- LEFT: '24.4em'; TOP: '1em';
- WIDTH: '6.8em'; HEIGHT: '2.1em'">
- <U>F</U>ind Next
- </BUTTON>
-
- <INPUT type=text id=txtFindText ACCESSKEY=n tabIndex=15 helpid="0x3068"
- style="font-family: 'ms sans serif'; font-size: '8pt'; position: absolute;
- LEFT: '6.1em'; TOP: '1em';
- WIDTH: '17.5em'; HEIGHT: '2.1em'">
-
- <DIV align=absMiddle
- style="font-family: 'ms sans serif'; font-size: '8pt'; position: absolute;
- LEFT: '1em'; TOP: '1.3em';
- WIDTH: '8em'; HEIGHT: '1.1em'">
- <LABEL FOR=txtFindText ID=lblFindText tabIndex=-1 helpid="0x3068">
- Fi<U>n</U>d what:
- </LABEL>
- </DIV>
-
- <!--
- BUGBUG (#19759) waiting for helpid for the cancel button
- -->
- <BUTTON id=btnCancel tabIndex=60 helpid="0x0000"
- style="font-family: 'ms sans serif'; font-size: '8pt'; position: absolute;
- LEFT: '24.4em'; TOP: '3.5em';
- WIDTH: '6.8em'; HEIGHT: '2.1em'">
- Cancel
- </BUTTON>
-
- <INPUT id=chkWholeWord ACCESSKEY=w type=checkbox tabIndex=25 helpid="0x3063"
- style="font-family: 'ms sans serif'; font-size: '8pt'; position: absolute;
- LEFT: '1em'; TOP: '4.5em';
- WIDTH: '1em'; HEIGHT: '1em'">
-
- <INPUT ACCESSKEY=c type=checkbox tabIndex=35 helpid="0x3064"
- id=chkMatchCase style="font-family: 'ms sans serif'; font-size: '8pt';
- position: absolute;LEFT: '1em';
- TOP: '6.3em'; WIDTH: '1em'; HEIGHT: '1em'">
-
- <DIV
- style="font-family: 'ms sans serif'; font-size: '8pt'; position: absolute;
- LEFT: '2.9em'; TOP: '4.5em';
- WIDTH: '12em'; HEIGHT: '1em'">
- <LABEL FOR=chkWholeWord ID=lblWholeWord tabIndex=-1 helpid="0x3063">
- Match <U>w</U>hole word only
- </LABEL>
- </DIV>
-
- <DIV style="font-family: 'ms sans serif'; font-size: '8pt'; position: absolute;
- LEFT: '2.9em'; TOP: '6.3em';
- WIDTH: '6em'; HEIGHT: '1.1em'">
- <LABEL FOR=chkMatchCase ID=lblMatchCase tabIndex=-1 helpid="0x3064">
- Match <U>c</U>ase
- </LABEL>
- </DIV>
-
- <TABLE cellspacing cellPadding=7 borderColorDark=buttonhighlight
- borderColorLight=buttonshadow noshade="yes" border=1
- style="font-family: 'ms sans serif'; font-size: '8pt'; position: absolute;
- LEFT: '14em'; TOP: '4.5em';
- WIDTH:'9.5em'; HEIGHT: '3em'">
- <TR>
- <TD style="font-family: 'ms sans serif'; font-size: '8pt'; width: '6.4em';
- height: '2em';">
- <DIV style="color: buttonface">a</DIV>
- </TD></TR>
- </TABLE>
-
-
- <INPUT id=radDirectionUp type=radio name=radDirection ACCESSKEY=u
- tabIndex=42 helpid="0x3065"
- style="font-family: 'ms sans serif'; font-size: '8pt'; position: absolute;
- top: '5.7em'; left: '15em'; width: '1em'; height: '1em';">
- <DIV style="font-family: 'ms sans serif'; font-size: '8pt';
- position: absolute;top: '5.7em'; left: '16.5em'; width: '2em';
- height: '2em';">
- <LABEL style="font-family: 'ms sans serif'; font-size: '8pt'"
- FOR=radDirectionUp ID=lblDirectionUp
- tabIndex=45 helpid="0x3065"> <U>U</U>p </LABEL>
- </DIV>
- <INPUT id=radDirectionDown type=radio CHECKED name=radDirection
- ACCESSKEY=d tabIndex=47 helpid="0x3066"
- style="font-family: 'ms sans serif'; font-size: '8pt'; position: absolute;
- top: '5.7em'; left: '18.5em'; width: '1em'; height: '1em';">
- <DIV style="font-family: 'ms sans serif'; font-size: '8pt';
- position: absolute;top: '5.7em'; left: '20em'; width: '3em';
- height: '2em';">
- <LABEL style="font-family: 'ms sans serif'; font-size: '8pt'"
- FOR=radDirectionDown helpid="0x3066"
- ID=lblDirectionDown tabIndex=50> <U>D</U>own </LABEL>
- </DIV>
-
- <DIV style="font-family: 'ms sans serif'; font-size: '8pt'; position: absolute;
- background: buttonface;
- HEIGHT: '1em'; LEFT: '14.7em'; TOP: '4.1em'; WIDTH: '4.1em'">
- <LABEL id=lblDirection> Direction </LABEL>
- </DIV>
-
- </BODY>
- </HTML>
-