Skip to content

Instantly share code, notes, and snippets.

@pkra pkra/wikipedia2mj.js
Last active Mar 7, 2017

Embed
What would you like to do?
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

This comment has been minimized.

Copy link
Owner Author

pkra commented Jul 24, 2013

Still missing: Wikipedia's texvc macros.

@christianp

This comment has been minimized.

Copy link

christianp commented Sep 19, 2013

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.

@ghost

This comment has been minimized.

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
You can’t perform that action at this time.