Subversion Repositories Applications.papyrus

Rev

Rev 431 | Go to most recent revision | Details | Compare with Previous | Last modification | View Log | RSS feed

Rev Author Line No. Line
431 ddelon 1
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
2
<!--
3
 * FCKeditor - The text editor for internet
875 ddelon 4
 * Copyright (C) 2003-2006 Frederico Caldeira Knabben
431 ddelon 5
 *
6
 * Licensed under the terms of the GNU Lesser General Public License:
7
 * 		http://www.opensource.org/licenses/lgpl-license.php
8
 *
9
 * For further information visit:
10
 * 		http://www.fckeditor.net/
11
 *
875 ddelon 12
 * "Support Open Source software. What about a donation today?"
13
 *
431 ddelon 14
 * File Name: fck_find.html
15
 * 	"Find" dialog window.
16
 *
17
 * File Authors:
18
 * 		Frederico Caldeira Knabben (fredck@fckeditor.net)
19
-->
875 ddelon 20
<html xmlns="http://www.w3.org/1999/xhtml">
21
<head>
22
	<title></title>
23
	<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
24
	<meta content="noindex, nofollow" name="robots" />
25
	<script type="text/javascript">
431 ddelon 26
 
27
var oEditor = window.parent.InnerDialogLoaded() ;
28
 
29
function OnLoad()
30
{
31
	// Whole word is available on IE only.
32
	if ( oEditor.FCKBrowserInfo.IsIE )
33
		document.getElementById('divWord').style.display = '' ;
34
 
35
	// First of all, translate the dialog box texts.
36
	oEditor.FCKLanguageManager.TranslatePage( document ) ;
37
 
38
	window.parent.SetAutoSize( true ) ;
39
}
40
 
41
function btnStat(frm)
42
{
43
	document.getElementById('btnFind').disabled =
44
		( document.getElementById('txtFind').value.length == 0 ) ;
45
}
46
 
47
function ReplaceTextNodes( parentNode, regex, replaceValue, replaceAll )
48
{
49
	for ( var i = 0 ; i < parentNode.childNodes.length ; i++ )
50
	{
51
		var oNode = parentNode.childNodes[i] ;
52
		if ( oNode.nodeType == 3 )
53
		{
54
			var sReplaced = oNode.nodeValue.replace( regex, replaceValue ) ;
55
			if ( oNode.nodeValue != sReplaced )
56
			{
57
				oNode.nodeValue = sReplaced ;
58
				if ( ! replaceAll )
59
					return true ;
60
			}
61
		}
62
		else
63
		{
64
			if ( ReplaceTextNodes( oNode, regex, replaceValue ) )
65
				return true ;
66
		}
67
	}
68
	return false ;
69
}
70
 
71
function GetRegexExpr()
72
{
73
	if ( document.getElementById('chkWord').checked )
74
		var sExpr = '\\b' + document.getElementById('txtFind').value + '\\b' ;
75
	else
76
		var sExpr = document.getElementById('txtFind').value ;
77
 
78
	return sExpr ;
79
}
80
 
81
function GetCase()
82
{
83
	return ( document.getElementById('chkCase').checked ? '' : 'i' ) ;
84
}
85
 
86
function Ok()
87
{
88
	if ( document.getElementById('txtFind').value.length == 0 )
89
		return ;
90
 
91
	if ( oEditor.FCKBrowserInfo.IsIE )
92
		FindIE() ;
93
	else
94
		FindGecko() ;
95
}
96
 
875 ddelon 97
var oRange ;
98
 
99
if ( oEditor.FCKBrowserInfo.IsIE )
100
	oRange = oEditor.FCK.EditorDocument.body.createTextRange() ;
101
 
431 ddelon 102
function FindIE()
103
{
104
	var iFlags = 0 ;
105
 
106
	if ( chkCase.checked )
107
		iFlags = iFlags | 4 ;
108
 
109
	if ( chkWord.checked )
110
		iFlags = iFlags | 2 ;
111
 
112
	var bFound = oRange.findText( document.getElementById('txtFind').value, 1, iFlags ) ;
113
 
114
	if ( bFound )
115
	{
116
		oRange.scrollIntoView() ;
117
		oRange.select() ;
118
		oRange.collapse(false) ;
119
		oLastRangeFound = oRange ;
120
	}
121
	else
122
	{
123
		oRange = oEditor.FCK.EditorDocument.body.createTextRange() ;
124
		alert( oEditor.FCKLang.DlgFindNotFoundMsg ) ;
125
	}
126
}
127
 
128
function FindGecko()
129
{
130
	var bCase = document.getElementById('chkCase').checked ;
131
	var bWord = document.getElementById('chkWord').checked ;
132
 
133
	// window.find( searchString, caseSensitive, backwards, wrapAround, wholeWord, searchInFrames, showDialog ) ;
134
	oEditor.FCK.EditorWindow.find( document.getElementById('txtFind').value, bCase, false, false, bWord, false, false ) ;
135
 
136
}
875 ddelon 137
 
138
function FindGecko()
139
{
140
	var bCase = document.getElementById('chkCase').checked ;
141
	var bWord = document.getElementById('chkWord').checked ;
142
 
143
	// window.find( searchString, caseSensitive, backwards, wrapAround, wholeWord, searchInFrames, showDialog ) ;
144
	if ( !oEditor.FCK.EditorWindow.find( document.getElementById('txtFind').value, bCase, false, false, bWord, false, false ) )
145
		alert( oEditor.FCKLang.DlgFindNotFoundMsg ) ;
146
}
147
	</script>
148
</head>
149
<body onload="OnLoad()" scroll="no" style="overflow: hidden">
150
	<table cellspacing="3" cellpadding="2" width="100%" border="0">
151
		<tr>
152
			<td nowrap="nowrap">
153
				<label for="txtFind" fcklang="DlgReplaceFindLbl">
154
					Find what:</label>&nbsp;
155
			</td>
156
			<td width="100%">
157
				<input id="txtFind" style="width: 100%" tabindex="1" type="text" />
158
			</td>
159
			<td>
160
				<input id="btnFind" style="padding-right: 5px; padding-left: 5px" onclick="Ok();"
161
					type="button" value="Find" fcklang="DlgFindFindBtn" />
162
			</td>
163
		</tr>
164
		<tr>
165
			<td valign="bottom" colspan="3">
166
				&nbsp;<input id="chkCase" tabindex="3" type="checkbox" /><label for="chkCase" fcklang="DlgReplaceCaseChk">Match
167
					case</label>
168
				<br />
169
				<div id="divWord" style="display: none">
170
					&nbsp;<input id="chkWord" tabindex="4" type="checkbox" /><label for="chkWord" fcklang="DlgReplaceWordChk">Match
171
					whole word</label>
172
				</div>
173
			</td>
174
		</tr>
175
	</table>
176
</body>
431 ddelon 177
</html>