forked from COMPSCI290-S2016/jsMath
-
Notifications
You must be signed in to change notification settings - Fork 1
/
jsMath-loader-post.html
78 lines (74 loc) · 2.35 KB
/
jsMath-loader-post.html
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
<html>
<head>
<!--
| jsMath-loader-post.html
|
| Part of the jsMath package for mathematics on the web.
|
| This file is used for loading jsMath components in Firefox3 when
| used in a file: url from a directory other than the one containing
| jsMath (gets around Firefox3's more restrictive same-origin policy.
|
| ---------------------------------------------------------------------
|
| Copyright 2008 by Davide P. Cervone
|
| Licensed under the Apache License, Version 2.0 (the "License");
| you may not use this file except in compliance with the License.
| You may obtain a copy of the License at
|
| http://www.apache.org/licenses/LICENSE-2.0
|
| Unless required by applicable law or agreed to in writing, software
| distributed under the License is distributed on an "AS IS" BASIS,
| WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
| See the License for the specific language governing permissions and
| limitations under the License.
-->
</head>
<body>
<script>
var isCheck = 0;
var url = location.search.substr(1); var ID = "jsMLD";
if (url.substr(0,9) == "autoload=") {url = url.substr(9); ID = "jsMAL"}
if (url == 'http://www.math.union.edu/locate/jsMath/jsMath/jsMath-version-check.js') {
//
// Handle version check separately
//
var jsMath = {Controls: {}}; isCheck = 1;
document.write('<script src="'+url+'"></'+'script>');
} else if (url != "" && url.match(/\.js$/) && !url.match('(^|[/\\?#=])[a-z]+://')) {
//
// Load the file and pass it to jsMath
//
var request = new XMLHttpRequest;
try {
request.open("GET",url,false);
request.send(null);
window.parent.postMessage(ID+":BGN:","*");
window.parent.postMessage(ID+":SCR:"+request.responseText,"*");
window.parent.postMessage(ID+":END:1","*");
} catch (err) {
window.parent.postMessage(ID+":ERR:Can't load "+url+": "+err.message,"*");
}
} else {
window.parent.postMessage(ID+":END:","*");
}
</script>
<script>
//
// If we are loading the version check, pass it to jsMath
// and run the check.
//
if (isCheck) {
var fn = jsMath.Controls.TestVersion.toString();
window.parent.postMessage(ID+":SCR:" +
"jsMath.Controls.TestVersion = "+fn+";" +
"jsMath.Message.Clear(); jsMath.Message.doClear();" +
"jsMath.Controls.TestVersion()","*"
);
window.parent.postMessage(ID+":END:","*");
}
</script>
</body>
</html>