reltub

Greasemonkey script to add MathJaX to Gmane's Maxima page

Jun 4th, 2012
168
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. // version 0.1 BETA!
  2. // 2012-01-231
  3. // Copyright (c) 2012, Leo Butler
  4. // Released under the GPL license
  5. // http://www.gnu.org/copyleft/gpl.html
  6. //
  7. // --------------------------------------------------------------------
  8. //
  9. // This is a Greasemonkey user script.  To install it, you need
  10. // Greasemonkey 0.3 or later: http://greasemonkey.mozdev.org/
  11. // Then restart Firefox and revisit this script.
  12. // Under Tools, there will be a new menu item to "Install User Script".
  13. // Accept the default configuration and install.
  14. //
  15. // --------------------------------------------------------------------
  16. //
  17. // ==UserScript==
  18. // @name          search
  19. // @namespace     http://www.a.namespace.without.a.name.org/projects/greasemonkey/
  20. // @description   example script to put MathJaX on Maxima's Gmane page
  21. // @include       http://blog.gmane.org/gmane.comp.mathematics.maxima.general
  22. // @include       http://comments.gmane.org/gmane.comp.mathematics.maxima.general
  23. // ==/UserScript==
  24.  
  25. // See HACK 47 of Greasemonkey Hacks
  26.  
  27. var mathjax = document.createElement('script');
  28. mathjax.type="text/javascript";
  29. mathjax.src="http://cdn.mathjax.org/mathjax/latest/MathJax.js?config=TeX-AMS-MML_HTMLorMML";
  30.  
  31. var mathjaxConfig=document.createElement('script');
  32. mathjaxConfig.type="text/x-mathjax-config";
  33. mathjaxConfig.innerHTML='MathJax.Hub.Config({'+
  34.     "tex2jax: {inlineMath: [['\\(','\\)']],"+
  35.     "displayMath: [['$$','$$'], ['\\[','\\]']]}}};";
  36.  
  37. var head=document.getElementsByTagName('head')[0];
  38. head.appendChild(mathjax);
  39. head.appendChild(mathjaxConfig);
Advertisement
Add Comment
Please, Sign In to add comment