wp-quicklatex-frontend.js 619 B

1234567891011121314
  1. jQuery(document).ready(function($) {
  2. // Detect if SVG possible in <img> tags
  3. var testImg = 'data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHdpZHRoPSIyNzUiIGhlaWdodD0iMjc1Ij48L3N2Zz4%3D';
  4. var img = document.createElement('img')
  5. img.setAttribute('src',testImg);
  6. // This event handler is never called in browsers without SVG support
  7. img.addEventListener('load',function() {
  8. // Iterate through all <img> and replace png -> svg
  9. $('img.quicklatex-auto-format').attr('src', function() { return $(this).attr('src').replace('.png', '.svg'); })
  10. },true);
  11. });