Skip to content

Instantly share code, notes, and snippets.

@pkra
Last active March 7, 2017 02:10
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save pkra/5500316 to your computer and use it in GitHub Desktop.
Save pkra/5500316 to your computer and use it in GitHub Desktop.
Bookmarklet for Wikipedia, replacing PNGs on the fly
javascript:(function(){ var s=document.createElement('script');s.setAttribute('src','ajax.googleapis.com/ajax/libs/jquery/1.7.1/jquery.min.js"');document.getElementsByTagName('body')[0].appendChild(s); $('img.tex').wrap('<span class="MathJax_Preview" />');$('.MathJax_Preview').after(function() { tex = $(this).find('img').attr("alt"); return " <script type='math/tex'>" + tex + "</" + "script>" ;});$.getScript('https://cdn.mathjax.org/mathjax/latest/MathJax.js?config=TeX-AMS-MML_HTMLorMML');})()
@pkra
Copy link
Author

pkra commented Jul 24, 2013

Still missing: Wikipedia's texvc macros.

@christianp
Copy link

Are texvc macros different to the images displayed by default on wikipedia? It looks like they've just got the class 'tex', with the TeX stored in the 'alt' attribute.

Copy link

ghost commented Sep 16, 2015

@christianp, that's true for almost all websites which use maths images.

If a script was made for that then it would work everywhere, not just on Wikipedia.

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