Make AJAX.loadComplete() work even if no AJAX.Load() was called (in preparation for putting multiple files into a single configuration file that can include all the common extensions and setup files)

git-svn-id: https://mathjax.svn.sourceforge.net/svnroot/mathjax/trunk@618 b8fd5906-0fad-46e2-a0d3-10d94ff285d1
This commit is contained in:
dpvc 2010-09-29 02:49:27 +00:00
parent b8350ca60c
commit 89fab25603
2 changed files with 13 additions and 14 deletions

File diff suppressed because one or more lines are too long

View File

@ -29,7 +29,7 @@ if (document.getElementById && document.childNodes && document.createElement) {
if (!window.MathJax) {window.MathJax= {}} if (!window.MathJax) {window.MathJax= {}}
if (!MathJax.Hub) { // skip if already loaded if (!MathJax.Hub) { // skip if already loaded
MathJax.version = "1.0.4"; MathJax.version = "1.0.5";
/**********************************************************/ /**********************************************************/
@ -631,7 +631,8 @@ MathJax.version = "1.0.4";
else {type = file.split(/\./).pop().toUpperCase()} else {type = file.split(/\./).pop().toUpperCase()}
file = this.fileURL(file); file = this.fileURL(file);
if (this.loading[file]) { if (this.loading[file]) {
this.loading[file].callbacks.push(callback); if (!this.loadHooks[file]) {this.loadHooks[file] = []}
this.loadHooks[file].push(callback);
} else { } else {
this.head = HEAD(this.head); this.head = HEAD(this.head);
if (this.loader[type]) {this.loader[type].call(this,file,callback)} if (this.loader[type]) {this.loader[type].call(this,file,callback)}
@ -669,7 +670,7 @@ MathJax.version = "1.0.4";
var script = document.createElement("script"); var script = document.createElement("script");
var timeout = BASE.Callback(["loadTimeout",this,file]); var timeout = BASE.Callback(["loadTimeout",this,file]);
this.loading[file] = { this.loading[file] = {
callbacks: [callback], callback: callback,
message: BASE.Message.File(file), message: BASE.Message.File(file),
timeout: setTimeout(timeout,this.timeout), timeout: setTimeout(timeout,this.timeout),
status: this.STATUS.OK, status: this.STATUS.OK,
@ -687,7 +688,7 @@ MathJax.version = "1.0.4";
var link = document.createElement("link"); var link = document.createElement("link");
link.rel = "stylesheet"; link.type = "text/css"; link.href = file; link.rel = "stylesheet"; link.type = "text/css"; link.href = file;
this.loading[file] = { this.loading[file] = {
callbacks: [callback], callback: callback,
message: BASE.Message.File(file), message: BASE.Message.File(file),
status: this.STATUS.OK status: this.STATUS.OK
}; };
@ -803,15 +804,13 @@ MathJax.version = "1.0.4";
SCRIPTS.push(loading.script); SCRIPTS.push(loading.script);
} }
this.loaded[file] = loading.status; delete this.loading[file]; this.loaded[file] = loading.status; delete this.loading[file];
if (this.loadHooks[file]) { if (!this.loadHooks[file]) {this.loadHooks[file] = []}
BASE.Callback.Queue( this.loadHooks[file].push(loading.callback);
[BASE.Callback.ExecuteHooks,this.loadHooks[file],loading.status],
[BASE.Callback.ExecuteHooks,loading.callbacks,loading.status]
);
} else { } else {
BASE.Callback.ExecuteHooks(loading.callbacks,loading.status); this.loaded[file] = this.STATUS.OK;
} loading = {status: this.STATUS.OK}
} }
BASE.Callback.ExecuteHooks(this.loadHooks[file],loading.status);
}, },
// //