home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
PC World Komputer 2010 April
/
PCWorld0410.iso
/
WindowsServerTrial
/
server.iso
/
sources
/
install.wim
/
2
/
Windows
/
System32
/
ieframe.dll
/
HTML
/
BIDIFIND.JS
< prev
next >
Wrap
Text File
|
2008-01-19
|
7KB
|
198 lines
//Find Text dialog box
//+---------------------------------------------------------------------
//
// Synopsis: Checks the status of the appropriate checkboxes and
// sets the flags for the findText method.
//
// Arguments: none
//
// returns: a number representing the flags for the findText
// method. (See OM spec for more info.)
//
//----------------------------------------------------------------------
function findFlags()
{
var htmlMatchWord = 2;
var htmlMatchCase = 4;
var htmlMatchDiacritic = 536870912; // 0x20000000 FR_MATCHDIAC
var htmlMatchKashida = 1073741824; // 0x40000000 FR_MATCHKASHIDA
var htmlMatchAlefHamza = 2147483648; // 0x80000000 FR_MATCHALEFHAMZA
return (htmlMatchWord * document.all.chkWholeWord.checked)
| (htmlMatchCase * document.all.chkMatchCase.checked)
| (htmlMatchDiacritic * document.all.chkMatchDiacritic.checked)
| (htmlMatchKashida * document.all.chkMatchKashida.checked)
| (htmlMatchAlefHamza * document.all.chkMatchAlefHamza.checked)
} // findFlags
//+---------------------------------------------------------------------
//
// Synopsis: Sets the focus to the find button. Also determines
// whether something is selected in the document.
//
// Arguments: none
//
// Returns: nothing
//
//-----------------------------------------------------------------------
function loadBdy()
{
// win.screenLeft == x-coordinate of the document window (not the frame)
// doc.body.clientoffsetWidth > doc.body.clientWidth
// doc.body.clientLeft > doc.body.offsetLeft
// document.body.offsetWidth == window.dialogWidth
// document.body.clientLeft == 0
// document.body.offsetLeft == 0
// Currently there is no way to get the total dialog width (only document width).
// Positioning of the dialog is done in dhuihand.cpp after the dialog is shown.
//
// Bind events to controls. This is done here to load the dialog
// quicker.
//
btnFindPrev.onclick = new
Function("btnFindClick(false)");
btnFindPrev.ondblclick = new
Function("btnFindClick(false)");
btnFindNext.onclick = new
Function("btnFindClick(true)");
btnFindNext.ondblclick = new
Function("btnFindClick(true)");
btnCancel.onclick = new Function("btnCancelClick2()");
document.onmouseup = new Function("mouseClick()");
txtFindText.onpropertychange = new Function("setFindState(true)");
txtFindText.onfocus = new Function("txtFindText.select()");
txtFindText.onkeypress = new Function("txtDefaultESC()");
g_fFindStartPoint = true;
//
// enable RTL search items if document supports RTL charset - default is disabled=1
//
var docCharset = window.dialogArguments.document.charset;
if(docCharset == "" || // plain text/unknown
docCharset == "utf-8" || // unicode
docCharset == "unicode-1-1-utf-8" ||
docCharset == "unicode-2-0-utf-8" ||
docCharset == "windows-1255" || // hebrew
docCharset == "dos-862" ||
docCharset == "iso-8859-8" ||
docCharset == "iso-8859-8-i" ||
docCharset == "windows-1256" || // arabic
docCharset == "asmo-708" ||
docCharset == "asmo-720" ||
docCharset == "dos-720" ||
docCharset == "iso-8859-6")
{
chkMatchDiacritic.disabled = 0;
if(docCharset == "windows-1255" || // hebrew does not have kashida or alef hamza
docCharset == "dos-862" ||
docCharset == "iso-8859-8" ||
docCharset == "iso-8859-8-i")
{
chkMatchKashida.checked = 1;
chkMatchKashida.disabled = 1;
chkMatchAlefHamza.checked = 1;
chkMatchAlefHamza.disabled = 1;
}
}
if ("" != window.dialogArguments.findText)
{
txtFindText.value = window.dialogArguments.findText;
}
txtFindText.focus();
txtFindText.select();
} // loadBdy
//+---------------------------------------------------------------------
//
// Synopsis: Sets the find text so it can be used next time.
//
// Arguments: none
//
// Returns: nothing
//
//-----------------------------------------------------------------------
function unloadBdy()
{
window.onerror = SuppressError;
window.dialogArguments.findText = txtFindText.value;
window.onerror = HandleError;
} // unloadBdy
function findStartPoint(fForward)
{
if (g_fFindStartPoint)
{
g_fFindStartPoint = false;
var win = window.dialogArguments.unsecuredWindowOfDocument;
var doc = window.dialogArguments.document;
//
// Are we in a frameset?
//
if (!g_fError && win.frames.length)
{
var win2;
g_fFrameset = true;
g_arrFrames[0] = 0;
g_arrFrames[1] = -1;
//
// Search through the frameset for a selection
//
win2 = CrawlPath();
// the find dialog gets it's own error handler
// until while we're not sure if the iframe
// is hosting trident. (It could host Word,
// explorer, etc.)
window.onerror = FindHandleError;
doc2 = win2.document;
window.onerror = HandleError;
while (doc2.selection.type == "None")
{
if (MoveDoc(fForward))
{
win2 = CrawlPath();
doc2 = win2.document;
}
else // no selection. reset search
{
g_arrFrames[0] = fForward ? 0 : win.frames.length - 1;
g_arrFrames[1] = -1;
break;
}
}
doc = GetFirstDoc();
g_docLastFound = doc;
}
//
// If a control is selected, select it as a text range.
// Dont set the text range to the control if we are doing this
// on wrap. That will scope the wrap to within the control.
//
if (!g_fWrapped && doc.selection.type == "Control")
{
var r = doc.selection.createRange();
r = getTextRange(r(0));
r.select();
}
}
} // findStartPoint