comparison wiki/htdocs/applets/FCKeditor/editor/dialog/fck_replace.html @ 0:77665d8e2254

tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0 (automatically generated log message) imported from: moin--main--1.5--base-0
author Thomas Waldmann <tw-public@gmx.de>
date Thu, 22 Sep 2005 15:09:50 +0000
parents
children 645324d706e2 07862b0663fd
comparison
equal deleted inserted replaced
-1:000000000000 0:77665d8e2254
1 <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
2 <!--
3 * FCKeditor - The text editor for internet
4 * Copyright (C) 2003-2005 Frederico Caldeira Knabben
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 *
12 * "Support Open Source software. What about a donation today?"
13 *
14 * File Name: fck_replace.html
15 * "Replace" dialog box window.
16 *
17 * File Authors:
18 * Frederico Caldeira Knabben (fredck@fckeditor.net)
19 * Abdul-Aziz A. Al-Oraij (aziz.oraij.com)
20 -->
21 <html>
22 <head>
23 <meta http-equiv="Content-Type" content="text/html; charset=utf-8">
24 <meta content="noindex, nofollow" name="robots">
25 <script type="text/javascript">
26
27 var oEditor = window.parent.InnerDialogLoaded() ;
28
29 function OnLoad()
30 {
31 // First of all, translate the dialog box texts
32 oEditor.FCKLanguageManager.TranslatePage( document ) ;
33
34 window.parent.SetAutoSize( true ) ;
35
36 oEditor.FCKUndo.SaveUndoStep() ;
37 }
38
39 function btnStat(frm)
40 {
41 document.getElementById('btnReplace').disabled =
42 document.getElementById('btnReplaceAll').disabled =
43 ( document.getElementById('txtFind').value.length == 0 ) ;
44 }
45
46 function ReplaceTextNodes( parentNode, regex, replaceValue, replaceAll, hasFound )
47 {
48 for ( var i = 0 ; i < parentNode.childNodes.length ; i++ )
49 {
50 var oNode = parentNode.childNodes[i] ;
51 if ( oNode.nodeType == 3 )
52 {
53 var sReplaced = oNode.nodeValue.replace( regex, replaceValue ) ;
54 if ( oNode.nodeValue != sReplaced )
55 {
56 oNode.nodeValue = sReplaced ;
57 if ( ! replaceAll )
58 return true ;
59 hasFound = true ;
60 }
61 }
62
63 hasFound = ReplaceTextNodes( oNode, regex, replaceValue, replaceAll, hasFound ) ;
64 if ( ! replaceAll && hasFound )
65 return true ;
66 }
67
68 return hasFound ;
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 Replace()
87 {
88 var oRegex = new RegExp( GetRegexExpr(), GetCase() ) ;
89 ReplaceTextNodes( oEditor.FCK.EditorDocument.body, oRegex, document.getElementById('txtReplace').value, false, false ) ;
90 }
91
92 function ReplaceAll()
93 {
94 var oRegex = new RegExp( GetRegexExpr(), GetCase() + 'g' ) ;
95 ReplaceTextNodes( oEditor.FCK.EditorDocument.body, oRegex, document.getElementById('txtReplace').value, true, false ) ;
96 window.parent.Cancel() ;
97 }
98 </script>
99 </head>
100 <body onload="OnLoad()" scroll="no" style="OVERFLOW: hidden">
101 <table cellSpacing="3" cellPadding="2" width="100%" border="0">
102 <tr>
103 <td noWrap><label for="txtFind" fckLang="DlgReplaceFindLbl">Find what:</label>
104 </td>
105 <td width="100%"><input id="txtFind" onkeyup="btnStat(this.form)" style="WIDTH: 100%" tabIndex="1" type="text">
106 </td>
107 <td><input id="btnReplace" style="WIDTH: 100%" disabled onclick="Replace();" type="button"
108 value="Replace" fckLang="DlgReplaceReplaceBtn">
109 </td>
110 </tr>
111 <tr>
112 <td vAlign="top" noWrap><label for="txtReplace" fckLang="DlgReplaceReplaceLbl">Replace
113 with:</label>
114 </td>
115 <td vAlign="top"><input id="txtReplace" style="WIDTH: 100%" tabIndex="2" type="text">
116 </td>
117 <td><input id="btnReplaceAll" disabled onclick="ReplaceAll()" type="button" value="Replace All"
118 fckLang="DlgReplaceReplAllBtn">
119 </td>
120 </tr>
121 <tr>
122 <td vAlign="bottom" colSpan="3">&nbsp;<input id="chkCase" tabIndex="3" type="checkbox"><label for="chkCase" fckLang="DlgReplaceCaseChk">Match
123 case</label>
124 <br>
125 &nbsp;<input id="chkWord" tabIndex="4" type="checkbox"><label for="chkWord" fckLang="DlgReplaceWordChk">Match
126 whole word</label>
127 </td>
128 </tr>
129 </table>
130 </body>
131 </html>