Annotation of loncom/html/adm/jsMath/jsMath-loader.html, revision 1.3

1.1       albertel    1: <html>
                      2: <head>
                      3: <!--
                      4:  | jsMath-loader.html
                      5:  |
                      6:  | Part of the jsMath package for mathematics on the web.
                      7:  | 
                      8:  | This file is used for jsMath components when the browser doesn't
                      9:  | handle the XmlHttpRequest function, or when they must be obtained
                     10:  | from a server other than the one server the page that is using jsMath.
                     11:  | 
                     12:  | ---------------------------------------------------------------------
                     13:  | 
                     14:  | Copyright 2004-2006 by Davide P. Cervone
                     15:  |
                     16:  | Licensed under the Apache License, Version 2.0 (the "License");
                     17:  | you may not use this file except in compliance with the License.
                     18:  | You may obtain a copy of the License at
                     19:  |
                     20:  |     http://www.apache.org/licenses/LICENSE-2.0
                     21:  |
                     22:  | Unless required by applicable law or agreed to in writing, software
                     23:  | distributed under the License is distributed on an "AS IS" BASIS,
                     24:  | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
                     25:  | See the License for the specific language governing permissions and
                     26:  | limitations under the License.
                     27: -->
                     28: </head>
                     29: <body>
                     30: 
                     31: <script>
                     32: var showWarning = 0;
                     33: while (!window.jsMath && !showWarning) {
                     34:   try {
                     35:     window.jsMath = window.parent.jsMath;
                     36:     if (!window.jsMath) {throw "no jsMath";}
                     37:   } catch (err) {
1.2       albertel   38:     showWarning = 1; pageDomain = '';
                     39:     try {pageDomain = document.domain} catch (err) {}
1.1       albertel   40:     //
                     41:     // MSIE on Mac can't change document.domain, and 'try' won't
1.2       albertel   42:     //   catch the error (Grrr!) so don't even attempt it.
1.1       albertel   43:     //
1.2       albertel   44:     if (pageDomain.match(/\..*\./) &&
1.1       albertel   45:         (navigator.appName != 'Microsoft Internet Explorer' ||
1.3     ! albertel   46:          !navigator.platform.match(/Mac/) || !navigator.userProfile || !document.all)) {
1.1       albertel   47:       try {
1.2       albertel   48:         document.domain = pageDomain.replace(/^[^.]*\./,'');
1.1       albertel   49:         showWarning = 0;
                     50:       } catch(err) {}
                     51:     }
                     52:   }
                     53: }
                     54: 
                     55: function Warning () {
                     56:   alert(
                     57:     "jsMath can't load one of its required components, because jsMath " +
                     58:     "was not obtained from a server that is in the same domain as the " +
                     59:     "page that loaded it."
                     60:   );
                     61: }
                     62: 
1.2       albertel   63: isOmniWeb4 = (document.readyState == 'loading' &&
                     64:               navigator.accentColorName != null &&
                     65:               navigator.omniWebString == null);
                     66: 
1.1       albertel   67: if (showWarning) {setTimeout("Warning()",1)} else {
                     68:   debug = window.parent.debug; show = window.parent.show;
                     69:   jsMath.Script.window = window; url = jsMath.Script.url;
1.2       albertel   70:   if (isOmniWeb4) {
                     71:     if (url != jsMath.Script.prevURL) {
                     72:       jsMath.Script.prevURL = url;
                     73:       document.writeln('<script src="'+jsMath.root+'jsMath-loader-omniweb4.js"><'+'/script>');
                     74:       document.writeln('<script src="'+url+'"><'+'/script>');
                     75:       document.writeln('<script src="'+jsMath.root+'jsMath-loader-omniweb4.js"><'+'/script>');
                     76:     }
                     77:   } else {
                     78:     jsMath.Script.Start();
                     79:     document.writeln('<script src="'+url+'"><'+'/script>');
                     80:   }
1.1       albertel   81: }
                     82: </script>
                     83: 
                     84: <script>
1.2       albertel   85: if (window.jsMath && !isOmniWeb4) {
                     86:   jsMath.Script.End();
                     87:   jsMath.Script.endLoad();
1.1       albertel   88: }
                     89: </script>
                     90: 
                     91: </body>
                     92: </html>

FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>