Advertisement
Guest User

Chatjax Tampermonkey Userscript

a guest
Feb 13th, 2017
154
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.24 KB | None | 0 0
  1. // ==UserScript==
  2. // @name Auto ChatJax
  3. // @namespace http://tampermonkey.net/
  4. // @version 0.1
  5. // @description try to take over the world!
  6. // @author You
  7. // @match http://chat.stackexchange.com/*
  8. // @grant none
  9. // ==/UserScript==
  10.  
  11. (function() {
  12. 'use strict';
  13. setTimeout(function(){
  14. // Your code here...
  15. if(window.MathJax===undefined){
  16. var script = document.createElement("script");
  17. script.type = "text/javascript";
  18. script.src = "https://cdn.mathjax.org/mathjax/latest/MathJax.js?config=TeX-AMS_HTML";
  19. var config = 'MathJax.Hub.Config({' + 'extensions: ["tex2jax.js"],' + 'tex2jax: { inlineMath: [["$","$"],["\\\\\\\\\\\\(","\\\\\\\\\\\\)"]], displayMath: [["$$","$$"],["\\\\[","\\\\]"]], processEscapes: true },' + 'jax: ["input/TeX","output/HTML-CSS"]' + '});' + 'MathJax.Hub.Startup.onload();';
  20. if (window.opera) {script.innerHTML = config;}
  21. else {script.text = config;}
  22. document.getElementsByTagName("head")[0].appendChild(script);
  23. var doChatJax=(function(){window.setTimeout(doChatJax,1000);MathJax.Hub.Queue(["Typeset",MathJax.Hub]);})();
  24. }else{
  25. MathJax.Hub.Queue(["Typeset",MathJax.Hub]);
  26. }},1000);
  27. })();
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement