Skip to content

Instantly share code, notes, and snippets.

@TehFlaminTaco
Last active February 15, 2017 08:33
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save TehFlaminTaco/862deef0822ab7576940d960801a4a84 to your computer and use it in GitHub Desktop.
Save TehFlaminTaco/862deef0822ab7576940d960801a4a84 to your computer and use it in GitHub Desktop.
// ==UserScript==
// @name Auto ChatJax
// @namespace http://tampermonkey.net/
// @version 0.2
// @description try to take over the world!
// @author You
// @match http://chat.stackexchange.com/*
// @match http://chat.stackoverflow.com/*
// @grant none
// ==/UserScript==
(function() {
'use strict';
setTimeout(function(){
// Your code here...
if(window.MathJax===undefined){
var script = document.createElement("script");
script.type = "text/javascript";
script.src = "https://cdn.mathjax.org/mathjax/latest/MathJax.js?config=TeX-AMS_HTML";
var config = 'MathJax.Hub.Config({' + 'extensions: ["tex2jax.js"],' + 'tex2jax: { inlineMath: [["$","$"],["\\\\\\\\\\\\(","\\\\\\\\\\\\)"]], displayMath: [["$$","$$"],["\\\\[","\\\\]"]], processEscapes: true },' + 'jax: ["input/TeX","output/HTML-CSS"]' + '});' + 'MathJax.Hub.Startup.onload();';
if (window.opera) {script.innerHTML = config;}
else {script.text = config;}
document.getElementsByTagName("head")[0].appendChild(script);
window.setInterval(function(){MathJax.Hub.Queue(["Typeset",MathJax.Hub]);},1000);
}else{
MathJax.Hub.Queue(["Typeset",MathJax.Hub]);
}},1000);
})();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment