This commit is contained in:
Lucas Tadeu Marculino 2025-11-17 19:52:44 -03:00
commit fb20596fba
36 changed files with 8679 additions and 0 deletions

69
www/src/jquery.jslatex.js Normal file
View file

@ -0,0 +1,69 @@
/*
* jsLaTeX v1.2 - jQuery plugin
*
* Copyright (c) 2009 Andreas Grech
*
* Dual licensed under the MIT and GPL licenses:
* http://www.opensource.org/licenses/mit-license.php
* http://www.gnu.org/licenses/gpl.html
*
* http://knowledge-aholic.blogspot.com
*/
(function ($) {
var attachToImage = function () {
return $("<img/>").attr({
src: this.src
});
},
formats = {
'gif': attachToImage,
'png': attachToImage,
'swf': function () {
return $("<embed/>").attr({
src: this.src,
type: 'application/x-shockwave-flash'
});
}
},
sections = {
'{f}': 'format',
'{e}': 'equation'
},
escapes = {
'+': '2B',
'=': '3D'
};
$.fn.latex = function (opts) {
opts = $.extend({},
$.fn.latex.defaults, opts);
opts.format = formats[opts.format] ? opts.format : 'gif';
return this.each(function () {
var $this = $(this),
format, s, element, url = opts.url;
opts.equation = $.trim($this.text());
for (s in sections) {
if (sections.hasOwnProperty(s) && (format = url.indexOf(s)) >= 0) {
url = url.replace(s, opts[sections[s]]);
}
}
for (s in escapes) {
if (escapes.hasOwnProperty(s) && (format = url.indexOf(s)) >= 0) {
url = url.replace(s, '%' + escapes[s]);
}
}
opts.src = url;
element = formats[opts.format].call(opts);
$this.html('').append(element);
if (opts.callback) {
opts.callback.call(element);
}
});
};
$.fn.latex.defaults = {
format: 'gif',
url: 'https://latex.codecogs.com/{f}.latex?{e}'
};
}(jQuery));