Skip to content

Instantly share code, notes, and snippets.

@pkra
Forked from christianp/id_mathjax_plugin.js
Created August 30, 2013 00:00
Show Gist options
  • Save pkra/6384845 to your computer and use it in GitHub Desktop.
Save pkra/6384845 to your computer and use it in GitHub Desktop.
var id_mathjax_plugin;
(function() {
var mjp = id_mathjax_plugin = {
load_mathjax: function() {
function e(e){var t='.MathJax .mn {background: inherit;} .MathJax .mi {color: inherit;} .MathJax .mo {background: inherit;}',n=e.createElement('style');n.innerText=t;try{n.textContent=t}catch(r){}e.getElementsByTagName('body')[0].appendChild(n);var i=e.createElement('script'),s;i.src='https://c328740.ssl.cf1.rackcdn.com/mathjax/latest/MathJax.js?config=TeX-AMS-MML_HTMLorMML.js',i.type='text/javascript',s='MathJax.Hub.Config({skipStartupTypeset:true,tex2jax:{inlineMath:[[\'$\',\'$\']],displayMath:[[\'\\\\[\',\'\\\\]\']],processEscapes:true}});MathJax.Hub.Startup.onload();',window.opera?i.innerHTML=s:i.text=s,e.getElementsByTagName('head')[0].appendChild(i)}function t(t){t.MathJax===undefined?e(t.document):t.MathJax.Hub.Queue(new t.Array('Typeset',t.MathJax.Hub))}var n=document.getElementsByTagName('iframe'),r,i;t(window);for(r=0;r<n.length;r++)i=n[r].contentWindow||n[r].contentDocument,i.document||(i=i.parentNode),t(i)
},
process_comments: function() {
MathJax.Hub.Queue(['Typeset',MathJax.Hub,'idc-container']);
}
};
id_add_action('idcomments_init',mjp.load_mathjax);
id_add_action('idcomments_func_load',mjp.process_comments);
id_add_action('page_load',mjp.process_comments);
id_add_action('thread_page_load',mjp.process_comments);
id_add_action('comment_post',mjp.process_comments);
})();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment