source: trunk/plugins/FindReplace/popups/find_replace.html @ 90

Last change on this file since 90 was 90, checked in by niko, 14 years ago

#172
New Plugin: FindReplace?
http://www.netflash.com.br/gb/HA3-rc1/examples/find-replace.html
Author: Cau Cuanabara <caugb@…>

I modified the plugin to work with the new i18n-system

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