source: companies/celepar/news_admin/templates/celepar/fckeditor/to_delete/_samples/_plugins/findreplace/find.html @ 763

Revision 763, 4.2 KB checked in by niltonneto, 15 years ago (diff)

Importação inicial do Expresso da Celepar

Line 
1<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
2<!--
3 * FCKeditor - The text editor for internet
4 * Copyright (C) 2003-2006 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: find.html
15 *      This is the sample "Find" plugin window.
16 *
17 * File Authors:
18 *              Frederico Caldeira Knabben (fredck@fckeditor.net)
19-->
20<html>
21        <head>
22                <meta http-equiv="Content-Type" content="text/html; charset=utf-8">
23                <meta content="noindex, nofollow" name="robots">
24                <script type="text/javascript">
25
26var oEditor = window.parent.InnerDialogLoaded() ;
27
28function OnLoad()
29{
30        // Whole word is available on IE only.
31        if ( oEditor.FCKBrowserInfo.IsIE )
32                document.getElementById('divWord').style.display = '' ;
33       
34        // First of all, translate the dialog box texts.
35        oEditor.FCKLanguageManager.TranslatePage( document ) ;
36
37        window.parent.SetAutoSize( true ) ;
38}
39
40function btnStat(frm)
41{
42        document.getElementById('btnFind').disabled =
43                ( document.getElementById('txtFind').value.length == 0 ) ;
44}
45
46function ReplaceTextNodes( parentNode, regex, replaceValue, replaceAll )
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                        }
60                }
61                else
62                {
63                        if ( ReplaceTextNodes( oNode, regex, replaceValue ) )
64                                return true ;
65                }
66        }
67        return false ;
68}
69
70function GetRegexExpr()
71{
72        if ( document.getElementById('chkWord').checked )
73                var sExpr = '\\b' + document.getElementById('txtFind').value + '\\b' ;
74        else
75                var sExpr = document.getElementById('txtFind').value ;
76               
77        return sExpr ;
78}
79
80function GetCase()
81{
82        return ( document.getElementById('chkCase').checked ? '' : 'i' ) ;
83}
84
85function Ok()
86{
87        if ( document.getElementById('txtFind').value.length == 0 )
88                return ;
89       
90        if ( oEditor.FCKBrowserInfo.IsIE )
91                FindIE() ;
92        else
93                FindGecko() ;
94}
95
96var oRange = null ;
97
98function FindIE()
99{
100        if ( oRange == null )
101                oRange = oEditor.FCK.EditorDocument.body.createTextRange() ;
102
103        var iFlags = 0 ;
104       
105        if ( chkCase.checked )
106                iFlags = iFlags | 4 ;
107       
108        if ( chkWord.checked )
109                iFlags = iFlags | 2 ;
110       
111        var bFound = oRange.findText( document.getElementById('txtFind').value, 1, iFlags ) ;
112       
113        if ( bFound )
114        {
115                oRange.scrollIntoView() ;
116                oRange.select() ;
117                oRange.collapse(false) ;
118                oLastRangeFound = oRange ;
119        }
120        else
121        {
122                oRange = null ;
123                alert( oEditor.FCKLang.DlgFindNotFoundMsg ) ;
124        }
125}
126
127function FindGecko()
128{
129        var bCase = document.getElementById('chkCase').checked ;
130        var bWord = document.getElementById('chkWord').checked ;
131       
132        // window.find( searchString, caseSensitive, backwards, wrapAround, wholeWord, searchInFrames, showDialog ) ;
133        oEditor.FCK.EditorWindow.find( document.getElementById('txtFind').value, bCase, false, false, bWord, false, false ) ;
134       
135}
136                </script>
137        </head>
138        <body onload="OnLoad()" scroll="no" style="OVERFLOW: hidden">
139                <div align="center">
140                        This is my Plugin!
141                </div>
142                <table cellSpacing="3" cellPadding="2" width="100%" border="0">
143                        <tr>
144                                <td nowrap>
145                                        <label for="txtFind" fckLang="DlgMyReplaceFindLbl">Find what:</label>&nbsp;
146                                </td>
147                                <td width="100%">
148                                        <input id="txtFind" onkeyup="btnStat(this.form)" style="WIDTH: 100%" tabIndex="1" type="text">
149                                </td>
150                                <td>
151                                        <input id="btnFind" style="WIDTH: 100%; PADDING-RIGHT: 5px; PADDING-LEFT: 5px" disabled
152                                                onclick="Ok();" type="button" value="Find" fckLang="DlgMyFindFindBtn">
153                                </td>
154                        </tr>
155                        <tr>
156                                <td valign="bottom" colSpan="3">
157                                        &nbsp;<input id="chkCase" tabIndex="3" type="checkbox"><label for="chkCase" fckLang="DlgMyReplaceCaseChk">Match
158                                                case</label>
159                                        <br>
160                                        <div id="divWord" style="DISPLAY: none">
161                                                &nbsp;<input id="chkWord" tabIndex="4" type="checkbox"><label for="chkWord" fckLang="DlgMyReplaceWordChk">Match
162                                                        whole word</label>
163                                        </div>
164                                </td>
165                        </tr>
166                </table>
167        </body>
168</html>
Note: See TracBrowser for help on using the repository browser.