Skip to content

Instantly share code, notes, and snippets.

@sir-deenicus
Last active December 18, 2015 14:28
Show Gist options
  • Save sir-deenicus/5797094 to your computer and use it in GitHub Desktop.
Save sir-deenicus/5797094 to your computer and use it in GitHub Desktop.
This is a very simple chrome plugin that allows latex to render in google plus. Installation is (simple). Download the zipped plugin from google drive [1](exactly same, conveniently packaged), go to extensions, check developer mode, unzip to a folder and click Load Unpacked Extenstion to load the folder [1] clickable link is a comment below.
var injectMathJax = document.createElement('script');
var typeSet = document.createElement('script');
var style=document.createElement('style');
//modified: css https://github.com/christianp/mathjax-bookmarklet/blob/master/bookmarklet.js
style.innerText = '.MathJax .mn {background: inherit;} .MathJax .mi {color: inherit;} .MathJax .mo {background: inherit;}';
injectMathJax.type = 'text/javascript';
injectMathJax.src = 'https://c328740.ssl.cf1.rackcdn.com/mathjax/latest/MathJax.js?config=TeX-AMS-MML_HTMLorMML';
typeSet.innerHTML = 'document.body.addEventListener("keydown",function(e){if(e.ctrlKey && e.shiftKey){MathJax.Hub.Queue(["Typeset",MathJax.Hub]); }});document.body.addEventListener("click",function(e) {if(e.target.nodeName == "SPAN"){MathJax.Hub.Queue(["Typeset",MathJax.Hub]); }});';
(document.head||document.documentElement).appendChild(injectMathJax);
(document.head||document.documentElement).appendChild(typeSet);
(document.head||document.documentElement).appendChild(style);
{
"manifest_version": 2,
"name": "Mx",
"description": "math jax inject",
"version": "1.0",
"content_security_policy": "script-src 'self' https://c328740.ssl.cf1.rackcdn.com/mathjax/; object-src 'self'",
"web_accessible_resources":["https://c328740.ssl.cf1.rackcdn.com/mathjax/*"],
"content_scripts": [{
"js": ["mx.js"],
"matches": ["https://plus.google.com/*"]
}],
"permissions": [
"https://plus.google.com/",
"https://c328740.ssl.cf1.rackcdn.com/mathjax/*"
]
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment