User:Nhjr/global.js

(function ($, mw){	console.log("User script load start...");	try{		if($(".tex, math")[0]){			console.log("start mathjax");			$(".texerror").replaceWith(function (i, e){ return "$" + e.split(":").reverse[0] + "$ "; });			window.MathJax = {       		startup: {    		        elements: [".mw-parser-output"],    		    },    		    tex: {    		        inlineMath: [    		            ["$", "$"],    		            ["\\(", "\\)"],    		        ],    		        displayMath: [    		            ["$$", "$$"],    		            ["\\[", "\\]"],    		        ],    		        processEscapes: true    		    },    		    loader: {    		        load: ["[tex]/mhchem"],    		    },    		    options: {        		    processHtmlClass: {        		        "[+]": ["tex", "mwe-math-fallback-source-display"],        		    }        		}    		};			const script1 = document.createElement("script");    		script1.src = "https://polyfill.io/v3/polyfill.js?features=es6";    		const script2 = document.createElement("script");    		script2.src = "https://cdn.jsdelivr.net/npm/mathjax@3/es5/tex-mml-chtml.js";    		script2.async = true;    		document.head.appendChild(script1); document.head.appendChild(script2); }	}catch(e){ console.error("user script error occured!"); console.error(e); } })(jQuery, mediaWiki);