1 | <html>
|
---|
2 | <head>
|
---|
3 | <title>Find and Replace</title>
|
---|
4 | <!--
|
---|
5 | /*---------------------------------------*\
|
---|
6 | Find and Replace Plugin for HTMLArea-3.0
|
---|
7 | -----------------------------------------
|
---|
8 | author: Cau guanabara
|
---|
9 | e-mail: caugb@ibest.com.br
|
---|
10 | \*---------------------------------------*/
|
---|
11 | -->
|
---|
12 | <script type="text/javascript" src="../fr_engine.js"></script>
|
---|
13 | <script type="text/javascript" src="../../../popups/popup.js"></script>
|
---|
14 | <link rel="stylesheet" type="text/css" href="../../../popups/popup.css" />
|
---|
15 |
|
---|
16 | <script type="text/javascript">
|
---|
17 |
|
---|
18 | window.resizeTo(335, 250);
|
---|
19 |
|
---|
20 | var accepted = {
|
---|
21 | 'fr_pattern' : true,
|
---|
22 | 'fr_replacement' : true,
|
---|
23 | 'fr_words' : true,
|
---|
24 | 'fr_matchcase' : true,
|
---|
25 | 'fr_replaceall' : true
|
---|
26 | };
|
---|
27 |
|
---|
28 | function Init() {
|
---|
29 | __dlg_translate('FindReplace');
|
---|
30 | __dlg_init();
|
---|
31 |
|
---|
32 | disab("fr_undo,fr_clear,fr_hiliteall",true);
|
---|
33 |
|
---|
34 | var params = window.dialogArguments;
|
---|
35 | if(params) {
|
---|
36 | document.getElementById('fr_pattern').value = params["fr_pattern"];
|
---|
37 | document.getElementById('fr_replacement').focus();
|
---|
38 | } else {
|
---|
39 | document.getElementById('fr_pattern').focus();
|
---|
40 | }
|
---|
41 |
|
---|
42 | document.body.onkeypress = __dlg_key_press;
|
---|
43 | }
|
---|
44 |
|
---|
45 | function onCancel() {
|
---|
46 | clearDoc();
|
---|
47 | __dlg_close(null);
|
---|
48 | return false;
|
---|
49 | }
|
---|
50 |
|
---|
51 | function onOK() {
|
---|
52 | var required = {'fr_pattern' : _lc("Enter the text you want to find")};
|
---|
53 | for (var i in required) {
|
---|
54 | var el = document.getElementById(i);
|
---|
55 | if (!el.value) {
|
---|
56 | alert(required[i]);
|
---|
57 | el.focus();
|
---|
58 | return false;
|
---|
59 | }
|
---|
60 | }
|
---|
61 |
|
---|
62 | var param = {};
|
---|
63 | for (var i in accepted) {
|
---|
64 | var el = document.getElementById(i);
|
---|
65 | param[i] = el.type == 'checkbox' ? el.checked : el.value;
|
---|
66 | }
|
---|
67 | execSearch(param);
|
---|
68 | return false;
|
---|
69 | }
|
---|
70 |
|
---|
71 | function __dlg_key_press(ev) {
|
---|
72 | ev || (ev = window.event);
|
---|
73 | switch(ev.keyCode) {
|
---|
74 | case 13:
|
---|
75 | document.getElementById('fr_go').click();
|
---|
76 | document.getElementById('fr_pattern').focus();
|
---|
77 | break;
|
---|
78 | case 27:
|
---|
79 | clearDoc();
|
---|
80 | window.close();
|
---|
81 | return false;
|
---|
82 | }
|
---|
83 | return true;
|
---|
84 | }
|
---|
85 |
|
---|
86 | </script>
|
---|
87 |
|
---|
88 | <style type="text/css">
|
---|
89 | table .label { text-align: right; width: 12em; }
|
---|
90 | .title {
|
---|
91 | background: #ddf;
|
---|
92 | color: #000;
|
---|
93 | font-weight: bold;
|
---|
94 | font-size: 120%;
|
---|
95 | padding: 3px 10px;
|
---|
96 | margin-bottom: 10px;
|
---|
97 | border-bottom: 1px solid black;
|
---|
98 | letter-spacing: 2px;
|
---|
99 | }
|
---|
100 | .buttons { border-top: 1px solid #999; padding: 2px; text-align: right; }
|
---|
101 | .hrstyle { border-width: 1px; border-color: #666; width: 95%; padding: 2px; }
|
---|
102 | </style>
|
---|
103 | </head>
|
---|
104 | <body class="dialog" onload="Init()">
|
---|
105 | <div class="title">Find and Replace</div>
|
---|
106 | <form action="" method="get">
|
---|
107 | <table border="0" style="width: 100%; padding: 2px;"><!---->
|
---|
108 | <tbody>
|
---|
109 | <tr>
|
---|
110 | <td width="29%" align="right" valign="bottom">Search for:</td>
|
---|
111 | <td width="71%" colspan="2" valign="bottom">
|
---|
112 | <input id="fr_pattern" type="text" style="width: 200px" onFocus="this.select();">
|
---|
113 | </td>
|
---|
114 | </tr>
|
---|
115 | <tr>
|
---|
116 | <td align="right">Replace with:</td>
|
---|
117 | <td colspan="2">
|
---|
118 | <input id="fr_replacement" type="text" style="width: 200px" onFocus="this.select();">
|
---|
119 | </td>
|
---|
120 | </tr>
|
---|
121 | <tr>
|
---|
122 | <td colspan="3"><table width="100%" border="0" cellpadding="1" cellspacing="0">
|
---|
123 | <tr>
|
---|
124 | <td width="78%" style="padding: 2px">
|
---|
125 | <FIELDSET style="width:90%; padding: 5px">
|
---|
126 | <LEGEND><span>Options</span></LEGEND>
|
---|
127 | <input id="fr_words" type="checkbox" checked onClick="clearDoc();">
|
---|
128 | <span onClick="e = document.getElementById('fr_words');
|
---|
129 | e.click(); e.focus();" style="cursor:default">
|
---|
130 | <span>Whole words only</span></span><br />
|
---|
131 | <input id="fr_matchcase" type="checkbox" onClick="clearDoc();">
|
---|
132 | <span onClick="e = document.getElementById('fr_matchcase');
|
---|
133 | e.click(); e.focus();" style="cursor:default">
|
---|
134 | <span>Case sensitive search</span></span><br />
|
---|
135 | <input id="fr_replaceall" type="checkbox" onClick="
|
---|
136 | if(document.getElementById('fr_replacement').value == '') {
|
---|
137 | alert(_lc('Inform a replacement word'));
|
---|
138 | return false;
|
---|
139 | }
|
---|
140 | clearDoc();">
|
---|
141 | <span onClick="e = document.getElementById('fr_replaceall');
|
---|
142 | e.click(); e.focus();" style="cursor:default">
|
---|
143 | <span>Substitute all occurrences</span></span>
|
---|
144 | </FIELDSET></td>
|
---|
145 | <td width="22%" align="center" valign="bottom" style="text-align: right; padding: 4px">
|
---|
146 | <button type="button" id="fr_clear" onClick="clearMarks()">Clear</button>
|
---|
147 | <div class="space"></div>
|
---|
148 | <button type="button" id="fr_hiliteall" onClick="hiliteAll()">Highlight</button>
|
---|
149 | <div class="space"></div>
|
---|
150 | <button type="button" id="fr_undo" onClick="resetContents();">Undo</button>
|
---|
151 | </td>
|
---|
152 | </tr>
|
---|
153 | </table></td>
|
---|
154 | </tr>
|
---|
155 | </tbody>
|
---|
156 | </table>
|
---|
157 | <div style="border-top: 1px solid #999; padding: 2px; padding: 5px; text-align: right; height: 20px"><button type="button" id="fr_go" onclick="return onOK();">Next</button>
|
---|
158 | <button type="button" name="cancel" onclick="return onCancel();">Done</button>
|
---|
159 | </div>
|
---|
160 | </form>
|
---|
161 | </body>
|
---|
162 | </html> |
---|