Subversion Repositories Applications.papyrus

Rev

Rev 1688 | Go to most recent revision | Details | Compare with Previous | Last modification | View Log | RSS feed

Rev Author Line No. Line
1075 ddelon 1
 
2
<script>
3
 
4
var wordWindow = null;
5
var controlWindow = null;
6
 
7
function init_spell( spellerWindow ) {
8
 
9
	if( spellerWindow ) {
10
		if( spellerWindow.windowType == "wordWindow" ) {
11
			wordWindow = spellerWindow;
12
		} else if ( spellerWindow.windowType == "controlWindow" ) {
13
			controlWindow = spellerWindow;
14
		}
15
	}
16
 
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 );
22
	}
23
}
24
 
25
// encodeForPost
26
function encodeForPost( str ) {
27
	var s = new String( str );
28
	s = encodeURIComponent( s );
1921 jp_milcent 29
	// additionally encode single quotes to evade any PHP
30
	// magic_quotes_gpc setting (it inserts escape characters and
1075 ddelon 31
	// therefore skews the btye positions of misspelled words)
32
	return s.replace( /\'/g, '%27' );
33
}
34
 
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>' + window.parent.FCKLang.DlgSpellProgress + '<\/p>');		// by FredCK
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)+'">');
49
		}
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>');
56
	}
57
	bodyDoc.write('<\/html>');
58
	bodyDoc.close();
59
}
60
</script>
61
 
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>