mirror of
https://codeberg.org/nobody/LocalCDN.git
synced 2025-02-17 04:10:53 +01:00
MathJax latest.js v2.7.5 file modified (#1194)
This commit is contained in:
parent
da9224c551
commit
f3ee6098d3
@ -16,6 +16,15 @@
|
|||||||
* limitations under the License.
|
* limitations under the License.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
/*
|
||||||
|
* @author nobody
|
||||||
|
* @since 2022-11-04
|
||||||
|
*
|
||||||
|
* This file was modified:
|
||||||
|
* - Obfuscation reverted with www.dcode.fr
|
||||||
|
* - getLatestMathJax defused and call the loadDefaultMathJax() method directly.
|
||||||
|
*/
|
||||||
|
|
||||||
(function() {
|
(function() {
|
||||||
function Error(text) {
|
function Error(text) {
|
||||||
if (console && console.log) {
|
if (console && console.log) {
|
||||||
@ -62,30 +71,30 @@
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
function setVersion(value) {
|
// function setVersion(value) {
|
||||||
cookie = "mjx.latest=" + value;
|
// cookie = "mjx.latest=" + value;
|
||||||
var d = new Date;
|
// var d = new Date;
|
||||||
d.setDate(d.getDate() + 7);
|
// d.setDate(d.getDate() + 7);
|
||||||
cookie = cookie + ("; expires=" + d.toGMTString());
|
// cookie = cookie + ("; expires=" + d.toGMTString());
|
||||||
cookie = cookie + "; path=/";
|
// cookie = cookie + "; path=/";
|
||||||
try {
|
// try {
|
||||||
document.cookie = cookie;
|
// document.cookie = cookie;
|
||||||
} catch (r) {}
|
// } catch (r) {}
|
||||||
}
|
// }
|
||||||
|
|
||||||
function getXMLHttpRequest() {
|
// function getXMLHttpRequest() {
|
||||||
if (window.XMLHttpRequest) {
|
// if (window.XMLHttpRequest) {
|
||||||
return new XMLHttpRequest;
|
// return new XMLHttpRequest;
|
||||||
}
|
// }
|
||||||
if (window.ActiveXObject) {
|
// if (window.ActiveXObject) {
|
||||||
try {
|
// try {
|
||||||
return new ActiveXObject("Msxml2.XMLHTTP");
|
// return new ActiveXObject("Msxml2.XMLHTTP");
|
||||||
} catch (q) {}
|
// } catch (q) {}
|
||||||
try {
|
// try {
|
||||||
return new ActiveXObject("Microsoft.XMLHTTP");
|
// return new ActiveXObject("Microsoft.XMLHTTP");
|
||||||
} catch (q) {}
|
// } catch (q) {}
|
||||||
}
|
// }
|
||||||
}
|
// }
|
||||||
|
|
||||||
function loadMathJax(url) {
|
function loadMathJax(url) {
|
||||||
var script = document.createElement("script");
|
var script = document.createElement("script");
|
||||||
@ -110,34 +119,36 @@
|
|||||||
}
|
}
|
||||||
|
|
||||||
function getLatestMathJax(cdn, config, unpacked) {
|
function getLatestMathJax(cdn, config, unpacked) {
|
||||||
var request = getXMLHttpRequest();
|
// var request = getXMLHttpRequest();
|
||||||
if (request) {
|
// if (request) {
|
||||||
request.onreadystatechange = function() {
|
// request.onreadystatechange = function() {
|
||||||
if (request.readyState === 4) {
|
// if (request.readyState === 4) {
|
||||||
if (request.status === 200) {
|
// if (request.status === 200) {
|
||||||
var json = JSON.parse(request.responseText);
|
// var json = JSON.parse(request.responseText);
|
||||||
if (json instanceof Array) {
|
// if (json instanceof Array) {
|
||||||
json = json[0];
|
// json = json[0];
|
||||||
}
|
// }
|
||||||
var value = json[cdn.version];
|
// var value = json[cdn.version];
|
||||||
if (value.substr(0, 2) === "2.") {
|
// if (value.substr(0, 2) === "2.") {
|
||||||
setVersion(value);
|
// setVersion(value);
|
||||||
loadMathJax(cdn.mathjax + json[cdn.version] + unpacked + "/MathJax.js" + config);
|
// loadMathJax(cdn.mathjax + json[cdn.version] + unpacked + "/MathJax.js" + config);
|
||||||
return;
|
// return;
|
||||||
}
|
// }
|
||||||
} else {
|
// } else {
|
||||||
Error("Problem acquiring MathJax version: status = " + request.status);
|
// Error("Problem acquiring MathJax version: status = " + request.status);
|
||||||
}
|
// }
|
||||||
loadDefaultMathJax();
|
// loadDefaultMathJax();
|
||||||
}
|
// }
|
||||||
};
|
// };
|
||||||
request.open("GET", cdn.api, true);
|
// request.open("GET", cdn.api, true);
|
||||||
request.send(null);
|
// request.send(null);
|
||||||
} else {
|
// } else {
|
||||||
Error("Can't create XMLHttpRequest object");
|
// Error("Can't create XMLHttpRequest object");
|
||||||
loadDefaultMathJax();
|
// loadDefaultMathJax();
|
||||||
}
|
// }
|
||||||
|
loadDefaultMathJax();
|
||||||
}
|
}
|
||||||
|
|
||||||
var CDN = {
|
var CDN = {
|
||||||
"cdnjs.cloudflare.com": {
|
"cdnjs.cloudflare.com": {
|
||||||
api: "https://api.cdnjs.com/libraries/mathjax?fields=version",
|
api: "https://api.cdnjs.com/libraries/mathjax?fields=version",
|
||||||
@ -155,9 +166,11 @@
|
|||||||
mathjax: "https://cdn.jsdelivr.net/mathjax/"
|
mathjax: "https://cdn.jsdelivr.net/mathjax/"
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
var valExpr = /(?:^|;\s*)mjx\.latest=([^;]*)(?:;|$)/;
|
var valExpr = /(?:^|;\s*)mjx\.latest=([^;]*)(?:;|$)/;
|
||||||
var script = getScript();
|
var script = getScript();
|
||||||
var cdn = getCDN(script);
|
var cdn = getCDN(script);
|
||||||
|
|
||||||
if (cdn) {
|
if (cdn) {
|
||||||
var config = script.src.replace(/.*?(\?|$)/, "$1");
|
var config = script.src.replace(/.*?(\?|$)/, "$1");
|
||||||
config = config + ((config ? "&" : "?") + "latest");
|
config = config + ((config ? "&" : "?") + "latest");
|
||||||
|
Loading…
x
Reference in New Issue
Block a user