0
|
1 <!DOCTYPE html
|
|
2 PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
|
|
3 "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
|
|
4 <html xmlns="http://www.w3.org/1999/xhtml"
|
|
5 xmlns:py="http://genshi.edgewall.org/"
|
|
6 xmlns:xi="http://www.w3.org/2001/XInclude">
|
|
7 <head>
|
|
8 <title>wordstream</title>
|
|
9 <script src="${link('jquery.js')}"></script>
|
|
10 <script type="text/javascript">
|
|
11 $(document).ready(function(){
|
|
12
|
|
13 $('#stream').keyup(function(event) {
|
|
14
|
|
15 if (event.keyCode == 13) {
|
|
16
|
|
17 var text = $('#stream').val();
|
|
18 var lines = text.split('\n');
|
|
19 var lastline = lines[lines.length - 2];
|
|
20 var words = lastline.split(" ");
|
|
21 var lastword = words[words.length - 1];
|
|
22
|
|
23 if (lastword.length) {
|
|
24 $.get(lastword, function(data) {
|
|
25 if (data.length) { $('#stream').val(text + data + '\n'); }
|
|
26 });
|
|
27 }
|
|
28
|
|
29 if (words.length > 1) {
|
|
30 path = words.join('/');
|
|
31 $.post(path);
|
|
32 }
|
|
33
|
|
34 }
|
|
35
|
|
36 });
|
|
37
|
|
38 $('#stream').focus();
|
|
39
|
|
40 });
|
|
41 </script>
|
|
42 </head>
|
|
43 <body>
|
|
44 <textarea id="stream" rows="25"></textarea>
|
|
45 </body>
|
|
46 </html>
|