Skip to content

Commit aa3936a

Browse files
committed
Add noContrib parameter to allow MathJax to be used off-line once we add the accessibility menu to the combined config files.
1 parent 76508cc commit aa3936a

File tree

1 file changed

+13
-6
lines changed

1 file changed

+13
-6
lines changed

unpacked/MathJax.js

Lines changed: 13 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -679,6 +679,7 @@ MathJax.cdnFileVersions = {}; // can be used to specify revisions for individua
679679
root: "", // URL of root directory to load from
680680
path: PATH // paths to named URL's (e.g., [MathJax]/...)
681681
},
682+
params: {}, // filled in from MathJax.js?...
682683

683684
STATUS: {
684685
OK: 1, // file is loading or did load OK
@@ -728,13 +729,17 @@ MathJax.cdnFileVersions = {}; // can be used to specify revisions for individua
728729
for (var i in file)
729730
{if (file.hasOwnProperty(i)) {type = i.toUpperCase(); file = file[i]}}
730731
} else {type = file.split(/\./).pop().toUpperCase()}
731-
file = this.fileURL(file);
732-
// FIXME: check that URL is OK
733-
if (this.loaded[file]) {
734-
callback(this.loaded[file]);
732+
if (this.params.noContrib && file.substr(0,9) === "[Contrib]") {
733+
callback(this.STATUS.ERROR);
735734
} else {
736-
var FILE = {}; FILE[type] = file;
737-
this.Load(FILE,callback);
735+
file = this.fileURL(file);
736+
// FIXME: check that URL is OK
737+
if (this.loaded[file]) {
738+
callback(this.loaded[file]);
739+
} else {
740+
var FILE = {}; FILE[type] = file;
741+
this.Load(FILE,callback);
742+
}
738743
}
739744
return callback;
740745
},
@@ -3123,12 +3128,14 @@ MathJax.Hub.Startup = {
31233128
for (var j = 0, m = params.length; j < m; j++) {
31243129
var KV = params[j].match(/(.*)=(.*)/);
31253130
if (KV) {STARTUP.params[unescape(KV[1])] = unescape(KV[2])}
3131+
else {STARTUP.params[params[j]] = true}
31263132
}
31273133
}
31283134
CONFIG.root = scripts[i].src.replace(/(^|\/)[^\/]*(\?.*)?$/,'')
31293135
// convert mathjax/latest to mathjax/x.y-latest so that all files are the same version
31303136
.replace(/^(https?:\/\/cdn.mathjax.org\/mathjax\/)(latest)/,"$1"+BASE.version.split(/\./).slice(0,2).join(".")+"-$2");
31313137
BASE.Ajax.config.root = CONFIG.root;
3138+
BASE.Ajax.params = STARTUP.params;
31323139
break;
31333140
}
31343141
}

0 commit comments

Comments
 (0)