Skip to content

Instantly share code, notes, and snippets.

@ifree
Last active January 11, 2022 01:54
Show Gist options
  • Save ifree/a98a7232df89cf5a8ba003227c6ad4af to your computer and use it in GitHub Desktop.
Save ifree/a98a7232df89cf5a8ba003227c6ad4af to your computer and use it in GitHub Desktop.
MathJax for kinopio.club
// ==UserScript==
// @name MathJax for kinopio.club
// @namespace
// @version 0.1
// @description Enables MathJax on reddit for the TeXtheWorld delimiters [; ... ;].
// @match https://kinopio.club/*
// @copyright
// @namespace https://greasyfork.org/users/399493
// ==/UserScript==
if (window.MathJax === undefined) {
var polyfill_src = "https://polyfill.io/v3/polyfill.min.js?features=es6";
var mathjax_src = "https://cdn.jsdelivr.net/npm/mathjax@3/es5/tex-mml-chtml.js";
var insert_script = function(src){
var script = document.createElement("script");
script.type = "text/javascript";
// script.src = "http://cdn.mathjax.org/mathjax/latest/MathJax.js?config=TeX-AMS_HTML";
//script.src = "https://cdnjs.cloudflare.com/ajax/libs/mathjax/2.7.1/MathJax.js?config=TeX-AMS_HTML";
script.src = src;
document.getElementsByTagName("head")[0].appendChild(script);
};
insert_script(polyfill_src);
insert_script(mathjax_src);
document.addEventListener('keyup', function(){
MathJax.typeset(MathJax.typeset(document.querySelectorAll(".markdown span")));
});
}
@ifree
Copy link
Author

ifree commented Jan 11, 2022

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment