oliverbooth.dev/src/ts/app.ts

19 lines
614 B
TypeScript
Raw Normal View History

2023-08-08 01:08:18 +00:00
declare const bootstrap: any;
2023-08-08 01:08:50 +00:00
declare const katex: any;
2023-08-04 11:55:16 +00:00
(() => {
2023-08-08 01:08:18 +00:00
const list = document.querySelectorAll('[data-bs-toggle="tooltip"]');
list.forEach((el: Element) => new bootstrap.Tooltip(el));
2023-08-08 01:08:50 +00:00
window.onload = function () {
const tex = document.getElementsByClassName("math");
Array.prototype.forEach.call(tex, function (el) {
let content = el.textContent.trim();
if (content.startsWith("\\[")) content = content.slice(2);
if (content.endsWith("\\]")) content = content.slice(0, -2);
katex.render(content, el);
});
};
2023-08-04 11:55:16 +00:00
})();