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