-
Notifications
You must be signed in to change notification settings - Fork 5
/
Copy pathautochatjax.user.js
40 lines (39 loc) · 1.64 KB
/
autochatjax.user.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
// ==UserScript==
// @name Auto ChatJax
// @namespace http://tampermonkey.net/
// @version 0.2.2
// @description Automatically launch Chatjax for Stack Exchange chats.
// @author Teh Flamin' Taco
// @include *://chat.meta.stackoverflow.com/rooms/*
// @include *://chat.meta.stackexchange.com/rooms/*
// @include *://chat.stackexchange.com/rooms/*
// @include *://chat.stackoverflow.com/rooms/*
// @include *://chat.askubuntu.com/rooms/*
// @include *://chat.serverfault.com/rooms/*
// @run-at document-end
// @grant none
// ==/UserScript==
/* global MathJax */
(function() {
'use strict';
setTimeout(function() {
if (typeof window.MathJax === "undefined") {
var script = document.createElement("script");
script.type = "text/javascript";
script.src = "https://cdn.rawgit.com/mathjax/MathJax/2.7.1/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);
})();