1
0
mirror of https://github.com/vichan-devel/vichan.git synced 2024-12-11 15:26:08 +01:00
vichan/js/katex-enable.js

36 lines
747 B
JavaScript
Raw Normal View History

2014-09-23 20:17:05 +02:00
/*
* katex-enable.js - LaTeX support
*
* Copyright (c) 2014 Fredrick Brennan <admin@8chan.co>
*
* Usage:
* $config['additional_javascript'][] = 'js/jquery.min.js';
* $config['additional_javascript'][] = 'js/katex-enable.js';
*/
/*
2014-09-23 20:17:05 +02:00
function render_katex(el) {
try {
katex.render($(el).text(), el)
} catch (e) {
$(el).text(_('Error: Invalid LaTeX syntax.')).css('color','red');
}
}
if (active_page == 'thread' || active_page == 'index') {
$(document).ready(function(){
var katex_enable = function() {
$('.tex').each(function(k, v) {
render_katex(v);
});
}
katex_enable();
$(document).on('new_post', function(e, post) {
$(post).find('.tex').each(function(k, v) {
render_katex(v);
});
});
});
}
*/