File: find.html

package info (click to toggle)
moin 1.5.3-1.2etch2
  • links: PTS
  • area: main
  • in suites: etch
  • size: 20,692 kB
  • ctags: 26,801
  • sloc: python: 32,907; java: 10,704; perl: 1,424; php: 642; makefile: 172; xml: 162; sh: 121; sed: 5
file content (168 lines) | stat: -rw-r--r-- 4,271 bytes parent folder | download | duplicates (3)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<!--
 * FCKeditor - The text editor for internet
 * Copyright (C) 2003-2005 Frederico Caldeira Knabben
 * 
 * Licensed under the terms of the GNU Lesser General Public License:
 * 		http://www.opensource.org/licenses/lgpl-license.php
 * 
 * For further information visit:
 * 		http://www.fckeditor.net/
 * 
 * "Support Open Source software. What about a donation today?"
 * 
 * File Name: find.html
 * 	This is the sample "Find" plugin window.
 * 
 * File Authors:
 * 		Frederico Caldeira Knabben (fredck@fckeditor.net)
-->
<html>
	<head>
		<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
		<meta content="noindex, nofollow" name="robots">
		<script type="text/javascript">

var oEditor = window.parent.InnerDialogLoaded() ;

function OnLoad()
{
	// Whole word is available on IE only.
	if ( oEditor.FCKBrowserInfo.IsIE )
		document.getElementById('divWord').style.display = '' ;
	
	// First of all, translate the dialog box texts.
	oEditor.FCKLanguageManager.TranslatePage( document ) ;

	window.parent.SetAutoSize( true ) ;
}

function btnStat(frm)
{
	document.getElementById('btnFind').disabled = 
		( document.getElementById('txtFind').value.length == 0 ) ;
}

function ReplaceTextNodes( parentNode, regex, replaceValue, replaceAll )
{
	for ( var i = 0 ; i < parentNode.childNodes.length ; i++ )
	{
		var oNode = parentNode.childNodes[i] ;
		if ( oNode.nodeType == 3 )
		{
			var sReplaced = oNode.nodeValue.replace( regex, replaceValue ) ;
			if ( oNode.nodeValue != sReplaced )
			{
				oNode.nodeValue = sReplaced ;
				if ( ! replaceAll )
					return true ;
			}
		}
		else
		{
			if ( ReplaceTextNodes( oNode, regex, replaceValue ) )
				return true ;
		}
	}
	return false ;
}

function GetRegexExpr()
{
	if ( document.getElementById('chkWord').checked )
		var sExpr = '\\b' + document.getElementById('txtFind').value + '\\b' ;
	else
		var sExpr = document.getElementById('txtFind').value ;
		
	return sExpr ;
}

function GetCase() 
{
	return ( document.getElementById('chkCase').checked ? '' : 'i' ) ;
}

function Ok()
{
	if ( document.getElementById('txtFind').value.length == 0 )
		return ;
	
	if ( oEditor.FCKBrowserInfo.IsIE )
		FindIE() ;
	else
		FindGecko() ;
}

var oRange = null ;

function FindIE()
{
	if ( oRange == null )
		oRange = oEditor.FCK.EditorDocument.body.createTextRange() ;

	var iFlags = 0 ;
	
	if ( chkCase.checked )
		iFlags = iFlags | 4 ;
	
	if ( chkWord.checked )
		iFlags = iFlags | 2 ;
	
	var bFound = oRange.findText( document.getElementById('txtFind').value, 1, iFlags ) ;
	
	if ( bFound )
	{
		oRange.scrollIntoView() ;
		oRange.select() ;
		oRange.collapse(false) ;
		oLastRangeFound = oRange ;
	}
	else
	{
		oRange = null ;
		alert( oEditor.FCKLang.DlgFindNotFoundMsg ) ;
	}
}

function FindGecko()
{
	var bCase = document.getElementById('chkCase').checked ;
	var bWord = document.getElementById('chkWord').checked ;
	
	// window.find( searchString, caseSensitive, backwards, wrapAround, wholeWord, searchInFrames, showDialog ) ;
	oEditor.FCK.EditorWindow.find( document.getElementById('txtFind').value, bCase, false, false, bWord, false, false ) ;
	
}
		</script>
	</head>
	<body onload="OnLoad()" scroll="no" style="OVERFLOW: hidden">
		<div align="center">
			This is my Plugin!
		</div>
		<table cellSpacing="3" cellPadding="2" width="100%" border="0">
			<tr>
				<td nowrap>
					<label for="txtFind" fckLang="DlgMyReplaceFindLbl">Find what:</label>&nbsp;
				</td>
				<td width="100%">
					<input id="txtFind" onkeyup="btnStat(this.form)" style="WIDTH: 100%" tabIndex="1" type="text">
				</td>
				<td>
					<input id="btnFind" style="WIDTH: 100%; PADDING-RIGHT: 5px; PADDING-LEFT: 5px" disabled
						onclick="Ok();" type="button" value="Find" fckLang="DlgMyFindFindBtn">
				</td>
			</tr>
			<tr>
				<td valign="bottom" colSpan="3">
					&nbsp;<input id="chkCase" tabIndex="3" type="checkbox"><label for="chkCase" fckLang="DlgMyReplaceCaseChk">Match 
						case</label>
					<br>
					<div id="divWord" style="DISPLAY: none">
						&nbsp;<input id="chkWord" tabIndex="4" type="checkbox"><label for="chkWord" fckLang="DlgMyReplaceWordChk">Match 
							whole word</label>
					</div>
				</td>
			</tr>
		</table>
	</body>
</html>