Utilisateur:Pierrelm/vector.js
Note : après avoir enregistré la page, vous devrez forcer le rechargement complet du cache de votre navigateur pour voir les changements.
Mozilla / Firefox / Konqueror / Safari : maintenez la touche Majuscule (Shift) en cliquant sur le bouton Actualiser (Reload) ou pressez Maj-Ctrl-R (Cmd-R sur Apple Mac) ;
Firefox (sur GNU/Linux) / Chrome / Internet Explorer / Opera : maintenez la touche Ctrl en cliquant sur le bouton Actualiser ou pressez Ctrl-F5.///////////////////////////////
// //
// MathJax for Wikipedia //
// //
///////////////////////////////
if ((window.unsafeWindow == null ? window : unsafeWindow).MathJax == null) {
//
// Replace tex class elements with MathJax scripts of type math/tex
//
var relatex = /^\s*\$\s*(\\scriptstyle)?\s*([\S\s]*?)\s*\$\s*$/, texelts, found = false;
if (document.getElementsByClassName == undefined)
{
texelts = [];
for (var i = document.all.length; i >= 0; i--) {if (document.all[i].className == 'tex') { texelts.append(document.all[i]) }}
}
else {texelts = document.getElementsByClassName('tex')};
for (var i = texelts.length - 1; i >= 0; i--)
{
var elt = texelts[i];
if (elt.nodeName == 'IMG') {code = elt.alt;}
else {if (relatex.test(elt.innerHTML)) {code = RegExp.$2} else continue};
var parent = elt.parentNode;
if (/(^|[^\\])(\\\\)*(\\eqnarray|\\\]|\\\[|\\newcommand|\\hspace)/.test(code))
{
var sp = document.createElement('span');
sp.className = 'error';
sp.innerHTML = "Erreur de codage : "+RegExp.$1+" non pris en charge par le serveur.";
parent.replaceChild(sp, elt);
}
else
{
found = true;
var script = document.createElement('script');
script.type = "math/tex";
code = code.replace(/</g, ' \\lt ').replace(/>/g, ' \\gt ').replace(/[\\]? /g, '~').replace(/&/g, '&').replace(/(\\)(d|t)?(frac|binom)\b\s*([A-Za-z\d])\s*([A-Za-z\d])/g, '$1$2$3{$4}{$5}');
if (/^(CENTER|DD|TD)$/.test(parent.nodeName)) {script.innerHTML = '\\displaystyle '+code;}
else {script.innerHTML = code;};
if (parent.lastChild == elt) {parent.appendChild(script);}
else {parent.insertBefore(script, elt.nextSibling);}
}
};
if (found)
{
//
// Configure MathJax
//
var script = document.createElement("script");
script.type = "text/x-mathjax-config";
script.innerHTML = "MathJax.Hub.Config({jax: ['input/TeX', 'output/HTML-CSS'], extensions: ['tex2jax.js'], tex2jax: {processEnvironments: false}, TeX: {extensions: ['AMSmath.js', 'AMSsymbols.js'], Macros: {empty: '\\\\emptyset', N: '\\\\mathbb N', Z: '\\\\mathbb Z', Q: '\\\\mathbb Q', R: '\\\\mathbb R', real: '\\\\mathbb R', C: '\\\\mathbb C', Complex: '\\\\mathbb C', H: '\\\\mathbb H', Alpha: '\\\\mathrm A', Beta: '\\\\mathrm B', Epsilon: '\\\\mathrm E', Zeta: '\\\\mathrm Z', Eta: '\\\\mathrm H', Iota: '\\\\mathrm I', Kappa: '\\\\mathrm K', Mu: '\\\\mathrm M', Nu: '\\\\mathrm N', Rho: '\\\\mathrm R', Tau: '\\\\mathrm T', Chi: '\\\\mathrm X', and: '\\\\wedge', infin: '\\\\infty', part: '\\\\partial', sgn: '\\\\operatorname{sgn}', sub: '\\\\subset'}}, preRemoveClass: 'tex'});";
document.getElementsByTagName("head")[0].appendChild(script);
//
// Load MathJax and have it process the page
//
script = document.createElement("script");
script.type = "text/javascript";
script.src = "http://cdn.mathjax.org/mathjax/latest/MathJax.js";
script.innerHTML = 'MathJax.Hub.Startup.onload()';
document.getElementsByTagName("head")[0].appendChild(script);
}
}