adding some strings
[moodle-linuxchix.git] / lib / speller / spellchecker.html
blob0a303ac8f714d76af1b9213bbc180f527916c3e5
2 <script type="text/javascript">
4 var wordWindow = null;
5 var controlWindow = null;
7 function init_spell( spellerWindow ) {
9 if( spellerWindow ) {
10 if( spellerWindow.windowType == "wordWindow" ) {
11 wordWindow = spellerWindow;
12 } else if ( spellerWindow.windowType == "controlWindow" ) {
13 controlWindow = spellerWindow;
17 if( controlWindow && wordWindow ) {
18 // populate the speller object and start it off!
19 var speller = opener.speller;
20 wordWindow.speller = speller;
21 speller.startCheck( wordWindow, controlWindow );
25 // encodeForPost
26 function encodeForPost( str ) {
27 var s = new String( str );
28 s = encodeURIComponent( s );
29 // additionally encode single quotes to evade any PHP
30 // magic_quotes_gpc setting (it inserts escape characters and
31 // therefore skews the btye positions of misspelled words)
32 return s.replace( /\'/g, '%27' );
35 // post the text area data to the script that populates the speller
36 function postWords() {
37 var bodyDoc = window.frames[0].document;
38 bodyDoc.open();
39 bodyDoc.write('<html>');
40 bodyDoc.write('<meta http-equiv="Content-Type" content="text/html; charset=utf-8">');
41 bodyDoc.write('<link rel="stylesheet" type="text/css" href="spellerStyle.css"/>');
42 if (opener) {
43 var speller = opener.speller;
44 bodyDoc.write('<body class="normalText" onLoad="document.forms[0].submit();">');
45 bodyDoc.write('<p>Spell check in progress...</p>');
46 bodyDoc.write('<form action="'+speller.spellCheckScript+'" method="post">');
47 for( var i = 0; i < speller.textInputs.length; i++ ) {
48 bodyDoc.write('<input type="hidden" name="textinputs[]" value="'+encodeForPost(speller.textInputs[i].value)+'" />');
50 bodyDoc.write('</form>');
51 bodyDoc.write('</body>');
52 } else {
53 bodyDoc.write('<body class="normalText">');
54 bodyDoc.write('<p><b>This page cannot be displayed</b></p><p>The window was not opened from another window.</p>');
55 bodyDoc.write('</body>');
57 bodyDoc.write('</html>');
58 bodyDoc.close();
60 </script>
62 <html>
63 <meta http-equiv="Content-Type" content="text/html; charset=utf-8">
64 <head>
65 <title>Speller Pages</title>
66 </head>
67 <frameset rows="*,201" onLoad="postWords();">
68 <frame src="blank.html">
69 <frame src="controls.html">
70 </frameset>
71 </html>