Debian Codegraph @

ts/input/asciimath/mathjax2/legacy/MathJax.js

raw
1 var MathJax = {debug:true};
2
3 var window = {
4 MathJax: MathJax
5 };
6 var navigator = {};
7 var document = null;
8
9 exports.MathJax = MathJax;
10
11 (function (BASENAME) {
12 var BASE = window[BASENAME];
13 if (!BASE) {BASE = window[BASENAME] = {}}
14
15 var PROTO = []; // a static object used to indicate when a prototype is being created
16 var OBJECT = function (def) {
17 var obj = def.constructor; if (!obj) {obj = function () {}}
18 for (var id in def) {if (id !== 'constructor' && def.hasOwnProperty(id)) {obj[id] = def[id]}}
19 return obj;
20 };
21 var CONSTRUCTOR = function () {
22 return function () {return arguments.callee.Init.call(this,arguments)};
23 };
24
25 BASE.Object = OBJECT({
26 constructor: CONSTRUCTOR(),
27
28 Subclass: function (def,classdef) {
29 var obj = CONSTRUCTOR();
30 obj.SUPER = this; obj.Init = this.Init;
31 obj.Subclass = this.Subclass; obj.Augment = this.Augment;
32 obj.protoFunction = this.protoFunction;
33 obj.can = this.can; obj.has = this.has; obj.isa = this.isa;
34 obj.prototype = new this(PROTO);
35 obj.prototype.constructor = obj; // the real constructor
36 obj.Augment(def,classdef);
37 return obj;
38 },
39
40 Init: function (args) {
41 var obj = this;
42 if (args.length === 1 && args[0] === PROTO) {return obj}
43 if (!(obj instanceof args.callee)) {obj = new args.callee(PROTO)}
44 return obj.Init.apply(obj,args) || obj;
45 },
46
47 Augment: function (def,classdef) {
48 var id;
49 if (def != null) {
50 for (id in def) {if (def.hasOwnProperty(id)) {this.protoFunction(id,def[id])}}
51 // MSIE doesn't list toString even if it is not native so handle it separately
52 if (def.toString !== this.prototype.toString && def.toString !== {}.toString)
53 {this.protoFunction('toString',def.toString)}
54 }
55 if (classdef != null) {
56 for (id in classdef) {if (classdef.hasOwnProperty(id)) {this[id] = classdef[id]}}
57 }
58 return this;
59 },
60
61 protoFunction: function (id,def) {
62 this.prototype[id] = def;
63 if (typeof def === "function") {def.SUPER = this.SUPER.prototype}
64 },
65
66 prototype: {
67 Init: function () {},
68 SUPER: function (fn) {return fn.callee.SUPER},
69 can: function (method) {return typeof(this[method]) === "function"},
70 has: function (property) {return typeof(this[property]) !== "undefined"},
71 isa: function (obj) {return (obj instanceof Object) && (this instanceof obj)}
72 },
73
74 can: function (method) {return this.prototype.can.call(this,method)},
75 has: function (property) {return this.prototype.has.call(this,property)},
76 isa: function (obj) {
77 var constructor = this;
78 while (constructor) {
79 if (constructor === obj) {return true} else {constructor = constructor.SUPER}
80 }
81 return false;
82 },
83
84
85 SimpleSUPER: OBJECT({
86 constructor: function (def) {return this.SimpleSUPER.define(def)},
87
88 define: function (src) {
89 var dst = {};
90 if (src != null) {
91 for (var id in src) {if (src.hasOwnProperty(id)) {dst[id] = this.wrap(id,src[id])}}
92 // MSIE doesn't list toString even if it is not native so handle it separately
93 if (src.toString !== this.prototype.toString && src.toString !== {}.toString)
94 {dst.toString = this.wrap('toString',src.toString)}
95 }
96 return dst;
97 },
98
99 wrap: function (id,f) {
100 if (typeof(f) !== 'function' || !f.toString().match(/\.\s*SUPER\s*\(/)) {return f}
101 var fn = function () {
102 this.SUPER = fn.SUPER[id];
103 try {var result = f.apply(this,arguments)} catch (err) {delete this.SUPER; throw err}
104 delete this.SUPER;
105 return result;
106 }
107 fn.toString = function () {return f.toString.apply(f,arguments)}
108 return fn;
109 }
110
111 })
112 });
113
114 BASE.Object.isArray = Array.isArray || function (obj) {
115 return Object.prototype.toString.call(obj) === "[object Array]";
116 };
117
118 BASE.Object.Array = Array;
119
120 })("MathJax");
121
122 /**********************************************************/
123
124 /*
125 * Create a callback function from various forms of data:
126 *
127 * MathJax.Callback(fn) -- callback to a function
128 *
129 * MathJax.Callback([fn]) -- callback to function
130 * MathJax.Callback([fn,data...])
131 * -- callback to function with given data as arguments
132 * MathJax.Callback([object,fn])
133 * -- call fn with object as "this"
134 * MathJax.Callback([object,fn,data...])
135 * -- call fn with object as "this" and data as arguments
136 * MathJax.Callback(["method",object])
137 * -- call method of object wth object as "this"
138 * MathJax.Callback(["method",object,data...])
139 * -- as above, but with data as arguments to method
140 *
141 * MathJax.Callback({hook: fn, data: [...], object: this})
142 * -- give function, data, and object to act as "this" explicitly
143 *
144 * MathJax.Callback("code") -- callback that compiles and executes a string
145 *
146 * MathJax.Callback([...],i)
147 * -- use slice of array starting at i and interpret
148 * result as above. (Used for passing "arguments" array
149 * and trimming initial arguments, if any.)
150 */
151
152 /*
153 * MathJax.Callback.After([...],cb1,cb2,...)
154 * -- make a callback that isn't called until all the other
155 * ones are called first. I.e., wait for a union of
156 * callbacks to occur before making the given callback.
157 */
158
159 /*
160 * MathJax.Callback.Queue([callback,...])
161 * -- make a synchronized queue of commands that process
162 * sequentially, waiting for those that return uncalled
163 * callbacks.
164 */
165
166 /*
167 * MathJax.Callback.Signal(name)
168 * -- finds or creates a names signal, to which listeners
169 * can be attached and are signaled by messages posted
170 * to the signal. Responses can be asynchronous.
171 */
172
173 (function (BASENAME) {
174 var BASE = window[BASENAME];
175 if (!BASE) {BASE = window[BASENAME] = {}}
176 //
177 // Create a callback from an associative array
178 //
179 var CALLBACK = function (data) {
180 var cb = function () {return arguments.callee.execute.apply(arguments.callee,arguments)};
181 for (var id in CALLBACK.prototype) {
182 if (CALLBACK.prototype.hasOwnProperty(id)) {
183 if (typeof(data[id]) !== 'undefined') {cb[id] = data[id]}
184 else {cb[id] = CALLBACK.prototype[id]}
185 }
186 }
187 cb.toString = CALLBACK.prototype.toString;
188 return cb;
189 };
190 CALLBACK.prototype = {
191 isCallback: true,
192 hook: function () {},
193 data: [],
194 object: window,
195 execute: function () {
196 if (!this.called || this.autoReset) {
197 this.called = !this.autoReset;
198 return this.hook.apply(this.object,this.data.concat([].slice.call(arguments,0)));
199 }
200 },
201 reset: function () {delete this.called},
202 toString: function () {return this.hook.toString.apply(this.hook,arguments)}
203 };
204 var ISCALLBACK = function (f) {
205 return (typeof(f) === "function" && f.isCallback);
206 }
207
208 //
209 // Evaluate a string in global context
210 //
211 var EVAL = function (code) {return eval.call(window,code)}
212 var TESTEVAL = function () {
213 EVAL("var __TeSt_VaR__ = 1"); // check if it works in global context
214 if (window.__TeSt_VaR__) {
215 try { delete window.__TeSt_VaR__; } // NOTE IE9 throws when in IE7 mode
216 catch (error) { window.__TeSt_VaR__ = null; }
217 } else {
218 if (window.execScript) {
219 // IE
220 EVAL = function (code) {
221 BASE.__code = code;
222 code = "try {"+BASENAME+".__result = eval("+BASENAME+".__code)} catch(err) {"+BASENAME+".__result = err}";
223 window.execScript(code);
224 var result = BASE.__result; delete BASE.__result; delete BASE.__code;
225 if (result instanceof Error) {throw result}
226 return result;
227 }
228 } else {
229 // Safari2
230 EVAL = function (code) {
231 BASE.__code = code;
232 code = "try {"+BASENAME+".__result = eval("+BASENAME+".__code)} catch(err) {"+BASENAME+".__result = err}";
233 var head = (document.getElementsByTagName("head"))[0]; if (!head) {head = document.body}
234 var script = document.createElement("script");
235 script.appendChild(document.createTextNode(code));
236 head.appendChild(script); head.removeChild(script);
237 var result = BASE.__result; delete BASE.__result; delete BASE.__code;
238 if (result instanceof Error) {throw result}
239 return result;
240 }
241 }
242 }
243 TESTEVAL = null;
244 }
245
246 //
247 // Create a callback from various types of data
248 //
249 var USING = function (args,i) {
250 if (arguments.length > 1) {
251 if (arguments.length === 2 && !(typeof arguments[0] === 'function') &&
252 arguments[0] instanceof Object && typeof arguments[1] === 'number')
253 {args = [].slice.call(args,i)}
254 else {args = [].slice.call(arguments,0)}
255 }
256 if (args instanceof Array && args.length === 1) {args = args[0]}
257 if (typeof args === 'function') {
258 if (args.execute === CALLBACK.prototype.execute) {return args}
259 return CALLBACK({hook: args});
260 } else if (args instanceof Array) {
261 if (typeof(args[0]) === 'string' && args[1] instanceof Object &&
262 typeof args[1][args[0]] === 'function') {
263 return CALLBACK({hook: args[1][args[0]], object: args[1], data: args.slice(2)});
264 } else if (typeof args[0] === 'function') {
265 return CALLBACK({hook: args[0], data: args.slice(1)});
266 } else if (typeof args[1] === 'function') {
267 return CALLBACK({hook: args[1], object: args[0], data: args.slice(2)});
268 }
269 } else if (typeof(args) === 'string') {
270 if (TESTEVAL) TESTEVAL();
271 return CALLBACK({hook: EVAL, data: [args]});
272 } else if (args instanceof Object) {
273 return CALLBACK(args);
274 } else if (typeof(args) === 'undefined') {
275 return CALLBACK({});
276 }
277 throw Error("Can't make callback from given data");
278 };
279
280 //
281 // Wait for a given time to elapse and then perform the callback
282 //
283 var DELAY = function (time,callback) {
284 callback = USING(callback);
285 callback.timeout = setTimeout(callback,time);
286 return callback;
287 };
288
289 //
290 // Callback used by AFTER, QUEUE, and SIGNAL to check if calls have completed
291 //
292 var WAITFOR = function (callback,signal) {
293 callback = USING(callback);
294 if (!callback.called) {WAITSIGNAL(callback,signal); signal.pending++}
295 };
296 var WAITEXECUTE = function () {
297 var signals = this.signal; delete this.signal;
298 this.execute = this.oldExecute; delete this.oldExecute;
299 var result = this.execute.apply(this,arguments);
300 if (ISCALLBACK(result) && !result.called) {WAITSIGNAL(result,signals)} else {
301 for (var i = 0, m = signals.length; i < m; i++) {
302 signals[i].pending--;
303 if (signals[i].pending <= 0) {signals[i].call()}
304 }
305 }
306 };
307 var WAITSIGNAL = function (callback,signals) {
308 if (!(signals instanceof Array)) {signals = [signals]}
309 if (!callback.signal) {
310 callback.oldExecute = callback.execute;
311 callback.execute = WAITEXECUTE;
312 callback.signal = signals;
313 } else if (signals.length === 1) {callback.signal.push(signals[0])}
314 else {callback.signal = callback.signal.concat(signals)}
315 };
316
317 //
318 // Create a callback that is called when a collection of other callbacks have
319 // all been executed. If the callback gets called immediately (i.e., the
320 // others are all already called), check if it returns another callback
321 // and return that instead.
322 //
323 var AFTER = function (callback) {
324 callback = USING(callback);
325 callback.pending = 0;
326 for (var i = 1, m = arguments.length; i < m; i++)
327 {if (arguments[i]) {WAITFOR(arguments[i],callback)}}
328 if (callback.pending === 0) {
329 var result = callback();
330 if (ISCALLBACK(result)) {callback = result}
331 }
332 return callback;
333 };
334
335 //
336 // An array of prioritized hooks that are executed sequentially
337 // with a given set of data.
338 //
339 var HOOKS = MathJax.Object.Subclass({
340 //
341 // Initialize the array and the auto-reset status
342 //
343 Init: function (reset) {
344 this.hooks = [];
345 this.remove = []; // used when hooks are removed during execution of list
346 this.reset = reset;
347 this.running = false;
348 },
349 //
350 // Add a callback to the list, in priority order (default priority is 10)
351 //
352 Add: function (hook,priority) {
353 if (priority == null) {priority = 10}
354 if (!ISCALLBACK(hook)) {hook = USING(hook)}
355 hook.priority = priority;
356 var i = this.hooks.length;
357 while (i > 0 && priority < this.hooks[i-1].priority) {i--}
358 this.hooks.splice(i,0,hook);
359 return hook;
360 },
361 Remove: function (hook) {
362 for (var i = 0, m = this.hooks.length; i < m; i++) {
363 if (this.hooks[i] === hook) {
364 if (this.running) {this.remove.push(i)}
365 else {this.hooks.splice(i,1)}
366 return;
367 }
368 }
369 },
370 //
371 // Execute the list of callbacks, resetting them if requested.
372 // If any return callbacks, return a callback that will be
373 // executed when they all have completed.
374 // Remove any hooks that requested being removed during processing.
375 //
376 Execute: function () {
377 var callbacks = [{}];
378 this.running = true;
379 for (var i = 0, m = this.hooks.length; i < m; i++) {
380 if (this.reset) {this.hooks[i].reset()}
381 var result = this.hooks[i].apply(window,arguments);
382 if (ISCALLBACK(result) && !result.called) {callbacks.push(result)}
383 }
384 this.running = false;
385 if (this.remove.length) {this.RemovePending()}
386 if (callbacks.length === 1) {return null}
387 if (callbacks.length === 2) {return callbacks[1]}
388 return AFTER.apply({},callbacks);
389 },
390 //
391 // Remove hooks that asked to be removed during execution of list
392 //
393 RemovePending: function () {
394 this.remove = this.remove.sort();
395 for (var i = this.remove.length-1; i >= 0; i--) {this.hooks.splice(i,1)}
396 this.remove = [];
397 }
398
399 });
400
401 //
402 // Run an array of callbacks passing them the given data.
403 // (Legacy function, since this has been replaced by the HOOKS object).
404 //
405 var EXECUTEHOOKS = function (hooks,data,reset) {
406 if (!hooks) {return null}
407 if (!(hooks instanceof Array)) {hooks = [hooks]}
408 if (!(data instanceof Array)) {data = (data == null ? [] : [data])}
409 var handler = HOOKS(reset);
410 for (var i = 0, m = hooks.length; i < m; i++) {handler.Add(hooks[i])}
411 return handler.Execute.apply(handler,data);
412 };
413
414 //
415 // Command queue that performs commands in order, waiting when
416 // necessary for commands to complete asynchronousely
417 //
418 var QUEUE = BASE.Object.Subclass({
419 //
420 // Create the queue and push any commands that are specified
421 //
422 Init: function () {
423 this.pending = this.running = 0;
424 this.queue = [];
425 this.Push.apply(this,arguments);
426 },
427 //
428 // Add commands to the queue and run them. Adding a callback object
429 // (rather than a callback specification) queues a wait for that callback.
430 // Return the final callback for synchronization purposes.
431 //
432 Push: function () {
433 var callback;
434 for (var i = 0, m = arguments.length; i < m; i++) {
435 callback = USING(arguments[i]);
436 if (callback === arguments[i] && !callback.called)
437 {callback = USING(["wait",this,callback])}
438 this.queue.push(callback);
439 }
440 if (!this.running && !this.pending) {this.Process()}
441 return callback;
442 },
443 //
444 // Process the command queue if we aren't waiting on another command
445 //
446 Process: function (queue) {
447 while (!this.running && !this.pending && this.queue.length) {
448 var callback = this.queue[0];
449 queue = this.queue.slice(1); this.queue = [];
450 this.Suspend(); var result = callback(); this.Resume();
451 if (queue.length) {this.queue = queue.concat(this.queue)}
452 if (ISCALLBACK(result) && !result.called) {WAITFOR(result,this)}
453 }
454 },
455 //
456 // Suspend/Resume command processing on this queue
457 //
458 Suspend: function () {this.running++},
459 Resume: function () {if (this.running) {this.running--}},
460 //
461 // Used by WAITFOR to restart the queue when an action completes
462 //
463 call: function () {this.Process.apply(this,arguments)},
464 wait: function (callback) {return callback}
465 });
466
467 //
468 // Create a named signal that listeners can attach to, to be signaled by
469 // postings made to the signal. Posts are queued if they occur while one
470 // is already in process.
471 //
472 var SIGNAL = QUEUE.Subclass({
473 Init: function (name) {
474 QUEUE.prototype.Init.call(this);
475 this.name = name;
476 this.posted = []; // the messages posted so far
477 this.listeners = HOOKS(true); // those with interest in this signal
478 this.posting = false;
479 this.callback = null;
480 },
481 //
482 // Post a message to the signal listeners, with callback for when complete
483 //
484 Post: function (message,callback,forget) {
485 callback = USING(callback);
486 if (this.posting || this.pending) {
487 this.Push(["Post",this,message,callback,forget]);
488 } else {
489 this.callback = callback; callback.reset();
490 if (!forget) {this.posted.push(message)}
491 this.Suspend(); this.posting = true;
492 var result = this.listeners.Execute(message);
493 if (ISCALLBACK(result) && !result.called) {WAITFOR(result,this)}
494 this.Resume(); this.posting = false;
495 if (!this.pending) {this.call()}
496 }
497 return callback;
498 },
499 //
500 // Clear the post history (so new listeners won't get old messages)
501 //
502 Clear: function (callback) {
503 callback = USING(callback);
504 if (this.posting || this.pending) {
505 callback = this.Push(["Clear",this,callback]);
506 } else {
507 this.posted = [];
508 callback();
509 }
510 return callback;
511 },
512 //
513 // Call the callback (all replies are in) and process the command queue
514 //
515 call: function () {this.callback(this); this.Process()},
516
517 //
518 // A listener calls this to register interest in the signal (so it will be called
519 // when posts occur). If ignorePast is true, it will not be sent the post history.
520 //
521 Interest: function (callback,ignorePast,priority) {
522 callback = USING(callback);
523 this.listeners.Add(callback,priority);
524 if (!ignorePast) {
525 for (var i = 0, m = this.posted.length; i < m; i++) {
526 callback.reset();
527 var result = callback(this.posted[i]);
528 if (ISCALLBACK(result) && i === this.posted.length-1) {WAITFOR(result,this)}
529 }
530 }
531 return callback;
532 },
533 //
534 // A listener calls this to remove itself from a signal
535 //
536 NoInterest: function (callback) {
537 this.listeners.Remove(callback);
538 },
539
540 //
541 // Hook a callback to a particular message on this signal
542 //
543 MessageHook: function (msg,callback,priority) {
544 callback = USING(callback);
545 if (!this.hooks) {this.hooks = {}; this.Interest(["ExecuteHooks",this])}
546 if (!this.hooks[msg]) {this.hooks[msg] = HOOKS(true)}
547 this.hooks[msg].Add(callback,priority);
548 for (var i = 0, m = this.posted.length; i < m; i++)
549 {if (this.posted[i] == msg) {callback.reset(); callback(this.posted[i])}}
550 callback.msg = msg; // keep track so we can remove it
551 return callback;
552 },
553 //
554 // Execute the message hooks for the given message
555 //
556 ExecuteHooks: function (msg) {
557 var type = ((msg instanceof Array) ? msg[0] : msg);
558 if (!this.hooks[type]) {return null}
559 return this.hooks[type].Execute(msg);
560 },
561 //
562 // Remove a hook safely
563 //
564 RemoveHook: function (hook) {
565 this.hooks[hook.msg].Remove(hook);
566 }
567
568 },{
569 signals: {}, // the named signals
570 find: function (name) {
571 if (!SIGNAL.signals[name]) {SIGNAL.signals[name] = new SIGNAL(name)}
572 return SIGNAL.signals[name];
573 }
574 });
575
576 //
577 // The main entry-points
578 //
579 BASE.Callback = BASE.CallBack = USING;
580 BASE.Callback.Delay = DELAY;
581 BASE.Callback.After = AFTER;
582 BASE.Callback.Queue = QUEUE;
583 BASE.Callback.Signal = SIGNAL.find;
584 BASE.Callback.Hooks = HOOKS;
585 BASE.Callback.ExecuteHooks = EXECUTEHOOKS;
586 })("MathJax");
587
588
589 /**********************************************************/
590
591 (function (BASENAME) {
592 var BASE = window[BASENAME];
593 if (!BASE) {BASE = window[BASENAME] = {}}
594
595 var isSafari2 = (navigator.vendor === "Apple Computer, Inc." &&
596 typeof navigator.vendorSub === "undefined");
597 var sheets = 0; // used by Safari2
598
599 //
600 // Update sheets count and look up the head object
601 //
602 var HEAD = function (head) {
603 return null;
604 /*
605 if (document.styleSheets && document.styleSheets.length > sheets)
606 {sheets = document.styleSheets.length}
607 if (!head) {
608 head = document.head || ((document.getElementsByTagName("head"))[0]);
609 if (!head) {head = document.body}
610 }
611 return head;
612 */
613 };
614
615 //
616 // Remove scripts that are completed so they don't clutter up the HEAD.
617 // This runs via setTimeout since IE7 can't remove the script while it is running.
618 //
619 var SCRIPTS = []; // stores scripts to be removed after a delay
620 var REMOVESCRIPTS = function () {
621 for (var i = 0, m = SCRIPTS.length; i < m; i++) {BASE.Ajax.head.removeChild(SCRIPTS[i])}
622 SCRIPTS = [];
623 };
624
625 var PATH = {};
626 PATH[BASENAME] = ""; // empty path gets the root URL
627
628 BASE.Ajax = {
629 loaded: {}, // files already loaded
630 loading: {}, // files currently in process of loading
631 loadHooks: {}, // hooks to call when files are loaded
632 timeout: 15*1000, // timeout for loading of files (15 seconds)
633 styleDelay: 1, // delay to use before styles are available
634 config: {
635 root: "", // URL of root directory to load from
636 path: PATH // paths to named URL's (e.g., [MathJax]/...)
637 },
638
639 STATUS: {
640 OK: 1, // file is loading or did load OK
641 ERROR: -1 // file timed out during load
642 },
643
644 //
645 // Return a complete URL to a file (replacing any root names)
646 //
647 fileURL: function (file) {
648 var match = file.match(/^\[([-._a-z0-9]+)\]/i);
649 if (match && match[1] in PATH)
650 {file = (PATH[match[1]]||this.config.root) + file.substr(match[1].length+2)}
651 return file;
652 },
653 //
654 // Replace root names if URL includes one
655 //
656 fileName: function (url) {
657 var root = this.config.root;
658 if (url.substr(0,root.length) === root) {url = "["+BASENAME+"]"+url.substr(root.length)}
659 else {
660 for (var id in PATH) {if (PATH.hasOwnProperty(id) && PATH[id]) {
661 if (url.substr(0,PATH[id].length) === PATH[id])
662 {url = "["+id+"]"+url.substr(PATH[id].length); break}
663 }}
664 }
665 return url;
666 },
667 //
668 // Cache-breaking revision number for file
669 //
670 fileRev: function (file) {
671 var rev = BASE.cdnFileVersions[name] || BASE.cdnVersion;
672 if (rev) {rev = "?rev="+rev}
673 return rev;
674 },
675 urlRev: function (file) {return this.fileURL(file)+this.fileRev(file)},
676
677 //
678 // Load a file if it hasn't been already.
679 // Make sure the file URL is "safe"?
680 //
681 Require: function (file,callback) {
682 callback = BASE.Callback(callback); var type;
683 if (file instanceof Object) {
684 for (var i in file)
685 {if (file.hasOwnProperty(i)) {type = i.toUpperCase(); file = file[i]}}
686 } else {type = file.split(/\./).pop().toUpperCase()}
687 file = this.fileURL(file);
688 // FIXME: check that URL is OK
689 if (this.loaded[file]) {
690 callback(this.loaded[file]);
691 } else {
692 var FILE = {}; FILE[type] = file;
693 this.Load(FILE,callback);
694 }
695 return callback;
696 },
697
698 //
699 // Load a file regardless of where it is and whether it has
700 // already been loaded.
701 //
702 Load: function (file,callback) {
703 callback = BASE.Callback(callback); var type;
704 if (file instanceof Object) {
705 for (var i in file)
706 {if (file.hasOwnProperty(i)) {type = i.toUpperCase(); file = file[i]}}
707 } else {type = file.split(/\./).pop().toUpperCase()}
708 file = this.fileURL(file);
709 if (this.loading[file]) {
710 this.addHook(file,callback);
711 } else {
712 this.head = HEAD(this.head);
713 if (this.loader[type]) {this.loader[type].call(this,file,callback)}
714 else {throw Error("Can't load files of type "+type)}
715 }
716 return callback;
717 },
718
719 //
720 // Register a load hook for a particular file (it will be called when
721 // loadComplete() is called for that file)
722 //
723 LoadHook: function (file,callback,priority) {
724 callback = BASE.Callback(callback);
725 if (file instanceof Object)
726 {for (var i in file) {if (file.hasOwnProperty(i)) {file = file[i]}}}
727 file = this.fileURL(file);
728 if (this.loaded[file]) {callback(this.loaded[file])}
729 else {this.addHook(file,callback,priority)}
730 return callback;
731 },
732 addHook: function (file,callback,priority) {
733 if (!this.loadHooks[file]) {this.loadHooks[file] = MathJax.Callback.Hooks()}
734 this.loadHooks[file].Add(callback,priority);
735 callback.file = file;
736 },
737 removeHook: function (hook) {
738 if (this.loadHooks[hook.file]) {
739 this.loadHooks[hook.file].Remove(hook);
740 if (!this.loadHooks[hook.file].hooks.length) {delete this.loadHooks[hook.file]}
741 }
742 },
743
744 //
745 // Used when files are combined in a preloading configuration file
746 //
747 Preloading: function () {
748 for (var i = 0, m = arguments.length; i < m; i++) {
749 var file = this.fileURL(arguments[i]);
750 if (!this.loading[file] && !this.loaded[file]) {this.loading[file] = {preloaded: true}}
751 }
752 },
753
754 //
755 // Code used to load the various types of files
756 // (JS for JavaScript, CSS for style sheets)
757 //
758 loader: {
759 //
760 // Create a SCRIPT tag to load the file
761 //
762 JS: function (file,callback) {
763 var name = this.fileName(file);
764 var timeout = BASE.Callback(["loadTimeout",this,file]);
765 this.loading[file] = {
766 callback: callback,
767 timeout: setTimeout(timeout,this.timeout),
768 status: this.STATUS.OK,
769 script: null
770 };
771 //
772 // Add this to the structure above after it is created to prevent recursion
773 // when loading the initial localization file (before loading messsage is available)
774 //
775 this.loading[file].message = BASE.Message.File(name);
776 if (window.System) {
777 window.System.import(file).catch(timeout);
778 } else {
779 timeout(); // indicate a load failure
780 }
781 },
782 //
783 // Create a LINK tag to load the style sheet
784 //
785 CSS: function (file,callback) {
786 var name = this.fileName(file);
787 var link = document.createElement("link");
788 link.rel = "stylesheet"; link.type = "text/css";
789 link.href = file+this.fileRev(name);
790 this.loading[file] = {
791 callback: callback,
792 message: BASE.Message.File(name),
793 status: this.STATUS.OK
794 };
795 this.head.appendChild(link);
796 this.timer.create.call(this,[this.timer.file,file],link);
797 }
798 },
799
800 //
801 // Timing code for checking when style sheets are available.
802 //
803 timer: {
804 //
805 // Create the timing callback and start the timing loop.
806 // We use a delay because some browsers need it to allow the styles
807 // to be processed.
808 //
809 create: function (callback,node) {
810 callback = BASE.Callback(callback);
811 if (node.nodeName === "STYLE" && node.styleSheet &&
812 typeof(node.styleSheet.cssText) !== 'undefined') {
813 callback(this.STATUS.OK); // MSIE processes style immediately, but doesn't set its styleSheet!
814 } else if (window.chrome && node.nodeName === "LINK") {
815 callback(this.STATUS.OK); // Chrome doesn't give access to cssRules for stylesheet in
816 // a link node, so we can't detect when it is loaded.
817 } else if (isSafari2) {
818 this.timer.start(this,[this.timer.checkSafari2,sheets++,callback],this.styleDelay);
819 } else {
820 this.timer.start(this,[this.timer.checkLength,node,callback],this.styleDelay);
821 }
822 return callback;
823 },
824 //
825 // Start the timer for the given callback checker
826 //
827 start: function (AJAX,check,delay,timeout) {
828 check = BASE.Callback(check);
829 check.execute = this.execute; check.time = this.time;
830 check.STATUS = AJAX.STATUS; check.timeout = timeout || AJAX.timeout;
831 check.delay = check.total = delay || 0;
832 if (delay) {setTimeout(check,delay)} else {check()}
833 },
834 //
835 // Increment the time total, increase the delay
836 // and test if we are past the timeout time.
837 //
838 time: function (callback) {
839 this.total += this.delay;
840 this.delay = Math.floor(this.delay * 1.05 + 5);
841 if (this.total >= this.timeout) {callback(this.STATUS.ERROR); return 1}
842 return 0;
843 },
844 //
845 // For JS file loads, call the proper routine according to status
846 //
847 file: function (file,status) {
848 if (status < 0) {BASE.Ajax.loadTimeout(file)} else {BASE.Ajax.loadComplete(file)}
849 },
850 //
851 // Call the hook with the required data
852 //
853 execute: function () {this.hook.call(this.object,this,this.data[0],this.data[1])},
854 //
855 // Safari2 doesn't set the link's stylesheet, so we need to look in the
856 // document.styleSheets array for the new sheet when it is created
857 //
858 checkSafari2: function (check,length,callback) {
859 if (check.time(callback)) return;
860 if (document.styleSheets.length > length &&
861 document.styleSheets[length].cssRules &&
862 document.styleSheets[length].cssRules.length)
863 {callback(check.STATUS.OK)} else {setTimeout(check,check.delay)}
864 },
865 //
866 // Look for the stylesheets rules and check when they are defined
867 // and no longer of length zero. (This assumes there actually ARE
868 // some rules in the stylesheet.)
869 //
870 checkLength: function (check,node,callback) {
871 if (check.time(callback)) return;
872 var isStyle = 0; var sheet = (node.sheet || node.styleSheet);
873 try {if ((sheet.cssRules||sheet.rules||[]).length > 0) {isStyle = 1}} catch(err) {
874 if (err.message.match(/protected variable|restricted URI/)) {isStyle = 1}
875 else if (err.message.match(/Security error/)) {
876 // Firefox3 gives "Security error" for missing files, so
877 // can't distinguish that from OK files on remote servers.
878 // or OK files in different directory from local files.
879 isStyle = 1; // just say it is OK (can't really tell)
880 }
881 }
882 if (isStyle) {
883 // Opera 9.6 requires this setTimeout
884 setTimeout(BASE.Callback([callback,check.STATUS.OK]),0);
885 } else {
886 setTimeout(check,check.delay);
887 }
888 }
889 },
890
891 //
892 // JavaScript code must call this when they are completely initialized
893 // (this allows them to perform asynchronous actions before indicating
894 // that they are complete).
895 //
896 loadComplete: function (file) {
897 file = this.fileURL(file);
898 var loading = this.loading[file];
899 if (loading && !loading.preloaded) {
900 BASE.Message.Clear(loading.message);
901 if (loading.timeout) clearTimeout(loading.timeout);
902 if (loading.script) {
903 if (SCRIPTS.length === 0) {setTimeout(REMOVESCRIPTS,0)}
904 SCRIPTS.push(loading.script);
905 }
906 this.loaded[file] = loading.status; delete this.loading[file];
907 this.addHook(file,loading.callback);
908 } else {
909 if (loading) {delete this.loading[file]}
910 this.loaded[file] = this.STATUS.OK;
911 loading = {status: this.STATUS.OK}
912 }
913 if (!this.loadHooks[file]) {return null}
914 return this.loadHooks[file].Execute(loading.status);
915 },
916
917 //
918 // If a file fails to load within the timeout period (or the onerror handler
919 // is called), this routine runs to signal the error condition.
920 //
921 loadTimeout: function (file) {
922 if (this.loading[file].timeout) {clearTimeout(this.loading[file].timeout)}
923 this.loading[file].status = this.STATUS.ERROR;
924 this.loadError(file);
925 this.loadComplete(file);
926 },
927
928 //
929 // The default error hook for file load failures
930 //
931 loadError: function (file) {
932 BASE.Message.Set(["LoadFailed","File failed to load: %1",file],null,2000);
933 BASE.Hub.signal.Post(["file load error",file]);
934 },
935
936 //
937 // Defines a style sheet from a hash of style declarations (key:value pairs
938 // where the key is the style selector and the value is a hash of CSS attributes
939 // and values).
940 //
941 Styles: function (styles,callback) {
942 var styleString = this.StyleString(styles);
943 if (styleString === "") {
944 callback = BASE.Callback(callback);
945 callback();
946 } else {
947 var style = document.createElement("style"); style.type = "text/css";
948 this.head = HEAD(this.head);
949 this.head.appendChild(style);
950 if (style.styleSheet && typeof(style.styleSheet.cssText) !== 'undefined') {
951 style.styleSheet.cssText = styleString;
952 } else {
953 style.appendChild(document.createTextNode(styleString));
954 }
955 callback = this.timer.create.call(this,callback,style);
956 }
957 return callback;
958 },
959
960 //
961 // Create a stylesheet string from a style declaration object
962 //
963 StyleString: function (styles) {
964 if (typeof(styles) === 'string') {return styles}
965 var string = "", id, style;
966 for (id in styles) {if (styles.hasOwnProperty(id)) {
967 if (typeof styles[id] === 'string') {
968 string += id + " {"+styles[id]+"}\n";
969 } else if (styles[id] instanceof Array) {
970 for (var i = 0; i < styles[id].length; i++) {
971 style = {}; style[id] = styles[id][i];
972 string += this.StyleString(style);
973 }
974 } else if (id.substr(0,6) === '@media') {
975 string += id + " {"+this.StyleString(styles[id])+"}\n";
976 } else if (styles[id] != null) {
977 style = [];
978 for (var name in styles[id]) {if (styles[id].hasOwnProperty(name)) {
979 if (styles[id][name] != null)
980 {style[style.length] = name + ': ' + styles[id][name]}
981 }}
982 string += id +" {"+style.join('; ')+"}\n";
983 }
984 }}
985 return string;
986 }
987 };
988
989 })("MathJax");
990
991 /**********************************************************/
992
993 MathJax.HTML = {
994 setDocument: function (doc) {document = this.document = doc},
995 //
996 // Create an HTML element with given attributes and content.
997 // The def parameter is an (optional) object containing key:value pairs
998 // of the attributes and their values, and contents is an (optional)
999 // array of strings to be inserted as text, or arrays of the form
1000 // [type,def,contents] that describes an HTML element to be inserted
1001 // into the current element. Thus the contents can describe a complete
1002 // HTML snippet of arbitrary complexity. E.g.:
1003 //
1004 // MathJax.HTML.Element("span",{id:"mySpan",style{"font-style":"italic"}},[
1005 // "(See the ",["a",{href:"http://www.mathjax.org"},["MathJax home page"]],
1006 // " for more details.)"]);
1007 //
1008 Element: function (type,def,contents) {
1009 var obj = document.createElement(type), id;
1010 if (def) {
1011 if (def.hasOwnProperty("style")) {
1012 var style = def.style; def.style = {};
1013 for (id in style) {if (style.hasOwnProperty(id))
1014 {def.style[id.replace(/-([a-z])/g,this.ucMatch)] = style[id]}}
1015 }
1016 MathJax.Hub.Insert(obj,def);
1017 for (id in def) {
1018 if (id === "role" || id.substr(0,5) === "aria-") obj.setAttribute(id,def[id]);
1019 }
1020 }
1021 if (contents) {
1022 if (!MathJax.Object.isArray(contents)) {contents = [contents]}
1023 for (var i = 0, m = contents.length; i < m; i++) {
1024 if (MathJax.Object.isArray(contents[i])) {
1025 obj.appendChild(this.Element(contents[i][0],contents[i][1],contents[i][2]));
1026 } else if (type === "script") { // IE throws an error if script is added as a text node
1027 this.setScript(obj, contents[i]);
1028 } else {
1029 obj.appendChild(document.createTextNode(contents[i]));
1030 }
1031 }
1032 }
1033 return obj;
1034 },
1035 ucMatch: function (match,c) {return c.toUpperCase()},
1036 addElement: function (span,type,def,contents) {return span.appendChild(this.Element(type,def,contents))},
1037 TextNode: function (text) {return document.createTextNode(text)},
1038 addText: function (span,text) {return span.appendChild(this.TextNode(text))},
1039
1040 //
1041 // Set and get the text of a script
1042 //
1043 setScript: function (script,text) {
1044 if (this.setScriptBug) {script.text = text} else {
1045 while (script.firstChild) {script.removeChild(script.firstChild)}
1046 this.addText(script,text);
1047 }
1048 },
1049 getScript: function (script) {return script.innerText}
1050 }
1051
1052 /**********************************************************/
1053
1054 MathJax.Localization = {
1055
1056 locale: "en",
1057 directory: "[MathJax]/localization",
1058 strings: {
1059 // Currently, this list is not modified by the MathJax-i18n script. You can
1060 // run the following command in MathJax/unpacked/localization to update it:
1061 //
1062 // find . -name "*.js" | xargs grep menuTitle\: | grep -v qqq | sed 's/^\.\/\(.*\)\/.*\.js\: / "\1"\: \{/' | sed 's/,$/\},/' | sed 's/"English"/"English", isLoaded: true/' > tmp ; sort tmp > tmp2 ; sed '$ s/,$//' tmp2 ; rm tmp*
1063 //
1064 // This only takes languages with localization data so you must also add
1065 // the languages that use a remap but are not translated at all.
1066 //
1067 "ast": {menuTitle: "asturianu"},
1068 "bg": {menuTitle: "\u0431\u044A\u043B\u0433\u0430\u0440\u0441\u043A\u0438"},
1069 "bcc": {menuTitle: "\u0628\u0644\u0648\u0686\u06CC"},
1070 "br": {menuTitle: "brezhoneg"},
1071 "ca": {menuTitle: "catal\u00E0"},
1072 "cdo": {menuTitle: "M\u00ECng-d\u0115\u0324ng-ng\u1E73\u0304"},
1073 "cs": {menuTitle: "\u010De\u0161tina"},
1074 "da": {menuTitle: "dansk"},
1075 "de": {menuTitle: "Deutsch"},
1076 "en": {menuTitle: "English", isLoaded: true},
1077 "eo": {menuTitle: "Esperanto"},
1078 "es": {menuTitle: "espa\u00F1ol"},
1079 "fa": {menuTitle: "\u0641\u0627\u0631\u0633\u06CC"},
1080 "fi": {menuTitle: "suomi"},
1081 "fr": {menuTitle: "fran\u00E7ais"},
1082 "gl": {menuTitle: "galego"},
1083 "he": {menuTitle: "\u05E2\u05D1\u05E8\u05D9\u05EA"},
1084 "ia": {menuTitle: "interlingua"},
1085 "it": {menuTitle: "italiano"},
1086 "ja": {menuTitle: "\u65E5\u672C\u8A9E"},
1087 "kn": {menuTitle: "\u0C95\u0CA8\u0CCD\u0CA8\u0CA1"},
1088 "ko": {menuTitle: "\uD55C\uAD6D\uC5B4"},
1089 "lb": {menuTitle: "L\u00EBtzebuergesch"},
1090 "lt": {menuTitle: "lietuvi\u0173"},
1091 "mk": {menuTitle: "\u043C\u0430\u043A\u0435\u0434\u043E\u043D\u0441\u043A\u0438"},
1092 "nl": {menuTitle: "Nederlands"},
1093 "oc": {menuTitle: "occitan"},
1094 "pl": {menuTitle: "polski"},
1095 "pt": {menuTitle: "portugus\u00EA"},
1096 "pt-br": {menuTitle: "portugu\u00EAs do Brasil"},
1097 "ru": {menuTitle: "\u0440\u0443\u0441\u0441\u043A\u0438\u0439"},
1098 "sco": {menuTitle: "Scots"},
1099 "scn": {menuTitle: "sicilianu"},
1100 "sl": {menuTitle: "sloven\u0161\u010Dina"},
1101 "sv": {menuTitle: "svenska"},
1102 "tr": {menuTitle: "T\u00FCrk\u00E7e"},
1103 "uk": {menuTitle: "\u0443\u043A\u0440\u0430\u0457\u043D\u0441\u044C\u043A\u0430"},
1104 "vi": {menuTitle: "Ti\u1EBFng Vi\u1EC7t"},
1105 "zh-hans": {menuTitle: "\u4E2D\u6587\uFF08\u7B80\u4F53\uFF09"}
1106 },
1107
1108 //
1109 // The pattern for substitution escapes:
1110 // %n or %{n} or %{plural:%n|option1|option1|...} or %c
1111 //
1112 pattern: /%(\d+|\{\d+\}|\{[a-z]+:\%\d+(?:\|(?:%\{\d+\}|%.|[^\}])*)+\}|.)/g,
1113
1114 SPLIT: ("axb".split(/(x)/).length === 3 ?
1115 function (string,regex) {return string.split(regex)} :
1116 //
1117 // IE8 and below don't do split() correctly when the pattern includes
1118 // parentheses (the split should include the matched exrepssions).
1119 // So implement it by hand here.
1120 //
1121 function (string,regex) {
1122 var result = [], match, last = 0;
1123 regex.lastIndex = 0;
1124 while ((match = regex.exec(string))) {
1125 result.push(string.substr(last,match.index-last));
1126 result.push.apply(result,match.slice(1));
1127 last = match.index + match[0].length;
1128 }
1129 result.push(string.substr(last));
1130 return result;
1131 }),
1132
1133 _: function (id,phrase) {
1134 if (phrase instanceof Array) {return this.processSnippet(id,phrase)}
1135 return this.processString(this.lookupPhrase(id,phrase),[].slice.call(arguments,2));
1136 },
1137
1138 processString: function (string,args,domain) {
1139 //
1140 // Process arguments for substitution
1141 // If the argument is a snippet (and we are processing snippets) do so,
1142 // Otherwise, if it is a number, convert it for the lacale
1143 //
1144 var i, m;
1145 for (i = 0, m = args.length; i < m; i++) {
1146 if (domain && args[i] instanceof Array) {args[i] = this.processSnippet(domain,args[i])}
1147 }
1148 //
1149 // Split string at escapes and process them individually
1150 //
1151 var parts = this.SPLIT(string,this.pattern);
1152 for (i = 1, m = parts.length; i < m; i += 2) {
1153 var c = parts[i].charAt(0); // first char will be { or \d or a char to be kept literally
1154 if (c >= "0" && c <= "9") { // %n
1155 parts[i] = args[parts[i]-1];
1156 if (typeof parts[i] === "number") parts[i] = this.number(parts[i]);
1157 } else if (c === "{") { // %{n} or %{plural:%n|...}
1158 c = parts[i].substr(1);
1159 if (c >= "0" && c <= "9") { // %{n}
1160 parts[i] = args[parts[i].substr(1,parts[i].length-2)-1];
1161 if (typeof parts[i] === "number") parts[i] = this.number(parts[i]);
1162 } else { // %{plural:%n|...}
1163 var match = parts[i].match(/^\{([a-z]+):%(\d+)\|(.*)\}$/);
1164 if (match) {
1165 if (match[1] === "plural") {
1166 var n = args[match[2]-1];
1167 if (typeof n === "undefined") {
1168 parts[i] = "???"; // argument doesn't exist
1169 } else {
1170 n = this.plural(n) - 1; // index of the form to use
1171 var plurals = match[3].replace(/(^|[^%])(%%)*%\|/g,"$1$2%\uEFEF").split(/\|/); // the parts (replacing %| with a special character)
1172 if (n >= 0 && n < plurals.length) {
1173 parts[i] = this.processString(plurals[n].replace(/\uEFEF/g,"|"),args,domain);
1174 } else {
1175 parts[i] = "???"; // no string for this index
1176 }
1177 }
1178 } else {parts[i] = "%"+parts[i]} // not "plural", put back the % and leave unchanged
1179 }
1180 }
1181 }
1182 if (parts[i] == null) {parts[i] = "???"}
1183 }
1184 //
1185 // If we are not forming a snippet, return the completed string
1186 //
1187 if (!domain) {return parts.join("")}
1188 //
1189 // We need to return an HTML snippet, so buld it from the
1190 // broken up string with inserted parts (that could be snippets)
1191 //
1192 var snippet = [], part = "";
1193 for (i = 0; i < m; i++) {
1194 part += parts[i]; i++; // add the string and move on to substitution result
1195 if (i < m) {
1196 if (parts[i] instanceof Array) { // substitution was a snippet
1197 snippet.push(part); // add the accumulated string
1198 snippet = snippet.concat(parts[i]); // concatenate the substution snippet
1199 part = ""; // start accumulating a new string
1200 } else { // substitution was a string
1201 part += parts[i]; // add to accumulating string
1202 }
1203 }
1204 }
1205 if (part !== "") {snippet.push(part)} // add final string
1206 return snippet;
1207 },
1208
1209 processSnippet: function (domain,snippet) {
1210 var result = []; // the new snippet
1211 //
1212 // Look through the original snippet for
1213 // strings or snippets to translate
1214 //
1215 for (var i = 0, m = snippet.length; i < m; i++) {
1216 if (snippet[i] instanceof Array) {
1217 //
1218 // This could be a sub-snippet:
1219 // ["tag"] or ["tag",{properties}] or ["tag",{properties},snippet]
1220 // Or it could be something to translate:
1221 // [id,string,args] or [domain,snippet]
1222 var data = snippet[i];
1223 if (typeof data[1] === "string") { // [id,string,args]
1224 var id = data[0]; if (!(id instanceof Array)) {id = [domain,id]}
1225 var phrase = this.lookupPhrase(id,data[1]);
1226 result = result.concat(this.processMarkdown(phrase,data.slice(2),domain));
1227 } else if (data[1] instanceof Array) { // [domain,snippet]
1228 result = result.concat(this.processSnippet.apply(this,data));
1229 } else if (data.length >= 3) { // ["tag",{properties},snippet]
1230 result.push([data[0],data[1],this.processSnippet(domain,data[2])]);
1231 } else { // ["tag"] or ["tag",{properties}]
1232 result.push(snippet[i]);
1233 }
1234 } else { // a string
1235 result.push(snippet[i]);
1236 }
1237 }
1238 return result;
1239 },
1240
1241 markdownPattern: /(%.)|(\*{1,3})((?:%.|.)+?)\2|(`+)((?:%.|.)+?)\4|\[((?:%.|.)+?)\]\(([^\s\)]+)\)/,
1242 // %c or *bold*, **italics**, ***bold-italics***, or `code`, or [link](url)
1243
1244 processMarkdown: function (phrase,args,domain) {
1245 var result = [], data;
1246 //
1247 // Split the string by the Markdown pattern
1248 // (the text blocks are separated by
1249 // c,stars,star-text,backtics,code-text,link-text,URL).
1250 // Start with teh first text string from the split.
1251 //
1252 var parts = phrase.split(this.markdownPattern);
1253 var string = parts[0];
1254 //
1255 // Loop through the matches and process them
1256 //
1257 for (var i = 1, m = parts.length; i < m; i += 8) {
1258 if (parts[i+1]) { // stars (for bold/italic)
1259 //
1260 // Select the tag to use by number of stars (three stars requires two tags)
1261 //
1262 data = this.processString(parts[i+2],args,domain);
1263 if (!(data instanceof Array)) {data = [data]}
1264 data = [["b","i","i"][parts[i+1].length-1],{},data]; // number of stars determines type
1265 if (parts[i+1].length === 3) {data = ["b",{},data]} // bold-italic
1266 } else if (parts[i+3]) { // backtics (for code)
1267 //
1268 // Remove one leading or trailing space, and process substitutions
1269 // Make a <code> tag
1270 //
1271 data = this.processString(parts[i+4].replace(/^\s/,"").replace(/\s$/,""),args,domain);
1272 if (!(data instanceof Array)) {data = [data]}
1273 data = ["code",{},data];
1274 } else if (parts[i+5]) { // hyperlink
1275 //
1276 // Process the link text, and make an <a> tag with the URL
1277 //
1278 data = this.processString(parts[i+5],args,domain);
1279 if (!(data instanceof Array)) {data = [data]}
1280 data = ["a",{href:this.processString(parts[i+6],args),target:"_blank"},data];
1281 } else {
1282 //
1283 // Escaped character (%c) gets added into the string.
1284 //
1285 string += parts[i]; data = null;
1286 }
1287 //
1288 // If there is a tag to insert,
1289 // Add any pending string, then push the tag
1290 //
1291 if (data) {
1292 result = this.concatString(result,string,args,domain);
1293 result.push(data); string = "";
1294 }
1295 //
1296 // Process the string that follows matches pattern
1297 //
1298 if (parts[i+7] !== "") {string += parts[i+7]}
1299 };
1300 //
1301 // Add any pending string and return the resulting snippet
1302 //
1303 result = this.concatString(result,string,args,domain);
1304 return result;
1305 },
1306 concatString: function (result,string,args,domain) {
1307 if (string != "") {
1308 //
1309 // Process the substutions.
1310 // If the result is not a snippet, turn it into one.
1311 // Then concatenate the snippet to the current one
1312 //
1313 string = this.processString(string,args,domain);
1314 if (!(string instanceof Array)) {string = [string]}
1315 result = result.concat(string);
1316 }
1317 return result;
1318 },
1319
1320 lookupPhrase: function (id,phrase,domain) {
1321 //
1322 // Get the domain and messageID
1323 //
1324 if (!domain) {domain = "_"}
1325 if (id instanceof Array) {domain = (id[0] || "_"); id = (id[1] || "")}
1326 //
1327 // Check if the data is available and if not,
1328 // load it and throw a restart error so the calling
1329 // code can wait for the load and try again.
1330 //
1331 var load = this.loadDomain(domain);
1332 if (load) {MathJax.Hub.RestartAfter(load)}
1333 //
1334 // Look up the message in the localization data
1335 // (if not found, the original English is used)
1336 //
1337 var localeData = this.strings[this.locale];
1338 if (localeData) {
1339 if (localeData.domains && domain in localeData.domains) {
1340 var domainData = localeData.domains[domain];
1341 if (domainData.strings && id in domainData.strings)
1342 {phrase = domainData.strings[id]}
1343 }
1344 }
1345 //
1346 // return the translated phrase
1347 //
1348 return phrase;
1349 },
1350
1351 //
1352 // Load a langauge data file from the proper
1353 // directory and file.
1354 //
1355 loadFile: function (file,data,callback) {
1356 callback = MathJax.Callback(callback);
1357 file = (data.file || file); // the data's file name or the default name
1358 if (!file.match(/\.js$/)) {file += ".js"} // add .js if needed
1359 //
1360 // Add the directory if the file doesn't
1361 // contain a full URL already.
1362 //
1363 if (!file.match(/^([a-z]+:|\[MathJax\])/)) {
1364 var dir = (this.strings[this.locale].directory ||
1365 this.directory + "/" + this.locale ||
1366 "[MathJax]/localization/" + this.locale);
1367 file = dir + "/" + file;
1368 }
1369 //
1370 // Load the file and mark the data as loaded (even if it
1371 // failed to load, so we don't continue to try to load it
1372 // over and over).
1373 //
1374 var load = MathJax.Ajax.Require(file,function () {data.isLoaded = true; return callback()});
1375 //
1376 // Return the callback if needed, otherwise null.
1377 //
1378 return (load.called ? null : load);
1379 },
1380
1381 //
1382 // Check to see if the localization data are loaded
1383 // for the given domain; if not, load the data file,
1384 // and return a callback for the loading operation.
1385 // Otherwise return null (data are loaded).
1386 //
1387 loadDomain: function (domain,callback) {
1388 var load, localeData = this.strings[this.locale];
1389 if (localeData) {
1390 if (!localeData.isLoaded) {
1391 load = this.loadFile(this.locale,localeData);
1392 if (load) {
1393 return MathJax.Callback.Queue(
1394 load,["loadDomain",this,domain] // call again to load domain
1395 ).Push(callback||{});
1396 }
1397 }
1398 if (localeData.domains && domain in localeData.domains) {
1399 var domainData = localeData.domains[domain];
1400 if (!domainData.isLoaded) {
1401 load = this.loadFile(domain,domainData);
1402 if (load) {return MathJax.Callback.Queue(load).Push(callback)}
1403 }
1404 }
1405 }
1406 // localization data are loaded, so just do the callback
1407 return MathJax.Callback(callback)();
1408 },
1409
1410 //
1411 // Perform a function, properly handling
1412 // restarts due to localization file loads.
1413 //
1414 // Note that this may return before the function
1415 // has been called successfully, so you should
1416 // consider fn as running asynchronously. (Callbacks
1417 // can be used to synchronize it with other actions.)
1418 //
1419 Try: function (fn) {
1420 fn = MathJax.Callback(fn); fn.autoReset = true;
1421 try {fn()} catch (err) {
1422 if (!err.restart) {throw err}
1423 MathJax.Callback.After(["Try",this,fn],err.restart);
1424 }
1425 },
1426
1427 //
1428 // Reset the current language
1429 //
1430 resetLocale: function(locale) {
1431 // Selection algorithm:
1432 // 1) Downcase locale name (e.g. "en-US" => "en-us")
1433 // 2) Try a parent language (e.g. "en-us" => "en")
1434 // 3) Try the fallback specified in the data (e.g. "pt" => "pt-br")
1435 // 4) Otherwise don't change the locale.
1436 if (!locale) return;
1437 locale = locale.toLowerCase();
1438 while (!this.strings[locale]) {
1439 var dashPos = locale.lastIndexOf("-");
1440 if (dashPos === -1) return;
1441 locale = locale.substring(0, dashPos);
1442 }
1443 var remap = this.strings[locale].remap;
1444 this.locale = remap ? remap : locale;
1445 },
1446
1447 //
1448 // Set the current language
1449 //
1450 setLocale: function(locale) {
1451 this.resetLocale(locale);
1452 if (MathJax.Menu) {this.loadDomain("MathMenu")}
1453 },
1454
1455 //
1456 // Add or update a language or domain
1457 //
1458 addTranslation: function (locale,domain,definition) {
1459 var data = this.strings[locale], isNew = false;
1460 if (!data) {data = this.strings[locale] = {}; isNew = true}
1461 if (!data.domains) {data.domains = {}}
1462 if (domain) {
1463 if (!data.domains[domain]) {data.domains[domain] = {}}
1464 data = data.domains[domain];
1465 }
1466 MathJax.Hub.Insert(data,definition);
1467 if (isNew && MathJax.Menu.menu) {MathJax.Menu.CreateLocaleMenu()}
1468 },
1469
1470 //
1471 // Set CSS for an element based on font requirements
1472 //
1473 setCSS: function (div) {
1474 var locale = this.strings[this.locale];
1475 if (locale) {
1476 if (locale.fontFamily) {div.style.fontFamily = locale.fontFamily}
1477 if (locale.fontDirection) {
1478 div.style.direction = locale.fontDirection;
1479 if (locale.fontDirection === "rtl") {div.style.textAlign = "right"}
1480 }
1481 }
1482 return div;
1483 },
1484
1485 //
1486 // Get the language's font family or direction
1487 //
1488 fontFamily: function () {
1489 var locale = this.strings[this.locale];
1490 return (locale ? locale.fontFamily : null);
1491 },
1492 fontDirection: function () {
1493 var locale = this.strings[this.locale];
1494 return (locale ? locale.fontDirection : null);
1495 },
1496
1497 //
1498 // Get the language's plural index for a number
1499 //
1500 plural: function (n) {
1501 var locale = this.strings[this.locale];
1502 if (locale && locale.plural) {return locale.plural(n)}
1503 // default
1504 if (n == 1) {return 1} // one
1505 return 2; // other
1506 },
1507
1508 //
1509 // Convert a number to language-specific form
1510 //
1511 number: function(n) {
1512 var locale = this.strings[this.locale];
1513 if (locale && locale.number) {return locale.number(n)}
1514 // default
1515 return n;
1516 }
1517 };
1518
1519
1520 /**********************************************************/
1521
1522 MathJax.Message = {
1523 localize: function (message) {
1524 return MathJax.Localization._(message,message);
1525 },
1526
1527 filterText: function (text,n,id) {
1528 if (MathJax.Hub.config.messageStyle === "simple") {
1529 if (id === "LoadFile") {
1530 if (!this.loading) {this.loading = this.localize("Loading") + " "}
1531 text = this.loading; this.loading += ".";
1532 } else if (id === "ProcessMath") {
1533 if (!this.processing) {this.processing = this.localize("Processing") + " "}
1534 text = this.processing; this.processing += ".";
1535 } else if (id === "TypesetMath") {
1536 if (!this.typesetting) {this.typesetting = this.localize("Typesetting") + " "}
1537 text = this.typesetting; this.typesetting += ".";
1538 }
1539 }
1540 return text;
1541 },
1542
1543 Set: function (text,n,clearDelay) {
1544 if (MathJax.debug) {
1545 if (Array.isArray(text)) {
1546 text = MathJax.Localization._.apply(MathJax.Localization,text);
1547 }
1548 console.log("Message: "+text);
1549 }
1550 },
1551
1552 Clear: function (n,delay) {},
1553 Remove: function () {},
1554 File: function (file) {
1555 return this.Set(["LoadFile","Loading %1",file],null,null);
1556 },
1557
1558 Log: function () {}
1559 };
1560
1561 /**********************************************************/
1562
1563 MathJax.Hub = {
1564 config: {
1565 root: "./mathjax2/legacy",
1566 config: [], // list of configuration files to load
1567 jax: [], // list of input and output jax to load
1568 extensions: [], // list of extensions to load
1569 preJax: null, // pattern to remove from before math script tag
1570 postJax: null, // pattern to remove from after math script tag
1571 displayAlign: 'center', // how to align displayed equations (left, center, right)
1572 displayIndent: '0', // indentation for displayed equations (when not centered)
1573 preRemoveClass: 'MathJax_Preview', // class of objects to remove preceeding math script
1574 showProcessingMessages: true, // display "Processing math: nn%" messages or not
1575 messageStyle: "normal", // set to "none" or "simple" (for "Loading..." and "Processing...")
1576 delayStartupUntil: "none", // set to "onload" to delay setup until the onload handler runs
1577 // set to "configured" to delay startup until MathJax.Hub.Configured() is called
1578 // set to a Callback to wait for before continuing with the startup
1579 skipStartupTypeset: false, // set to true to skip PreProcess and Process during startup
1580 elements: [], // array of elements to process when none is given explicitly
1581 positionToHash: true, // after initial typeset pass, position to #hash location?
1582
1583 showMathMenu: true, // attach math context menu to typeset math?
1584 showMathMenuMSIE: true, // separtely determine if MSIE should have math menu
1585 // (since the code for that is a bit delicate)
1586
1587 menuSettings: {
1588 zoom: "None", // when to do MathZoom
1589 CTRL: false, // require CTRL for MathZoom?
1590 ALT: false, // require Alt or Option?
1591 CMD: false, // require CMD?
1592 Shift: false, // require Shift?
1593 discoverable: false, // make math menu discoverable on hover?
1594 zscale: "200%", // the scaling factor for MathZoom
1595 renderer: null, // set when Jax are loaded
1596 font: "Auto", // what font HTML-CSS should use
1597 context: "MathJax", // or "Browser" for pass-through to browser menu
1598 locale: null, // the language to use for messages
1599 mpContext: false, // true means pass menu events to MathPlayer in IE
1600 mpMouse: false, // true means pass mouse events to MathPlayer in IE
1601 texHints: true, // include class names for TeXAtom elements
1602 FastPreview: null, // use PreviewHTML output as preview?
1603 assistiveMML: null, // include hidden MathML for screen readers?
1604 inTabOrder: true, // set to false if math elements should be included in the tabindex
1605 semantics: false // add semantics tag with original form in MathML output
1606 },
1607
1608 errorSettings: {
1609 // localized HTML snippet structure for message to use
1610 message: ["[",["MathProcessingError","Math Processing Error"],"]"],
1611 style: {color: "#CC0000", "font-style":"italic"} // style for message
1612 },
1613
1614 ignoreMMLattributes: {} // attributes not to copy to HTML-CSS or SVG output
1615 // from MathML input (in addition to the ones in MML.nocopyAttributes).
1616 // An id set to true will be ignored, one set to false will
1617 // be allowed (even if other criteria normally would prevent
1618 // it from being copied); use false carefully!
1619 },
1620
1621 preProcessors: MathJax.Callback.Hooks(true), // list of callbacks for preprocessing (initialized by extensions)
1622 inputJax: {}, // mime-type mapped to input jax (by registration)
1623 outputJax: {order:{}}, // mime-type mapped to output jax list (by registration)
1624
1625 processSectionDelay: 50, // pause between input and output phases of processing
1626 processUpdateTime: 250, // time between screen updates when processing math (milliseconds)
1627 processUpdateDelay: 10, // pause between screen updates to allow other processing (milliseconds)
1628
1629 signal: MathJax.Callback.Signal("Hub"), // Signal used for Hub events
1630
1631 Config: function (def) {
1632 this.Insert(this.config,def);
1633 if (this.config.Augment) {this.Augment(this.config.Augment)}
1634 },
1635 CombineConfig: function (name,def) {
1636 var config = this.config, id, parent; name = name.split(/\./);
1637 for (var i = 0, m = name.length; i < m; i++) {
1638 id = name[i]; if (!config[id]) {config[id] = {}}
1639 parent = config; config = config[id];
1640 }
1641 parent[id] = config = this.Insert(def,config);
1642 return config;
1643 },
1644
1645 Register: {
1646 PreProcessor: function () {return MathJax.Hub.preProcessors.Add.apply(MathJax.Hub.preProcessors,arguments)},
1647 MessageHook: function () {return MathJax.Hub.signal.MessageHook.apply(MathJax.Hub.signal,arguments)},
1648 StartupHook: function () {return MathJax.Hub.Startup.signal.MessageHook.apply(MathJax.Hub.Startup.signal,arguments)},
1649 LoadHook: function () {return MathJax.Ajax.LoadHook.apply(MathJax.Ajax,arguments)}
1650 },
1651 UnRegister: {
1652 PreProcessor: function (hook) {MathJax.Hub.preProcessors.Remove(hook)},
1653 MessageHook: function (hook) {MathJax.Hub.signal.RemoveHook(hook)},
1654 StartupHook: function (hook) {MathJax.Hub.Startup.signal.RemoveHook(hook)},
1655 LoadHook: function (hook) {MathJax.Ajax.removeHook(hook)}
1656 },
1657
1658 setRenderer: function (renderer,type) {
1659 if (!renderer) return;
1660 if (!MathJax.OutputJax[renderer]) {
1661 this.config.menuSettings.renderer = "";
1662 var file = "[MathJax]/jax/output/"+renderer+"/config.js";
1663 return MathJax.Ajax.Require(file,["setRenderer",this,renderer,type]);
1664 } else {
1665 this.config.menuSettings.renderer = renderer;
1666 if (type == null) {type = "jax/mml"}
1667 var jax = this.outputJax;
1668 if (jax[type] && jax[type].length) {
1669 if (renderer !== jax[type][0].id) {
1670 jax[type].unshift(MathJax.OutputJax[renderer]);
1671 return this.signal.Post(["Renderer Selected",renderer]);
1672 }
1673 }
1674 return null;
1675 }
1676 },
1677
1678 Queue: function () {
1679 return this.queue.Push.apply(this.queue,arguments);
1680 },
1681
1682 RestartAfter: function (callback) {
1683 throw this.Insert(Error("restart"),{restart: MathJax.Callback(callback)});
1684 },
1685
1686 Insert: function (dst,src) {
1687 for (var id in src) {if (src.hasOwnProperty(id)) {
1688 // allow for concatenation of arrays?
1689 if (typeof src[id] === 'object' && !(src[id] instanceof Array) &&
1690 (typeof dst[id] === 'object' || typeof dst[id] === 'function')) {
1691 this.Insert(dst[id],src[id]);
1692 } else {
1693 dst[id] = src[id];
1694 }
1695 }}
1696 return dst;
1697 },
1698
1699 // Old browsers (e.g. Internet Explorer <= 8) do not support trim().
1700 SplitList: ("trim" in String.prototype ?
1701 function (list) {return list.trim().split(/\s+/)} :
1702 function (list) {return list.replace(/^\s+/,'').
1703 replace(/\s+$/,'').split(/\s+/)})
1704 };
1705
1706 //
1707 // Storage area for extensions and preprocessors
1708 //
1709 MathJax.Extension = {};
1710
1711 MathJax.Hub.Startup = {
1712 queue: MathJax.Callback.Queue(), // Queue used for startup actions
1713 signal: MathJax.Callback.Signal("Startup") // Signal used for startup events
1714 };
1715
1716 MathJax.Ajax.config.root = MathJax.Hub.config.root;
1717
1718 /**********************************************************/
1719
1720 (function (BASENAME) {
1721 var BASE = window[BASENAME], ROOT = "["+BASENAME+"]";
1722 var HUB = BASE.Hub, AJAX = BASE.Ajax, CALLBACK = BASE.Callback;
1723
1724 var JAX = MathJax.Object.Subclass({
1725 JAXFILE: "jax.js",
1726 require: null, // array of files to load before jax.js is complete
1727 config: {},
1728 //
1729 // Make a subclass and return an instance of it.
1730 // (FIXME: should we replace config with a copy of the constructor's
1731 // config? Otherwise all subclasses share the same config structure.)
1732 //
1733 Init: function (def,cdef) {
1734 if (arguments.length === 0) {return this}
1735 return (this.constructor.Subclass(def,cdef))();
1736 },
1737 //
1738 // Augment by merging with class definition (not replacing)
1739 //
1740 Augment: function (def,cdef) {
1741 var cObject = this.constructor, ndef = {};
1742 if (def != null) {
1743 for (var id in def) {if (def.hasOwnProperty(id)) {
1744 if (typeof def[id] === "function")
1745 {cObject.protoFunction(id,def[id])} else {ndef[id] = def[id]}
1746 }}
1747 // MSIE doesn't list toString even if it is not native so handle it separately
1748 if (def.toString !== cObject.prototype.toString && def.toString !== {}.toString)
1749 {cObject.protoFunction('toString',def.toString)}
1750 }
1751 HUB.Insert(cObject.prototype,ndef);
1752 cObject.Augment(null,cdef);
1753 return this;
1754 },
1755 Translate: function (script,state) {
1756 throw Error(this.directory+"/"+this.JAXFILE+" failed to define the Translate() method");
1757 },
1758 Register: function (mimetype) {},
1759 Config: function () {
1760 this.config = HUB.CombineConfig(this.id,this.config);
1761 if (this.config.Augment) {this.Augment(this.config.Augment)}
1762 },
1763 Startup: function () {},
1764 loadComplete: function (file) {
1765 if (file === "config.js") {
1766 return AJAX.loadComplete(this.directory+"/"+file);
1767 } else {
1768 var queue = CALLBACK.Queue();
1769 queue.Push(
1770 ["Post",HUB.Startup.signal,this.id+" Jax Config"],
1771 ["Config",this],
1772 ["Post",HUB.Startup.signal,this.id+" Jax Startup"],
1773 ["Startup",this],
1774 ["Post",HUB.Startup.signal,this.id+" Jax Ready"]
1775 );
1776 if (this.copyTranslate) {
1777 queue.Push(
1778 [function (THIS) {
1779 THIS.preProcess = THIS.preTranslate;
1780 THIS.Process = THIS.Translate;
1781 THIS.postProcess = THIS.postTranslate;
1782 },this.constructor.prototype]
1783 );
1784 }
1785 return queue.Push(["loadComplete",AJAX,this.directory+"/"+file]);
1786 }
1787 }
1788 },{
1789 id: "Jax",
1790 version: "2.6.0",
1791 directory: ROOT+"/jax",
1792 extensionDir: ROOT+"/extensions"
1793 });
1794
1795 /***********************************/
1796
1797 BASE.InputJax = JAX.Subclass({
1798 elementJax: "mml", // the element jax to load for this input jax
1799 sourceMenuTitle: /*_(MathMenu)*/ ["Original","Original Form"],
1800 copyTranslate: true,
1801 Process: function (script,state) {
1802 throw Error("Input jax failed to load properly")
1803 },
1804 needsUpdate: function (jax) {
1805 var script = jax.SourceElement();
1806 return (jax.originalText !== BASE.HTML.getScript(script));
1807 },
1808 Register: function (mimetype) {
1809 if (!HUB.inputJax) {HUB.inputJax = {}}
1810 HUB.inputJax[mimetype] = this;
1811 }
1812 },{
1813 id: "InputJax",
1814 version: "2.6.0",
1815 directory: JAX.directory+"/input",
1816 extensionDir: JAX.extensionDir
1817 });
1818
1819 /***********************************/
1820
1821 BASE.OutputJax = JAX.Subclass({
1822 copyTranslate: true,
1823 preProcess: function (state) {
1824 throw Error("Output jax failed to load properly");
1825 },
1826 Register: function (mimetype) {
1827 var jax = HUB.outputJax;
1828 if (!jax[mimetype]) {jax[mimetype] = []}
1829 // If the output jax is earlier in the original configuration list, put it first here
1830 if (jax[mimetype].length && (this.id === HUB.config.menuSettings.renderer ||
1831 (jax.order[this.id]||0) < (jax.order[jax[mimetype][0].id]||0)))
1832 {jax[mimetype].unshift(this)} else {jax[mimetype].push(this)}
1833 },
1834 Remove: function (jax) {}
1835 },{
1836 id: "OutputJax",
1837 version: "2.6.0",
1838 directory: JAX.directory+"/output",
1839 extensionDir: JAX.extensionDir,
1840 fontDir: ROOT+(BASE.isPacked?"":"/..")+"/fonts",
1841 imageDir: ROOT+(BASE.isPacked?"":"/..")+"/images"
1842 });
1843
1844 /***********************************/
1845
1846 BASE.ElementJax = JAX.Subclass({
1847 // make a subclass, not an instance
1848 Init: function (def,cdef) {return this.constructor.Subclass(def,cdef)},
1849
1850 inputJax: null,
1851 outputJax: null,
1852 inputID: null,
1853 originalText: "",
1854 mimeType: "",
1855 sourceMenuTitle: /*_(MathMenu)*/ ["MathMLcode","MathML Code"],
1856
1857 Text: function (text,callback) {
1858 var script = this.SourceElement();
1859 BASE.HTML.setScript(script,text);
1860 script.MathJax.state = this.STATE.UPDATE;
1861 return HUB.Update(script,callback);
1862 },
1863 Reprocess: function (callback) {
1864 var script = this.SourceElement();
1865 script.MathJax.state = this.STATE.UPDATE;
1866 return HUB.Reprocess(script,callback);
1867 },
1868 Update: function (callback) {return this.Rerender(callback)},
1869 Rerender: function (callback) {
1870 var script = this.SourceElement();
1871 script.MathJax.state = this.STATE.OUTPUT;
1872 return HUB.Process(script,callback);
1873 },
1874 Remove: function (keep) {
1875 if (this.hover) {this.hover.clear(this)}
1876 BASE.OutputJax[this.outputJax].Remove(this);
1877 if (!keep) {
1878 HUB.signal.Post(["Remove Math",this.inputID]); // wait for this to finish?
1879 this.Detach();
1880 }
1881 },
1882 needsUpdate: function () {
1883 return BASE.InputJax[this.inputJax].needsUpdate(this);
1884 },
1885
1886 SourceElement: function () {return document.getElementById(this.inputID)},
1887
1888 Attach: function (script,inputJax) {
1889 var jax = script.MathJax.elementJax;
1890 if (script.MathJax.state === this.STATE.UPDATE) {
1891 jax.Clone(this);
1892 } else {
1893 jax = script.MathJax.elementJax = this;
1894 if (script.id) {this.inputID = script.id}
1895 else {script.id = this.inputID = BASE.ElementJax.GetID(); this.newID = 1}
1896 }
1897 jax.originalText = BASE.HTML.getScript(script);
1898 jax.inputJax = inputJax;
1899 if (jax.root) {jax.root.inputID = jax.inputID}
1900 return jax;
1901 },
1902 Detach: function () {
1903 var script = this.SourceElement(); if (!script) return;
1904 try {delete script.MathJax} catch(err) {script.MathJax = null}
1905 if (this.newID) {script.id = ""}
1906 },
1907 Clone: function (jax) {
1908 var id;
1909 for (id in this) {
1910 if (!this.hasOwnProperty(id)) continue;
1911 if (typeof(jax[id]) === 'undefined' && id !== 'newID') {delete this[id]}
1912 }
1913 for (id in jax) {
1914 if (!jax.hasOwnProperty(id)) continue;
1915 if (typeof(this[id]) === 'undefined' || (this[id] !== jax[id] && id !== 'inputID'))
1916 {this[id] = jax[id]}
1917 }
1918 }
1919 },{
1920 id: "ElementJax",
1921 version: "2.6.0",
1922 directory: JAX.directory+"/element",
1923 extensionDir: JAX.extensionDir,
1924 ID: 0, // jax counter (for IDs)
1925 STATE: {
1926 PENDING: 1, // script is identified as math but not yet processed
1927 PROCESSED: 2, // script has been processed
1928 UPDATE: 3, // elementJax should be updated
1929 OUTPUT: 4 // output should be updated (input is OK)
1930 },
1931
1932 GetID: function () {this.ID++; return "MathJax-Element-"+this.ID},
1933 Subclass: function () {
1934 var obj = JAX.Subclass.apply(this,arguments);
1935 obj.loadComplete = this.prototype.loadComplete;
1936 return obj;
1937 }
1938 });
1939 BASE.ElementJax.prototype.STATE = BASE.ElementJax.STATE;
1940
1941 })("MathJax");
1942
1943 MathJax.Hub.Browser = {Select: function () {}};